diff --git a/include/core/ParseCommandLineOpts.h b/include/core/ParseCommandLineOpts.h index bd17defe..063edf2b 100644 --- a/include/core/ParseCommandLineOpts.h +++ b/include/core/ParseCommandLineOpts.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -29,11 +30,8 @@ class ParseCommandLineOpts if (cmdOptionExists("-i")) { parameters_filename = getCmdOption("-i"); - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "Using the input parameter file: " << parameters_filename - << std::endl; - } + conditionalOStreams::pout_base + << "Using the input parameter file: " << parameters_filename << std::endl; } else { @@ -52,11 +50,8 @@ class ParseCommandLineOpts throw("The previous extension .in for the parameters file is no " "longer accepted. Please rename parameters.in as " "parameters.prm"); - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "Using the input parameter file: " << parameters_filename - << std::endl; - } + conditionalOStreams::pout_base + << "Using the input parameter file: " << parameters_filename << std::endl; } else { @@ -72,11 +67,9 @@ class ParseCommandLineOpts if (!ifs_prm && ifs_in) throw("The previous extension .in for the parameters file is no longer " "accepted. Please rename parameters.in as parameters.prm"); - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "Using the input parameter file: " << parameters_filename - << std::endl; - } + + conditionalOStreams::pout_base + << "Using the input parameter file: " << parameters_filename << std::endl; } else { diff --git a/include/core/matrixFreePDE.h b/include/core/matrixFreePDE.h index ff2b744b..d0687cd1 100644 --- a/include/core/matrixFreePDE.h +++ b/include/core/matrixFreePDE.h @@ -111,11 +111,6 @@ class MatrixFreePDE : public Subscriptor void buildFields(); - /** - * \brief Parallel message stream. - */ - ConditionalOStream pcout; - /** * \brief Set the initial condition for all fields. This function is overriden in each * application. @@ -421,9 +416,6 @@ class MatrixFreePDE : public Subscriptor unsigned int currentIncrement, currentOutput, currentCheckpoint, current_grain_reassignment; - /*Timer and logging object*/ - mutable TimerOutput computing_timer; - bool first_integrated_var_output_complete; // Methods and variables for integration diff --git a/include/core/temp_test.h b/include/core/temp_test.h index 18901736..ac5995a9 100644 --- a/include/core/temp_test.h +++ b/include/core/temp_test.h @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -71,9 +72,7 @@ class LaplaceProblem LinearAlgebra::distributed::Vector solution; LinearAlgebra::distributed::Vector system_rhs; - double setup_time {}; - ConditionalOStream pcout; - ConditionalOStream time_details; + double setup_time {}; }; template @@ -84,8 +83,6 @@ LaplaceProblem::LaplaceProblem() parallel::distributed::Triangulation::construct_multigrid_hierarchy) , fe(degree_finite_element) , dof_handler(triangulation) - , pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - , time_details(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) {} template @@ -101,7 +98,8 @@ LaplaceProblem::setup_system() dof_handler.distribute_dofs(fe); dof_handler.distribute_mg_dofs(); - pcout << "Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; + conditionalOStreams::pout_base + << "Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; constraints.clear(); constraints.reinit(dof_handler.locally_owned_dofs(), @@ -115,8 +113,9 @@ LaplaceProblem::setup_system() constraints.close(); } setup_time += time.wall_time(); - time_details << "Distribute DoFs & B.C. (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << 's' << std::endl; + conditionalOStreams::pout_base << "Distribute DoFs & B.C. (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << 's' + << std::endl; time.restart(); { { @@ -139,8 +138,9 @@ LaplaceProblem::setup_system() system_matrix.initialize_dof_vector(system_rhs); } setup_time += time.wall_time(); - time_details << "Setup matrix-free system (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << 's' << std::endl; + conditionalOStreams::pout_base << "Setup matrix-free system (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << 's' + << std::endl; time.restart(); { @@ -182,8 +182,9 @@ LaplaceProblem::setup_system() } } setup_time += time.wall_time(); - time_details << "Setup matrix-free levels (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << 's' << std::endl; + conditionalOStreams::pout_base << "Setup matrix-free levels (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << 's' + << std::endl; } template @@ -208,8 +209,9 @@ LaplaceProblem::assemble_rhs() system_rhs.compress(VectorOperation::add); setup_time += time.wall_time(); - time_details << "Assemble right hand side (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << 's' << std::endl; + conditionalOStreams::pout_base << "Assemble right hand side (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << 's' + << std::endl; } template @@ -220,8 +222,8 @@ LaplaceProblem::solve() MGTransferMatrixFree mg_transfer(mg_constrained_dofs); mg_transfer.build(dof_handler); setup_time += time.wall_time(); - time_details << "MG build transfer time (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << "s\n"; + conditionalOStreams::pout_base << "MG build transfer time (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << "s\n"; time.restart(); using SmootherType = @@ -280,9 +282,10 @@ LaplaceProblem::solve() SolverControl solver_control(100, 1e-12 * system_rhs.l2_norm()); SolverCG> cg(solver_control); setup_time += time.wall_time(); - time_details << "MG build smoother time (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << "s\n"; - pcout << "Total setup time (wall) " << setup_time << "s\n"; + conditionalOStreams::pout_base << "MG build smoother time (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << "s\n"; + conditionalOStreams::pout_base << "Total setup time (wall) " << setup_time + << "s\n"; time.reset(); time.start(); @@ -291,9 +294,10 @@ LaplaceProblem::solve() constraints.distribute(solution); - pcout << "Time solve (" << solver_control.last_step() << " iterations)" - << (solver_control.last_step() < 10 ? " " : " ") << "(CPU/wall) " - << time.cpu_time() << "s/" << time.wall_time() << "s\n"; + conditionalOStreams::pout_base + << "Time solve (" << solver_control.last_step() << " iterations)" + << (solver_control.last_step() < 10 ? " " : " ") << "(CPU/wall) " << time.cpu_time() + << "s/" << time.wall_time() << "s\n"; } template @@ -318,8 +322,8 @@ LaplaceProblem::output_results(unsigned int cycle) const data_out.set_flags(flags); data_out.write_vtu_with_pvtu_record("./", "solution", cycle, MPI_COMM_WORLD, 3); - time_details << "Time write output (CPU/wall) " << time.cpu_time() << "s/" - << time.wall_time() << "s\n"; + conditionalOStreams::pout_base << "Time write output (CPU/wall) " + << time.cpu_time() << "s/" << time.wall_time() << "s\n"; } template @@ -330,9 +334,10 @@ LaplaceProblem::run() const unsigned int n_vect_doubles = VectorizedArray::size(); const unsigned int n_vect_bits = 8 * sizeof(double) * n_vect_doubles; - pcout << "Vectorization over " << n_vect_doubles << " doubles = " << n_vect_bits - << " bits (" << Utilities::System::get_current_vectorization_level() << ')' - << std::endl; + conditionalOStreams::pout_base + << "Vectorization over " << n_vect_doubles << " doubles = " << n_vect_bits + << " bits (" << Utilities::System::get_current_vectorization_level() << ')' + << std::endl; } GridGenerator::hyper_cube(triangulation, 0.0, 1.0); diff --git a/include/core/userInputParameters.h b/include/core/userInputParameters.h index 0d76b339..187a07d5 100644 --- a/include/core/userInputParameters.h +++ b/include/core/userInputParameters.h @@ -445,9 +445,7 @@ class userInputParameters const std::string &elastic_const_symmetry) const; dealii::Tensor<2, 2 * dim - 1 + dim / 3> - getCIJMatrix(const elasticityModel model, - const std::vector &constants, - dealii::ConditionalOStream &pcout) const; + getCIJMatrix(const elasticityModel model, const std::vector &constants) const; // Private nucleation variables std::vector> nucleation_parameters_list; diff --git a/src/core/boundary_conditions/boundaryConditions.cc b/src/core/boundary_conditions/boundaryConditions.cc index 90b55028..75548c32 100644 --- a/src/core/boundary_conditions/boundaryConditions.cc +++ b/src/core/boundary_conditions/boundaryConditions.cc @@ -1,8 +1,7 @@ -// methods to apply boundary conditons - #include #include #include +#include #include // ================================================================================= @@ -236,7 +235,8 @@ MatrixFreePDE::setPeriodicity() } triangulation.add_periodicity(periodicity_vector); - pcout << "periodic facepairs: " << periodicity_vector.size() << std::endl; + conditionalOStreams::pout_base << "periodic facepairs: " << periodicity_vector.size() + << std::endl; } // Set constraints to enforce periodic boundary conditions diff --git a/src/core/checkpoint.cc b/src/core/checkpoint.cc index 096b5b45..ce5cd1ac 100644 --- a/src/core/checkpoint.cc +++ b/src/core/checkpoint.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,6 @@ template void MatrixFreePDE::save_checkpoint() { - computing_timer.enter_subsection("matrixFreePDE: save_checkpoint"); unsigned int my_id = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD); if (my_id == 0) @@ -118,8 +118,7 @@ MatrixFreePDE::save_checkpoint() time_info_file.close(); } - pcout << "*** Checkpoint created! ***\n\n"; - computing_timer.leave_subsection("matrixFreePDE: save_checkpoint"); + conditionalOStreams::pout_base << "*** Checkpoint created! ***\n\n"; } // Load from a previously created checkpoint @@ -132,7 +131,7 @@ MatrixFreePDE::load_checkpoint_triangulation() verify_checkpoint_file_exists("restart.mesh"); verify_checkpoint_file_exists("restart.mesh.info"); - pcout << "\n*** Resuming from a checkpoint! ***\n\n"; + conditionalOStreams::pout_base << "\n*** Resuming from a checkpoint! ***\n\n"; try { diff --git a/src/core/init.cc b/src/core/init.cc index f4fe66c8..2b065e30 100644 --- a/src/core/init.cc +++ b/src/core/init.cc @@ -1,8 +1,7 @@ -// init() method for MatrixFreePDE class - #include #include +#include #include // populate with fields and setup matrix free system @@ -10,11 +9,9 @@ template void MatrixFreePDE::init() { - computing_timer.enter_subsection("matrixFreePDE: initialization"); - // creating mesh - pcout << "creating problem mesh...\n"; + conditionalOStreams::pout_base << "creating problem mesh...\n"; // Create the coarse mesh and mark the boundaries create_triangulation(triangulation); @@ -37,18 +34,21 @@ MatrixFreePDE::init() // elements if (dim < 3) { - pcout << "problem dimensions: " << userInputs.domain_size[0] << "x" - << userInputs.domain_size[1] << "\n"; + conditionalOStreams::pout_base + << "problem dimensions: " << userInputs.domain_size[0] << "x" + << userInputs.domain_size[1] << "\n"; } else { - pcout << "problem dimensions: " << userInputs.domain_size[0] << "x" - << userInputs.domain_size[1] << "x" << userInputs.domain_size[2] << "\n"; + conditionalOStreams::pout_base + << "problem dimensions: " << userInputs.domain_size[0] << "x" + << userInputs.domain_size[1] << "x" << userInputs.domain_size[2] << "\n"; } - pcout << "number of elements: " << triangulation.n_global_active_cells() << "\n\n"; + conditionalOStreams::pout_base + << "number of elements: " << triangulation.n_global_active_cells() << "\n\n"; // Setup system - pcout << "initializing matrix free object\n"; + conditionalOStreams::pout_base << "initializing matrix free object\n"; totalDOFs = 0; for (auto &field : fields) { @@ -82,7 +82,7 @@ MatrixFreePDE::init() var_type.c_str(), (field.type == SCALAR ? "SCALAR" : "VECTOR"), field.name.c_str()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; // Check if any time dependent fields present if (field.pdetype == EXPLICIT_TIME_DEPENDENT) @@ -121,7 +121,7 @@ MatrixFreePDE::init() } else { - pcout << "\nmatrixFreePDE.h: unknown field type\n"; + conditionalOStreams::pout_base << "\nmatrixFreePDE.h: unknown field type\n"; exit(-1); } FESet.push_back(fe); @@ -225,9 +225,9 @@ MatrixFreePDE::init() field.name.c_str(), dof_handler->n_dofs(), constraintsDirichlet->n_constraints()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } - pcout << "total DOF : " << totalDOFs << "\n"; + conditionalOStreams::pout_base << "total DOF : " << totalDOFs << "\n"; // Setup the matrix free object typename MatrixFree::AdditionalData additional_data; @@ -247,7 +247,8 @@ MatrixFreePDE::init() bool dU_vector_init = false; // Setup solution vectors - pcout << "initializing parallel::distributed residual and solution vectors\n"; + conditionalOStreams::pout_base + << "initializing parallel::distributed residual and solution vectors\n"; for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++) { dealii::LinearAlgebra::distributed::Vector *U = nullptr; @@ -331,8 +332,6 @@ MatrixFreePDE::init() // reinitializes the system with the new mesh if (!userInputs.resume_from_checkpoint && userInputs.h_adaptivity == true) { - computing_timer.enter_subsection("matrixFreePDE: AMR"); - unsigned int numDoF_preremesh = totalDOFs; for (unsigned int remesh_index = 0; remesh_index < @@ -347,8 +346,6 @@ MatrixFreePDE::init() } numDoF_preremesh = totalDOFs; } - - computing_timer.leave_subsection("matrixFreePDE: AMR"); } // If resuming from a checkpoint, load the proper starting increment and time @@ -359,8 +356,6 @@ MatrixFreePDE::init() // Once the initial triangulation has been set, compute element volume compute_element_volume(); - - computing_timer.leave_subsection("matrixFreePDE: initialization"); } template diff --git a/src/core/initial_conditions/initialConditions.cc b/src/core/initial_conditions/initialConditions.cc index 8a898159..0de683eb 100644 --- a/src/core/initial_conditions/initialConditions.cc +++ b/src/core/initial_conditions/initialConditions.cc @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -100,14 +101,15 @@ MatrixFreePDE::applyInitialConditions() } else { - pcout << "Error in vtk file type: Use either UNSTRUCTURED OR RECTILINEAR\n"; + conditionalOStreams::pout_base + << "Error in vtk file type: Use either UNSTRUCTURED OR RECTILINEAR\n"; abort(); } // new section ends ScalarField &id_field = body.find_scalar_field(userInputs.grain_structure_variable_name); - pcout << "Applying PField initial condition...\n"; + conditionalOStreams::pout_base << "Applying PField initial condition...\n"; VectorTools::interpolate(*dofHandlersSet[scalar_field_index], InitialConditionPField(0, id_field), @@ -124,11 +126,11 @@ MatrixFreePDE::applyInitialConditions() QGaussLobatto quadrature2(degree + 1); FloodFiller flood_filler(*FESet.at(scalar_field_index), quadrature2); - pcout << "Locating the grains...\n"; + conditionalOStreams::pout_base << "Locating the grains...\n"; std::vector> grain_sets; for (unsigned int id = min_id; id < max_id + 1; id++) { - pcout << "Locating grain " << id << "...\n"; + conditionalOStreams::pout_base << "Locating grain " << id << "...\n"; std::vector> grain_sets_single_id; @@ -151,7 +153,8 @@ MatrixFreePDE::applyInitialConditions() grain_sets_single_id.end()); } - pcout << "Generating simplified representations of the grains...\n"; + conditionalOStreams::pout_base + << "Generating simplified representations of the grains...\n"; for (unsigned int g = 0; g < grain_sets.size(); g++) { SimplifiedGrainRepresentation simplified_grain_representation( @@ -159,22 +162,24 @@ MatrixFreePDE::applyInitialConditions() if (dim == 2) { - pcout << "Grain: " << simplified_grain_representation.getGrainId() << " " - << simplified_grain_representation.getOrderParameterId() - << " Center: " << simplified_grain_representation.getCenter()(0) - << " " << simplified_grain_representation.getCenter()(1) - << " Radius: " << simplified_grain_representation.getRadius() - << std::endl; + conditionalOStreams::pout_base + << "Grain: " << simplified_grain_representation.getGrainId() << " " + << simplified_grain_representation.getOrderParameterId() + << " Center: " << simplified_grain_representation.getCenter()(0) << " " + << simplified_grain_representation.getCenter()(1) + << " Radius: " << simplified_grain_representation.getRadius() + << std::endl; } else { - pcout << "Grain: " << simplified_grain_representation.getGrainId() << " " - << simplified_grain_representation.getOrderParameterId() - << " Center: " << simplified_grain_representation.getCenter()(0) - << " " << simplified_grain_representation.getCenter()(1) << " " - << simplified_grain_representation.getCenter()(2) - << " Radius: " << simplified_grain_representation.getRadius() - << std::endl; + conditionalOStreams::pout_base + << "Grain: " << simplified_grain_representation.getGrainId() << " " + << simplified_grain_representation.getOrderParameterId() + << " Center: " << simplified_grain_representation.getCenter()(0) << " " + << simplified_grain_representation.getCenter()(1) << " " + << simplified_grain_representation.getCenter()(2) + << " Radius: " << simplified_grain_representation.getRadius() + << std::endl; } simplified_grain_representations.push_back(simplified_grain_representation); @@ -193,35 +198,38 @@ MatrixFreePDE::applyInitialConditions() } } - pcout << "Reassigning the grains to new order parameters...\n"; + conditionalOStreams::pout_base + << "Reassigning the grains to new order parameters...\n"; SimplifiedGrainManipulator simplified_grain_manipulator; simplified_grain_manipulator.reassignGrains(simplified_grain_representations, userInputs.buffer_between_grains, userInputs.variables_for_remapping); - pcout << "After reassignment: " << std::endl; + conditionalOStreams::pout_base << "After reassignment: " << std::endl; for (unsigned int g = 0; g < simplified_grain_representations.size(); g++) { if (dim == 2) { - pcout << "Grain: " << simplified_grain_representations.at(g).getGrainId() - << " " << simplified_grain_representations.at(g).getOrderParameterId() - << " Center: " - << simplified_grain_representations.at(g).getCenter()(0) << " " - << simplified_grain_representations.at(g).getCenter()(1) << std::endl; + conditionalOStreams::pout_base + << "Grain: " << simplified_grain_representations.at(g).getGrainId() << " " + << simplified_grain_representations.at(g).getOrderParameterId() + << " Center: " << simplified_grain_representations.at(g).getCenter()(0) + << " " << simplified_grain_representations.at(g).getCenter()(1) + << std::endl; } else { - pcout << "Grain: " << simplified_grain_representations.at(g).getGrainId() - << " " << simplified_grain_representations.at(g).getOrderParameterId() - << " Center: " - << simplified_grain_representations.at(g).getCenter()(0) << " " - << simplified_grain_representations.at(g).getCenter()(1) << " " - << simplified_grain_representations.at(g).getCenter()(2) << std::endl; + conditionalOStreams::pout_base + << "Grain: " << simplified_grain_representations.at(g).getGrainId() << " " + << simplified_grain_representations.at(g).getOrderParameterId() + << " Center: " << simplified_grain_representations.at(g).getCenter()(0) + << " " << simplified_grain_representations.at(g).getCenter()(1) << " " + << simplified_grain_representations.at(g).getCenter()(2) << std::endl; } } - pcout << "Placing the grains in their new order parameters...\n"; + conditionalOStreams::pout_base + << "Placing the grains in their new order parameters...\n"; OrderParameterRemapper order_parameter_remapper; order_parameter_remapper.remap_from_index_field( simplified_grain_representations, @@ -304,12 +312,12 @@ MatrixFreePDE::applyInitialConditions() } } // Read out unique filenames - if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0 && !file_field_map.empty()) + if (!file_field_map.empty()) { - std::cout << "Unique VTK input files: " << std::endl; + conditionalOStreams::pout_base << "Unique VTK input files: " << std::endl; for (const auto &pair : file_field_map) { - std::cout << pair.first << ", "; + conditionalOStreams::pout_base << pair.first << ", "; } } // Read in each vtk once and apply initial conditions @@ -352,7 +360,8 @@ MatrixFreePDE::applyInitialConditions() } else { - pcout << "Error in vtk file type: Use either UNSTRUCTURED OR RECTILINEAR\n"; + conditionalOStreams::pout_base + << "Error in vtk file type: Use either UNSTRUCTURED OR RECTILINEAR\n"; abort(); } // new section ends @@ -365,8 +374,9 @@ MatrixFreePDE::applyInitialConditions() if (var_attributes.at(index).var_type == SCALAR) { - pcout << "Applying PField initial condition for " - << userInputs.load_field_name[index] << "...\n"; + conditionalOStreams::pout_base << "Applying PField initial condition for " + << userInputs.load_field_name[index] + << "...\n"; VectorTools::interpolate(*dofHandlersSet[index], InitialConditionPField(index, field), *solutionSet[index]); @@ -397,7 +407,8 @@ MatrixFreePDE::applyInitialConditions() { if (userInputs.load_ICs[var_index] == false) { - pcout << "Applying non-PField initial condition...\n"; + conditionalOStreams::pout_base + << "Applying non-PField initial condition...\n"; if (variable.var_type == SCALAR) { @@ -416,8 +427,9 @@ MatrixFreePDE::applyInitialConditions() *solutionSet[var_index]); } } - pcout << "Application of initial conditions for field number " << var_index - << " complete \n"; + conditionalOStreams::pout_base + << "Application of initial conditions for field number " << var_index + << " complete \n"; } } } diff --git a/src/core/inputFileReader.cc b/src/core/inputFileReader.cc index 16129d6f..fe483fc4 100644 --- a/src/core/inputFileReader.cc +++ b/src/core/inputFileReader.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -16,12 +17,9 @@ inputFileReader::inputFileReader(const std::string &input_file_name, model_constant_names = get_model_constant_names(); uint num_constants = model_constant_names.size(); - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "Number of constants: " << num_constants << "\n"; - std::cout << "Number of post-processing variables: " << pp_attributes.size() - << "\n"; - } + conditionalOStreams::pout_base + << "Number of constants: " << num_constants << "\n" + << "Number of post-processing variables: " << pp_attributes.size() << "\n"; // Read in all of the parameters now declare_parameters(); diff --git a/src/core/invM.cc b/src/core/invM.cc index b98f0ae4..231a564d 100644 --- a/src/core/invM.cc +++ b/src/core/invM.cc @@ -1,6 +1,6 @@ -// computeInvM() method for MatrixFreePDE class #include +#include #include // compute inverse of the diagonal mass matrix and store in vector invM @@ -125,8 +125,9 @@ MatrixFreePDE::computeInvM() invMscalar.local_element(k) = 0; } } - pcout << "computed scalar mass matrix (using FE space for field: " - << parabolicScalarFieldIndex << ")\n"; + conditionalOStreams::pout_base + << "computed scalar mass matrix (using FE space for field: " + << parabolicScalarFieldIndex << ")\n"; // Invert vector mass matrix diagonal elements for (unsigned int k = 0; k < invMvector.locally_owned_size(); ++k) @@ -140,8 +141,9 @@ MatrixFreePDE::computeInvM() invMvector.local_element(k) = 0; } } - pcout << "computed vector mass matrix (using FE space for field: " - << parabolicVectorFieldIndex << ")\n"; + conditionalOStreams::pout_base + << "computed vector mass matrix (using FE space for field: " + << parabolicVectorFieldIndex << ")\n"; } template class MatrixFreePDE<2, 1>; diff --git a/src/core/matrixFreePDE.cc b/src/core/matrixFreePDE.cc index c73e7cbe..6fac8afe 100644 --- a/src/core/matrixFreePDE.cc +++ b/src/core/matrixFreePDE.cc @@ -1,12 +1,10 @@ -// constructor and destructor for matrixFreePDE class - +#include #include // constructor template MatrixFreePDE::MatrixFreePDE(userInputParameters _userInputs) : Subscriptor() - , pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) , userInputs(_userInputs) , var_attributes(_userInputs.var_attributes) , pp_attributes(_userInputs.pp_attributes) @@ -21,7 +19,6 @@ MatrixFreePDE::MatrixFreePDE(userInputParameters _userInputs) , currentOutput(0) , currentCheckpoint(0) , current_grain_reassignment(0) - , computing_timer(pcout, TimerOutput::summary, TimerOutput::wall_times) , first_integrated_var_output_complete(false) , AMR(_userInputs, triangulation, diff --git a/src/core/outputResults.cc b/src/core/outputResults.cc index 3ae485dd..5f340455 100644 --- a/src/core/outputResults.cc +++ b/src/core/outputResults.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -10,9 +11,6 @@ template void MatrixFreePDE::outputResults() { - // log time - computing_timer.enter_subsection("matrixFreePDE: output"); - // create DataOut object DataOut data_out; @@ -83,8 +81,9 @@ MatrixFreePDE::outputResults() { double integrated_field = NAN; computeIntegral(integrated_field, pp_index, postProcessedSet); - pcout << "Integrated value of " << pp_variable.name << ": " - << integrated_field << std::endl; + conditionalOStreams::pout_base << "Integrated value of " + << pp_variable.name << ": " + << integrated_field << std::endl; if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) { output_file << "\t" << pp_variable.name << "\t" << integrated_field; @@ -191,7 +190,8 @@ MatrixFreePDE::outputResults() std::ofstream master_output(pvtuFileName); data_out.write_pvtu_record(master_output, filenames); - pcout << "Output written to:" << pvtuFileName << "\n\n"; + conditionalOStreams::pout_base << "Output written to:" << pvtuFileName + << "\n\n"; } } else @@ -202,7 +202,8 @@ MatrixFreePDE::outputResults() std::string svtuFileName = svtuFileNameStream.str(); data_out.write_vtu_in_parallel(svtuFileName, MPI_COMM_WORLD); - pcout << "Output written to:" << svtuFileName << "\n\n"; + conditionalOStreams::pout_base << "Output written to:" << svtuFileName + << "\n\n"; } } else if (userInputs.output_file_type == "vtk") @@ -210,7 +211,7 @@ MatrixFreePDE::outputResults() // Write the results to separate files for each process std::ofstream output(vtuFileName); data_out.write_vtk(output); - pcout << "Output written to:" << vtuFileName << "\n\n"; + conditionalOStreams::pout_base << "Output written to:" << vtuFileName << "\n\n"; } else { @@ -218,9 +219,6 @@ MatrixFreePDE::outputResults() "either \"vtu\" or \"vtk\"\n"; abort(); } - - // log time - computing_timer.leave_subsection("matrixFreePDE: output"); } template class MatrixFreePDE<2, 1>; diff --git a/src/core/postprocessing/computeIntegral.cc b/src/core/postprocessing/computeIntegral.cc index e8b2e5a0..b67bd0c8 100644 --- a/src/core/postprocessing/computeIntegral.cc +++ b/src/core/postprocessing/computeIntegral.cc @@ -39,10 +39,6 @@ MatrixFreePDE::computeIntegral( value = Utilities::MPI::sum(value, MPI_COMM_WORLD); - // if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0){ - // std::cout<<"Integrated field: "< #include // populate with fields and setup matrix free system @@ -7,10 +6,8 @@ template void MatrixFreePDE::reinit() { - computing_timer.enter_subsection("matrixFreePDE: reinitialization"); - // setup system - pcout << "Reinitializing matrix free object\n"; + conditionalOStreams::pout_base << "Reinitializing matrix free object\n"; totalDOFs = 0; for (const auto &field : fields) { @@ -89,9 +86,9 @@ MatrixFreePDE::reinit() field.name.c_str(), dof_handler->n_dofs(), constraintsDirichlet->n_constraints()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } - pcout << "total DOF : " << totalDOFs << "\n"; + conditionalOStreams::pout_base << "total DOF : " << totalDOFs << "\n"; // Setup the matrix free object typename MatrixFree::AdditionalData additional_data; @@ -117,7 +114,8 @@ MatrixFreePDE::reinit() bool dU_vector_init = false; // Setup solution vectors - pcout << "initializing parallel::distributed residual and solution vectors\n"; + conditionalOStreams::pout_base + << "initializing parallel::distributed residual and solution vectors\n"; for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++) { dealii::LinearAlgebra::distributed::Vector *U = nullptr; @@ -200,8 +198,6 @@ MatrixFreePDE::reinit() // Once the initial triangulation has been set, compute element volume compute_element_volume(); - - computing_timer.leave_subsection("matrixFreePDE: reinitialization"); } template class MatrixFreePDE<2, 1>; diff --git a/src/core/solvers/solve.cc b/src/core/solvers/solve.cc index 3684c835..0fca4569 100644 --- a/src/core/solvers/solve.cc +++ b/src/core/solvers/solve.cc @@ -1,5 +1,4 @@ -// solve() method for MatrixFreePDE class - +#include #include // solve BVP @@ -7,9 +6,7 @@ template void MatrixFreePDE::solve() { - // log time - computing_timer.enter_subsection("matrixFreePDE: solve"); - pcout << "\nsolving...\n\n"; + conditionalOStreams::pout_base << "\nsolving...\n\n"; // time dependent BVP if (isTimeDependentBVP) @@ -67,9 +64,10 @@ MatrixFreePDE::solve() } // time stepping - pcout << "\nTime stepping parameters: timeStep: " << userInputs.dtValue - << " timeFinal: " << userInputs.finalTime - << " timeIncrements: " << userInputs.totalIncrements << "\n"; + conditionalOStreams::pout_base + << "\nTime stepping parameters: timeStep: " << userInputs.dtValue + << " timeFinal: " << userInputs.finalTime + << " timeIncrements: " << userInputs.totalIncrements << "\n"; // This is the main time-stepping loop for (; currentIncrement <= userInputs.totalIncrements; ++currentIncrement) @@ -78,20 +76,16 @@ MatrixFreePDE::solve() currentTime += userInputs.dtValue; if (currentIncrement % userInputs.skip_print_steps == 0) { - pcout << "\ntime increment:" << currentIncrement - << " time: " << currentTime << "\n"; + conditionalOStreams::pout_base << "\ntime increment:" << currentIncrement + << " time: " << currentTime << "\n"; } // check and perform adaptive mesh refinement if (userInputs.h_adaptivity == true && currentIncrement % userInputs.skip_remeshing_steps == 0) { - computing_timer.enter_subsection("matrixFreePDE: AMR"); - AMR.do_adaptive_refinement(currentIncrement); reinit(); - - computing_timer.leave_subsection("matrixFreePDE: AMR"); } // Update the list of nuclei (if relevant) @@ -119,11 +113,6 @@ MatrixFreePDE::solve() solutionSet[fieldIndex]->update_ghost_values(); } outputResults(); - if (userInputs.print_timing_with_output && - currentIncrement < userInputs.totalIncrements) - { - computing_timer.print_summary(); - } currentOutput++; } @@ -148,9 +137,6 @@ MatrixFreePDE::solve() // output results to file outputResults(); } - - // log time - computing_timer.leave_subsection("matrixFreePDE: solve"); } template class MatrixFreePDE<2, 1>; diff --git a/src/core/solvers/solveIncrement.cc b/src/core/solvers/solveIncrement.cc index 8f45354b..c782a77c 100644 --- a/src/core/solvers/solveIncrement.cc +++ b/src/core/solvers/solveIncrement.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include @@ -9,8 +10,6 @@ template void MatrixFreePDE::solveIncrement(bool skip_time_dependent) { - // log time - computing_timer.enter_subsection("matrixFreePDE: solveIncrements"); Timer time; char buffer[200]; @@ -45,7 +44,7 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) fields[fieldIndex].name.c_str(), solution_L2_norm, residualSet[fieldIndex]->l2_norm()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; if (!numbers::is_finite(solution_L2_norm)) { @@ -53,7 +52,7 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) sizeof(buffer), "ERROR: field '%s' solution is NAN. exiting.\n\n", fields[fieldIndex].name.c_str()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; exit(-1); } } @@ -93,7 +92,7 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) fields[fieldIndex].name.c_str(), solutionSet[fieldIndex]->l2_norm(), residualSet[fieldIndex]->l2_norm()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } nonlinear_iteration_converged = @@ -135,7 +134,7 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) fields[fieldIndex].name.c_str(), solutionSet[fieldIndex]->l2_norm(), residualSet[fieldIndex]->l2_norm()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } // Check to see if this individual variable has converged @@ -168,7 +167,7 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) currentIncrement, nonlinear_iteration_index, diff); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } if (diff > userInputs.nonlinear_solver_parameters @@ -198,7 +197,7 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) sizeof(buffer), "ERROR: field '%s' solution is NAN. exiting.\n\n", fields[fieldIndex].name.c_str()); - pcout << buffer; + conditionalOStreams::pout_base << buffer; exit(-1); } } @@ -209,10 +208,8 @@ MatrixFreePDE::solveIncrement(bool skip_time_dependent) if (currentIncrement % userInputs.skip_print_steps == 0) { - pcout << "wall time: " << time.wall_time() << "s\n"; + conditionalOStreams::pout_base << "wall time: " << time.wall_time() << "s\n"; } - // log time - computing_timer.leave_subsection("matrixFreePDE: solveIncrements"); } // Application of boundary conditions @@ -342,10 +339,10 @@ MatrixFreePDE::updateImplicitSolution(unsigned int fieldIndex, } catch (...) { - pcout << "\nWarning: linear solver did not converge as " - "per set tolerances. consider increasing the " - "maximum number of iterations or decreasing the " - "solver tolerance.\n"; + conditionalOStreams::pout_base << "\nWarning: linear solver did not converge as " + "per set tolerances. consider increasing the " + "maximum number of iterations or decreasing the " + "solver tolerance.\n"; } if (var_attributes.at(fieldIndex).is_nonlinear) @@ -387,9 +384,10 @@ MatrixFreePDE::updateImplicitSolution(unsigned int fieldIndex, if (currentIncrement % userInputs.skip_print_steps == 0) { - pcout << " Old residual: " << residual_old - << " Damping Coeff: " << damping_coefficient - << " New Residual: " << residual_new << "\n"; + conditionalOStreams::pout_base + << " Old residual: " << residual_old + << " Damping Coeff: " << damping_coefficient + << " New Residual: " << residual_new << "\n"; } // An improved approach would use the @@ -452,7 +450,7 @@ MatrixFreePDE::updateImplicitSolution(unsigned int fieldIndex, solver_control.tolerance(), solutionSet[fieldIndex]->l2_norm(), dU_norm); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } // Check to see if this individual variable has converged @@ -480,7 +478,7 @@ MatrixFreePDE::updateImplicitSolution(unsigned int fieldIndex, currentIncrement, nonlinear_iteration_index, diff); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } if (diff > @@ -493,10 +491,11 @@ MatrixFreePDE::updateImplicitSolution(unsigned int fieldIndex, else if (diff > userInputs.nonlinear_solver_parameters.getToleranceValue(fieldIndex)) { - pcout << "\nWarning: nonlinear solver did not converge as " - "per set tolerances. consider increasing the " - "maximum number of iterations or decreasing the " - "solver tolerance.\n"; + conditionalOStreams::pout_base + << "\nWarning: nonlinear solver did not converge as " + "per set tolerances. consider increasing the " + "maximum number of iterations or decreasing the " + "solver tolerance.\n"; } } else @@ -543,7 +542,7 @@ MatrixFreePDE::updateImplicitSolution(unsigned int fieldIndex, solver_control.tolerance(), solutionSet[fieldIndex]->l2_norm(), dU_norm); - pcout << buffer; + conditionalOStreams::pout_base << buffer; } } } diff --git a/src/core/userInputParameters.cc b/src/core/userInputParameters.cc index 0f7fdaf8..a5ce70e9 100644 --- a/src/core/userInputParameters.cc +++ b/src/core/userInputParameters.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include @@ -524,15 +525,13 @@ userInputParameters::assign_nonlinear_solve_parameters( } else { - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "PRISMS-PF Warning: Laplace's equation is only used " - "to generate the initial guess for time independent " - "equations. The equation for variable " - << variable.name - << " is not a time independent equation. No initial " - "guess is needed for this equation.\n"; - } + conditionalOStreams::pout_base + << "PRISMS-PF Warning: Laplace's equation is only used " + "to generate the initial guess for time independent " + "equations. The equation for variable " + << variable.name + << " is not a time independent equation. No initial " + "guess is needed for this equation.\n"; } nonlinear_solver_parameters.loadParameters(index, @@ -586,13 +585,12 @@ userInputParameters::assign_output_parameters( if ((output_file_type == "vtk") && (!output_vtu_per_process)) { output_vtu_per_process = true; - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "PRISMS-PF Warning: 'Output file type' given as 'vtk' and " - "'Output separate files per process' given as 'false'. Shared " - "output files are not supported for the vtk output format. " - "Separate files per process will be created.\n"; - } + + conditionalOStreams::pout_base + << "PRISMS-PF Warning: 'Output file type' given as 'vtk' and " + "'Output separate files per process' given as 'false'. Shared " + "output files are not supported for the vtk output format. " + "Separate files per process will be created.\n"; } print_timing_with_output = @@ -1345,34 +1343,29 @@ userInputParameters::get_Cij_tensor(std::vector elastic_constants, } } - dealii::ConditionalOStream pcout(std::cout, - dealii::Utilities::MPI::this_mpi_process( - MPI_COMM_WORLD) == 0); - - return getCIJMatrix(mat_model, elastic_constants, pcout); + return getCIJMatrix(mat_model, elastic_constants); } template dealii::Tensor<2, 2 * dim - 1 + dim / 3> -userInputParameters::getCIJMatrix(const elasticityModel model, - const std::vector &constants, - dealii::ConditionalOStream &pcout) const +userInputParameters::getCIJMatrix(const elasticityModel model, + const std::vector &constants) const { // CIJ.fill(0.0); dealii::Tensor<2, 2 * dim - 1 + dim / 3> CIJ; - pcout << "Reading material model:"; + conditionalOStreams::pout_base << "Reading material model:"; switch (dim) { case 1: { - pcout << " 1D "; + conditionalOStreams::pout_base << " 1D "; // 1D models switch (model) { case ISOTROPIC: { - pcout << " ISOTROPIC \n"; + conditionalOStreams::pout_base << " ISOTROPIC \n"; CIJ[0][0] = constants[0]; break; } @@ -1388,13 +1381,13 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } case 2: { - pcout << " 2D "; + conditionalOStreams::pout_base << " 2D "; // 2D models switch (model) { case ISOTROPIC: { - pcout << " ISOTROPIC \n"; + conditionalOStreams::pout_base << " ISOTROPIC \n"; const double E = constants[0]; const double nu = constants[1]; const double mu = E / (2 * (1 + nu)); @@ -1407,7 +1400,7 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } case ANISOTROPIC: { - pcout << " ANISOTROPIC \n"; + conditionalOStreams::pout_base << " ANISOTROPIC \n"; CIJ[0][0] = constants[0]; // C11 CIJ[1][1] = constants[1]; // C22 CIJ[2][2] = constants[2]; // C33 @@ -1428,13 +1421,13 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } case 3: { - pcout << " 3D "; + conditionalOStreams::pout_base << " 3D "; // 3D models switch (model) { case ISOTROPIC: { - pcout << " ISOTROPIC \n"; + conditionalOStreams::pout_base << " ISOTROPIC \n"; const double E = constants[0]; const double nu = constants[1]; const double mu = E / (2 * (1 + nu)); @@ -1452,7 +1445,7 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } case TRANSVERSE: { - pcout << " TRANSVERSE \n"; + conditionalOStreams::pout_base << " TRANSVERSE \n"; CIJ[0][0] = constants[0]; // C11 CIJ[1][1] = constants[0]; // C11 CIJ[2][2] = constants[1]; // C33 @@ -1466,7 +1459,7 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } case ORTHOTROPIC: { - pcout << " ORTHOTROPIC \n"; + conditionalOStreams::pout_base << " ORTHOTROPIC \n"; CIJ[0][0] = constants[0]; // C11 CIJ[1][1] = constants[1]; // C22 CIJ[2][2] = constants[2]; // C33 @@ -1480,7 +1473,7 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } case ANISOTROPIC: { - pcout << " ANISOTROPIC \n"; + conditionalOStreams::pout_base << " ANISOTROPIC \n"; CIJ[0][0] = constants[0]; // C11 CIJ[1][1] = constants[1]; // C22 CIJ[2][2] = constants[2]; // C33 @@ -1521,18 +1514,18 @@ userInputParameters::getCIJMatrix(const elasticityModel model, } } // print CIJ to terminal - pcout << "Elasticity matrix (Voigt notation):\n"; + conditionalOStreams::pout_base << "Elasticity matrix (Voigt notation):\n"; constexpr unsigned int voight_matrix_size = 2 * dim - 1 + dim / 3; for (unsigned int i = 0; i < voight_matrix_size; i++) { for (unsigned int j = 0; j < voight_matrix_size; j++) { - pcout << std::setw(8) << std::setprecision(3) << std::scientific << CIJ[i][j] - << " "; + conditionalOStreams::pout_base << std::setw(8) << std::setprecision(3) + << std::scientific << CIJ[i][j] << " "; } - pcout << "\n"; + conditionalOStreams::pout_base << "\n"; } - pcout << "\n"; + conditionalOStreams::pout_base << "\n"; return CIJ; } diff --git a/src/grains/SimplifiedGrainRepresentation.cc b/src/grains/SimplifiedGrainRepresentation.cc index b5e31e65..99f31674 100644 --- a/src/grains/SimplifiedGrainRepresentation.cc +++ b/src/grains/SimplifiedGrainRepresentation.cc @@ -1,3 +1,4 @@ +#include #include // ============================================================================ @@ -174,15 +175,11 @@ SimplifiedGrainManipulator::reassignGrains( if ((sum_radii + 2.0 * buffer_distance > center_distance) and (order_parameter_other == order_parameter_base)) { - if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) - { - std::cout << "Found overlap between grain " - << grain_representations.at(g_base).getGrainId() - << " and grain " - << grain_representations.at(g_other).getGrainId() - << " with order parameter " << order_parameter_base - << std::endl; - } + conditionalOStreams::pout_base + << "Found overlap between grain " + << grain_representations.at(g_base).getGrainId() << " and grain " + << grain_representations.at(g_other).getGrainId() + << " with order parameter " << order_parameter_base << std::endl; grain_representations.at(g_base).setDistanceToNeighbor( center_distance - sum_radii); diff --git a/src/grains/reassignGrains.cc b/src/grains/reassignGrains.cc index 8c09cd2a..c4b068fe 100644 --- a/src/grains/reassignGrains.cc +++ b/src/grains/reassignGrains.cc @@ -1,3 +1,4 @@ +#include #include #include #include @@ -8,10 +9,7 @@ template void MatrixFreePDE::reassignGrains() { - // log time - computing_timer.enter_subsection("matrixFreePDE: reassignGrains"); - - pcout << "Reassigning grains...\n"; + conditionalOStreams::pout_base << "Reassigning grains...\n"; // Get the index of the first scalar field (used to get the FE object and // DOFHandler) @@ -71,10 +69,11 @@ MatrixFreePDE::reassignGrains() SimplifiedGrainRepresentation simplified_grain_representation( grain_sets.at(g)); - pcout << "Grain: " << simplified_grain_representation.getGrainId() << " " - << simplified_grain_representation.getOrderParameterId() - << " Center: " << simplified_grain_representation.getCenter()(0) << " " - << simplified_grain_representation.getCenter()(1) << std::endl; + conditionalOStreams::pout_base + << "Grain: " << simplified_grain_representation.getGrainId() << " " + << simplified_grain_representation.getOrderParameterId() + << " Center: " << simplified_grain_representation.getCenter()(0) << " " + << simplified_grain_representation.getCenter()(1) << std::endl; simplified_grain_representations.push_back(simplified_grain_representation); } @@ -93,10 +92,11 @@ MatrixFreePDE::reassignGrains() for (unsigned int g = 0; g < this->simplified_grain_representations.size(); g++) { - pcout << "Grain: " << simplified_grain_representations[g].getGrainId() << " " - << simplified_grain_representations[g].getOrderParameterId() - << " Center: " << simplified_grain_representations[g].getCenter()(0) << " " - << simplified_grain_representations[g].getCenter()(1) << std::endl; + conditionalOStreams::pout_base + << "Grain: " << simplified_grain_representations[g].getGrainId() << " " + << simplified_grain_representations[g].getOrderParameterId() + << " Center: " << simplified_grain_representations[g].getCenter()(0) << " " + << simplified_grain_representations[g].getCenter()(1) << std::endl; } OrderParameterRemapper order_parameter_remapper; @@ -105,10 +105,7 @@ MatrixFreePDE::reassignGrains() *dofHandlersSet_nonconst.at(scalar_field_index), FESet.at(scalar_field_index)->dofs_per_cell); - pcout << "Reassigning grains completed.\n\n"; - - // end log - computing_timer.leave_subsection("matrixFreePDE: reassignGrains"); + conditionalOStreams::pout_base << "Reassigning grains completed.\n\n"; } template class MatrixFreePDE<2, 1>; diff --git a/src/nucleation/nucleation.cc b/src/nucleation/nucleation.cc index 55deab9f..f908611d 100644 --- a/src/nucleation/nucleation.cc +++ b/src/nucleation/nucleation.cc @@ -1,6 +1,6 @@ -// Methods in MatrixFreePDE to update the list of nuclei #include #include +#include #include #include #include @@ -23,7 +23,6 @@ MatrixFreePDE::updateNucleiList() userInputs.dtValue * (double) currentIncrement <= userInputs.nucleation_end_time) { - computing_timer.enter_subsection("matrixFreePDE: nucleation"); // Apply constraints for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++) { @@ -70,7 +69,6 @@ MatrixFreePDE::updateNucleiList() { refineMeshNearNuclei(new_nuclei); } - computing_timer.leave_subsection("matrixFreePDE: nucleation"); } } } @@ -87,10 +85,12 @@ MatrixFreePDE::getNewNuclei() std::vector> newnuclei; // Get list of prospective new nuclei for the local processor - pcout << "Nucleation attempt for increment " << currentIncrement << "\n"; + conditionalOStreams::pout_base << "Nucleation attempt for increment " + << currentIncrement << "\n"; getLocalNucleiList(newnuclei); - pcout << "nucleation attempt! " << currentTime << " " << currentIncrement << "\n"; + conditionalOStreams::pout_base << "nucleation attempt! " << currentTime << " " + << currentIncrement << "\n"; // Generate global list of new nuclei and resolve conflicts between new nuclei parallelNucleationList new_nuclei_parallel(newnuclei); diff --git a/src/utilities/utilities.cc b/src/utilities/utilities.cc index 81ee5234..1510081b 100644 --- a/src/utilities/utilities.cc +++ b/src/utilities/utilities.cc @@ -1,5 +1,4 @@ -// utility functions for the MatrixFreePDE class - +#include #include // return index of given field name if exists, else throw error @@ -14,7 +13,8 @@ MatrixFreePDE::getFieldIndex(std::string _name) return field.index; } } - pcout << "\nutilities.h: field '" << _name.c_str() << "' not initialized\n"; + conditionalOStreams::pout_base << "\nutilities.h: field '" << _name.c_str() + << "' not initialized\n"; exit(-1); }