Commit 91279de9 authored by GILLES Sebastien's avatar GILLES Sebastien

#1443 Remove the GodOfDof::FullFromPreprocessedInit() method, which was there...

#1443 Remove the GodOfDof::FullFromPreprocessedInit() method, which was there only for the test... instead the model of the test has been made a friend of GodOfDof, and calls the first functions itself. The debug data attribute do_consider_proc_wise_local_2_global_ of GodOfDof is now used with more safeties added.
parent dc6f7244
......@@ -168,10 +168,10 @@ namespace MoReFEM
const std::map<unsigned int, std::vector<unsigned int>>& dof_list_per_felt_space,
const Internal::Parallelism* parallelism)
{
#ifndef NDEBUG
do_consider_proc_wise_local_2_global_ = do_consider_proc_wise_local_2_global;
#endif // NDEBUG
assert("do_consider_proc_wise_local_2_global_ is only stored in debug mode (in release its value "
"is propagated through arguments) but it is not expected to change in the process" &&
GetDoConsiderProcessorWiseLocal2Global() == do_consider_proc_wise_local_2_global);
const auto& mpi = GetMpi();
const auto rank = mpi.GetRank<unsigned int>();
......
......@@ -52,6 +52,16 @@ namespace MoReFEM
class GlobalDiagonalMatrix;
namespace TestNS::LoadPrepartitionedGodOfDofNS
{
class Model;
} // namespace TestNS::LoadPrepartitionedGodOfDofNS
// ============================
// End of forward declarations.
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
......@@ -101,6 +111,8 @@ namespace MoReFEM
//! Friendship.
friend class GodOfDofManager;
//! Friendship to test class,
friend class TestNS::LoadPrepartitionedGodOfDofNS::Model;
/// \name Special members.
///@{
......@@ -556,7 +568,6 @@ namespace MoReFEM
* \brief Init the output directories and the list of \a FEltSpace to consider.
*
* \param[in] felt_space_list List of all \a FEltSpace to consider in the \a GodOfDof.
* \copydetails doxygen_hide_do_consider_processor_wise_local_2_global
* \param[in] output_directory Output directory for data specific to the mesh covered by the \a GodOfDof.
*
* <b>Prerequisite:</b> none - this method can be called at the very beginning of the initialization process.
......@@ -567,7 +578,7 @@ namespace MoReFEM
/*!
* \brief The method called by \a Init() when the parallelism strategy is "run_from_preprocessed"
* \brief The method called by \a Init() for all parallelism strategy save "run_from_preprocessed_data".
*
* \copydetails doxygen_hide_do_consider_processor_wise_local_2_global
* \copydoc doxygen_hide_morefem_data_param
......@@ -576,10 +587,22 @@ namespace MoReFEM
*
*/
template<class MoReFEMDataT>
void InitFromPreprocessedData(const MoReFEMDataT& morefem_data,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global);
void StandardInit(const MoReFEMDataT& morefem_data,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global);
/*!
* \brief The method called by \a Init() when the parallelism strategy is "run_from_preprocessed_data"
*
* \copydetails doxygen_hide_do_consider_processor_wise_local_2_global
* \copydoc doxygen_hide_morefem_data_param
*
* <b>Prerequisite:</b> \a FEltSpace and output directories must have been initialized.
*
*/
template<class MoReFEMDataT>
void InitFromPreprocessedData(const MoReFEMDataT& morefem_data,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global);
// ============================
//! \cond IGNORE_BLOCK_IN_DOXYGEN
......@@ -591,9 +614,7 @@ namespace MoReFEM
void Init4(DoConsiderProcessorWiseLocal2Global do_consider_proc_wise_local_2_global,
const Internal::Parallelism* parallelism);
template<class MoReFEMDataT>
void StandardInit(const MoReFEMDataT& morefem_data,
DoConsiderProcessorWiseLocal2Global do_consider_proc_wise_local_2_global);
template<class MoReFEMDataT>
void FromPreprocessedInit(const MoReFEMDataT& morefem_data,
......@@ -614,17 +635,6 @@ namespace MoReFEM
public:
void FullFromPreprocessedInit(FEltSpace::vector_unique_ptr&& felt_space_list,
LuaOptionFile& god_of_dof_prepartitioned_data,
const FilesystemNS::Directory& output_directory,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global,
const Internal::Parallelism* parallelism);
//! Number of program-wise dofs per \a NumberingSubset.
//! You shouldn't need this: it is useful only for reloading data for two-steps parallelism.
const std::map<unsigned int, unsigned int>& NprogramWiseDofPerNumberingSubset() const noexcept;
......
......@@ -29,6 +29,10 @@ namespace MoReFEM
{
InitHelper_FEltSpace_Output(output_directory, std::move(a_felt_space_list));
# ifndef NDEBUG
do_consider_proc_wise_local_2_global_ = do_consider_proc_wise_local_2_global;
# endif // NDEBUG
if constexpr (!MoReFEMDataT::HasParallelismField())
{
assert(morefem_data.GetParallelismPtr() == nullptr);
......@@ -69,10 +73,6 @@ namespace MoReFEM
void GodOfDof::InitFromPreprocessedData(const MoReFEMDataT& morefem_data,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global)
{
#ifndef NDEBUG
do_consider_proc_wise_local_2_global_ = do_consider_processor_wise_local_2_global;
#endif // NDEBUG
namespace ipl = Utilities::InputDataNS;
decltype(auto) prepartitioned_data_dir_str =
......@@ -105,7 +105,10 @@ namespace MoReFEM
DoConsiderProcessorWiseLocal2Global do_consider_proc_wise_local_2_global)
{
static_cast<void>(morefem_data);
static_cast<void>(do_consider_proc_wise_local_2_global);
assert("do_consider_proc_wise_local_2_global_ is only stored in debug mode (in release its value "
"is propagated through arguments) but it is not expected to change in the process" &&
GetDoConsiderProcessorWiseLocal2Global() == do_consider_proc_wise_local_2_global);
namespace ipl = Utilities::InputDataNS;
......
......@@ -27,7 +27,7 @@ namespace MoReFEM::Internal::FEltSpaceNS
* \endinternal
*
* \copydoc doxygen_hide_input_data_arg
* \returnThe list of all \a FEltSpace detailed in the input
* \return The list of all \a FEltSpace detailed in the input
* data file and store them in this container which key is the index of the \a GodOfDof (which are
* not yet created when this function is called - hence the index rather than the pointer of the object).
*/
......
......@@ -269,24 +269,6 @@ namespace MoReFEM
} // namespace anonymous
void GodOfDof::FullFromPreprocessedInit(FEltSpace::vector_unique_ptr&& felt_space_list,
LuaOptionFile& god_of_dof_prepartitioned_data,
const FilesystemNS::Directory& output_directory,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global,
const Internal::Parallelism* parallelism)
{
InitHelper_FEltSpace_Output(output_directory, std::move(felt_space_list));
#ifndef NDEBUG
do_consider_proc_wise_local_2_global_ = do_consider_processor_wise_local_2_global;
#endif // NDEBUG
FromPreprocessedInit(god_of_dof_prepartitioned_data,
do_consider_processor_wise_local_2_global,
parallelism);
}
void GodOfDof::FromPreprocessedInit(LuaOptionFile& god_of_dof_prepartitioned_data,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global,
const Internal::Parallelism* parallelism)
......
......@@ -152,12 +152,21 @@ namespace MoReFEM::TestNS::LoadPrepartitionedGodOfDofNS
const auto god_of_dof_prepartitioned_data_file = mesh_subdir.AddFile("god_of_dof.hhdata");
LuaOptionFile god_of_dof_prepartitioned_data(god_of_dof_prepartitioned_data_file, __FILE__, __LINE__);
reconstructed_god_of_dof.FullFromPreprocessedInit(std::move(felt_space_list),
god_of_dof_prepartitioned_data,
output_directory,
// Initialize the reconstructed \a GodOfDof.
// The purpose here is truly to check the internal without incurring a new Lua file; in a proper model
// you should NEVER do what is done here (and requires anyway friendship to \a GodOfDof class).
{
reconstructed_god_of_dof.InitHelper_FEltSpace_Output(output_directory, std::move(felt_space_list));
#ifndef NDEBUG
reconstructed_god_of_dof.do_consider_proc_wise_local_2_global_ = DoConsiderProcessorWiseLocal2Global::yes;
#endif // NDEBUG
reconstructed_god_of_dof.FromPreprocessedInit(god_of_dof_prepartitioned_data,
DoConsiderProcessorWiseLocal2Global::yes,
nullptr);
}
}
......
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