https://mooseframework.inl.gov
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Moose::MFEM::CoefficientManager Class Reference

Front-end class for creating and storing MFEM coefficients. More...

#include <CoefficientManager.h>

Public Member Functions

 CoefficientManager ()=default
 
mfem::Coefficient & declareScalar (const std::string &name, const std::string &existing_or_literal)
 Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the name as a number with which to create a new constant coefficient. More...
 
template<class P , class... Args>
P & declareScalar (const std::string &name, Args &&... args)
 Create a new scalar coefficient, constructed from the argument pack. More...
 
mfem::Coefficient & declareScalarProperty (const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_or_literal)
 Use an existing scalar coefficient for a property on some blocks of the mesh. More...
 
template<class P , class... Args>
mfem::Coefficient & declareScalarProperty (const std::string &name, const std::vector< std::string > &blocks, Args &&... args)
 Use a new scalar coefficient, constructed from the argument pack, for a property on some blocks of the mesh. More...
 
mfem::VectorCoefficient & declareVector (const std::string &name, const std::string &existing_or_literal)
 Declare an alias to an existing vector coefficientor or, if it does not exist, try interpreting the name as a vector of numbers with which to create a new constant vector coefficient. More...
 
template<class P , class... Args>
P & declareVector (const std::string &name, Args &&... args)
 Create a new vector coefficient, constructed from the argument pack. More...
 
mfem::VectorCoefficient & declareVectorProperty (const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_or_literal)
 Use an existing vector coefficient for a property on some blocks of the mesh. More...
 
template<class P , class... Args>
mfem::VectorCoefficient & declareVectorProperty (const std::string &name, const std::vector< std::string > &blocks, Args &&... args)
 Use a new vector coefficient, constructed from the argument pack, for a property on some blocks of the mesh. More...
 
mfem::MatrixCoefficient & declareMatrix (const std::string &name, const std::string &existing_coef)
 Declare an alias to an existing matrix coefficient. More...
 
template<class P , class... Args>
P & declareMatrix (const std::string &name, Args &&... args)
 Create a new matrix coefficient, constructed from the argument pack. More...
 
mfem::MatrixCoefficient & declareMatrixProperty (const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_coef)
 Use an existing matrix coefficient for a property on some blocks of the mesh. More...
 
template<class P , class... Args>
mfem::MatrixCoefficient & declareMatrixProperty (const std::string &name, const std::vector< std::string > &blocks, Args &&... args)
 Use a new matrix coefficient, constructed from the argument pack, for a property on some blocks of the mesh. More...
 
mfem::Coefficient & getScalarCoefficient (const std::string &name)
 Return a scalar coefficient with the given name or, if that doesn't exists, try interpreting the name as a number with which to build a new constant coefficient. More...
 
mfem::VectorCoefficient & getVectorCoefficient (const std::string &name)
 Return a vector coefficient with the given name or, if that doesn't exists, try interpreting the name as a vector of number with which to build a new constant vector coefficient. More...
 
mfem::MatrixCoefficient & getMatrixCoefficient (const std::string &name)
 Return scalar coefficient with the given name. More...
 
bool scalarPropertyIsDefined (const std::string &name, const std::string &block) const
 
bool vectorPropertyIsDefined (const std::string &name, const std::string &block) const
 
bool matrixPropertyIsDefined (const std::string &name, const std::string &block) const
 
void setTime (const mfem::real_t time)
 
void markSolutionChanged ()
 Notify quadrature function coefficients that solution variables have changed, marking the stored values of those with a NONLINEAR update policy as stale so their source coefficients are re-projected on next use. More...
 

Private Member Functions

mfem::Coefficient & declareScalar (const std::string &name, std::shared_ptr< mfem::Coefficient > coef)
 
mfem::Coefficient & declareScalarProperty (const std::string &name, const std::vector< std::string > &blocks, std::shared_ptr< mfem::Coefficient > coef)
 
mfem::VectorCoefficient & declareVector (const std::string &name, std::shared_ptr< mfem::VectorCoefficient > coef)
 
