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 () |
| Returns the number of elements in the map. More... | |
Protected Member Functions | |
| const_iterator | FindField (const std::string &field_name) const |
| Returns a const iterator to the field. More... | |
| void | CheckFieldIsRegistrable ([[maybe_unused]] const std::string &field_name, [[maybe_unused]] T *field) const |
| Check that the field pointer is valid and the field has not already been registered. 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 24 of file MFEMContainers.h.
| using Moose::MFEM::NamedFieldsMap< T >::const_iterator = typename MapType::const_iterator |
Definition at line 28 of file MFEMContainers.h.
| using Moose::MFEM::NamedFieldsMap< T >::MapType = std::map<std::string, std::shared_ptr<T> > |
Definition at line 27 of file MFEMContainers.h.
|
default |
Default initializer.
|
inline |
Destructor.
Definition at line 34 of file MFEMContainers.h.
|
inline |
Returns a begin const iterator to the registered fields.
Definition at line 109 of file MFEMContainers.h.
|
inlineprotected |
Check that a field exists in the map.
Definition at line 135 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 126 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register().
|
inline |
Unregister association between a field and the field_name.
Definition at line 54 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register().
|
inlineprotected |
Clear all associations between names and fields.
Definition at line 159 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 113 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Has().
|
inlineprotected |
Ensure that a returned shared pointer is valid.
Definition at line 142 of file MFEMContainers.h.
Referenced by Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::GetShared().
|
inlineprotected |
Ensure that a dynamic cast is successful.
Definition at line 151 of file MFEMContainers.h.
|
inlineprotected |
Returns a const iterator to the field.
Definition at line 120 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 79 of file MFEMContainers.h.
Referenced by Moose::MFEM::TimeDependentEquationSystem::AddKernel(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckFieldIsRegistrable(), Moose::MFEM::TimeDependentEquationSystem::EliminateCoupledVariables(), Moose::MFEM::EquationSystem::EliminateCoupledVariables(), Moose::MFEM::EigenproblemEquationSystem::FormEigenproblemMatrix(), Moose::MFEM::EquationSystem::FormJacobianMatrix(), Moose::MFEM::ComplexEquationSystem::FormSystemMatrix(), Moose::MFEM::EquationSystem::FormSystemMatrix(), Moose::MFEM::ComplexEquationSystem::FormSystemOperator(), Moose::MFEM::EquationSystem::FormSystemOperator(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Get(), MFEMProblem::getMeshDisplacementGridFunction(), MFEMProblem::getMFEMVariableMesh(), Moose::MFEM::ComplexEquationSystem::Init(), Moose::MFEM::EquationSystem::Init(), Moose::MFEM::EquationSystem::PrepareLinearSolver(), Moose::MFEM::EigenproblemESProblemOperator::RecoverEigenproblemSolution(), Moose::MFEM::ProblemOperatorBase::SetGridFunctions(), Moose::MFEM::ComplexEquationSystemProblemOperator::SetGridFunctions(), Moose::MFEM::EquationSystem::SetTrialVariablesFromTrueVectors(), and Moose::MFEM::ComplexEquationSystem::SetTrialVariablesFromTrueVectors().
|
inline |
Returns a non-owning pointer to the field where TDerived is a derived class of class T.
Definition at line 86 of file MFEMContainers.h.
|
inline |
Returns a vector containing all values for supplied keys.
Definition at line 94 of file MFEMContainers.h.
|
inline |
Returns a reference to a field.
Definition at line 73 of file MFEMContainers.h.
Referenced by Moose::MFEM::ComplexEquationSystem::AddComplexEssentialBCs(), Moose::MFEM::EquationSystem::AddEssentialBC(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), Moose::MFEM::ComplexEquationSystem::ApplyComplexEssentialBC(), Moose::MFEM::EquationSystem::ApplyEssentialBC(), Moose::MFEM::EigenproblemEquationSystem::ApplyEssentialBCs(), Moose::MFEM::ComplexEquationSystem::ApplyEssentialBCs(), Moose::MFEM::EquationSystem::ApplyEssentialBCs(), Moose::MFEM::ComplexEquationSystem::BuildLinearForms(), and Moose::MFEM::EquationSystem::BuildLinearForms().
|
inline |
Returns a shared pointer to the field. This is guaranteed to return a non-null shared pointer.
Definition at line 63 of file MFEMContainers.h.
Referenced by Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), Moose::MFEM::ComplexEquationSystem::BuildBilinearForms(), Moose::MFEM::EquationSystem::BuildBilinearForms(), Moose::MFEM::ComplexEquationSystem::BuildLinearForms(), Moose::MFEM::EquationSystem::BuildLinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildNonlinearForms(), Moose::MFEM::EquationSystem::BuildNonlinearForms(), Moose::MFEM::EquationSystem::ComputeNonlinearResidual(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Get(), MFEMProblem::getComplexGridFunction(), MFEMProblem::getGridFunction(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::GetRef(), Moose::MFEM::ComplexEquationSystem::Init(), and Moose::MFEM::EquationSystem::Init().
|
inline |
Predicate to check if a field is registered with name field_name.
Definition at line 57 of file MFEMContainers.h.
Referenced by Moose::MFEM::ComplexEquationSystem::AddComplexEssentialBCs(), Moose::MFEM::EquationSystem::AddEssentialBC(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), Moose::MFEM::ComplexEquationSystem::ApplyComplexEssentialBC(), Moose::MFEM::EquationSystem::ApplyEssentialBC(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckFieldIsRegistered(), Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::CheckFieldIsRegistrable(), Moose::MFEM::TimeDependentEquationSystem::EliminateCoupledVariables(), Moose::MFEM::EquationSystem::FormJacobianMatrix(), MFEMProblem::getMFEMVariableMesh(), Moose::MFEM::ComplexEquationSystem::Init(), Moose::MFEM::EquationSystem::Init(), MultiAppMFEMCopyTransfer::transferVariables(), and MultiAppMFEMShapeEvaluationTransfer::transferVariables().
|
inline |
Construct new field with name field_name and register.
Definition at line 38 of file MFEMContainers.h.
Referenced by Moose::MFEM::ComplexEquationSystem::AddComplexEssentialBCs(), Moose::MFEM::EquationSystem::AddEssentialBC(), MFEMProblem::addFESpace(), MFEMProblem::addGridFunction(), Moose::MFEM::TimeDependentEquationSystem::AddKernel(), MFEMProblem::addSubMesh(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), Moose::MFEM::ComplexEquationSystem::BuildBilinearForms(), Moose::MFEM::EquationSystem::BuildBilinearForms(), Moose::MFEM::ComplexEquationSystem::BuildLinearForms(), Moose::MFEM::EquationSystem::BuildLinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildMixedBilinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildNonlinearForms(), Moose::MFEM::EquationSystem::BuildNonlinearForms(), Moose::MFEM::ComplexEquationSystem::Init(), Moose::MFEM::EquationSystem::Init(), and Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm >::Register().
|
inline |
Register association between field and field_name.
Definition at line 44 of file MFEMContainers.h.
|
inline |
Returns the number of elements in the map.
Definition at line 116 of file MFEMContainers.h.
Referenced by Moose::MFEM::ComplexEquationSystem::Init(), and Moose::MFEM::EquationSystem::Init().
|
private |
Definition at line 162 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().
1.8.14