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)
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
virtual Elem * queryElemPtr(const dof_id_type i)
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default),...
std::vector< Point > _points
The points to evaluate at.
const Elem * getLocalElemContainingPoint(const Point &p)
Find the local element that contains the point.
std::vector< std::vector< Real > > _point_values
Vector of values per 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...
MooseMesh & _mesh
The Mesh we're using.
static InputParameters validParams()
std::unique_ptr< libMesh::PointLocatorBase > _pl
Point locator.
virtual void finalize()
Finalize.
bool _discontinuous_at_faces
Whether values are requested for objects that are discontinuous on faces.
virtual void initialize()
Called before execute() is ever called so that data can be cleared.
std::vector< Real > _ids
The ID to use for each point (yes, this is Real on purpose)
const bool _warn_discontinuous_face_values
Whether to return a warning if a discontinuous variable is sampled on a face.
PointSamplerBase(const InputParameters ¶meters)
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
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.
virtual void initialize()
Initialize the datastructures.
virtual void finalize()
Finalize the values.
const libMesh::Parallel::Communicator & _comm
The communicator of the child.
static InputParameters validParams()
void maxloc(T &r, unsigned int &max_id) const
void set_union(T &data, const unsigned int root_id) const
processor_id_type processor_id() const
const Parallel::Communicator & comm() const