MoReFEM
|
Init MoReFEM: initialize mpi and read the input data file. More...
#include <MoReFEMData.hpp>
Public Types | |
using | self |
Alias to the type of the class. | |
using | parent |
Alias to parent. | |
using | const_unique_ptr = std::unique_ptr<self> |
Alias to unique_ptr. | |
using | input_data_type = InputDataT |
Convenient alias for InputData instantiation to use. | |
using | model_settings_type = ModelSettingsT |
Alias to ModelSettingsT. | |
using | time_manager_type = TimeManagerT |
Alias to TimeManagerT. | |
Public Member Functions | |
const Internal::Parallelism * | GetParallelismPtr () const noexcept |
const ::MoReFEM::Wrappers::Mpi & | GetMpi () const noexcept |
Accessor to underlying mpi object. | |
const ::MoReFEM::FilesystemNS::Directory & | GetResultDirectory () const noexcept |
Accessor to the result directory, in which all the outputs of MoReFEM should be written. | |
const model_settings_type & | GetModelSettings () const noexcept |
Accessor to underlying model_settings_type object. | |
const input_data_type & | GetInputData () const noexcept |
Accessor to underlying input_data_type object. | |
const time_manager_type & | GetTimeManager () const noexcept |
Constant accessor to the object in charge of time management. | |
time_manager_type & | GetNonCstTimeManager () noexcept |
Non constant access to the object in charge of time management. | |
Special members. | |
MoReFEMData (int argc, char **argv) | |
Constructor. | |
MoReFEMData (FilesystemNS::File &&lua_file) | |
Constructor from a Lua file. | |
virtual | ~MoReFEMData () override |
Destructor. | |
MoReFEMData (const MoReFEMData &rhs)=delete | |
The copy constructor. | |
MoReFEMData (MoReFEMData &&rhs)=delete | |
The move constructor. | |
MoReFEMData & | operator= (const MoReFEMData &rhs)=delete |
The (copy) operator=. | |
MoReFEMData & | operator= (MoReFEMData &&rhs)=delete |
The (move) operator=. | |
Static Public Member Functions | |
static constexpr bool | HasParallelismField () |
Static Public Attributes | |
static constexpr is_morefem_data | ConceptIsMoReFEMData = is_morefem_data::yes |
Helper variable to define the MoReFEMDataType concept. | |
Protected Member Functions | |
::MoReFEM::FilesystemNS::behaviour | DetermineDirectoryBehaviour (Advanced::CommandLineFlagsNS::overwrite_directory do_overwrite_directory) const noexcept |
Determine the behaviour to adopt for output directory creation. | |
void | SetResultDirectory (std::filesystem::path path, Advanced::CommandLineFlagsNS::overwrite_directory do_overwrite_directory) |
Set the directory into which outputs will be written. | |
void | SetTimeManager () |
Init properly the TimeManagerT instance. | |
void | SetInputData (typename input_data_type::const_unique_ptr &&input_data) |
Set the input_data_ object. | |
void | InitCheckInvertedElementsSingleton () |
Init the CheckInvertedElements singletons, depending whether there is a field or not in the input data or model settings. | |
Private Member Functions | |
const Internal::Parallelism & | GetParallelism () const noexcept |
void | Construct (FilesystemNS::File &&lua_file, Advanced::CommandLineFlagsNS::overwrite_directory do_overwrite_directory) |
Helper function used in constructors. | |
void | CheckNoMissingIndexedSectionDescriptions () const |
Check all the expected IndexedSectionDescription class in the model-specific ModelSettings are properly present. | |
Private Attributes | |
Internal::Parallelism::unique_ptr | parallelism_ = nullptr |
Object which holds the parallelism strategy to use. | |
::MoReFEM::FilesystemNS::Directory::const_unique_ptr | result_directory_ { nullptr } |
Directory into which model results will be written,. | |
ModelSettingsT | model_settings_ |
The model-specific ModelSettings, which encompasses data specific to the model but that shouldn't be modified by the end-user. | |
TimeManagerT::unique_ptr | time_manager_ { nullptr } |
input_data_type::const_unique_ptr | input_data_ { nullptr } |
Holds InputData. | |
Init MoReFEM: initialize mpi and read the input data file.
ProgramTypeT | Type of the program run. For instance for post-processing there is no removal of the existing result directory, contrary to what happens in model run. If update_lua_file, the result directory can't be queried at all |
AdditionalCommandLineArgumentsPolicyT | Policy if you need additional arguments on the command line. To see a concrete example of this possibility, have a look at Test/Core/MoReFEMData/test_command_line_options.cpp which demonstrate the possibility. If none, use std::false_type. |
http://tclap.sourceforge.net gives a nice manual of how to add additional argument on the command lines. By default, there is one mandatory argument (–input_data lua file) and one optional that might be repeated to define pseudo environment variables (-e KEY=VALUE).
using MoReFEM::MoReFEMData< ModelSettingsT, InputDataT, TimeManagerT, ProgramTypeT, DoTrackUnusedFieldsT, AdditionalCommandLineArgumentsPolicyT >::self |
Alias to the type of the class.
using MoReFEM::MoReFEMData< ModelSettingsT, InputDataT, TimeManagerT, ProgramTypeT, DoTrackUnusedFieldsT, AdditionalCommandLineArgumentsPolicyT >::parent |
Alias to parent.
using MoReFEM::MoReFEMData< ModelSettingsT, InputDataT, TimeManagerT, ProgramTypeT, DoTrackUnusedFieldsT, AdditionalCommandLineArgumentsPolicyT >::input_data_type = InputDataT |
Convenient alias for InputData instantiation to use.
|
explicit |
Constructor.
This is the staple constructor used in models: at the beginning of the main the object is constructed and initializes under the hood stuff like the initialization of MPI (which requires the argc and argv values).
[in] | argc | Number of argument in the command line (including the program name). |
[in] | argv | List of arguments read. |
|
explicit |
Constructor from a Lua file.
Useful for tests.
[in] | lua_file | Input data file. |
|
delete |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
|
delete |
The move constructor.
[in] | rhs | The object from which the construction occurs. |
|
staticconstexpr |
Whether there is a Parallelism block in MoReFEM input data.
|
delete |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
delete |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
noexcept |
Accessor to the object which keeps the data related to parallelism strategy. Might be nullptr if none specified in the input lua file.
|
privatenoexcept |
Accessor to the object which keeps the data related to parallelism strategy. No pointer here, but it assumes parallelism_ is not nullptr.
|
private |
Helper function used in constructors.
[in] | lua_file | Input data file. |
[in] | do_overwrite_directory | Whether the program may overwrite result directory or not. In the general case it is the value read from command line (if any) but for tests it is arbitrarily set to yes. |
|
private |
Check all the expected IndexedSectionDescription class in the model-specific ModelSettings are properly present.
If there is a leaf or a section either in the model-specific ModelSettings or in the model-specific InputData that is related to an IndexedSection, then the related IndexedSectionDescription should be declared in the model-specific ModelSettings. Current method checks that this is the case, and if not provide a clear error in runtime to help the author of the model to fix it quickly.
|
noexceptinherited |
Accessor to the result directory, in which all the outputs of MoReFEM should be written.
|
protectednoexceptinherited |
Determine the behaviour to adopt for output directory creation.
This behaviour depends both on the do_overwrite_directory argument and on the type of program you are running (model, test, update a Lua file, etc...)
[in] | do_overwrite_directory | Whether an eventual pre-existing output directory should be overwritten. |
|
protectedinherited |
Set the directory into which outputs will be written.
[in] | path | Path on your filesystem to the directory in which the outputs should be written. It should be determined internally in the class derived from this one (MoReFEMData or MoReFEMDataForTest so far are possible). |
[in] | do_overwrite_directory | Whether an eventual pre-existing output directory should be overwritten. |
|
protectedinherited |
Init properly the TimeManagerT instance.
It is not done automatically because it requires some data that are to be defined in the constructors of child classes.
|
protectedinherited |
Set the input_data_ object.
Even MoReFEMDataTest child class which doesn't rely on it provides a dummy object and must do this call.
[in] | input_data | The input_data object, that should be initialized in derived classes constructors. |
|
privateinherited |
The model-specific ModelSettings, which encompasses data specific to the model but that shouldn't be modified by the end-user.
|
privateinherited |
Time management facility.