10 #ifdef MOOSE_MFEM_ENABLED 36 "The scalar coefficient to sample.");
38 "The points where the coefficient is evaluated.");
45 _coefficient(nullptr),
46 _interp_vals(_query_points.size()),
47 _declared_vals(declareVector(getParam<MFEMScalarCoefficientName>(
"coefficient")))
56 if (dynamic_cast<mfem::QuadratureFunctionCoefficient *>(
_coefficient))
58 "Quadrature-function-backed coefficients can only be evaluated at the quadrature " 59 "points configured by their quadrature rule and cannot be sampled at arbitrary " 68 mfem::Array<unsigned int> received_elements;
69 mfem::Array<unsigned int> received_codes;
70 mfem::Vector received_reference_points;
71 _finder.DistributePointInfoToOwningMPIRanks(
72 received_elements, received_reference_points, received_codes);
74 const auto mesh_dim =
_mesh.Dimension();
75 mfem::Vector evaluated_values(received_elements.Size());
76 for (
const auto i :
make_range(received_elements.Size()))
78 mfem::IntegrationPoint integration_point;
79 integration_point.Set(&received_reference_points[mesh_dim * i], mesh_dim);
81 auto & transformation = *
_mesh.GetElementTransformation(received_elements[i]);
82 transformation.SetIntPoint(&integration_point);
83 evaluated_values[i] =
_coefficient->Eval(transformation, integration_point);
87 _finder.DistributeInterpolatedValues(evaluated_values, 1, mfem::Ordering::byVDIM,
_interp_vals);
93 const auto *
const interp_vals =
_interp_vals.HostRead();
98 #endif // MOOSE_MFEM_ENABLED void finalizeValues() override
Copies interpolated values into the subclass VPP vectors.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
mfem::Vector _interp_vals
Values evaluated on owning ranks and returned to the querying ranks.
virtual MFEMMesh & mesh() override
Overwritten mesh() method from base MooseMesh to retrieve the correct mesh type, in this case MFEMMes...
void initialSetup() override
Checks point locations and warns when GSLIB selects an element at a boundary.
Samples a real scalar MFEM coefficient at specified points.
VectorPostprocessorValue & _declared_vals
VectorPostprocessor output column for the coefficient.
static InputParameters validParams()
void initialSetup() override
Checks that all query points were found.
Abstract base class for sampling MFEM quantities at points.
mfem::Coefficient * _coefficient
Scalar coefficient being sampled, resolved after all coefficient-declaring objects exist...
mfem::ParMesh & _mesh
MFEM mesh on which the sampled quantity is defined.
Generic class for solving transient nonlinear problems.
mfem::ParMesh & getMFEMParMesh()
Accessors for the _mfem_par_mesh object.
mfem::FindPointsGSLIB _finder
GSLIB point finder used to locate and interpolate the query points.
mfem::Coefficient & getScalarCoefficient(const std::string &name)
Retrieve a scalar MFEM coefficient using the value of an input parameter.
IntRange< T > make_range(T beg, T end)
static InputParameters validParams()
MFEMScalarCoefficientPointValueSampler(const InputParameters ¶meters)
const std::vector< Point > _query_points
Original query points used for point-location diagnostics.
auto index_range(const T &sizable)
const Elem & get(const ElemType type_in)
void execute() override
Evaluates the coefficient in each point's owning element.
registerMooseObject("MooseApp", MFEMScalarCoefficientPointValueSampler)