19 #include "libmesh/point.h" 31 params.
set<
bool>(
"_auto_broadcast") =
false;
39 : _sampler_params(parameters),
43 _x(vpp->declareVector(
"x")),
44 _y(vpp->declareVector(
"y")),
45 _z(vpp->declareVector(
"z")),
46 _id(vpp->declareVector(
"id"))
54 _values.reserve(variable_names.size());
56 for (
const auto & variable_name : variable_names)
69 mooseAssert(values.size() ==
_variable_names.size(),
"Mismatch of variable names to vector size");
70 for (MooseIndex(values) i = 0; i < values.size(); ++i)
71 _values[i]->emplace_back(values[i]);
98 constexpr
auto NUM_ID_VECTORS = 4;
100 std::vector<VectorPostprocessorValue *> vec_ptrs;
101 vec_ptrs.reserve(
_values.size() + NUM_ID_VECTORS);
108 for (
auto vec_ptr : vec_ptrs)
112 std::vector<std::size_t> sorted_indices;
124 auto vector_length = sorted_indices.size();
128 for (
const auto vec_ptr : vec_ptrs)
129 if (vec_ptr->size() != vector_length)
134 for (
auto & vec_ptr : vec_ptrs)
136 for (MooseIndex(sorted_indices) j = 0; j < sorted_indices.size(); ++j)
137 tmp_vector[j] = (*vec_ptr)[sorted_indices[j]];
140 vec_ptr->swap(tmp_vector);
147 _x.insert(
_x.end(), y.
_x.begin(), y.
_x.end());
148 _y.insert(
_y.end(), y.
_y.begin(), y.
_y.end());
149 _z.insert(
_z.end(), y.
_z.begin(), y.
_z.end());
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
virtual void initialize()
Initialize the datastructures.
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
void indirectSort(RandomAccessIterator beg, RandomAccessIterator end, std::vector< size_t > &b)
processor_id_type rank() const
std::vector< std::string > _variable_names
The variable names.
VectorPostprocessorValue & _y
y coordinate of the points
const unsigned int _sort_by
What to sort by.
std::vector< VectorPostprocessorValue * > _values
void setupVariables(const std::vector< std::string > &variable_names)
You MUST call this in the constructor of the child class and pass down the name of the variables...
bool containsCompleteHistory() const
Return whether or not this VectorPostprocessor contains complete history.
VectorPostprocessor * _vpp
The child VectorPostprocessor.
virtual void threadJoin(const SamplerBase &y)
Join the values.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
VectorPostprocessorValue & declareVector(const std::string &vector_name)
Register a new vector to fill up.
VectorPostprocessorValue & _x
x coordinate of the points
static InputParameters validParams()
SamplerBase(const InputParameters ¶meters, VectorPostprocessor *vpp, const libMesh::Parallel::Communicator &comm)
virtual void finalize()
Finalize the values.
std::vector< Real > VectorPostprocessorValue
VectorPostprocessorValue & _id
The node ID of each point.
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.
VectorPostprocessorValue & _z
x coordinate of the points
const libMesh::Parallel::Communicator & _comm
The communicator of the child.
Base class for Postprocessors that produce a vector of values.