Commit 5990580f authored by GILLES Sebastien's avatar GILLES Sebastien

#859 Model: add the possibility not to print the banners, for the integration tests.

parent 395eda16
......@@ -59,6 +59,10 @@ namespace MoReFEM
*/
//! Enum class to say whether banners are printed or not.
enum class print_banner { yes, no };
/*!
* \brief Class that drives the finite element resolution.
*
......@@ -97,11 +101,13 @@ namespace MoReFEM
* \copydoc doxygen_hide_init_morefem_param
* \copydoc doxygen_hide_init_morefem_param
* \param[in] a_create_domain_list_for_coords Whether the model will compute the list of domains a coord is in or not.
*
* \param[in] do_print_banner If True, print text at the beginning and the end of the program. False has been
* introduced only for the integration tests.
*/
template<class MoReFEMDataT>
explicit Model(const MoReFEMDataT& morefem_data,
create_domain_list_for_coords a_create_domain_list_for_coords = create_domain_list_for_coords::no);
create_domain_list_for_coords a_create_domain_list_for_coords = create_domain_list_for_coords::no,
print_banner do_print_banner = print_banner::yes);
//! Destructor.
......@@ -272,6 +278,13 @@ namespace MoReFEM
//! Coords will get the information of which domain they are in.
void CreateDomainListForCoords();
/*!
* \brief Whether banners should be printed or not.
*
* \return Boolean...
*/
bool DoPrintBanner() const noexcept;
private:
//! Transient parameters.
......@@ -292,9 +305,16 @@ namespace MoReFEM
*/
bool do_clear_god_of_dof_temporary_data_after_initialize_ = true;
//! Enables to force not to print the time iteration banner.
/*!
* \brief If false, the banner for each new time iteration won't be printed.
*
* Even if true it is second to \a do_print_banner_.
*/
bool do_print_new_time_iteration_banner_ = true;
//! If false, no banner at all will be printed. False is useful for test framework.
print_banner do_print_banner_ = print_banner::yes;
};
} // namespace MoReFEM
......
......@@ -20,9 +20,11 @@ namespace MoReFEM
template<class DerivedT, DoConsiderProcessorWiseLocal2Global DoConsiderProcessorWiseLocal2GlobalT>
template<class MoReFEMDataT>
Model<DerivedT, DoConsiderProcessorWiseLocal2GlobalT>::Model(const MoReFEMDataT& morefem_data,
create_domain_list_for_coords a_create_domain_list_for_coords)
create_domain_list_for_coords a_create_domain_list_for_coords,
print_banner do_print_banner)
: Crtp::CrtpMpi<Model<DerivedT, DoConsiderProcessorWiseLocal2GlobalT>>(morefem_data.GetMpi()),
output_directory_(morefem_data.GetResultDirectory())
output_directory_(morefem_data.GetResultDirectory()),
do_print_banner_(do_print_banner)
{
if (a_create_domain_list_for_coords == create_domain_list_for_coords::yes)
Coords::SetCreateDomainListForCoords();
......@@ -94,26 +96,29 @@ namespace MoReFEM
}
}
if (DoPrintBanner())
{
std::cout << "REALLY?" << std::endl;
Wrappers::Petsc::PrintMessageOnFirstProcessor("\n================================================================\n",
mpi, __FILE__, __LINE__);
Wrappers::Petsc::PrintMessageOnFirstProcessor("\n================================================================\n",
mpi, __FILE__, __LINE__);
std::ostringstream oconv;
oconv << "MoReFEM ";
oconv << 8 * sizeof(void*);
oconv << " bits ";
Wrappers::Petsc::PrintMessageOnFirstProcessor(oconv.str().c_str(),
mpi, __FILE__, __LINE__);
if (mpi.template Nprocessor<int>() == 1)
Wrappers::Petsc::PrintMessageOnFirstProcessor("on 1 processor \n",
std::ostringstream oconv;
oconv << "MoReFEM ";
oconv << 8 * sizeof(void*);
oconv << " bits ";
Wrappers::Petsc::PrintMessageOnFirstProcessor(oconv.str().c_str(),
mpi, __FILE__, __LINE__);
else
Wrappers::Petsc::PrintMessageOnFirstProcessor("on %d processors \n",
mpi, __FILE__, __LINE__, mpi.template Nprocessor<int>());
Wrappers::Petsc::PrintMessageOnFirstProcessor("%s=================================================================\n",
mpi, __FILE__, __LINE__, date_time);
if (mpi.template Nprocessor<int>() == 1)
Wrappers::Petsc::PrintMessageOnFirstProcessor("on 1 processor \n",
mpi, __FILE__, __LINE__);
else
Wrappers::Petsc::PrintMessageOnFirstProcessor("on %d processors \n",
mpi, __FILE__, __LINE__, mpi.template Nprocessor<int>());
Wrappers::Petsc::PrintMessageOnFirstProcessor("%s=================================================================\n",
mpi, __FILE__, __LINE__, date_time);
}
}
......@@ -122,21 +127,25 @@ namespace MoReFEM
{
const auto& mpi = this->GetMpi();
Wrappers::Petsc::PrintMessageOnFirstProcessor("\nIf no exception, all results have been printed in %s.\n",
mpi, __FILE__, __LINE__, GetOutputDirectory().c_str());
if (DoPrintBanner())
{
Wrappers::Petsc::PrintMessageOnFirstProcessor("\nIf no exception, all results have been printed in %s.\n",
mpi, __FILE__, __LINE__, GetOutputDirectory().c_str());
Wrappers::Petsc::PrintMessageOnFirstProcessor("\n==============================================================\n",
mpi, __FILE__, __LINE__);
Wrappers::Petsc::PrintMessageOnFirstProcessor("MoReFEM %s ended (if exception thrown it will appear afterwards).\n",
mpi, __FILE__, __LINE__, DerivedT::ClassName().c_str());
Wrappers::Petsc::PrintMessageOnFirstProcessor("\n==============================================================\n",
mpi, __FILE__, __LINE__);
Wrappers::Petsc::PrintMessageOnFirstProcessor("MoReFEM %s ended (if exception thrown it will appear afterwards).\n",
mpi, __FILE__, __LINE__, DerivedT::ClassName().c_str());
// current date and time system
time_t now = time(0);
char* date_time = ctime(&now);
// current date and time system
time_t now = time(0);
char* date_time = ctime(&now);
Wrappers::Petsc::PrintMessageOnFirstProcessor("%s==============================================================\n",
mpi, __FILE__, __LINE__, date_time);
Wrappers::Petsc::PrintMessageOnFirstProcessor("%s==============================================================\n",
mpi, __FILE__, __LINE__, date_time);
}
#ifdef MOREFEM_CHECK_UPDATE_GHOSTS_CALL_RELEVANCE
if (mpi.template Nprocessor<int>() > 1 && mpi.IsRootProcessor())
::MoReFEM::Internal::Wrappers::Petsc::CheckUpdateGhostManager::GetInstance(__FILE__, __LINE__).Print();
......@@ -265,7 +274,7 @@ namespace MoReFEM
UpdateTime();
// Print time information
if (do_print_new_time_iteration_banner_)
if (DoPrintBanner() && do_print_new_time_iteration_banner_)
{
if ((this->GetTimeManager().NtimeModified() % GetDisplayValue()) == 0)
{
......@@ -295,13 +304,16 @@ namespace MoReFEM
std::string time_end = time_keep.TimeElapsedSinceBeginning();
Wrappers::Petsc::PrintMessageOnFirstProcessor("\n----------------------------------------------\n",
mpi, __FILE__, __LINE__);
Wrappers::Petsc::PrintMessageOnFirstProcessor("Time of execution : %s.\n",
mpi, __FILE__, __LINE__,
time_end.c_str());
Wrappers::Petsc::PrintMessageOnFirstProcessor("----------------------------------------------\n",
mpi, __FILE__, __LINE__);
if (DoPrintBanner())
{
Wrappers::Petsc::PrintMessageOnFirstProcessor("\n----------------------------------------------\n",
mpi, __FILE__, __LINE__);
Wrappers::Petsc::PrintMessageOnFirstProcessor("Time of execution : %s.\n",
mpi, __FILE__, __LINE__,
time_end.c_str());
Wrappers::Petsc::PrintMessageOnFirstProcessor("----------------------------------------------\n",
mpi, __FILE__, __LINE__);
}
// Destroy manually some singletons that would blow up at the end of the program: due to a dependancy
// their content must be destroyed before the call to Mpi::Finalize(), which occurs before the natural end of
......@@ -477,7 +489,8 @@ namespace MoReFEM
template<class DerivedT, DoConsiderProcessorWiseLocal2Global DoConsiderProcessorWiseLocal2GlobalT>
inline void Model<DerivedT, DoConsiderProcessorWiseLocal2GlobalT>::SetDoPrintNewTimeIterationBanner(bool do_print) noexcept
inline void Model<DerivedT, DoConsiderProcessorWiseLocal2GlobalT>
::SetDoPrintNewTimeIterationBanner(bool do_print) noexcept
{
do_print_new_time_iteration_banner_ = do_print;
}
......@@ -530,6 +543,19 @@ namespace MoReFEM
}
template<class DerivedT, DoConsiderProcessorWiseLocal2Global DoConsiderProcessorWiseLocal2GlobalT>
bool Model<DerivedT, DoConsiderProcessorWiseLocal2GlobalT>::DoPrintBanner() const noexcept
{
switch(do_print_banner_)
{
case print_banner::yes:
return true;
case print_banner::no:
return false;
}
}
} // namespace MoReFEM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment