10#ifdef MOOSE_MFEM_ENABLED
24 std::vector<Point> points;
25 points.reserve(num_points);
26 for (
const auto i_point : make_range(num_points))
29 Real t =
static_cast<Real
>(i_point) /
static_cast<Real
>(num_points - 1);
30 points.push_back(t * end_point + (1 - t) * start_point);
46 auto & variables = parameters.
get<std::vector<VariableName>>(
"variables");
48 if (variables.empty())
49 parameters.
paramError(
"variables",
"In MFEMVariableSamplerBase: variables must not be empty.");
51 auto & first_variable = variables[0];
52 auto &
mesh =
const_cast<mfem::ParMesh &
>(problem.getMFEMVariableMesh(first_variable));
55 for (
const auto & variable : variables)
56 if (&problem.getMFEMVariableMesh(variable) != &
mesh)
57 parameters.paramError(
"variables",
58 "In MFEMVariableSamplerBase:"
59 " all variables must be on the same mesh. Found: ",
61 " which is not on the same mesh as: ",
73 MFEMExecutedObject::addRequiredDependencyParam<std::vector<VariableName>>(
74 params,
"variables",
"The variables that this VectorPostprocessor samples.");
75 MooseEnum avg_type(getL2AverageTypeOptions(),
"ARITHMETIC");
78 "Average type used when sampling L2 functions at element boundaries.");
83 const std::vector<Point> & points)
85 _var_names(getParam<
std::vector<VariableName>>(
"variables"))
87 _finder.SetL2AvgType(
static_cast<mfem::FindPointsGSLIB::AvgType
>(
88 getParam<MooseEnum>(
"side_interpolation_type").getEnum<L2AverageType>()));
97 const auto var_indices = index_range(
_var_names);
102 { return getFESpaceContinuityType(i) == mfem::FiniteElementCollection::CONTINUOUS; }))
105 const auto & point_codes =
_finder.GetCode();
108 for (
const auto i_var : index_range(
_var_names))
111 case mfem::FiniteElementCollection::DISCONTINUOUS:
114 " found a point on an element boundary but the FE space is discontinuous at "
115 "element boundaries: ",
119 " is discontinuous.");
121 case mfem::FiniteElementCollection::TANGENTIAL:
126 " on an element boundary. The H(curl) finite element space has a continuous "
127 "tangential trace there, but the normal component may differ between "
128 "elements. The element selected by GSLIB will supply the sampled value.",
130 " has tangential continuity.");
132 case mfem::FiniteElementCollection::NORMAL:
137 " on an element boundary. The H(div) finite element space has a continuous "
138 "normal trace there, but the tangential component may differ between "
139 "elements. The element selected by GSLIB will supply the sampled value.",
141 " has normal continuity.");
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
CreateMooseEnumClass(Mortar3DSubpatchPlane, GEOMETRIC_NORMAL, AVERAGED_NODAL_NORMAL)
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
Abstract base class for sampling MFEM quantities at points.
mfem::FindPointsGSLIB _finder
GSLIB point finder used to locate and interpolate the query points.
static InputParameters validParams()
PointLocationCode
Classification returned by GSLIB for a query point's location.
const std::vector< Point > _query_points
Original query points used for point-location diagnostics.
void initialSetup() override
Checks that all query points were found and prepares coordinate output.
virtual int getFESpaceContinuityType(size_t i_var) const =0
Return the continuity type of the i-th sampled variable's finite element collection.
static InputParameters validParams()
void initialSetup() override
Checks point locations and warns when sampled components may be discontinuous at boundaries.
const std::vector< VariableName > _var_names
Names of the variables being sampled.
MFEMVariableSamplerBase(const InputParameters ¶meters, const std::vector< Point > &points)
std::string typeAndName() const
Get the class's combined type and name; useful in error handling.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Generic class for solving transient nonlinear problems.
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
std::vector< Point > generateLinePoints(const Point &start_point, const Point &end_point, unsigned int num_points)