10#ifdef MOOSE_MFEM_ENABLED
35 const std::vector<std::string> &
blocks,
36 std::shared_ptr<mfem::Coefficient> coef)
44 const std::vector<std::string> &
blocks,
45 const std::string & 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.");
53mfem::VectorCoefficient &
55 std::shared_ptr<mfem::VectorCoefficient> coef)
61mfem::VectorCoefficient &
67mfem::VectorCoefficient &
69 const std::vector<std::string> &
blocks,
70 std::shared_ptr<mfem::VectorCoefficient> coef)
76mfem::VectorCoefficient &
78 const std::vector<std::string> &
blocks,
79 const std::string & existing_or_literal)
81 std::shared_ptr<mfem::VectorCoefficient> coef =
83 if (std::dynamic_pointer_cast<mfem::PWVectorCoefficient>(coef))
84 mooseError(
"Properties must not be defined out of other properties or piecewise coefficients.");
88mfem::MatrixCoefficient &
90 std::shared_ptr<mfem::MatrixCoefficient> coef)
96mfem::MatrixCoefficient &
102mfem::MatrixCoefficient &
104 const std::vector<std::string> &
blocks,
105 std::shared_ptr<mfem::MatrixCoefficient> coef)
111mfem::MatrixCoefficient &
113 const std::vector<std::string> &
blocks,
114 const std::string & 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.");
122std::shared_ptr<mfem::Coefficient>
129 mfem::real_t real_value;
130 if (ss >> real_value && ss.eof())
132 this->declareScalar<mfem::ConstantCoefficient>(name, real_value);
135 mooseError(
"Scalar coefficient with name '" + name +
"' has not been declared.");
138std::shared_ptr<mfem::VectorCoefficient>
144 std::vector<mfem::real_t> vec_values;
147 this->declareVector<mfem::VectorConstantCoefficient>(
148 name, mfem::Vector(vec_values.data(), vec_values.size()));
151 mooseError(
"Vector coefficient with name '" + name +
"' has not been declared.");
154std::shared_ptr<mfem::MatrixCoefficient>
167mfem::VectorCoefficient &
173mfem::MatrixCoefficient &
181 const std::string & block)
const
188 const std::string & block)
const
195 const std::string & block)
const
211 auto mark_solution_changed = [](
auto & coef)
214 qf_coef->MarkSolutionChanged();
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Shared lazy-update state for quadrature function coefficients.
std::shared_ptr< mfem::Coefficient > getScalarCoefficientPtr(const std::string &name)
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.
bool scalarPropertyIsDefined(const std::string &name, const std::string &block) const
std::shared_ptr< mfem::VectorCoefficient > getVectorCoefficientPtr(const std::string &name)
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.
void setTime(const mfem::real_t time)
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...
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.
mfem::MatrixCoefficient & declareMatrix(const std::string &name, const std::string &existing_coef)
Declare an alias to an existing matrix coefficient.
mfem::MatrixCoefficient & getMatrixCoefficient(const std::string &name)
Return scalar coefficient with the given name.
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...
bool vectorPropertyIsDefined(const std::string &name, const std::string &block) const
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...
void markSolutionChanged()
Notify quadrature function coefficients that solution variables have changed, marking the stored valu...
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< mfem::MatrixCoefficient > getMatrixCoefficientPtr(const std::string &name)
bool matrixPropertyIsDefined(const std::string &name, const std::string &block) const
bool propertyDefinedOnBlock(const std::string &name, const std::string &block) const
void addCoefficient(const std::string &name, std::shared_ptr< T > coeff)
Add a named global coefficient.
bool hasCoefficient(const std::string &name) const
void addPiecewiseBlocks(const std::string &name, std::shared_ptr< T > coeff, const std::vector< std::string > &blocks)
Add piecewise material property.
std::shared_ptr< T > getCoefficientPtr(const std::string &name)
void setTime(const mfem::real_t time)
void apply(F &&func)
Apply a function to every coefficient created by this map.
bool tokenizeAndConvert(const std::string &str, std::vector< T > &tokenized_vector, const std::string &delimiter=" \t\n\v\f\r")
tokenizeAndConvert splits a string using delimiter and then converts to type T.
std::string trim(const std::string &str, const std::string &white_space=" \t\n\v\f\r")
Standard scripting language trim function.
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).