Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ enum icontrols
optimized,
/*! \brief Verbose level
*
* Defines the level of verbose outputs.
* Defines the level of verbose outputs. For higher levels all output from lower levels is always given.
* 0: No output
* 1: Minimal convergence output.
* 2: Minimal problem setting details, iteration output and timings.
* 3: Print all parameters and more detailed problem settings.
* 4: Information on called functions.
* 5: Prints information on multigrid levels.
* 6: Print out all kind of variable values.
*/
verbose,
/*! \brief openmp paralellization
Expand Down
40 changes: 34 additions & 6 deletions include/gyro.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,40 @@ void trafo(double r_i, std::vector<double> theta, std::vector<double> sin_theta,
int ntheta, std::vector<double>& x, std::vector<double>& y, int verbose);

/***************************************************************************
* Display arrays or vectors
**************************************************************************/
void disp(int na, double* a, const std::string& s_a);
void disp(std::vector<double> a, const std::string& s_a);
void disp(int na, int* a, const std::string& s_a);
void disp(std::vector<int> a, const std::string& s_a);
* Display arrays or vectors
**************************************************************************/
/*!
* \brief Forwards all values inside an array to std::cout.
*
* \param na: Size of the array.
* \param a: The array.
* \param s_a: Name of the array (to be printed).
*
*/
template <typename T>
void disp(int na, T* a, const std::string& s_a)
{
std::cout << s_a << "(" << na << "): ";
for (int i = 0; i < na; i++)
std::cout << a[i] << " ";
std::cout << "\n";
}

/*!
* \brief Forwards all values inside a vector to std::cout.
*
* \param a: The vector.
* \param s_a: Name of the vector (to be printed).
*
*/
template <typename T>
void disp(std::vector<T> a, const std::string& s_a)
{
std::cout << s_a << "(" << a.size() << "): ";
for (std::size_t i = 0; i < a.size(); i++)
std::cout << a[i] << " ";
std::cout << "\n";
}

/***************************************************************************
* Matrix operations
Expand Down
2 changes: 0 additions & 2 deletions src/build_bi_aniso_rdir_phiper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,6 @@ std::vector<double> level::apply_prolongation_inj0(std::vector<double> u, int mc
}
}

//std::cout << "end of applyP_inj \n";

return Pu;
} /* ----- end of level::apply_prolongation_inj0 ----- */