mfem::VectorCoefficient & declareVectorProperty (const std::string &name, const std::vector< std::string > &blocks, std::shared_ptr< mfem::VectorCoefficient > coef)
 
mfem::MatrixCoefficient & declareMatrix (const std::string &name, std::shared_ptr< mfem::MatrixCoefficient > coef)
 
mfem::MatrixCoefficient & declareMatrixProperty (const std::string &name, const std::vector< std::string > &blocks, std::shared_ptr< mfem::MatrixCoefficient > coef)
 
std::shared_ptr< mfem::Coefficient > getScalarCoefficientPtr (const std::string &name)
 
std::shared_ptr< mfem::VectorCoefficient > getVectorCoefficientPtr (const std::string &name)
 
std::shared_ptr< mfem::MatrixCoefficient > getMatrixCoefficientPtr (const std::string &name)
 

Private Attributes

ScalarMap _scalar_coeffs
 
VectorMap _vector_coeffs
 
MatrixMap _matrix_coeffs
 

Detailed Description

Front-end class for creating and storing MFEM coefficients.

They can be created so they are global (defined across the entire domain) or as piecewise material properties.

Definition at line 32 of file CoefficientManager.h.

Constructor & Destructor Documentation

◆ CoefficientManager()

Moose::MFEM::CoefficientManager::CoefficientManager ( )
default

Member Function Documentation

◆ declareMatrix() [1/3]

mfem::MatrixCoefficient & Moose::MFEM::CoefficientManager::declareMatrix ( const std::string &  name,
const std::string &  existing_coef 
)

Declare an alias to an existing matrix coefficient.

Unlike for the scalar and vector counterparts, there is currently no way to try interpreting the name as numbers with which to construct a constant matrix coefficient.

Definition at line 97 of file CoefficientManager.C.

Referenced by declareMatrix().

98 {
99  return this->declareMatrix(name, this->getMatrixCoefficientPtr(existing_coef));
100 }
std::shared_ptr< mfem::MatrixCoefficient > getMatrixCoefficientPtr(const std::string &name)
mfem::MatrixCoefficient & declareMatrix(const std::string &name, const std::string &existing_coef)
Declare an alias to an existing matrix coefficient.

◆ declareMatrix() [2/3]

template<class P , class... Args>
P& Moose::MFEM::CoefficientManager::declareMatrix ( const std::string &  name,
Args &&...  args 
)
inline

Create a new matrix coefficient, constructed from the argument pack.

Definition at line 122 of file CoefficientManager.h.

123  {
124  auto coef = _matrix_coeffs.make<P>(args...);
125  this->declareMatrix(name, coef);
126  return *coef;
127  }
mfem::MatrixCoefficient & declareMatrix(const std::string &name, const std::string &existing_coef)
Declare an alias to an existing matrix coefficient.
std::shared_ptr< P > make(Args &&... args)
Make arbitrary coefficients which will be tracked by this object.

◆ declareMatrix() [3/3]

mfem::MatrixCoefficient & Moose::MFEM::CoefficientManager::declareMatrix ( const std::string &  name,
std::shared_ptr< mfem::MatrixCoefficient >  coef 
)
private

Definition at line 89 of file CoefficientManager.C.

91 {
92  this->_matrix_coeffs.addCoefficient(name, coef);
93  return *coef;
94 }
void addCoefficient(const std::string &name, std::shared_ptr< T > coeff)
Add a named global coefficient.

◆ declareMatrixProperty() [1/3]

mfem::MatrixCoefficient & Moose::MFEM::CoefficientManager::declareMatrixProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
const std::string &  existing_coef 
)

Use an existing matrix coefficient for a property on some blocks of the mesh.

The property will be a piecewise coefficient and it will have the value of existing_coef on these blocks. Unlike for the scalar and vector counterparts, there is currently no way to try interpreting the name as numbers with which to construct a constant matrix coefficient.

Definition at line 112 of file CoefficientManager.C.

Referenced by declareMatrixProperty().

