MoReFEM
|
Singleton class which is aware of all essential boundary conditions that might be considered within a model. More...
#include <DirichletBoundaryConditionManager.hpp>
Public Types | |
using | indexed_section_tag = ::MoReFEM::Internal::InputDataNS::BoundaryConditionNS::Tag |
Convenient alias to the (internal) tag used to identify IndexedSection of a specific type (e.g. all the sections related to a Mesh). | |
using | self |
Convenient alias. | |
Public Member Functions | |
template<class IndexedSectionDescriptionT , ::MoReFEM::Concept::ModelSettingsType ModelSettingsT, ::MoReFEM::Concept::InputDataType InputDataT> | |
void | Create (const IndexedSectionDescriptionT &indexed_section_description, const ModelSettingsT &model_settings, const InputDataT &input_data) |
Create a DirichletBoundaryCondition object from InputData and ModelSettings information. | |
std::size_t | NboundaryCondition () const noexcept |
Returns the number of boundary conditions. | |
const DirichletBoundaryCondition & | GetDirichletBoundaryCondition (BoundaryConditionNS::unique_id unique_id, const std::source_location location=std::source_location::current()) const |
DirichletBoundaryCondition & | GetNonCstDirichletBoundaryCondition (BoundaryConditionNS::unique_id unique_id, const std::source_location location=std::source_location::current()) |
DirichletBoundaryCondition::shared_ptr | GetDirichletBoundaryConditionPtr (BoundaryConditionNS::unique_id unique_id, const std::source_location location=std::source_location::current()) const |
const DirichletBoundaryCondition::vector_shared_ptr & | GetList () const noexcept |
Access to the list of boundary conditions. | |
Static Public Member Functions | |
static const std::string & | ClassName () |
Return the name of the class. | |
static DirichletBoundaryConditionManager & | CreateOrGetInstance (const std::source_location location=std::source_location::current(), Args &&... args) |
Call instance of the singleton. | |
static DirichletBoundaryConditionManager & | GetInstance (const std::source_location location=std::source_location::current()) |
Call an instance of the singleton that must already have been created. | |
static void | Destroy () |
Destroy the singleton. | |
Private Member Functions | |
void | Create (BoundaryConditionNS::unique_id unique_id, const Domain &domain, const Unknown &unknown, const std::vector< double > &value_per_component, const std::string &component, const bool is_mutable) |
void | RegisterDirichletBoundaryCondition (const DirichletBoundaryCondition::shared_ptr &ptr) |
Special members | |
virtual | ~DirichletBoundaryConditionManager () override |
Destructor. | |
DirichletBoundaryConditionManager (const DirichletBoundaryConditionManager &rhs)=delete | |
The copy constructor. | |
DirichletBoundaryConditionManager (DirichletBoundaryConditionManager &&rhs)=delete | |
The move constructor. | |
DirichletBoundaryConditionManager & | operator= (const DirichletBoundaryConditionManager &rhs)=delete |
The (copy) operator=. | |
DirichletBoundaryConditionManager & | operator= (DirichletBoundaryConditionManager &&rhs)=delete |
The (move) operator=. | |
Static Private Member Functions | |
static void | OnDeadReference (const std::source_location location=std::source_location::current()) |
Gets called if dead reference detected. | |
static std::mutex & | GetNonCstSingletonMutex () |
Get reference to the singleton mutex. | |
Private Attributes | |
DirichletBoundaryCondition::vector_shared_ptr | boundary_condition_list_ |
List of boundary conditions. | |
Static Private Attributes | |
static DirichletBoundaryConditionManager * | instance_ |
Internal pointer to the actual instance. | |
static bool | destroyed_ |
Used for protection against dead reference problem (invocation while the instance has been destroyed). | |
static std::mutex | singleton_mutex_ |
Mutex object. | |
Singleton class which is aware of all essential boundary conditions that might be considered within a model.
These conditions are defined in the input data file.
|
privatedelete |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
|
privatedelete |
The move constructor.
[in] | rhs | The object from which the construction occurs. |
|
privatedelete |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
privatedelete |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
void MoReFEM::DirichletBoundaryConditionManager::Create | ( | const IndexedSectionDescriptionT & | indexed_section_description, |
const ModelSettingsT & | model_settings, | ||
const InputDataT & | input_data ) |
Create a DirichletBoundaryCondition object from InputData and ModelSettings information.
[in] | indexed_section_description | Instantiation of a IndexedSectionDescription object that is a placeholder to tell a given IndexedSection exists for the Model. Most of the time the instantiation itself is not used and the relevant information is in fact its type (from which type of the IndexedSection may be inferred). |
[in] | model_settings | Object which hold the values of all the input data that should not be modifiable by the end user. Example (in most of the models): NumberingSubset in which an Unknown should be allotted in a FEltSpace. |
const DirichletBoundaryCondition & MoReFEM::DirichletBoundaryConditionManager::GetDirichletBoundaryCondition | ( | BoundaryConditionNS::unique_id | unique_id, |
const std::source_location | location = std::source_location::current() ) const |
Get the boundary condition associated with unique_id.
[in] | unique_id | Unique identifier of the sought DirichletBoundaryCondition (as returned by DirichletBoundaryCondition::GetUniqueId()). |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
DirichletBoundaryCondition & MoReFEM::DirichletBoundaryConditionManager::GetNonCstDirichletBoundaryCondition | ( | BoundaryConditionNS::unique_id | unique_id, |
const std::source_location | location = std::source_location::current() ) |
Get the boundary condition associated with unique_id.
[in] | unique_id | Unique identifier of the sought DirichletBoundaryCondition (as returned by DirichletBoundaryCondition::GetUniqueId()). |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
DirichletBoundaryCondition::shared_ptr MoReFEM::DirichletBoundaryConditionManager::GetDirichletBoundaryConditionPtr | ( | BoundaryConditionNS::unique_id | unique_id, |
const std::source_location | location = std::source_location::current() ) const |
Get the boundary condition associated with unique_id as a smart pointer.
[in] | unique_id | Unique identifier of the sought DirichletBoundaryCondition (as returned by DirichletBoundaryCondition::GetUniqueId()). |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
private |
[in] | unique_id | Unique identifier, used in the input data file to tag the condition. |
[in] | domain | Domain upon which the condition is applied. |
[in] | unknown | Unknown considered for the boundary condition. If you actually want a condition on a given domain that acts upon two unknowns, you must define another DirichletBoundaryCondition; both should be given in the dedicated VariationaFormulation. |
[in] | value_per_component | Initial value for each of the component. |
[in] | component | String that details on which component the condition should be applied. This string must be one recognized by the ComponentFactory; current choices are 'Comp1', 'Comp2', 'Comp3', 'Comp12', 'Comp23', 'Comp13' and 'Comp123'. |
[in] | is_mutable | False if the boundary condition is homogeneous, true otherwise. |
|
private |
Register properly boundary condition in use.
[in] | ptr | Shared pointernton the new boundary condition to register. |
|
staticinherited |
Call instance of the singleton.
If not already existing it will be created on the fly, otherwise the existing one will be used. This method should be called in two cases:
In all other cases, call instead GetInstance().
Args | Variadic template arguments. |
[in] | args | Arguments passed to the constructor if the object is to be built. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
staticinherited |
Call an instance of the singleton that must already have been created.
This must be called instead of CreateOrGetInstance(location) if T doesn't get a default constructor.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
staticprivateinherited |
Gets called if dead reference detected.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
staticprivateinherited |
Used for protection against dead reference problem (invocation while the instance has been destroyed).
Should not occur in our case, but it is much safer to put the protection there anyway.
|
staticprivateinherited |
Mutex object.
This follows item 16 of Scott Meyers's "Effective Modern C++", which advises to make const member functions thread safe.