Expand Down
14 changes: 8 additions & 6 deletions src/create_grid_polar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
*/
void gmgpolar::create_grid_polar()
{
if (gyro::icntl[Param::verbose] > 2)
std::cout << "Setup for the problem...\n";
if (gyro::icntl[Param::verbose] > 3)
std::cout << "Creating polar grid...\n";

level* new_level = new level(0);
v_level.push_back(new_level);
Expand Down Expand Up @@ -73,7 +73,7 @@ void gmgpolar::create_grid_polar()
std::cout << "on the coordinates (r x theta): (" << gyro::dcntl[Param::R0] << ", " << gyro::dcntl[Param::R]
<< ") x (" << gyro::dcntl[Param::THETA0] << ", " << gyro::dcntl[Param::THETA] << ")\n";
}
if (gyro::icntl[Param::verbose] > 3) {
if (gyro::icntl[Param::verbose] > 5) {
v_level[0]->display_r();
v_level[0]->display_theta();
std::cout << "\n";
Expand Down Expand Up @@ -243,7 +243,9 @@ void level::build_theta()
theta[i] = fac * i;
}
else {
std::cout << "Anisotropy chosen in theta.\n";
if (gyro::icntl[Param::verbose] > 2) {
std::cout << "Anisotropy chosen in theta.\n";
}
ntheta = pow(2, ceil(log2(nr)) - 1);
double fac = 2 * PI / ntheta;

Expand Down Expand Up @@ -280,8 +282,8 @@ void level::build_theta()
*/
void gmgpolar::create_grid_polar_divide()
{
if (gyro::icntl[Param::verbose] > 2)
std::cout << "dividing a coarser grid...\n";
if (gyro::icntl[Param::verbose] > 3)
std::cout << "Dividing a coarser grid...\n";

int divide = gyro::icntl[Param::divideBy2];
std::vector<double> r_tmp;
Expand Down
12 changes: 6 additions & 6 deletions src/define_coarse_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ void gmgpolar::define_coarse_nodes()
}
levels_orig = levels;
for (int i = 0; i < levels; i++) {
if (gyro::icntl[Param::verbose] > 1)
if (gyro::icntl[Param::verbose] > 3)
std::cout << "=> Defining coarse nodes on level " << i << "\n";
v_level[i]->store_theta_n_co();
if (i < levels - 1) {
v_level[i]->define_coarse_nodes_onelevel(v_level[i + 1]);
}
if (gyro::icntl[Param::verbose] > 1) {
if (gyro::icntl[Param::verbose] > 3) {
std::cout << "level: " << i;
if (i != levels - 1)
std::cout << ", coarse_nodes: " << v_level[i]->coarse_nodes;
Expand All @@ -66,7 +66,7 @@ void gmgpolar::define_coarse_nodes()
}
if (i != levels - 1 &&
(v_level[i]->nr % 2 != 1 || v_level[i]->nr < 5 || v_level[i]->ntheta % 2 != 0 || v_level[i]->ntheta < 8)) {
std::cout << "ACHTUNG: Cannot reach the desired number of levels (" << levels << "). Replacing it with "
std::cout << "WARNING: Cannot reach the desired number of levels (" << levels << "). Replacing it with "
<< i + 1 << "...\n";
;
levels = i + 1;
Expand Down Expand Up @@ -139,7 +139,7 @@ void level::define_coarse_nodes_onelevel(level* coarser)
itr_theta++;
}

if (gyro::icntl[Param::verbose] > 3) {
if (gyro::icntl[Param::verbose] > 5) {
display_r();
display_theta();
std::cout << "Coarse grid: \n";
Expand All @@ -166,7 +166,7 @@ void level::store_theta_n_co()
if (fabs(theta[ntheta - 1] - 2 * PI) < 1e-10) // check if end is 2*Pi (for periodic boundary conditions)
ntheta_int--;
if (ntheta_int % 2)
std::cout << "ACHTUNG.... theta has an odd size\n";
std::cout << "WARNING: The number of thetas is odd. Please use even numbers only.\n";

// To take first/last theta into account without conditions:
// - theta_per = [theta_last, theta, 2PI]
Expand Down Expand Up @@ -227,7 +227,7 @@ void level::store_theta_n_co()
for (int i = 0; i < nr_int; i++)
hplus[i] = r[i + 1] - r[i];

if (gyro::icntl[Param::verbose] > 3) {
if (gyro::icntl[Param::verbose] > 5) {
gyro::disp(theta_per, "theta_per");
gyro::disp(cos_theta, "cos_theta");
gyro::disp(sin_theta, "sin_theta");
Expand Down
14 changes: 7 additions & 7 deletions src/direct_solve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ std::vector<double> level::solve_gaussian_elimination(std::vector<int> A_row_ind
{
// int m_solution = f.size();

// std::cout << "Forward substitution \n";
if (gyro::icntl[Param::verbose] > 3) {
std::cout << "Starting Gaussian elimination forward substitution \n";
}
// Solve Ly = b for y (Forward Substitution)
// (assumes rows in increasing order)
int row = A_row_indices[0];
Expand All @@ -299,7 +301,9 @@ std::vector<double> level::solve_gaussian_elimination(std::vector<int> A_row_ind
y[A_row_indices[j]] -= y[A_col_indices[j]] * A_vals[j];
}

// std::cout << "Backward substitution \n";
if (gyro::icntl[Param::verbose] > 3) {
std::cout << "Starting Gaussian elimination backward substitution \n";
}
//Solve Ux = y for x (Backward Substitution)
row = A_row_indices[A_row_indices.size() - 1];
int jind;
Expand Down Expand Up @@ -748,8 +752,6 @@ void level::fill_in_circle(int ij, int smoother)
int ind, ind2;
int msc = m_sc[smoother];
int size_LU = 3 * msc + 2 * (msc - 3);
// std::cout << "ij: " << ij << ", smoother: " << smoother << ", m_sc: " << msc << ", size_LU: " << size_LU << "\n";
// std::cout << "A_Zebra_r_row[smoother][ij].size(): " << A_Zebra_r_row[smoother][ij].size() << "\n";
// first line
A_Zebra_r_LU_row[smoother][ij] = std::vector<int>(size_LU);
A_Zebra_c_LU_row[smoother][ij] = std::vector<int>(size_LU);
Expand All @@ -767,9 +769,7 @@ void level::fill_in_circle(int ij, int smoother)
for (int i = 0; i < msc - 2; i++) {
ind = 3 * i + 3;
ind2 = 4 * i + 3;
// std::cout << "ind: " << ind << ", ind2: " << ind2 << ", ij: " << ij << "\n";
// std::cout << "A_Zebra_r_row[smoother][ij][ind]: " << A_Zebra_r_row[smoother][ij][ind] << "\n";
// std::cout << "A_Zebra_r_LU_row[smoother][ij][ind2]: " << A_Zebra_r_LU_row[smoother][ij][ind2] << "\n";

A_Zebra_r_LU_row[smoother][ij][ind2] = A_Zebra_r_row[smoother][ij][ind];
A_Zebra_r_LU_row[smoother][ij][ind2 + 1] = A_Zebra_r_row[smoother][ij][ind + 1];
A_Zebra_r_LU_row[smoother][ij][ind2 + 2] = A_Zebra_r_row[smoother][ij][ind + 2];
Expand Down
Loading