115 {
116  std::shared_ptr<mfem::MatrixCoefficient> coef = this->getMatrixCoefficientPtr(existing_coef);
117  if (std::dynamic_pointer_cast<mfem::PWMatrixCoefficient>(coef))
118  mooseError("Properties must not be defined out of other properties or piecewise coefficients.");
119  return this->declareMatrixProperty(name, blocks, coef);
120 }
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
mfem::MatrixCoefficient & declareMatrixProperty(const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_coef)
Use an existing matrix coefficient for a property on some blocks of the mesh.
std::shared_ptr< mfem::MatrixCoefficient > getMatrixCoefficientPtr(const std::string &name)

◆ declareMatrixProperty() [2/3]

template<class P , class... Args>
mfem::MatrixCoefficient& Moose::MFEM::CoefficientManager::declareMatrixProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
Args &&...  args 
)
inline

Use a new matrix coefficient, constructed from the argument pack, for a property on some blocks of the mesh.

The property will be a piecewise coefficient and it will have the value of the new coefficient on these blocks.

Definition at line 147 of file CoefficientManager.h.

150  {
151  return this->declareMatrixProperty(name, blocks, _matrix_coeffs.make<P>(args...));
152  }
char ** blocks
mfem::MatrixCoefficient & declareMatrixProperty(const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_coef)
Use an existing matrix coefficient for a property on some blocks of the mesh.
std::shared_ptr< P > make(Args &&... args)
Make arbitrary coefficients which will be tracked by this object.

◆ declareMatrixProperty() [3/3]

mfem::MatrixCoefficient & Moose::MFEM::CoefficientManager::declareMatrixProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
std::shared_ptr< mfem::MatrixCoefficient >  coef 
)
private

Definition at line 103 of file CoefficientManager.C.

106 {
107  this->_matrix_coeffs.addPiecewiseBlocks(name, coef, blocks);
108  return getMatrixCoefficient(name);
109 }
char ** blocks
mfem::MatrixCoefficient & getMatrixCoefficient(const std::string &name)
Return scalar coefficient with the given name.
void addPiecewiseBlocks(const std::string &name, std::shared_ptr< T > coeff, const std::vector< std::string > &blocks)
Add piecewise material property.

◆ declareScalar() [1/3]

mfem::Coefficient & Moose::MFEM::CoefficientManager::declareScalar ( const std::string &  name,
const std::string &  existing_or_literal 
)

Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the name as a number with which to create a new constant coefficient.

Definition at line 28 of file CoefficientManager.C.

Referenced by MFEMProblem::addFunction(), MFEMProblem::addPostprocessor(), MFEMComplexVariable::declareCoefficients(), MFEMVariable::declareCoefficients(), declareScalar(), and MFEMScalarQuadratureFunction::MFEMScalarQuadratureFunction().

