Commit 44b8a67e authored by GILLES Sebastien's avatar GILLES Sebastien

#1473 Intermediate step - I put an object in GodOfDof, but it was clearly not...

#1473 Intermediate step - I put an object in GodOfDof, but it was clearly not the right place (GodOfDof is closely related to a single mesh, whereas I want something at a higher level). Will be moved into MoReFEMData.
parent 38e77254
......@@ -23,6 +23,8 @@
#include "Core/LinearAlgebra/GlobalMatrix.hpp"
#include "Core/LinearAlgebra/GlobalVector.hpp"
#include "Geometry/Mesh/Advanced/WritePrepartitionedData.hpp"
#include "FiniteElement/FiniteElementSpace/Internal/CreateNodeListHelper.hpp"
#include "FiniteElement/FiniteElementSpace/Internal/DofComputations.hpp"
#include "FiniteElement/FiniteElementSpace/Internal/Partition.hpp"
......@@ -267,8 +269,7 @@ namespace MoReFEM
// Prepare the output directories.
PrepareOutput();
#ifndef NDEBUG
if (mpi.Nprocessor<int>() == 1)
assert(NprocessorWiseDof() == NprogramWiseDof());
......@@ -834,9 +835,9 @@ namespace MoReFEM
void GodOfDof::PrepareOutput()
{
const auto& numbering_subset_list = GetNumberingSubsetList();
decltype(auto) numbering_subset_list = GetNumberingSubsetList();
const auto& mpi = GetMpi();
decltype(auto) mpi = GetMpi();
// First create all the relevant folders; make sure this is done before any processor attempts to create a file.
{
......@@ -857,8 +858,6 @@ namespace MoReFEM
mpi.Barrier();
for (const auto& numbering_subset_ptr : numbering_subset_list)
{
assert(!(!numbering_subset_ptr));
......@@ -875,6 +874,41 @@ namespace MoReFEM
FilesystemNS::File::Create(out, oconv.str(), __FILE__, __LINE__);
PrintDofInformation(numbering_subset, out);
}
// Write if required the parallelism strategy.
{
decltype(auto) parallelism = GetParallelism();
const auto parallelism_strategy = parallelism.GetParallelismStrategy();
decltype(auto) mesh = GetMesh();
switch(parallelism_strategy)
{
case Advanced::parallelism_strategy::parallel:
case Advanced::parallelism_strategy::precompute:
{
const auto parallelism_directory = GetOutputDirectory() + "/Parallelism";
std::cout << "CHECK = " << parallelism_directory << std::endl;
FilesystemNS::Folder::Create(parallelism_directory, __FILE__, __LINE__);
Advanced::MeshNS::WritePrepartitionedData partition_data_facility(mpi,
mesh,
parallelism_directory,
mesh.GetInitialFormat());
break;
}
case Advanced::parallelism_strategy::none:
case Advanced::parallelism_strategy::run_from_preprocessed:
case Advanced::parallelism_strategy::parallel_no_write:
break;
}
}
}
......
......@@ -38,6 +38,8 @@ namespace MoReFEM::Internal::GodOfDofNS
exit(EXIT_FAILURE);
}
if (parallelism_strategy_ == ::MoReFEM::Advanced::parallelism_strategy::run_from_preprocessed)
preprocessed_directory_ = ipl::Extract<Parallelism::Path>::Folder(input_data);
else
......
......@@ -65,7 +65,8 @@ namespace MoReFEM
Mesh::BuildPseudoNormals do_build_pseudo_normals)
: unique_id_parent(unique_id),
dimension_(dimension),
space_unit_(space_unit)
space_unit_(space_unit),
initial_format_(format)
{
GeometricElt::vector_shared_ptr unsort_element_list;
Coords::vector_unique_ptr coords_list;
......
......@@ -260,7 +260,7 @@ namespace MoReFEM
explicit Mesh(unsigned int unique_id,
const std::string& mesh_file,
unsigned dimension,
::MoReFEM::MeshNS::Format format,
MeshNS::Format format,
const double space_unit,
BuildEdge do_build_edge = BuildEdge::no,
BuildFace do_build_face = BuildFace::no,
......@@ -308,7 +308,7 @@ namespace MoReFEM
const std::string& mesh_file,
LuaOptionFile& prepartitioned_data,
unsigned dimension,
::MoReFEM::MeshNS::Format format,
MeshNS::Format format,
const double space_unit,
BuildEdge do_build_edge = BuildEdge::no,
BuildFace do_build_face = BuildFace::no,
......@@ -479,6 +479,11 @@ namespace MoReFEM
const GeometricElt& GetGeometricEltFromIndex(unsigned int index,
const RefGeomElt& ref_geom_elt) const;
public:
//! Returns the format in which the mesh was originally read. May be 'None' if undisclosed.
MeshNS::Format GetInitialFormat() const noexcept;
public:
/// \name Edge-related methods.
......@@ -833,6 +838,9 @@ namespace MoReFEM
//! Space unit of the mesh.
const double space_unit_;
//! Format in which the mesh was first read. May be 'None' if undisclosed or not kept.
MeshNS::Format initial_format_ = MeshNS::Format::None;
}; // class Mesh
......
......@@ -372,6 +372,11 @@ namespace MoReFEM
}
inline MeshNS::Format Mesh::GetInitialFormat() const noexcept
{
return initial_format_;
}
} // 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