16 #include "libmesh/mesh_tools.h" 26 "scaling", 1.0,
"The postprocessor that the variables are multiplied with");
28 "warn_discontinuous_face_values",
30 "Whether to return a warning if a discontinuous variable is sampled on a face");
38 _mesh(_subproblem.
mesh()),
39 _pp_value(getPostprocessorValue(
"scaling")),
40 _warn_discontinuous_face_values(getParam<bool>(
"warn_discontinuous_face_values")),
41 _discontinuous_at_faces(false)
51 auto old_size =
_ids.size();
53 std::iota(
_ids.begin() + old_size,
_ids.end(), old_size);
66 _pl->enable_out_of_mesh_mode();
94 if (pid == 0 && !_global_found_points[i])
108 const Elem * elem =
nullptr;
111 libmesh_parallel_only(
comm());
114 std::set<const Elem *> candidate_elements;
115 (*_pl)(p, candidate_elements);
118 std::set<dof_id_type> candidate_ids;
119 for (
auto candidate : candidate_elements)
120 candidate_ids.insert(candidate->id());
125 if (candidate_elements.size())
133 mooseDoOnce(
mooseWarning(
"A discontinuous variable is sampled on a face, at ", p));
141 std::set<const Elem *> candidate_elements;
142 (*_pl)(p, candidate_elements);
145 for (
auto candidate : candidate_elements)
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
virtual void initialize()
Initialize the datastructures.
std::vector< Real > _ids
The ID to use for each point (yes, this is Real on purpose)
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
virtual void initialize()
Initialize the datastructures.
const Parallel::Communicator & comm() const
std::vector< Point > _points
The points to evaluate at.
virtual const std::string & name() const
Get the name of the class.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
virtual Elem * queryElemPtr(const dof_id_type i)
virtual void finalize()
Finalize.
std::vector< std::vector< Real > > _point_values
Vector of values per point.
const bool _warn_discontinuous_face_values
Whether to return a warning if a discontinuous variable is sampled on a face.
static InputParameters validParams()
const Elem * getLocalElemContainingPoint(const Point &p)
Find the local element that contains the point.
std::vector< short > _found_points
Whether or not the Point was found on this processor (short because bool and char don't work with MPI...
static InputParameters validParams()
void maxloc(T &r, unsigned int &max_id) const
bool _discontinuous_at_faces
Whether values are requested for objects that are discontinuous on faces.
static InputParameters validParams()
PointSamplerBase(const InputParameters ¶meters)
virtual void finalize()
Finalize the values.
virtual void addSample(const Point &p, const Real &id, const std::vector< Real > &values)
Call this with the value of every variable at each point you want to sample at.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
std::unique_ptr< PointLocatorBase > _pl
Point locator.
MooseMesh & _mesh
The Mesh we're using.
const libMesh::Parallel::Communicator & _comm
The communicator of the child.
processor_id_type processor_id() const
virtual std::unique_ptr< PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default)...
void set_union(T &data, const unsigned int root_id) const