29 {
30  return this->declareScalar(name, this->getScalarCoefficientPtr(existing_or_literal));
31 }
mfem::Coefficient & declareScalar(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the nam...
std::shared_ptr< mfem::Coefficient > getScalarCoefficientPtr(const std::string &name)

◆ declareScalar() [2/3]

template<class P , class... Args>
P& Moose::MFEM::CoefficientManager::declareScalar ( const std::string &  name,
Args &&...  args 
)
inline

Create a new scalar coefficient, constructed from the argument pack.

Definition at line 44 of file CoefficientManager.h.

45  {
46  auto coef = _scalar_coeffs.make<P>(args...);
47  this->declareScalar(name, coef);
48  return *coef;
49  }
mfem::Coefficient & declareScalar(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the nam...
std::shared_ptr< P > make(Args &&... args)
Make arbitrary coefficients which will be tracked by this object.

◆ declareScalar() [3/3]

mfem::Coefficient & Moose::MFEM::CoefficientManager::declareScalar ( const std::string &  name,
std::shared_ptr< mfem::Coefficient >  coef 
)
private

Definition at line 21 of file CoefficientManager.C.

22 {
23  this->_scalar_coeffs.addCoefficient(name, coef);
24  return *coef;
25 }
void addCoefficient(const std::string &name, std::shared_ptr< T > coeff)
Add a named global coefficient.

◆ declareScalarProperty() [1/3]

mfem::Coefficient & Moose::MFEM::CoefficientManager::declareScalarProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
const std::string &  existing_or_literal 
)

Use an existing scalar coefficient for a property on some blocks of the mesh.

The property will be a piecewise coefficient and it will have the value of existing_coef on these blocks. If no such scalar coefficient exists, try interpreting the name as a number with which to create a new constant coefficient.

Definition at line 43 of file CoefficientManager.C.

Referenced by declareScalarProperty(), and MFEMGenericFunctorMaterial::MFEMGenericFunctorMaterial().

46 {
47  std::shared_ptr<mfem::Coefficient> coef = this->getScalarCoefficientPtr(existing_or_literal);
48  if (std::dynamic_pointer_cast<mfem::PWCoefficient>(coef))
49  mooseError("Properties must not be defined out of other properties or piecewise coefficients.");
50  return this->declareScalarProperty(name, blocks, coef);
51 }
mfem::Coefficient & declareScalarProperty(const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_or_literal)
Use an existing scalar coefficient for a property on some blocks of the mesh.
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::shared_ptr< mfem::Coefficient > getScalarCoefficientPtr(const std::string &name)

◆ declareScalarProperty() [2/3]

template<class P , class... Args>
mfem::Coefficient& Moose::MFEM::CoefficientManager::declareScalarProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
Args &&...  args 
)
inline

Use a new scalar coefficient, constructed from the argument pack, for a property on some blocks of the mesh.

The property will be a piecewise coefficient and it will have the value of the new coefficient on these blocks.

Definition at line 68 of file CoefficientManager.h.

71  {
72  return this->declareScalarProperty(name, blocks, _scalar_coeffs.make<P>(args...));
73  }
mfem::Coefficient & declareScalarProperty(const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_or_literal)
Use an existing scalar coefficient for a property on some blocks of the mesh.
char ** blocks
std::shared_ptr< P > make(Args &&... args)
Make arbitrary coefficients which will be tracked by this object.

◆ declareScalarProperty() [3/3]

mfem::Coefficient & Moose::MFEM::CoefficientManager::declareScalarProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
std::shared_ptr< mfem::Coefficient >  coef 
)
private

Definition at line 34 of file CoefficientManager.C.

37 {
38  this->_scalar_coeffs.addPiecewiseBlocks(name, coef, blocks);
39  return getScalarCoefficient(name);
40 }
char ** blocks
mfem::Coefficient & getScalarCoefficient(const std::string &name)
Return a scalar coefficient with the given name or, if that doesn&#39;t exists, try interpreting the name...
void addPiecewiseBlocks(const std::string &name, std::shared_ptr< T > coeff, const std::vector< std::string > &blocks)
Add piecewise material property.

◆ declareVector() [1/3]

mfem::VectorCoefficient & Moose::MFEM::CoefficientManager::declareVector ( const std::string &  name,
const std::string &  existing_or_literal 
)

Declare an alias to an existing vector coefficientor or, if it does not exist, try interpreting the name as a vector of numbers with which to create a new constant vector coefficient.

Definition at line 62 of file CoefficientManager.C.

Referenced by MFEMProblem::addFunction(), MFEMComplexVariable::declareCoefficients(), MFEMVariable::declareCoefficients(), declareVector(), and MFEMVectorQuadratureFunction::MFEMVectorQuadratureFunction().

