Commit 7ef974c7 authored by GILLES Sebastien's avatar GILLES Sebastien

#1480 Fixes to make some test pass properly.

parent 6c6ee800
......@@ -69,6 +69,10 @@
argument = "-np 4

-np 4"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--stdin 0"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "$(BUILT_PRODUCTS_DIR)/Hyperelasticity"
isEnabled = "YES">
......
......@@ -888,7 +888,6 @@ namespace MoReFEM
case Advanced::parallelism_strategy::parallel:
case Advanced::parallelism_strategy::precompute:
{
FilesystemNS::Directory mesh_subdir(parallelism.GetDirectory(),
"Mesh_" + std::to_string(mesh.GetUniqueId()),
__FILE__, __LINE__);
......
......@@ -171,9 +171,8 @@ namespace MoReFEM
* must be implemented in DerivedT::SupplInitialize() (this method must be defined even
* in cases its content is null).
*
* \copydoc doxygen_hide_do_create_output_dir_arg
*/
void Initialize(create_output_dir do_create_output_dir = create_output_dir::yes);
void Initialize();
/*!
......@@ -228,9 +227,8 @@ namespace MoReFEM
*
* \endcode
*
* \copydoc doxygen_hide_do_create_output_dir_arg
*/
void Run(create_output_dir do_create_output_dir = create_output_dir::yes);
void Run();
//! Access to the object in charge of transient data.
const TimeManager& GetTimeManager() const noexcept;
......@@ -291,14 +289,10 @@ namespace MoReFEM
/*!
* \brief Create on disk an output directory for each mesh.
*
* \param[in] do_create_output_dir Whether the output directory should be created (if it does already exist,
* the old one is removed and a new one is created).
* Should be 'yes' for model executables, but might be run for Post processing ones.
*
* \return Key is the unique id of the mesh, value the path to it.
*/
std::map<unsigned int, FilesystemNS::Directory::const_unique_ptr>
CreateMeshDataDirectory(create_output_dir do_create_output_dir) const;
CreateMeshDataDirectory() const;
//! Constant accessor to create_domain_list_for_coords_.
create_domain_list_for_coords GetCreateDomainListForCoords() const noexcept;
......
......@@ -193,7 +193,7 @@ namespace MoReFEM
class TimeManagerPolicyT
>
void Model<DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT, TimeManagerPolicyT>
::Initialize(create_output_dir do_create_output_dir)
::Initialize()
{
const auto& mpi = this->GetMpi();
......@@ -210,11 +210,8 @@ namespace MoReFEM
Advanced::SetFromInputData<>(input_data, manager);
}
if (is_root_processor)
{
auto mesh_directory_storage = CreateMeshDataDirectory(do_create_output_dir);
Internal::MeshNS::WriteInterfaceListForEachMesh(mesh_directory_storage);
}
auto mesh_directory_storage = CreateMeshDataDirectory();
Internal::MeshNS::WriteInterfaceListForEachMesh(mesh_directory_storage);
mpi.Barrier();
......@@ -261,7 +258,7 @@ namespace MoReFEM
Internal::ModelNS::InitGodOfDof(morefem_data,
DoConsiderProcessorWiseLocal2GlobalT,
CreateMeshDataDirectory(do_create_output_dir));
std::move(mesh_directory_storage));
// As FiberListManager gets a constructor with arguments, call it explicitly there.
decltype(auto) time_manager = GetTimeManager();
......@@ -382,11 +379,11 @@ namespace MoReFEM
class TimeManagerPolicyT
>
void Model<DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT, TimeManagerPolicyT>
::Run(create_output_dir do_create_output_dir)
::Run()
{
auto& crtp_helper = static_cast<DerivedT&>(*this);
crtp_helper.Initialize(do_create_output_dir);
crtp_helper.Initialize();
while (!crtp_helper.HasFinished())
{
......@@ -553,7 +550,7 @@ namespace MoReFEM
>
std::map<unsigned int, FilesystemNS::Directory::const_unique_ptr>
Model<DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT, TimeManagerPolicyT>
::CreateMeshDataDirectory(create_output_dir do_create_output_dir) const
::CreateMeshDataDirectory() const
{
std::map<unsigned int, FilesystemNS::Directory::const_unique_ptr> ret;
......
......@@ -9,6 +9,7 @@
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Utilities/Filesystem/Directory.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
......@@ -50,11 +51,12 @@ int main(int argc, char** argv)
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory = ipl::Extract<Result::OutputDirectory>::Folder(input_data);
if (!FilesystemNS::Folder::DoExist(result_directory))
throw Exception("The specified directory doesn't exist!", __FILE__, __LINE__);
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
{
auto& manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
Advanced::SetFromInputData<>(input_data, manager);
......
......@@ -9,6 +9,7 @@
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Utilities/Filesystem/Directory.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
......@@ -50,10 +51,12 @@ int main(int argc, char** argv)
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory = ipl::Extract<Result::OutputDirectory>::Folder(input_data);
if (!FilesystemNS::Folder::DoExist(result_directory))
throw Exception("The specified directory doesn't exist!", __FILE__, __LINE__);
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
decltype(auto) mesh_manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
MoReFEM::Advanced::SetFromInputData<>(input_data, mesh_manager);
......
......@@ -9,6 +9,7 @@
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Utilities/Filesystem/Directory.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
......@@ -50,10 +51,12 @@ int main(int argc, char** argv)
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory = ipl::Extract<Result::OutputDirectory>::Folder(input_data);
if (!FilesystemNS::Folder::DoExist(result_directory))
throw Exception("The specified directory doesn't exist!", __FILE__, __LINE__);
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
decltype(auto) mesh_manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
MoReFEM::Advanced::SetFromInputData<>(input_data, mesh_manager);
......
......@@ -9,6 +9,7 @@
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Utilities/Filesystem/Directory.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
......@@ -50,10 +51,12 @@ int main(int argc, char** argv)
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory = ipl::Extract<Result::OutputDirectory>::Folder(input_data);
if (!FilesystemNS::Folder::DoExist(result_directory))
throw Exception("The specified directory doesn't exist!", __FILE__, __LINE__);
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
decltype(auto) mesh_manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
MoReFEM::Advanced::SetFromInputData<>(input_data, mesh_manager);
......
......@@ -9,6 +9,7 @@
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Utilities/Filesystem/Directory.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
......@@ -50,10 +51,12 @@ int main(int argc, char** argv)
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory = ipl::Extract<Result::OutputDirectory>::Folder(input_data);
if (!FilesystemNS::Folder::DoExist(result_directory))
throw Exception("The specified directory doesn't exist!", __FILE__, __LINE__);
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
decltype(auto) mesh_manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
MoReFEM::Advanced::SetFromInputData<>(input_data, mesh_manager);
......
......@@ -9,6 +9,8 @@
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Utilities/Filesystem/Folder.hpp"
#include "Utilities/Filesystem/Directory.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
......@@ -50,12 +52,13 @@ int main(int argc, char** argv)
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory = ipl::Extract<Result::OutputDirectory>::Folder(input_data);
if (!FilesystemNS::Folder::DoExist(result_directory))
throw Exception("The specified directory doesn't exist!", __FILE__, __LINE__);
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
auto& mesh_manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
Advanced::SetFromInputData<>(input_data, mesh_manager);
......
......@@ -80,9 +80,9 @@ namespace MoReFEM
MatrixConversion::MatrixConversion(const Wrappers::Mpi& mpi,
const std::string& freefem_numbering_informations_file,
const std::string& matrix_binary_file,
const std::string& data_directory,
const FilesystemNS::Directory& data_directory,
const std::vector<std::string>& unknown_in_matrix_list,
const std::string& output_directory,
const FilesystemNS::Directory& output_directory,
const NumberingSubset& numbering_subset,
const Mesh& mesh,
const char* invoking_file, int invoking_line)
......@@ -90,7 +90,7 @@ namespace MoReFEM
original_matrix_(Wrappers::Petsc::Matrix(mpi,
matrix_binary_file,
invoking_file, invoking_line)),
output_directory_(output_directory + "/")
output_directory_(output_directory)
{
assert(mpi.Nprocessor<int>() == 1 && "This class should be invoked only in sequential (but may deal "
"with matrix obtained in parallel computation).");
......@@ -103,10 +103,6 @@ namespace MoReFEM
freefem_dof_numbering_per_geom_elt_ = ReadFreefemDofNumbering(freefem_numbering_informations_file);
// No mutex here as sequential assumed (see assert above).
if (!FilesystemNS::Folder::DoExist(output_directory_))
FilesystemNS::Folder::Create(output_directory_, __FILE__, __LINE__);
ComputeDofMapping(numbering_subset, unknown_in_matrix_list);
ComputeTransfertMatrix();
}
......@@ -151,7 +147,7 @@ namespace MoReFEM
decltype(auto) output_directory = GetOutputDirectory();
transfert_matrix.View(GetMpi(),
output_directory + "transfert_matrix.hhdata",
output_directory.AddFile("transfert_matrix.hhdata"),
__FILE__, __LINE__);
Wrappers::Petsc::Matrix matrix_in_freefem_numbering;
......@@ -162,7 +158,7 @@ namespace MoReFEM
__FILE__, __LINE__);
matrix_in_freefem_numbering.View(GetMpi(),
output_directory + "matrix_in_freefem_numbering.m",
output_directory.AddFile("matrix_in_freefem_numbering.m"),
__FILE__, __LINE__,
PETSC_VIEWER_ASCII_MATLAB);
......
......@@ -19,6 +19,7 @@
# include <vector>
# include "Utilities/Mpi/Mpi.hpp"
# include "Utilities/Filesystem/Directory.hpp"
# include "ThirdParty/Wrappers/Petsc/Matrix/Matrix.hpp"
......@@ -141,9 +142,9 @@ namespace MoReFEM
explicit MatrixConversion(const Wrappers::Mpi& mpi,
const std::string& freefem_numbering_informations_file,
const std::string& matrix_binary_file,
const std::string& data_directory,
const FilesystemNS::Directory& data_directory,
const std::vector<std::string>& unknown_in_matrix_list,
const std::string& output_directory,
const FilesystemNS::Directory& output_directory,
const NumberingSubset& numbering_subset,
const Mesh& mesh,
const char* invoking_file, int invoking_line);
......@@ -214,7 +215,7 @@ namespace MoReFEM
const std::vector<std::string>& unknown_in_matrix_list);
//! Output directory.
const std::string& GetOutputDirectory() const noexcept;
const FilesystemNS::Directory& GetOutputDirectory() const noexcept;
private:
......@@ -234,7 +235,7 @@ namespace MoReFEM
std::vector<std::vector<unsigned int>> freefem_dof_numbering_per_geom_elt_;
//! Output directory.
const std::string output_directory_;
const FilesystemNS::Directory& output_directory_;
};
......
......@@ -72,9 +72,8 @@ namespace MoReFEM
}
inline const std::string& MatrixConversion::GetOutputDirectory() const noexcept
inline const FilesystemNS::Directory& MatrixConversion::GetOutputDirectory() const noexcept
{
assert(FilesystemNS::Folder::DoExist(output_directory_));
return output_directory_;
}
......
......@@ -33,7 +33,7 @@ namespace MoReFEM
{
OutputDeformedMesh::OutputDeformedMesh(const std::string& data_directory,
OutputDeformedMesh::OutputDeformedMesh(const FilesystemNS::Directory& data_directory,
const std::string& unknown_id,
const unsigned int numbering_subset_id,
Internal::MeshNS::MeshManager& mesh_manager,
......@@ -46,23 +46,14 @@ namespace MoReFEM
const unsigned int output_offset,
const unsigned int output_frequence)
{
if (!FilesystemNS::Folder::DoExist(data_directory))
throw Exception("Invalid data directory: '" + data_directory + "' doesn't exist!",
__FILE__, __LINE__);
const std::string mesh_directory = data_directory + "/Mesh_"
+ std::to_string(mesh.GetUniqueId()) + "/";
if (!FilesystemNS::Folder::DoExist(mesh_directory))
throw Exception("Invalid mesh directory: '" + mesh_directory + "' doesn't exist!",
__FILE__, __LINE__);
const std::string output_mesh_directory = mesh_directory + "OutputDeformedMesh_" + std::to_string(output_mesh_index) + "/";
if (FilesystemNS::Folder::DoExist(output_mesh_directory))
FilesystemNS::Folder::Remove(output_mesh_directory, __FILE__, __LINE__);
FilesystemNS::Folder::Create(output_mesh_directory, __FILE__, __LINE__);
FilesystemNS::Directory mesh_directory(data_directory,
"Mesh_" + std::to_string(mesh.GetUniqueId()),
__FILE__, __LINE__);
FilesystemNS::Directory output_mesh_directory(mesh_directory,
"OutputDeformedMesh_" + std::to_string(output_mesh_index),
__FILE__, __LINE__,
std::make_unique<FilesystemNS::behaviour>(FilesystemNS::behaviour::overwrite));
const auto mesh_dimension = mesh.GetDimension();
const auto unique_id_output_mesh = mesh_manager.GenerateUniqueId();
......@@ -218,11 +209,11 @@ namespace MoReFEM
if (output_format == "Medit")
{
new_mesh.Write<MeshNS::Format::Medit>(output_mesh_directory + "initial_" + output_name + ".mesh");
new_mesh.Write<MeshNS::Format::Medit>(output_mesh_directory.AddFile("initial_" + output_name + ".mesh"));
}
else if (output_format == "Ensight")
{
new_mesh.Write<MeshNS::Format::Ensight>(output_mesh_directory + "initial_" + output_name + ".geo");
new_mesh.Write<MeshNS::Format::Ensight>(output_mesh_directory.AddFile("initial_" + output_name + ".geo"));
}
else
{
......@@ -372,11 +363,15 @@ namespace MoReFEM
if (output_format == "Medit")
{
new_mesh.Write<MeshNS::Format::Medit>(output_mesh_directory + output_name + "_" + std::to_string(iteration) + ".mesh");
new_mesh.Write<MeshNS::Format::Medit>(output_mesh_directory.AddFile(output_name + "_"
+ std::to_string(iteration)
+ ".mesh"));
}
else if (output_format == "Ensight")
{
new_mesh.Write<MeshNS::Format::Ensight>(output_mesh_directory + output_name + "_" + std::to_string(iteration) + ".geo");
new_mesh.Write<MeshNS::Format::Ensight>(output_mesh_directory.AddFile(output_name + "_"
+ std::to_string(iteration)
+ ".geo"));
}
else
{
......
......@@ -89,7 +89,7 @@ namespace MoReFEM
* \param[in] output_frequence Only one time iterations over this number is kept (choose 1 to keep them all,
* 2, to get one half of the iterations and so forth...).
*/
explicit OutputDeformedMesh(const std::string& data_directory,
explicit OutputDeformedMesh(const FilesystemNS::Directory& data_directory,
const std::string& unknown_name,
const unsigned int numbering_subset_id,
Internal::MeshNS::MeshManager& mesh_manager,
......
......@@ -101,42 +101,40 @@ namespace MoReFEM::PostProcessingNS::OutputFormat
} // namespace anonymous
Ensight6::Ensight6(const std::string& data_directory,
Ensight6::Ensight6(const FilesystemNS::Directory& data_directory,
const std::vector<std::string>& unknown_list,
const std::vector<unsigned int>& numbering_subset_id_list,
const Mesh& mesh,
RefinedMesh is_mesh_refined,
const std::string& output_directory)
const FilesystemNS::Directory* ensight_directory_ptr)
{
assert(unknown_list.size() == numbering_subset_id_list.size());
const auto Nunknown = unknown_list.size();
if (!FilesystemNS::Folder::DoExist(data_directory))
throw Exception("Invalid data directory: '" + data_directory + "' doesn't exist!",
__FILE__, __LINE__);
FilesystemNS::Directory mesh_directory(data_directory,
"Mesh_" + std::to_string(mesh.GetUniqueId()),
__FILE__, __LINE__);
const std::string mesh_directory = data_directory + "/Mesh_"
+ std::to_string(mesh.GetUniqueId()) + "/";
// Its sole role is to provide RAII at the end of the constructor.
FilesystemNS::Directory::const_unique_ptr ensight_directory_smart_ptr = nullptr;
if (!FilesystemNS::Folder::DoExist(mesh_directory))
throw Exception("Invalid mesh directory: '" + mesh_directory + "' doesn't exist!",
__FILE__, __LINE__);
const std::string ensight_directory =
output_directory.empty()
? mesh_directory + "Ensight6/"
: output_directory;
if (ensight_directory_ptr == nullptr)
{
ensight_directory_smart_ptr = std::make_unique<FilesystemNS::Directory>(mesh_directory,
"Ensight6",
__FILE__, __LINE__);
ensight_directory_ptr = ensight_directory_smart_ptr.get();
}
if (FilesystemNS::Folder::DoExist(ensight_directory))
FilesystemNS::Folder::Remove(ensight_directory, __FILE__, __LINE__);
assert(!(!ensight_directory_ptr));
FilesystemNS::Folder::Create(ensight_directory, __FILE__, __LINE__);
const auto& ensight_directory = *ensight_directory_ptr;
PostProcessing post_processing(data_directory,
numbering_subset_id_list,
mesh);
mesh.Write<MeshNS::Format::Ensight>(ensight_directory + "/mesh.geo");
mesh.Write<MeshNS::Format::Ensight>(ensight_directory.AddFile("mesh.geo"));
const auto& time_iteration_list = post_processing.GetTimeIterationList();
......
......@@ -18,6 +18,8 @@
# include <memory>
# include <vector>
# include "Utilities/Filesystem/Directory.hpp"
# include "Geometry/Mesh/Mesh.hpp"
......@@ -85,17 +87,17 @@ namespace MoReFEM
* \param[in] unknown_list Define here the list of unknowns for which Ensight output is sought.
* If empty, all the unknowns found in the output file are taken; if not only the selected subset is
* taken. The name specified here MUST match some of the unknowns in the unknown file.
* \param[in] output_directory Directory into which the Ensight outputs will be written. If left empty,
* a subdirectory named "Ensight6" will be created in the Mesh directory. Beware: this directory is
* removed and recreated; make sure not to provide a directory into which you have some content you
* don't want to lose.
* \param[in] ensight_directory Directory into which the Ensight outputs will be written. If nullptr,
* a subdirectory named "Ensight6" will be created in the Mesh directory (this should be the default
* behaviour but I need the other one for some tests). Call site is responsible of the object
* destruction (should be stored in a smart pointer in the first place).
*/
explicit Ensight6(const std::string& data_directory,
explicit Ensight6(const FilesystemNS::Directory& data_directory,
const std::vector<std::string>& unknown_list,
const std::vector<unsigned int>& numbering_subset_id_list,
const Mesh& mesh,
RefinedMesh is_mesh_refined = RefinedMesh::no,
const std::string& output_directory = "");
const FilesystemNS::Directory* ensight_directory = nullptr);
//! Destructor.
~Ensight6() = default;
......
......@@ -31,7 +31,7 @@ namespace MoReFEM
{
PostProcessing::PostProcessing(const std::string& data_directory,
PostProcessing::PostProcessing(const FilesystemNS::Directory& data_directory,
const std::vector<unsigned int>& numbering_subset_id_list,
const Mesh& mesh)
: data_directory_(data_directory),
......@@ -42,6 +42,7 @@ namespace MoReFEM
time_iteration_file_(nullptr),
numbering_subset_id_list_(numbering_subset_id_list)
{
data_directory_.SetBehaviour(FilesystemNS::behaviour::read);
// Read the different files.
ReadInterfaceFile();
......@@ -97,8 +98,13 @@ namespace MoReFEM
void PostProcessing::ReadInterfaceFile()
{
std::string input_file(GetDataDirectory() + "/Mesh_" + std::to_string(GetMesh().GetUniqueId()));
input_file += "/interfaces.hhdata";
assert(GetDataDirectory().GetBehaviour() == FilesystemNS::behaviour::read);
FilesystemNS::Directory mesh_dir (GetDataDirectory(),
"Mesh_" + std::to_string(GetMesh().GetUniqueId()),
__FILE__, __LINE__,
std::make_unique<FilesystemNS::behaviour>(FilesystemNS::behaviour::read));
std::string input_file = mesh_dir.AddFile("interfaces.hhdata");
assert(!interface_file_);
interface_file_ = std::make_unique<InterfaceFile>(input_file);
......@@ -121,14 +127,14 @@ namespace MoReFEM
// First check whether a 'filtered_time_iteration.hhdata' is present (it would have been generated through
// the PostProcessing/FilterTimeIteration script). If found, use it.
std::string input_file = data_dir + "/filtered_time_iteration.hhdata";
std::string input_file = data_dir.AddFile("filtered_time_iteration.hhdata");
assert(!time_iteration_file_);
if (FilesystemNS::File::DoExist(input_file))
std::cout << "[Time iterations] Using the filtered_time_iteration.hhdata file." << std::endl;
else
input_file = data_dir + "/time_iteration.hhdata";
input_file = data_dir.AddFile("time_iteration.hhdata");
time_iteration_file_ = std::make_unique<TimeIterationFile>(input_file);
}
......@@ -139,7 +145,7 @@ namespace MoReFEM
assert(Nprocessor_ == NumericNS::UninitializedIndex<std::size_t>());
std::ifstream in;
FilesystemNS::File::Read(in, GetDataDirectory() + "/mpi.hhdata", __FILE__, __LINE__);
FilesystemNS::File::Read(in, GetDataDirectory().AddFile("mpi.hhdata"), __FILE__, __LINE__);
std::string line;
getline(in, line);
......@@ -179,9 +185,12 @@ namespace MoReFEM
{
decltype(auto) numbering_subset_directory = GetNumberingSubsetDirectory(static_cast<unsigned int>(rank),
numbering_subset_id);
oconv.str("");
oconv << numbering_subset_directory << "/dof_information.hhdata";
auto&& dof_list_ptr= std::make_unique<DofInformationFile>(rank, oconv.str(), interface_file);
const auto dof_infos_data_file = numbering_subset_directory.AddFile("dof_information.hhdata");
auto&& dof_list_ptr= std::make_unique<DofInformationFile>(rank,
dof_infos_data_file,
interface_file);
Ndof_ += dof_list_ptr->Ndof();
dof_information_file_list_for_numbering_subset.emplace_back(std::move(dof_list_ptr));
......@@ -200,7 +209,7 @@ namespace MoReFEM
const DofInformationFile& PostProcessing::GetDofFile(const unsigned int numbering_subset_id,
const std::size_t processor) const
const std::size_t processor) const
{
assert(processor < Nprocessor());
......@@ -214,17 +223,22 @@ namespace MoReFEM
}
std::string PostProcessing::GetNumberingSubsetDirectory(const unsigned int rank,
const unsigned int numbering_subset_id) const
FilesystemNS::Directory PostProcessing::GetNumberingSubsetDirectory(const unsigned int rank,
const unsigned int numbering_subset_id) const
{
std::ostringstream oconv;
decltype(auto) data_directory = GetDataDirectory();
oconv << GetDataDirectory()
<< "/Rank_" << rank
<< "/Mesh_" << GetMesh().GetUniqueId()
<< "/NumberingSubset_" << numbering_subset_id << '/';
FilesystemNS::Directory rank_data_directory = GetRankDirectory(data_directory, rank, __FILE__, __LINE__);
return oconv.str();
FilesystemNS::Directory mesh_dir(rank_data_directory,
"Mesh_" + std::to_string(GetMesh().GetUniqueId()),
__FILE__, __LINE__);
FilesystemNS::Directory ret(mesh_dir,
"NumberingSubset_" + std::to_string(numbering_subset_id),
__FILE__, __LINE__);
return ret;
}
......
......@@ -18,6 +18,7 @@
# include <string>
# include "Utilities/OutputFormat/OutputFormat.hpp"
# include "Utilities/Filesystem/Directory.hpp"
# include "Geometry/Mesh/Mesh.hpp"
......@@ -83,11 +84,13 @@ namespace MoReFEM
* - interfaces.hhdata For all geometric interfaces, the list of Coords that delimit them.
* - mpi.hhdata The number of processor involved in the simulation (to determine the files to retrieve).
*
* Data directory is copied and its beheviour is set to 'read'.
*
* \param[in] numbering_subset_id_list List of \a NumberingSubset unique identifiers to consider.
* \param[in] mesh \a Mesh for which the post-processing is performed.
*
*/
explicit PostProcessing(const std::string& data_directory,
explicit PostProcessing(const FilesystemNS::Directory& data_directory,
const std::vector<unsigned int>& numbering_subset_id_list,
const Mesh& mesh);
......@@ -148,14 +151,14 @@ namespace MoReFEM
private: