Commit 3deeaab2 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1443 Replace the PrepartitionedData input data by the Parallelism one.

parent 1725273f
/*!
//
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Thu, 19 Feb 2015 14:38:32 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup CoreGroup
// \addtogroup CoreGroup
// \{
*/
#include "Utilities/String/EmptyString.hpp"
#include "Core/InputData/Instances/PrepartitionedData.hpp"
namespace MoReFEM
{
namespace InputDataNS
{
const std::string& PrepartitionedData::GetName()
{
static std::string ret("PrepartitionedData");
return ret;
}
const std::string& PrepartitionedData::Directory::NameInFile()
{
static std::string ret("directory");
return ret;
}
const std::string& PrepartitionedData::Directory::Description()
{
static std::string ret("Directory in which prepartitioned data are stored. Leave it empty if irrelevant.");
return ret;
}
const std::string& PrepartitionedData::Directory::Constraint()
{
return Utilities::EmptyString();
}
const std::string& PrepartitionedData::Directory::DefaultValue()
{
return Utilities::EmptyString();
}
const std::string& PrepartitionedData::IsPrepartitionRun::NameInFile()
{
static std::string ret("is_prepartition_run");
return ret;
}
const std::string& PrepartitionedData::IsPrepartitionRun::Description()
{
static std::string ret("If True, the program runs to generate prepartition data and will stop once it's "
"done. If False, mode will be run with pre-computed prepartitioned data (if "
"directory is not empty) or will not use them (and compute them on the fly if "
"parallel mode).");
return ret;
}
const std::string& PrepartitionedData::IsPrepartitionRun::Constraint()
{
return Utilities::EmptyString();
}
const std::string& PrepartitionedData::IsPrepartitionRun::DefaultValue()
{
static std::string ret("False");
return ret;
}
} // namespace InputDataNS
} // namespace MoReFEM
/// @} // addtogroup CoreGroup
/*!
//
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Tue, 27 Aug 2013 11:26:39 +0200
// Copyright (c) Inria. All rights reserved.
//
// \ingroup CoreGroup
// \addtogroup CoreGroup
// \{
*/
#ifndef MOREFEM_x_CORE_x_INPUT_DATA_x_INSTANCES_x_PREPARTITIONED_DATA_HPP_
# define MOREFEM_x_CORE_x_INPUT_DATA_x_INSTANCES_x_PREPARTITIONED_DATA_HPP_
# include <string>
# include "Core/InputData/Instances/Crtp/Section.hpp"
namespace MoReFEM::InputDataNS
{
//! \copydoc doxygen_hide_core_input_data_section
struct PrepartitionedData : public Crtp::Section<PrepartitionedData, NoEnclosingSection>
{
//! Return the name of the section in the input parameter.
static const std::string& GetName();
//! Convenient alias.
using self = PrepartitionedData;
//! Friendship to section parent.
using parent = Crtp::Section<self, NoEnclosingSection>;
//! \cond IGNORE_BLOCK_IN_DOXYGEN
friend parent;
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
//! Directory in which preprocessed data are stored.
struct Directory : public Crtp::InputData<Directory, self, std::string>
{
//! Name of the input parameter in Lua input file.
static const std::string& NameInFile();
//! Description of the input parameter.
static const std::string& Description();
/*!
* \return Constraint to fulfill.
*
* Might be left empty; if not the format to respect is the \a LuaOptionFile one. Hereafter some text from \a LuaOptionFile example file:
*
* An age should be greater than 0 and less than, say, 150. It is possible
* to check it with a logical expression (written in Lua). The expression
* should be written with 'v' being the variable to be checked.
* \a constraint = "v >= 0 and v < 150"
*
* It is possible to check whether a variable is in a set of acceptable
* value. This is performed with 'value_in' (a Lua function defined by \a LuaOptionFile).
* \a constraint = "value_in(v, {'Messiah', 'Water Music'})"
*
* If a vector is retrieved, the constraint must be satisfied on every
* element of the vector.
*/
static const std::string& Constraint();
/*!
* \return Default value.
*
* This is intended to be used only when the class is used to create a default file; never when no value has been given
* in the input data file (doing so is too much error prone...)
*
* This is given as a string; if no default value return an empty string. The value must be \a LuaOptionFile-formatted.
*/
static const std::string& DefaultValue();
};
//! Whether we intend to run a model or just pre-process it for later parallel use.
struct IsPrepartitionRun : public Crtp::InputData<IsPrepartitionRun, self, bool>
{
//! Name of the input parameter in Lua input file.
static const std::string& NameInFile();
//! Description of the input parameter.
static const std::string& Description();
/*!
* \return Constraint to fulfill.
*
* Might be left empty; if not the format to respect is the \a LuaOptionFile one. Hereafter some text from \a LuaOptionFile example file:
*
* An age should be greater than 0 and less than, say, 150. It is possible
* to check it with a logical expression (written in Lua). The expression
* should be written with 'v' being the variable to be checked.
* \a constraint = "v >= 0 and v < 150"
*
* It is possible to check whether a variable is in a set of acceptable
* value. This is performed with 'value_in' (a Lua function defined by \a LuaOptionFile).
* \a constraint = "value_in(v, {'Messiah', 'Water Music'})"
*
* If a vector is retrieved, the constraint must be satisfied on every
* element of the vector.
*/
static const std::string& Constraint();
/*!
* \return Default value.
*
* This is intended to be used only when the class is used to create a default file; never when no value has been given
* in the input data file (doing so is too much error prone...)
*
* This is given as a string; if no default value return an empty string. The value must be \a LuaOptionFile-formatted.
*/
static const std::string& DefaultValue();
};
//! Alias to the tuple of structs.
using section_content_type = std::tuple
<
Directory,
IsPrepartitionRun
>;
private:
//! Content of the section.
section_content_type section_content_;
}; // struct PrepartitionedData
} // namespace MoReFEM::InputDataNS
/// @} // addtogroup CoreGroup
#endif // MOREFEM_x_CORE_x_INPUT_DATA_x_INSTANCES_x_PREPARTITIONED_DATA_HPP_
......@@ -11,14 +11,12 @@ target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.cpp"
"${CMAKE_CURRENT_LIST_DIR}/PrepartitionedData.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Result.cpp"
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.hpp"
"${CMAKE_CURRENT_LIST_DIR}/OutputDeformedMesh.hpp"
"${CMAKE_CURRENT_LIST_DIR}/OutputDeformedMesh.hxx"
"${CMAKE_CURRENT_LIST_DIR}/PrepartitionedData.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Result.hpp"
)
......
......@@ -23,7 +23,6 @@
# include "Core/MoReFEMData/MoReFEMData.hpp"
# include "Core/InputData/Advanced/SetFromInputData.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Core/InputData/Instances/PrepartitionedData.hpp"
# include "Geometry/Mesh/Mesh.hpp"
......@@ -415,14 +414,6 @@ namespace MoReFEM
NodeBearer::vector_shared_ptr&& ghost);
/*!
* \brief Return the list of all boundaries conditions.
*
* \return List of all boundaries conditions inside the GodOfDof.
*/
DirichletBoundaryCondition::vector_shared_ptr& GetNonCstDirichletBoundaryConditionList();
/*!
* \brief Iterator to the finite element space which index is \a unique_id.
*
......@@ -596,6 +587,11 @@ namespace MoReFEM
public:
template<class MoReFEMDataT>
void PreprocessInitHelper(const MoReFEMDataT& morefem_data,
DoConsiderProcessorWiseLocal2Global do_consider_processor_wise_local_2_global);
void FullFromPreprocessedInit(FEltSpace::vector_unique_ptr&& felt_space_list,
LuaOptionFile& god_of_dof_prepartitioned_data,
const FilesystemNS::Directory& output_directory,
......@@ -620,6 +616,7 @@ namespace MoReFEM
public:
# ifndef NDEBUG
/*!
* \brief Whether local2global arrays for processor-wise indexes might be required or not.
*
......@@ -628,6 +625,7 @@ namespace MoReFEM
* \return yes if local2global arrays for processor-wise indexes are to be considered.
*/
DoConsiderProcessorWiseLocal2Global GetDoConsiderProcessorWiseLocal2Global() const;
# endif // NDEBUG
private:
......
......@@ -83,7 +83,7 @@ namespace MoReFEM
namespace ipl = Utilities::InputDataNS;
decltype(auto) prepartitioned_data_dir_str =
ipl::Extract<InputDataNS::PrepartitionedData::Directory>::Path(morefem_data.GetInputData());
ipl::Extract<InputDataNS::Parallelism::Directory>::Path(morefem_data.GetInputData());
decltype(auto) mpi = GetMpi();
......@@ -117,7 +117,7 @@ namespace MoReFEM
namespace ipl = Utilities::InputDataNS;
decltype(auto) prepartitioned_data_dir_str =
ipl::Extract<InputDataNS::PrepartitionedData::Directory>::Path(morefem_data.GetInputData());
ipl::Extract<InputDataNS::Parallelism::Directory>::Path(morefem_data.GetInputData());
decltype(auto) mpi = GetMpi();
......
......@@ -22,7 +22,7 @@
# include "Core/InputData/Instances/FElt/NumberingSubset.hpp"
# include "Core/InputData/Instances/FElt/FEltSpace.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Core/InputData/Instances/PrepartitionedData.hpp"
# include "Core/InputData/Instances/Parallelism/Parallelism.hpp"
# include "Core/InputData/Instances/DirichletBoundaryCondition/DirichletBoundaryCondition.hpp"
......@@ -104,7 +104,7 @@ namespace MoReFEM
InputDataNS::Petsc<original>,
InputDataNS::Result,
InputDataNS::PrepartitionedData
InputDataNS::Parallelism
>;
......
......@@ -86,7 +86,7 @@ namespace MoReFEM::TestNS::LoadPrepartitionedGodOfDofNS
::Extract<InputDataNS::Mesh<1>::Format>::Value(input_data));
decltype(auto) prepartitioned_data_dir_str =
Utilities::InputDataNS::Extract<InputDataNS::PrepartitionedData::Directory>::Path(input_data);
Utilities::InputDataNS::Extract<InputDataNS::Parallelism::Directory>::Path(input_data);
FilesystemNS::Directory prepartitioned_data_dir(mpi,
prepartitioned_data_dir_str,
......@@ -137,7 +137,7 @@ namespace MoReFEM::TestNS::LoadPrepartitionedGodOfDofNS
namespace ipl = Utilities::InputDataNS;
decltype(auto) prepartitioned_data_dir_str =
ipl::Extract<InputDataNS::PrepartitionedData::Directory>::Path(GetMoReFEMData().GetInputData());
ipl::Extract<InputDataNS::Parallelism::Directory>::Path(GetMoReFEMData().GetInputData());
// TMP #1443 Automatize a bit... (subdir should be available more easily from GodOfDof1
FilesystemNS::Directory prepartitioned_data_dir(mpi,
......
......@@ -413,7 +413,7 @@ Result = {
-- directly: it might have been extended in MoReFEMData class! Rather call the GetResultDirectory() from
-- this class.
-- Expected format: "VALUE"
output_directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedGodOfDof',
output_directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedGodOfDof/Quad/Results',
-- Enables to skip some printing in the console. Can be used to WriteSolution every n time.
......@@ -428,19 +428,25 @@ Result = {
} -- Result
PrepartitionedData = {
Parallelism = {
-- Directory in which prepartitioned data are stored. Leave it empty if irrelevant.
-- Expected format: "VALUE"
directory = "${MOREFEM_TEST_OUTPUT_DIR}/PrepartionedData/Test/LoadPrepartitionedGodOfDof",
-- What should be done for a parallel run. There are 4 possibilities:
-- 'Precompute': Precompute the data for a later parallel run and stop once it's done.
-- 'ParallelNoWrite': Run the code in parallel without using any pre-processed data and do not write down
-- the processed data.
-- 'Parallel': Run the code in parallel without using any pre-processed data and write down the processed
-- data.
-- 'RunFromPreprocessed': Run the code in parallel using pre-processed data.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Precompute', 'ParallelNoWrite', 'Parallel', 'RunFromPreprocessed'})
policy = 'Parallel',
-- If True, the program runs to generate prepartition data and will stop once it's done. If False, mode
-- will be run with pre-computed prepartitioned data (if directory is not empty) or will not use them (and
-- compute them on the fly if parallel mode).
-- Expected format: 'true' or 'false' (without the quote)
is_prepartition_run = false
-- Directory in which parallelism data will be written or read (depending on the policy).
-- Expected format: "VALUE"
directory = '${MOREFEM_RESULT_DIR}/Test/LoadPrepartitionedGodOfDof/Quad/PrepartitionedData'
} -- Parallelism
} -- PrepartitionedData
......@@ -415,7 +415,7 @@ Result = {
-- directly: it might have been extended in MoReFEMData class! Rather call the GetResultDirectory() from
-- this class.
-- Expected format: "VALUE"
output_directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedGodOfDof',
output_directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedGodOfDof/Tri/Results',
-- Enables to skip some printing in the console. Can be used to WriteSolution every n time.
......@@ -430,19 +430,24 @@ Result = {
} -- Result
PrepartitionedData = {
Parallelism = {
-- Directory in which prepartitioned data are stored. Leave it empty if irrelevant.
-- Expected format: "VALUE"
directory = "${MOREFEM_TEST_OUTPUT_DIR}/PrepartionedData/Test/LoadPrepartitionedGodOfDof",
-- What should be done for a parallel run. There are 4 possibilities:
-- 'Precompute': Precompute the data for a later parallel run and stop once it's done.
-- 'ParallelNoWrite': Run the code in parallel without using any pre-processed data and do not write down
-- the processed data.
-- 'Parallel': Run the code in parallel without using any pre-processed data and write down the processed
-- data.
-- 'RunFromPreprocessed': Run the code in parallel using pre-processed data.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Precompute', 'ParallelNoWrite', 'Parallel', 'RunFromPreprocessed'})
policy = 'Parallel',
-- If True, the program runs to generate prepartition data and will stop once it's done. If False, mode
-- will be run with pre-computed prepartitioned data (if directory is not empty) or will not use them (and
-- compute them on the fly if parallel mode).
-- Expected format: 'true' or 'false' (without the quote)
is_prepartition_run = false
} -- PrepartitionedData
-- Directory in which parallelism data will be written or read (depending on the policy).
-- Expected format: "VALUE"
directory = '${MOREFEM_RESULT_DIR}/Test/LoadPrepartitionedGodOfDof/Tri/PrepartitionedData'
} -- Parallelism
......@@ -22,7 +22,6 @@
# include "Core/InputData/Instances/FElt/NumberingSubset.hpp"
# include "Core/InputData/Instances/FElt/FEltSpace.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Core/InputData/Instances/PrepartitionedData.hpp"
namespace MoReFEM
......@@ -63,7 +62,7 @@ namespace MoReFEM
InputDataNS::Petsc<whatever>,
InputDataNS::Result,
InputDataNS::PrepartitionedData
InputDataNS::Parallelism
>;
......
......@@ -206,7 +206,7 @@ Result = {
-- directly: it might have been extended in MoReFEMData class! Rather call the GetResultDirectory() from
-- this class.
-- Expected format: "VALUE"
output_directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedMesh',
output_directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedMesh/Results',
-- Enables to skip some printing in the console. Can be used to WriteSolution every n time.
......@@ -221,19 +221,24 @@ Result = {
} -- Result
PrepartitionedData = {
Parallelism = {
-- Directory in which prepartitioned data are stored. Leave it empty if irrelevant.
-- Expected format: "VALUE"
directory = "${MOREFEM_TEST_OUTPUT_DIR}/PrepartionedData/Test/LoadPrepartitionedMesh",
-- What should be done for a parallel run. There are 4 possibilities:
-- 'Precompute': Precompute the data for a later parallel run and stop once it's done.
-- 'ParallelNoWrite': Run the code in parallel without using any pre-processed data and do not write down
-- the processed data.
-- 'Parallel': Run the code in parallel without using any pre-processed data and write down the processed
-- data.
-- 'RunFromPreprocessed': Run the code in parallel using pre-processed data.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Precompute', 'ParallelNoWrite', 'Parallel', 'RunFromPreprocessed'})
policy = 'Parallel',
-- If True, the program runs to generate prepartition data and will stop once it's done. If False, mode
-- will be run with pre-computed prepartitioned data (if directory is not empty) or will not use them (and
-- compute them on the fly if parallel mode).
-- Expected format: 'true' or 'false' (without the quote)
is_prepartition_run = false
-- Directory in which parallelism data will be written or read (depending on the policy).
-- Expected format: "VALUE"
directory = '${MOREFEM_TEST_OUTPUT_DIR}/Test/LoadPrepartitionedMesh/PrepartitionedData',
} -- PrepartitionedData
} -- Parallelism
......@@ -22,7 +22,6 @@
# include "Core/InputData/Instances/FElt/NumberingSubset.hpp"
# include "Core/InputData/Instances/FElt/FEltSpace.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Core/InputData/Instances/PrepartitionedData.hpp"
namespace MoReFEM::TestNS::PetscNS::MatrixOperationsNS
......
......@@ -23,7 +23,6 @@
# include "Core/InputData/Instances/FElt/NumberingSubset.hpp"
# include "Core/InputData/Instances/FElt/FEltSpace.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Core/InputData/Instances/PrepartitionedData.hpp"
namespace MoReFEM::TestNS::PetscNS::VectorIONS
......
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