63 {
64  return this->declareVector(name, this->getVectorCoefficientPtr(existing_or_literal));
65 }
std::shared_ptr< mfem::VectorCoefficient > getVectorCoefficientPtr(const std::string &name)
mfem::VectorCoefficient & declareVector(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing vector coefficientor or, if it does not exist, try interpreting the n...

◆ declareVector() [2/3]

template<class P , class... Args>
P& Moose::MFEM::CoefficientManager::declareVector ( const std::string &  name,
Args &&...  args 
)
inline

Create a new vector coefficient, constructed from the argument pack.

Definition at line 82 of file CoefficientManager.h.

83  {
84  auto coef = _vector_coeffs.make<P>(args...);
85  this->declareVector(name, coef);
86  return *coef;
87  }
mfem::VectorCoefficient & declareVector(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing vector coefficientor or, if it does not exist, try interpreting the n...
std::shared_ptr< P > make(Args &&... args)
Make arbitrary coefficients which will be tracked by this object.

◆ declareVector() [3/3]

mfem::VectorCoefficient & Moose::MFEM::CoefficientManager::declareVector ( const std::string &  name,
std::shared_ptr< mfem::VectorCoefficient >  coef 
)
private

Definition at line 54 of file CoefficientManager.C.

56 {
57  this->_vector_coeffs.addCoefficient(name, coef);
58  return *coef;
59 }
void addCoefficient(const std::string &name, std::shared_ptr< T > coeff)
Add a named global coefficient.

◆ declareVectorProperty() [1/3]

mfem::VectorCoefficient & Moose::MFEM::CoefficientManager::declareVectorProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
const std::string &  existing_or_literal 
)

Use an existing vector coefficient for a property on some blocks of the mesh.

The property will be a piecewise coefficient and it will have the value of existing_coef on these blocks. If no such vector coefficient exists, try interpreting the name as a vector of numbers with which to create a new constant vector coefficient.

Definition at line 77 of file CoefficientManager.C.

Referenced by declareVectorProperty(), and MFEMGenericFunctorVectorMaterial::MFEMGenericFunctorVectorMaterial().

80 {
81  std::shared_ptr<mfem::VectorCoefficient> coef =
82  this->getVectorCoefficientPtr(existing_or_literal);
83  if (std::dynamic_pointer_cast<mfem::PWVectorCoefficient>(coef))
84  mooseError("Properties must not be defined out of other properties or piecewise coefficients.");
85  return this->declareVectorProperty(name, blocks, coef);
86 }
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
mfem::VectorCoefficient & declareVectorProperty(const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_or_literal)
Use an existing vector coefficient for a property on some blocks of the mesh.
std::shared_ptr< mfem::VectorCoefficient > getVectorCoefficientPtr(const std::string &name)

◆ declareVectorProperty() [2/3]

template<class P , class... Args>
mfem::VectorCoefficient& Moose::MFEM::CoefficientManager::declareVectorProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
Args &&...  args 
)
inline

Use a new vector coefficient, constructed from the argument pack, for a property on some blocks of the mesh.

The property will be a piecewise coefficient and it will have the value of the new coefficient on these blocks.

Definition at line 107 of file CoefficientManager.h.

110  {
111  return this->declareVectorProperty(name, blocks, _vector_coeffs.make<P>(args...));
112  }
char ** blocks
mfem::VectorCoefficient & declareVectorProperty(const std::string &name, const std::vector< std::string > &blocks, const std::string &existing_or_literal)
Use an existing vector coefficient for a property on some blocks of the mesh.
std::shared_ptr< P > make(Args &&... args)
Make arbitrary coefficients which will be tracked by this object.

◆ declareVectorProperty() [3/3]

mfem::VectorCoefficient & Moose::MFEM::CoefficientManager::declareVectorProperty ( const std::string &  name,
const std::vector< std::string > &  blocks,
std::shared_ptr< mfem::VectorCoefficient >  coef 
)
private

Definition at line 68 of file CoefficientManager.C.

71 {
72  this->_vector_coeffs.addPiecewiseBlocks(name, coef, blocks);
73  return getVectorCoefficient(name);
74 }
char ** blocks
mfem::VectorCoefficient & getVectorCoefficient(const std::string &name)
Return a vector coefficient with the given name or, if that doesn&#39;t exists, try interpreting the name...
void addPiecewiseBlocks(const std::string &name, std::shared_ptr< T > coeff, const std::vector< std::string > &blocks)
Add piecewise material property.

