MoReFEM
|
Class which purpose is to store model-related data that are intended to be set exclusively by the author of the model. More...
#include <ModelSettings.hpp>
Public Types | |
using | self = ModelSettings |
Self. | |
using | parent = Internal::InputDataNS::AbstractClass<TupleT> |
Parent. | |
using | const_unique_ptr = std::unique_ptr<const self> |
Alias to smart pointers storing objects. | |
using | underlying_tuple_type = TupleT |
The underlying tuple type. | |
Public Member Functions | |
ModelSettings () | |
Special members. | |
ModelSettings (const ModelSettings &rhs)=delete | |
The copy constructor. | |
ModelSettings (ModelSettings &&rhs)=default | |
The move constructor. | |
ModelSettings & | operator= (const ModelSettings &rhs)=delete |
The (copy) operator=. | |
ModelSettings & | operator= (ModelSettings &&rhs)=default |
The (move) operator=. | |
virtual | ~ModelSettings () override |
Destructor. | |
template<Advanced::Concept::InputDataNS::LeafType LeafT> | |
void | Add (typename LeafT::return_type &&value) |
Fill the value related to the leaf LeafT. | |
template<Advanced::Concept::InputDataNS::IndexedSectionType SectionT> | |
void | SetDescription (std::string &&description) |
Specify the description for a given IndexedSection. | |
void | CheckTupleCompletelyFilled () const |
Check all the values in the tuple have been properly filled. | |
virtual void | Init ()=0 |
std::unordered_set< std::string > | ExtractIndexedSectionNames () const |
Extract from the tuple the names of the indexed sections. | |
void | PrintUnusedLeafs (std::ostream &stream, const ::MoReFEM::Wrappers::Mpi &mpi) const |
Print the list of input data that weren't used in the program. | |
void | PrintKeys (std::ostream &stream) const |
Print the complete identifiers of all the expected leaves expected in an input data tuple. | |
std::vector< std::string > | ExtractKeys () const |
Extract the complete identifiers of all the expected leaves expected in an input data tuple. | |
std::vector< std::string > | ComputeUnusedLeafList (const ::MoReFEM::Wrappers::Mpi &mpi) const |
Compute the list of all leaves that are in fact not used. | |
const underlying_tuple_type & | GetTuple () const noexcept |
Static Public Member Functions | |
static constexpr std::size_t | Size () |
Size of the tuple. | |
static constexpr std::size_t | Nleaves () |
Returns the number of leaves in the tuple. | |
template<class ItemT > | |
static constexpr bool | Find () |
Whether ItemT is present in the tuple or not. | |
Static Public Attributes | |
static constexpr bool | ConceptIsModelSettings = true |
Helper variable to define the ModelSettingsType concept. | |
Protected Member Functions | |
template<::MoReFEM::Advanced::Concept::InputDataNS::LeafType LeafT, ::MoReFEM::InputDataNS::CountAsUsed CountAsUsedT = ::MoReFEM::InputDataNS::CountAsUsed::yes> | |
auto | ExtractLeaf () const -> typename Utilities::ConstRefOrValue< typename LeafT::return_type >::type |
Helper function used to extract value of a leaf. | |
template<Advanced::Concept::InputDataNS::SectionType SectionT> | |
auto & | ExtractSection () const |
Helper function used to extract a section. | |
underlying_tuple_type & | GetNonCstTuple () |
Private Types | |
using | tuple_iteration = Internal::InputDataNS::TupleIteration<underlying_tuple_type, 0ul> |
Helper object to iterate upon the tuple (including the in-depth sections). | |
Private Member Functions | |
const std::vector< std::string > & | GetListIdentifiersProperlySet () const |
std::vector< std::string > & | GetNonCstListIdentifiersProperlySet () |
void | CheckNoDuplicateKeysInTuple () const |
Throw an exception if there is a duplicate in the keys. | |
Private Attributes | |
std::vector< std::string > | list_identifiers_properly_set_ |
underlying_tuple_type | tuple_ |
The tuple that actually stores all the relevant quantities for the problem. | |
Class which purpose is to store model-related data that are intended to be set exclusively by the author of the model.
When a model is written, there is need to specify some data that are really specific to this model: how many meshes or finite elements spaces are involved, which unknowns are involved, what are the characteristics of a Solid involved, and so forth...
Up to v23.11.2, all these data were stored in a template class named InputData
which parameter is a tuple telling which data is expected in the input file. Doing this enable a rather tight control: we could check that all the data mentioned in said input file are accounted for and are really expected, and there are also no "hidden" value that the end user may not know (said otherwise, if you tackle volumic mass of a solid the field MUST be in the input data file; there is no risk that a value is silently used).
There was however a default doing so: when defining for instance a finite element space, there is (at the time of this writing) 5 leaves to be defined in the input data file:
The problem is that the only ones that are truly expected to be modified by an end user is the shape function list (or numbering subset list in the very specific case of the Stokes model).
So to circumvent this, a new structure named ModelSettings
has been introduced. Its goal is to provide a way for a model user to set the values the end user should not modify without breaking completely the infrastructure that has already been implemented for InputData
.
So tu put in a nutshell, now model-related data may be stored:
InputData
class, in which case the data will be modifiable by the end-user.ModelSettings
class, in which case the data is not intended to be modified by the end-user (but it should nonetheless be visible - ordering of unknowns for instance must be known to provide in the Lua file the shape functions).
|
explicit |
Special members.
Constructor.
|
delete |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
|
default |
The move constructor.
[in] | rhs | The object from which the construction occurs. |
|
delete |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
default |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
void MoReFEM::ModelSettings< TupleT >::Add | ( | typename LeafT::return_type && | value | ) |
Fill the value related to the leaf LeafT.
LeafT | Leaf for which the value is set. An exception is thrown if LeafT is not in TupleT. |
[in] | value | Value to be put in the tuple. Its type is defined in LeafT. |
void MoReFEM::ModelSettings< TupleT >::SetDescription | ( | std::string && | description | ) |
Specify the description for a given IndexedSection.
The description will appear above the section in the input data file (if some leaves are still handled there and thus modifiable by the end-user).
Current function is essentially syntactic sugar over Add() method concerning the IndexedSectionDescription special leaf of the IndexedSection.
[in] | description | Description of the specific instance of SectionT, which will appear as such before the section within the Lua file (if it is automatically generated or updated through the specific UpdateLuaFile executable for your model). |
void MoReFEM::ModelSettings< TupleT >::CheckTupleCompletelyFilled | ( | ) | const |
Check all the values in the tuple have been properly filled.
This method must be add explicitly - I'm not proud of it but baring introducing an Init()
method which is not much better I have not better way to do so.
|
pure virtual |
Virtual method to be overriden in child classes. In this method the content of the values of the tuple must be filled.
Implemented in MoReFEM::ElasticityNS::ModelSettings, MoReFEM::HeatNS::ModelSettings, MoReFEM::MidpointHyperelasticityNS::ModelSettings, MoReFEM::LaplacianNS::ModelSettings, MoReFEM::MidpointNonLinearShellNS::ModelSettings, MoReFEM::RivlinCubeNS::ModelSettings, MoReFEM::StokesNS::ModelSettings, MoReFEM::TestNS::InputDataSolidNS::ModelSettings, MoReFEM::TestNS::InputDataSolidNS::ModelSettings, MoReFEM::TestNS::WriteLuaFileNS::ModelSettings, MoReFEM::TestNS::BoundaryConditionNS::InvalidCompNS::ModelSettings, MoReFEM::TestNS::BoundaryConditionNS::TwoMeshesNS::ModelSettings, MoReFEM::TestNS::LoadPrepartitionedGodOfDofNS::ModelSettings, MoReFEM::TestNS::MovemeshNS::ModelSettings, MoReFEM::TestNS::MovemeshNS::ModelSettingsForScalarUnknownTest, MoReFEM::TestNS::MovemeshNS::ModelSettingsForSeveralUnknownTest, MoReFEM::TestNS::ColoringNS::ModelSettings, MoReFEM::TestNS::CoordsInParallelNS::ModelSettings, MoReFEM::TestNS::CoordsMatchingNS::ModelSettings, MoReFEM::TestNS::DomainListInCoordsNS::ModelSettings, MoReFEM::TestNS::LightweightDomainListNS::ModelSettings, MoReFEM::TestNS::LoadPrepartitionedMeshNS::ModelSettings, MoReFEM::TestNS::NcoordInDomainNS::ModelSettings, MoReFEM::TestNS::HyperelasticLawNS::ModelSettings, MoReFEM::TestNS::FromCoordsMatchingNS::ModelSettings, MoReFEM::TestNS::P1_to_P_HigherOrder_NS::ModelSettings, MoReFEM::TestNS::GlobalCoordsQuadPt::ModelSettings, MoReFEM::TestNS::UpdateCauchyGreenTensorNS::ModelSettings, MoReFEM::TestNS::ConformProjectorNS::ModelSettings, MoReFEM::TestNS::AnalyticalInternalVariable::ModelSettings, MoReFEM::TestNS::GradGrad::ModelSettings, MoReFEM::TestNS::HyperelasticOperatorNS::ModelSettings, MoReFEM::TestNS::Mass::ModelSettings, MoReFEM::TestNS::Microsphere::ModelSettings, MoReFEM::TestNS::NonLinearMembraneOperatorNS::ModelSettings, MoReFEM::TestNS::NonlinearShell::ModelSettings, MoReFEM::TestNS::MITCNS::ModelSettings, MoReFEM::TestNS::QuasiIncompressiblePk2::ModelSettings, MoReFEM::TestNS::FibersAtQuadPt::ModelSettings, MoReFEM::TestNS::FromInputDataNS::ModelSettings, MoReFEM::TestNS::FromInputDataNS::ModelSettings, MoReFEM::TestNS::FromInputDataNS::ModelSettings, MoReFEM::TestNS::FromInputDataNS::ModelSettings, MoReFEM::TestNS::FromInputDataAndModelSettingsNS::ModelSettings, MoReFEM::TestNS::HardcodedConstructionNS::ModelSettings, MoReFEM::TestNS::ParameterNS::TimeDependencyNS::ModelSettings, MoReFEM::TestNS::PetscNS::MatrixNS::ModelSettings, MoReFEM::TestNS::PetscNS::MatrixOperationsNS::ModelSettings, MoReFEM::TestNS::PetscNS::VectorIONS::ModelSettings, MoReFEM::TestNS::SlepcNS::ModelSettings, MoReFEM::TestNS::EmptyModelSettings, and MoReFEM::TestNS::ReadInputDataNS::ModelSettings.
std::unordered_set< std::string > MoReFEM::ModelSettings< TupleT >::ExtractIndexedSectionNames | ( | ) | const |
Extract from the tuple the names of the indexed sections.
The way to tag these is to use the special leaves than inherits from IndexedSectionDescription
CRTP. If not they won't be found properly - but there are safeties in the code to pinpoint this to the developer of a model (see Model::CheckNoMissingIndexedSectionDescriptions()).
Current method is public but isn't intended to be used publicly - in other words if you're not a developer of the main library you shouldn't bother.
|
private |
Accessor to the list of identifiers that have been filled with Add()
method. This is a purely internal data attribute that shouldn't be exposed publicly.
|
private |
Non constant accessor to the list of identifiers that have been filled with Add()
method. This is a purely internal data attribute that shouldn't be exposed publicly.
|
staticconstexprinherited |
Returns the number of leaves in the tuple.
It is not the same as size: this method explorates the sections to count how many leaves they include.
|
inherited |
Print the list of input data that weren't used in the program.
This method is dedicated to be called at destruction, but when using OpenMPI it is rather uneasy to make it called in the destructor due to racing conditions (error if MPI_Finalize() has already been called.
So this method should be called at the very end of your program if you want the information it gives.
[in,out] | stream | Stream upon which object information are written. If nothing added then all input data were used. |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[internal]
This method collects the data from all mpi processors; the list is therefore ensured to be exhaustive.
|
inherited |
Print the complete identifiers of all the expected leaves expected in an input data tuple.
An identifier being here the chaining of sections and subsections followed by the leaf name, with '.' acting as a separator.
For instance "Section1.SubsectionInSection1.LeafInSubSection1"
[in,out] | stream | Stream upon which object information are written. |
|
inherited |
Extract the complete identifiers of all the expected leaves expected in an input data tuple.
An identifier being here the chaining of sections and subsections followed by the leaf name, with '.' acting as a separator.
For instance "Section1.SubsectionInSection1.LeafInSubSection1"
|
staticconstexprinherited |
Whether ItemT is present in the tuple or not.
ItemT | Field sought in the tuple. |
|
inherited |
Compute the list of all leaves that are in fact not used.
This is a rather crude indicator: a leaf is considered 'used' if Extract facility is called upon it. Leaf that are present indirectly because their enclosing section is given in the input data tuple are correctly counted.
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
|
protectedinherited |
Helper function used to extract value of a leaf.
This should not be used directly by a user; ExtractLeaf class deals with it with a more user-friendly interface (no pesky template keyword to add!).
AbstractClassT | AbstractClass class used to store the wanted input data. |
CountAsUsedT | Whether the call to the methods counts as an effective use of the input parameter in the program. See CountAsUsed for more details; default value is fine in almost all cases. |
|
protectedinherited |
Helper function used to extract a section.
Currently it is not of much use and you shouldn't have to call it; however it might be handy in the future if we need to extend the class.
SectionT | The section object we which to extract. |
|
privateinherited |
Throw an exception if there is a duplicate in the keys.
The key for an AbstractClass A class is given by free function AbstractClassKey<A>().
As these keys are what is used by OptionFile to read the value, it is important not to use the same for two parameters.
An additional bonus is that a same AbstractClass class put twice in the tuple will also trigger this exception.
|
noexceptinherited |
Accessor to the underlying tuple.
|
protectedinherited |
Non constant accessor to the underlying tuple.
|
private |
List of identifiers that have been filled with Add()
method. This is a purely internal data attribute that shouldn't be exposed publicly.