Lightweight adaptor over an std::map from strings to pointer to T. More...
#include <MFEMContainers.h>
Public Types | |
using | MapType = std::map< std::string, std::shared_ptr< T > > |
using | const_iterator = typename MapType::const_iterator |
Public Member Functions | |
NamedFieldsMap ()=default | |
Default initializer. More... | |
~NamedFieldsMap () | |
Destructor. More... | |
template<class FieldType , class... FieldArgs> | |
void | Register (const std::string &field_name, FieldArgs &&... args) |
Construct new field with name field_name and register. More... | |
void | Register (const std::string &field_name, std::shared_ptr< T > field) |
Register association between field and field_name. More... | |
void | Deregister (const std::string &field_name) |
Unregister association between a field and the field_name. More... | |
bool | Has (const std::string &field_name) const |
Predicate to check if a field is registered with name field_name. More... | |
std::shared_ptr< T > | GetShared (const std::string &field_name) const |
Returns a shared pointer to the field. This is guaranteed to return a non-null shared pointer. More... | |
T & | GetRef (const std::string &field_name) const |
Returns a reference to a field. More... | |
T * | Get (const std::string &field_name) const |
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer. More... | |
template<typename TDerived > | |
TDerived * | Get (const std::string &field_name) const |
Returns a non-owning pointer to the field where TDerived is a derived class of class T. More... | |
std::vector< T * > | Get (const std::vector< std::string > &keys) const |
Returns a vector containing all values for supplied keys. More... | |
const_iterator | begin () const |
Returns a begin const iterator to the registered fields. More... | |
const_iterator | end () const |
Returns an end const iterator to the registered fields. More... | |
int | size () |
Protected Member Functions | |
const_iterator | FindField (const std::string &field_name) const |
Returns a const iterator to the field. More... | |
void | CheckFieldIsRegistrable (const std::string &field_name, T *field) const |
Check that the field pointer is valid and the field has not already been registered. More... | |
void | CheckForDoubleRegistration (const std::string &field_name, T *field) const |
Check for double-registration of a field. More... | |
void | CheckFieldIsRegistered (const std::string &field_name) const |
Check that a field exists in the map. More... | |
std::shared_ptr< T > | EnsureFieldPointerIsNonNull (const_iterator &iterator) const |
Ensure that a returned shared pointer is valid. More... | |
template<typename TDerived > | |
TDerived * | EnsurePointerCastIsNonNull (T *ptr) const |
Ensure that a dynamic cast is successful. More... | |
void | DeregisterAll () |
Clear all associations between names and fields. More... | |
Private Attributes | |
MapType | _field_map {} |
Lightweight adaptor over an std::map from strings to pointer to T.
Definition at line 27 of file MFEMContainers.h.
using Moose::MFEM::NamedFieldsMap< T >::const_iterator = typename MapType::const_iterator |
Definition at line 31 of file MFEMContainers.h.
using Moose::MFEM::NamedFieldsMap< T >::MapType = std::map<std::string, std::shared_ptr<T> > |
Definition at line 30 of file MFEMContainers.h.
|
default |
Default initializer.
|
inline |
Destructor.
Definition at line 37 of file MFEMContainers.h.
|
inline |
Returns a begin const iterator to the registered fields.
Definition at line 112 of file MFEMContainers.h.
|
inlineprotected |
Check that a field exists in the map.
Definition at line 150 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::GetShared().
|
inlineprotected |
Check that the field pointer is valid and the field has not already been registered.
Definition at line 129 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register().
|
inlineprotected |
Check for double-registration of a field.
A double-registered field may result in undefined behavior.
Definition at line 141 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckFieldIsRegistrable().
|
inline |
Unregister association between a field and the field_name.
Definition at line 57 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register().
|
inlineprotected |
Clear all associations between names and fields.
Definition at line 186 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::~NamedFieldsMap().
|
inline |
Returns an end const iterator to the registered fields.
Definition at line 116 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Has().
|
inlineprotected |
Ensure that a returned shared pointer is valid.
Definition at line 159 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::GetShared().
|
inlineprotected |
Ensure that a dynamic cast is successful.
Definition at line 173 of file MFEMContainers.h.
|
inlineprotected |
Returns a const iterator to the field.
Definition at line 123 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::GetShared(), and Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Has().
|
inline |
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer.
Definition at line 82 of file MFEMContainers.h.
Referenced by Moose::MFEM::EquationSystem::AddIntegratedBC(), Moose::MFEM::EquationSystem::AddKernel(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), Moose::MFEM::EquationSystem::BuildMixedBilinearForms(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckForDoubleRegistration(), Moose::MFEM::EquationSystem::FormLegacySystem(), Moose::MFEM::TimeDependentEquationSystem::FormLegacySystem(), Moose::MFEM::EquationSystem::FormSystem(), Moose::MFEM::TimeDependentEquationSystem::FormSystem(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Get(), MFEMProblem::getMeshDisplacementGridFunction(), Moose::MFEM::EquationSystem::Init(), Moose::MFEM::EquationSystem::RecoverFEMSolution(), Moose::MFEM::ProblemOperatorInterface::SetGridFunctions(), Moose::MFEM::TimeDomainEquationSystemProblemOperator::SetGridFunctions(), and Moose::MFEM::TimeDependentEquationSystem::SetTimeStep().
|
inline |
Returns a non-owning pointer to the field where TDerived is a derived class of class T.
Definition at line 89 of file MFEMContainers.h.
|
inline |
Returns a vector containing all values for supplied keys.
Definition at line 97 of file MFEMContainers.h.
|
inline |
Returns a reference to a field.
Definition at line 76 of file MFEMContainers.h.
Referenced by Moose::MFEM::EquationSystem::AddEssentialBC(), Moose::MFEM::EquationSystem::AddIntegratedBC(), Moose::MFEM::EquationSystem::AddKernel(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), Moose::MFEM::EquationSystem::ApplyEssentialBCs(), Moose::MFEM::EquationSystem::BuildLinearForms(), and MultiAppMFEMCopyTransfer::transfer().
|
inline |
Returns a shared pointer to the field. This is guaranteed to return a non-null shared pointer.
Definition at line 66 of file MFEMContainers.h.
Referenced by Moose::MFEM::EquationSystem::BuildBilinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), Moose::MFEM::EquationSystem::BuildLinearForms(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Get(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::GetRef(), and Moose::MFEM::EquationSystem::Init().
|
inline |
Predicate to check if a field is registered with name field_name.
Definition at line 60 of file MFEMContainers.h.
Referenced by Moose::MFEM::EquationSystem::AddEssentialBC(), Moose::MFEM::EquationSystem::AddIntegratedBC(), Moose::MFEM::EquationSystem::AddKernel(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), Moose::MFEM::EquationSystem::ApplyEssentialBCs(), Moose::MFEM::EquationSystem::BuildMixedBilinearForms(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckFieldIsRegistered(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckForDoubleRegistration(), Moose::MFEM::EquationSystem::FormLegacySystem(), and Moose::MFEM::EquationSystem::Init().
|
inline |
Construct new field with name field_name and register.
Definition at line 41 of file MFEMContainers.h.
Referenced by Moose::MFEM::EquationSystem::AddEssentialBC(), MFEMProblem::addFESpace(), MFEMProblem::addGridFunction(), Moose::MFEM::EquationSystem::AddIntegratedBC(), Moose::MFEM::EquationSystem::AddKernel(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), MFEMProblem::addSubMesh(), Moose::MFEM::EquationSystem::BuildBilinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), Moose::MFEM::EquationSystem::BuildLinearForms(), Moose::MFEM::EquationSystem::BuildMixedBilinearForms(), Moose::MFEM::EquationSystem::Init(), and Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register().
|
inline |
Register association between field and field_name.
Definition at line 47 of file MFEMContainers.h.
|
inline |
Definition at line 119 of file MFEMContainers.h.
|
private |
Definition at line 189 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::begin(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Deregister(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::DeregisterAll(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::end(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::FindField(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register(), and Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::size().