◆ getMatrixCoefficient()

mfem::MatrixCoefficient & Moose::MFEM::CoefficientManager::getMatrixCoefficient ( const std::string &  name)

Return scalar coefficient with the given name.

Unlike for the scalar and vector counterparts, there is currently no way to try interpreting the name as numbers with which to construct a constant matrix coefficient.

Definition at line 174 of file CoefficientManager.C.

Referenced by declareMatrixProperty(), and MFEMObject::getMatrixCoefficientByName().

175 {
176  return *this->getMatrixCoefficientPtr(name);
177 }
std::shared_ptr< mfem::MatrixCoefficient > getMatrixCoefficientPtr(const std::string &name)

◆ getMatrixCoefficientPtr()

std::shared_ptr< mfem::MatrixCoefficient > Moose::MFEM::CoefficientManager::getMatrixCoefficientPtr ( const std::string &  name)
private

Definition at line 155 of file CoefficientManager.C.

Referenced by declareMatrix(), declareMatrixProperty(), and getMatrixCoefficient().

156 {
157  return this->_matrix_coeffs.getCoefficientPtr(name);
158  // TODO: Work out how to parse literal matrices from input.
159 }
std::shared_ptr< T > getCoefficientPtr(const std::string &name)

◆ getScalarCoefficient()

mfem::Coefficient & Moose::MFEM::CoefficientManager::getScalarCoefficient ( const std::string &  name)

Return a scalar coefficient with the given name or, if that doesn't exists, try interpreting the name as a number with which to build a new constant coefficient.

Definition at line 162 of file CoefficientManager.C.

Referenced by declareScalarProperty(), MFEMObject::getScalarCoefficientByName(), MFEMParsedFunction::initialSetup(), and MFEMParaViewDataCollection::registerScalarCoefficients().

163 {
164  return *this->getScalarCoefficientPtr(name);
165 }
std::shared_ptr< mfem::Coefficient > getScalarCoefficientPtr(const std::string &name)

◆ getScalarCoefficientPtr()

std::shared_ptr< mfem::Coefficient > Moose::MFEM::CoefficientManager::getScalarCoefficientPtr ( const std::string &  name)
private

Definition at line 123 of file CoefficientManager.C.

Referenced by declareScalar(), declareScalarProperty(), and getScalarCoefficient().

