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.");
53 mfem::VectorCoefficient &
55 std::shared_ptr<mfem::VectorCoefficient> coef)
61 mfem::VectorCoefficient &
67 mfem::VectorCoefficient &
69 const std::vector<std::string> &
blocks,
70 std::shared_ptr<mfem::VectorCoefficient> coef)
76 mfem::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.");
88 mfem::MatrixCoefficient &
90 std::shared_ptr<mfem::MatrixCoefficient> coef)
96 mfem::MatrixCoefficient &
102 mfem::MatrixCoefficient &
104 const std::vector<std::string> &
blocks,
105 std::shared_ptr<mfem::MatrixCoefficient> coef)
111 mfem::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.");
122 std::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.");
138 std::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.");
154 std::shared_ptr<mfem::MatrixCoefficient>
167 mfem::VectorCoefficient &
173 mfem::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)
213 if (
auto *
const qf_coef = dynamic_cast<MFEMQuadratureFunctionCoefficientBase *>(&coef))
214 qf_coef->MarkSolutionChanged();
std::string name(const ElemQuality q)
bool propertyDefinedOnBlock(const std::string &name, const std::string &block) const
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 mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
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 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.
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
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::VectorCoefficient > getVectorCoefficientPtr(const std::string &name)
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.
mfem::MatrixCoefficient & getMatrixCoefficient(const std::string &name)
Return scalar coefficient with the given name.
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)
void addCoefficient(const std::string &name, std::shared_ptr< T > coeff)
Add a named global coefficient.
void apply(F &&func)
Apply a function to every coefficient created by this map.
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::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
bool vectorPropertyIsDefined(const std::string &name, const std::string &block) const
void setTime(const mfem::real_t time)
void setTime(const mfem::real_t time)
bool matrixPropertyIsDefined(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...
std::shared_ptr< T > getCoefficientPtr(const std::string &name)
void addPiecewiseBlocks(const std::string &name, std::shared_ptr< T > coeff, const std::vector< std::string > &blocks)
Add piecewise material property.
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
bool hasCoefficient(const std::string &name) const