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 double time)
 

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 35 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 96 of file CoefficientManager.C.

Referenced by declareMatrix().

97 {
98  return this->declareMatrix(name, this->getMatrixCoefficientPtr(existing_coef));
99 }
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 125 of file CoefficientManager.h.

126  {
127  auto coef = _matrix_coeffs.make<P>(args...);
128  this->declareMatrix(name, coef);
129  return *coef;
130  }
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 88 of file CoefficientManager.C.

90 {
91  this->_matrix_coeffs.addCoefficient(name, coef);
92  return *coef;
93 }
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 111 of file CoefficientManager.C.

Referenced by declareMatrixProperty().

114 {
115  std::shared_ptr<mfem::MatrixCoefficient> coef = this->getMatrixCoefficientPtr(existing_coef);
116  if (std::dynamic_pointer_cast<mfem::PWMatrixCoefficient>(coef))
117  mooseError("Properties must not be defined out of other properties or piecewise coefficients.");
118  return this->declareMatrixProperty(name, blocks, coef);
119 }
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
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 150 of file CoefficientManager.h.

153  {
154  return this->declareMatrixProperty(name, blocks, _matrix_coeffs.make<P>(args...));
155  }
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 102 of file CoefficientManager.C.

105 {
106  this->_matrix_coeffs.addPiecewiseBlocks(name, coef, blocks);
107  return getMatrixCoefficient(name);
108 }
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 27 of file CoefficientManager.C.

Referenced by MFEMProblem::addFunction(), MFEMProblem::addGridFunction(), MFEMProblem::addPostprocessor(), and declareScalar().

28 {
29  return this->declareScalar(name, this->getScalarCoefficientPtr(existing_or_literal));
30 }
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 47 of file CoefficientManager.h.

48  {
49  auto coef = _scalar_coeffs.make<P>(args...);
50  this->declareScalar(name, coef);
51  return *coef;
52  }
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 20 of file CoefficientManager.C.

21 {
22  this->_scalar_coeffs.addCoefficient(name, coef);
23  return *coef;
24 }
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 42 of file CoefficientManager.C.

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

45 {
46  std::shared_ptr<mfem::Coefficient> coef = this->getScalarCoefficientPtr(existing_or_literal);
47  if (std::dynamic_pointer_cast<mfem::PWCoefficient>(coef))
48  mooseError("Properties must not be defined out of other properties or piecewise coefficients.");
49  return this->declareScalarProperty(name, blocks, coef);
50 }
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:302
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 71 of file CoefficientManager.h.

74  {
75  return this->declareScalarProperty(name, blocks, _scalar_coeffs.make<P>(args...));
76  }
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 33 of file CoefficientManager.C.

36 {
37  this->_scalar_coeffs.addPiecewiseBlocks(name, coef, blocks);
38  return getScalarCoefficient(name);
39 }
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 61 of file CoefficientManager.C.

Referenced by MFEMProblem::addFunction(), MFEMProblem::addGridFunction(), and declareVector().

62 {
63  return this->declareVector(name, this->getVectorCoefficientPtr(existing_or_literal));
64 }
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 85 of file CoefficientManager.h.

86  {
87  auto coef = _vector_coeffs.make<P>(args...);
88  this->declareVector(name, coef);
89  return *coef;
90  }
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 53 of file CoefficientManager.C.

55 {
56  this->_vector_coeffs.addCoefficient(name, coef);
57  return *coef;
58 }
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 76 of file CoefficientManager.C.

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

79 {
80  std::shared_ptr<mfem::VectorCoefficient> coef =
81  this->getVectorCoefficientPtr(existing_or_literal);
82  if (std::dynamic_pointer_cast<mfem::PWVectorCoefficient>(coef))
83  mooseError("Properties must not be defined out of other properties or piecewise coefficients.");
84  return this->declareVectorProperty(name, blocks, coef);
85 }
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
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 110 of file CoefficientManager.h.

113  {
114  return this->declareVectorProperty(name, blocks, _vector_coeffs.make<P>(args...));
115  }
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 67 of file CoefficientManager.C.

70 {
71  this->_vector_coeffs.addPiecewiseBlocks(name, coef, blocks);
72  return getVectorCoefficient(name);
73 }
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 173 of file CoefficientManager.C.

Referenced by declareMatrixProperty(), and MFEMGeneralUserObject::getMatrixCoefficient().

174 {
175  return *this->getMatrixCoefficientPtr(name);
176 }
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 154 of file CoefficientManager.C.

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

155 {
156  return this->_matrix_coeffs.getCoefficientPtr(name);
157  // TODO: Work out how to parse literal matrices from input.
158 }
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 161 of file CoefficientManager.C.

Referenced by declareScalarProperty(), and MFEMGeneralUserObject::getScalarCoefficient().

162 {
163  return *this->getScalarCoefficientPtr(name);
164 }
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 122 of file CoefficientManager.C.

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

123 {
124  if (this->_scalar_coeffs.hasCoefficient(name))
125  return this->_scalar_coeffs.getCoefficientPtr(name);
126  // If name not present, check if it can be parsed cleanly into a real number
127  std::istringstream ss(MooseUtils::trim(name));
128  mfem::real_t real_value;
129  if (ss >> real_value && ss.eof())
130  {
131  this->declareScalar<mfem::ConstantCoefficient>(name, real_value);
132  return this->_scalar_coeffs.getCoefficientPtr(name);
133  }
134  mooseError("Scalar coefficient with name '" + name + "' has not been declared.");
135 }
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:302
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 167 of file CoefficientManager.C.

Referenced by declareVectorProperty(), and MFEMGeneralUserObject::getVectorCoefficient().

168 {
169  return *this->getVectorCoefficientPtr(name);
170 }
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 138 of file CoefficientManager.C.

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

139 {
140  if (this->_vector_coeffs.hasCoefficient(name))
141  return this->_vector_coeffs.getCoefficientPtr(name);
142  // If name not present, check if it can be parsed cleanly into a vector of real numbers
143  std::vector<mfem::real_t> vec_values;
144  if (MooseUtils::tokenizeAndConvert(name, vec_values) && vec_values.size() > 0)
145  {
146  this->declareVector<mfem::VectorConstantCoefficient>(
147  name, mfem::Vector(vec_values.data(), vec_values.size()));
148  return this->_vector_coeffs.getCoefficientPtr(name);
149  }
150  mooseError("Vector coefficient with name '" + name + "' has not been declared.");
151 }
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:302
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

◆ matrixPropertyIsDefined()

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

Definition at line 193 of file CoefficientManager.C.

195 {
196  return this->_matrix_coeffs.propertyDefinedOnBlock(name, block);
197 }
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 179 of file CoefficientManager.C.

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

◆ setTime()

void Moose::MFEM::CoefficientManager::setTime ( const double  time)

◆ vectorPropertyIsDefined()

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

Definition at line 186 of file CoefficientManager.C.

188 {
189  return this->_vector_coeffs.propertyDefinedOnBlock(name, block);
190 }
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: