Commit b43bc31e authored by GILLES Sebastien's avatar GILLES Sebastien

#1443 Remove the parallelism object within GodOfDof, which was not compliant with DRY principle.

parent 2e6d8b22
......@@ -127,7 +127,7 @@ namespace MoReFEM
*/
const FilesystemNS::Directory& GetResultDirectory() const noexcept;
//! Accessor to the object which keeps the data related to parallelism strategy.
//! Accessor to the object which keeps the data related to parallelism strategy. Might be nullptr if none specified in the input lua file.
const Internal::Parallelism* GetParallelismPtr() const noexcept;
private:
......
......@@ -167,7 +167,8 @@ namespace MoReFEM
void GodOfDof::Init3(DoConsiderProcessorWiseLocal2Global do_consider_proc_wise_local_2_global,
const std::map<unsigned int, std::vector<unsigned int>>& dof_list_per_felt_space)
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;
......@@ -268,7 +269,7 @@ namespace MoReFEM
SetBoundaryCondition();
// Prepare the output directories.
PrepareOutput();
PrepareOutput(parallelism);
#ifndef NDEBUG
if (mpi.Nprocessor<int>() == 1)
......@@ -833,7 +834,7 @@ namespace MoReFEM
void GodOfDof::PrepareOutput()
void GodOfDof::PrepareOutput(const Internal::Parallelism* parallelism)
{
decltype(auto) numbering_subset_list = GetNumberingSubsetList();
......@@ -875,10 +876,9 @@ namespace MoReFEM
}
// Write if required the parallelism strategy.
if (IsParallelismStrategy())
if (parallelism != nullptr)
{
decltype(auto) parallelism = GetParallelism();
const auto parallelism_strategy = parallelism.GetParallelismStrategy();
const auto parallelism_strategy = parallelism->GetParallelismStrategy();
decltype(auto) mesh = GetMesh();
......@@ -887,7 +887,7 @@ namespace MoReFEM
case Advanced::parallelism_strategy::parallel:
case Advanced::parallelism_strategy::precompute:
{
FilesystemNS::Directory mesh_subdir(parallelism.GetDirectory(),
FilesystemNS::Directory mesh_subdir(parallelism->GetDirectory(),
"Mesh_" + std::to_string(mesh.GetUniqueId()),
__FILE__, __LINE__);
......
......@@ -428,12 +428,6 @@ namespace MoReFEM
*/
auto GetIteratorFEltSpace(unsigned int unique_id) const;
//! Whether parallelism object is activated or not for the current model.
bool IsParallelismStrategy() const noexcept;
//! Access to internal object in charge of parallelism strategy.
const Internal::Parallelism& GetParallelism() const noexcept;
private:
//! Init the nodes.
......@@ -485,8 +479,10 @@ namespace MoReFEM
/*!
* \brief Prepare the subfolders for each numbering_subset.
*
* \param[in] parallelism Object which holds the parallelism strategy to use. or some of them, additional informations will be written on disk.
*/
void PrepareOutput();
void PrepareOutput(const Internal::Parallelism* parallelism);
//! Accessor to NdofHolder.
const Internal::FEltSpaceNS::NdofHolder& GetNdofHolder() const noexcept;
......@@ -538,9 +534,11 @@ namespace MoReFEM
*
* \copydetails doxygen_hide_do_consider_processor_wise_local_2_global
* \param[in] \copydetails doxygen_hide_dof_list_per_felt_space_arg
* \param[in] parallelism Internal object which holds the parallelism behaviour to use. If none given, might be nullptr.
*/
void Init3(DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global,
const std::map<unsigned int, std::vector<unsigned int>>& dof_list_per_felt_space);
const std::map<unsigned int, std::vector<unsigned int>>& dof_list_per_felt_space,
const Internal::Parallelism* parallelism);
......@@ -608,9 +606,6 @@ namespace MoReFEM
//! Path of the file listing the time iterations and the related files.
std::string time_iteration_file_;
//! Object which holds the informations about parallelism.
const Internal::Parallelism* parallelism_ = nullptr;
# ifndef NDEBUG
/*!
......
......@@ -27,8 +27,6 @@ namespace MoReFEM
DoConsiderProcessorWiseLocal2Global do_consider_proc_wise_local_2_global,
const FilesystemNS::Directory& output_directory)
{
parallelism_ = morefem_data.GetParallelismPtr();
std::map<unsigned int, std::vector<unsigned int>> dof_list_per_felt_space;
Init1(output_directory,
......@@ -37,7 +35,7 @@ namespace MoReFEM
Init2(morefem_data.GetInputData());
Init3(do_consider_proc_wise_local_2_global, dof_list_per_felt_space);
Init3(do_consider_proc_wise_local_2_global, dof_list_per_felt_space, morefem_data.GetParallelismPtr());
}
......@@ -269,19 +267,6 @@ namespace MoReFEM
}
inline const Internal::Parallelism& GodOfDof::GetParallelism() const noexcept
{
assert(!(!parallelism_));
return *parallelism_;
}
inline bool GodOfDof::IsParallelismStrategy() const noexcept
{
return parallelism_ != nullptr;
}
} // 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