124 {
125  if (this->_scalar_coeffs.hasCoefficient(name))
126  return this->_scalar_coeffs.getCoefficientPtr(name);
127  // If name not present, check if it can be parsed cleanly into a real number
128  std::istringstream ss(MooseUtils::trim(name));
129  mfem::real_t real_value;
130  if (ss >> real_value && ss.eof())
131  {
132  this->declareScalar<mfem::ConstantCoefficient>(name, real_value);
133  return this->_scalar_coeffs.getCoefficientPtr(name);
134  }
135  mooseError("Scalar coefficient with name '" + name + "' has not been declared.");
136 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
std::shared_ptr< T > getCoefficientPtr(const std::string &name)
bool hasCoefficient(const std::string &name) const

◆ getVectorCoefficient()

mfem::VectorCoefficient & Moose::MFEM::CoefficientManager::getVectorCoefficient ( const std::string &  name)

Return a vector coefficient with the given name or, if that doesn't exists, try interpreting the name as a vector of number with which to build a new constant vector coefficient.

Definition at line 168 of file CoefficientManager.C.

Referenced by MFEMComplexVariable::declareCoefficients(), MFEMVariable::declareCoefficients(), declareVectorProperty(), MFEMObject::getVectorCoefficientByName(), and MFEMParaViewDataCollection::registerVectorCoefficients().

169 {
170  return *this->getVectorCoefficientPtr(name);
171 }
std::shared_ptr< mfem::VectorCoefficient > getVectorCoefficientPtr(const std::string &name)

◆ getVectorCoefficientPtr()

std::shared_ptr< mfem::VectorCoefficient > Moose::MFEM::CoefficientManager::getVectorCoefficientPtr ( const std::string &  name)
private

Definition at line 139 of file CoefficientManager.C.

Referenced by declareVector(), declareVectorProperty(), and getVectorCoefficient().

140 {
141  if (this->_vector_coeffs.hasCoefficient(name))
142  return this->_vector_coeffs.getCoefficientPtr(name);
143  // If name not present, check if it can be parsed cleanly into a vector of real numbers
144  std::vector<mfem::real_t> vec_values;
145  if (MooseUtils::tokenizeAndConvert(name, vec_values) && vec_values.size() > 0)
146  {
147  this->declareVector<mfem::VectorConstantCoefficient>(
148  name, mfem::Vector(vec_values.data(), vec_values.size()));
149  return this->_vector_coeffs.getCoefficientPtr(name);
150  }
151  mooseError("Vector coefficient with name '" + name + "' has not been declared.");
152 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool tokenizeAndConvert(const std::string &str, std::vector< T > &tokenized_vector, const std::string &delimiter=" \\\)
tokenizeAndConvert splits a string using delimiter and then converts to type T.
std::shared_ptr< T > getCoefficientPtr(const std::string &name)
bool hasCoefficient(const std::string &name) const

◆ markSolutionChanged()

void Moose::MFEM::CoefficientManager::markSolutionChanged ( )

Notify quadrature function coefficients that solution variables have changed, marking the stored values of those with a NONLINEAR update policy as stale so their source coefficients are re-projected on next use.

Definition at line 209 of file CoefficientManager.C.

Referenced by Moose::MFEM::ComplexEquationSystem::SetTrialVariablesFromTrueVectors(), and Moose::MFEM::EquationSystem::SetTrialVariablesFromTrueVectors().

210 {
211  auto mark_solution_changed = [](auto & coef)
212  {
213  if (auto * const qf_coef = dynamic_cast<MFEMQuadratureFunctionCoefficientBase *>(&coef))
214  qf_coef->MarkSolutionChanged();
215  };
216  this->_scalar_coeffs.apply(mark_solution_changed);
217  this->_vector_coeffs.apply(mark_solution_changed);
218 }
void apply(F &&func)
Apply a function to every coefficient created by this map.

◆ matrixPropertyIsDefined()

bool Moose::MFEM::CoefficientManager::matrixPropertyIsDefined ( const std::string &  name,
const std::string &  block 
) const

Definition at line 194 of file CoefficientManager.C.

196 {
197  return this->_matrix_coeffs.propertyDefinedOnBlock(name, block);
198 }
bool propertyDefinedOnBlock(const std::string &name, const std::string &block) const

◆ scalarPropertyIsDefined()

bool Moose::MFEM::CoefficientManager::scalarPropertyIsDefined ( const std::string &  name,
const std::string &  block 
) const

Definition at line 180 of file CoefficientManager.C.

182 {
183  return this->_scalar_coeffs.propertyDefinedOnBlock(name, block);
184 }
bool propertyDefinedOnBlock(const std::string &name, const std::string &block) const

◆ setTime()

void Moose::MFEM::CoefficientManager::setTime ( const mfem::real_t  time)

◆ vectorPropertyIsDefined()

bool Moose::MFEM::CoefficientManager::vectorPropertyIsDefined ( const std::string &  name,
const std::string &  block 
) const

Definition at line 187 of file CoefficientManager.C.

189 {
190  return this->_vector_coeffs.propertyDefinedOnBlock(name, block);
191 }
bool propertyDefinedOnBlock(const std::string &name, const std::string &block) const

Member Data Documentation

◆ _matrix_coeffs

MatrixMap Moose::MFEM::CoefficientManager::_matrix_coeffs
private

◆ _scalar_coeffs

ScalarMap Moose::MFEM::CoefficientManager::_scalar_coeffs
private

◆ _vector_coeffs

VectorMap Moose::MFEM::CoefficientManager::_vector_coeffs
private

The documentation for this class was generated from the following files: