Base class for VectorPostprocessors that need to do "sampling" of values in the domain. More...
#include <SamplerBase.h>
Public Member Functions | |
SamplerBase (const InputParameters ¶meters, VectorPostprocessor *vpp, const libMesh::Parallel::Communicator &comm) | |
virtual | ~SamplerBase ()=default |
Static Public Member Functions | |
static InputParameters | validParams () |
Protected Member Functions | |
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. More... | |
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. More... | |
virtual void | initialize () |
Initialize the datastructures. More... | |
virtual void | finalize () |
Finalize the values. More... | |
virtual void | threadJoin (const SamplerBase &y) |
Join the values. More... | |
Protected Attributes | |
const InputParameters & | _sampler_params |
The child params. More... | |
VectorPostprocessor * | _vpp |
The child VectorPostprocessor. More... | |
const libMesh::Parallel::Communicator & | _comm |
The communicator of the child. More... | |
std::vector< std::string > | _variable_names |
The variable names. More... | |
const unsigned int | _sort_by |
What to sort by. More... | |
VectorPostprocessorValue & | _x |
x coordinate of the points More... | |
VectorPostprocessorValue & | _y |
y coordinate of the points More... | |
VectorPostprocessorValue & | _z |
x coordinate of the points More... | |
VectorPostprocessorValue & | _id |
The node ID of each point. More... | |
std::vector< VectorPostprocessorValue * > | _values |
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition at line 36 of file SamplerBase.h.
SamplerBase::SamplerBase | ( | const InputParameters & | parameters, |
VectorPostprocessor * | vpp, | ||
const libMesh::Parallel::Communicator & | comm | ||
) |
parameters | The parameters for the object |
vpp | A pointer to the child object |
comm | The communicator of the child |
Definition at line 36 of file SamplerBase.C.
|
virtualdefault |
|
protectedvirtual |
Call this with the value of every variable at each point you want to sample at.
p | The point where you took the sample |
id | This can either be an actual ID or a distance or anything else you want |
values | The value of each variable |
Definition at line 61 of file SamplerBase.C.
Referenced by SideValueSampler::execute(), LineFunctionSampler::execute(), ElementValueSampler::execute(), NodalValueSampler::execute(), and PointSamplerBase::finalize().
|
protectedvirtual |
Finalize the values.
YOU MUST CALL THIS DURING finalize() in the child class!
We have several vectors that all need to be processed in the same way. Rather than enumerate them all, let's just create a vector of pointers and work on them that way.
We now have one sorted vector. The remaining vectors need to be sorted according to that vector. We'll need a temporary vector to hold values as we map them according to the sorted indices. After that, we'll swap the vector contents with the sorted vector to get the values back into the original vector.
Reimplemented in LineMaterialSamplerBase< T >, LineMaterialSamplerBase< Real >, PointSamplerBase, ElementValueSampler, NodalValueSampler, LineFunctionSampler, and SideValueSampler.
Definition at line 91 of file SamplerBase.C.
Referenced by SideValueSampler::finalize(), LineFunctionSampler::finalize(), NodalValueSampler::finalize(), ElementValueSampler::finalize(), PointSamplerBase::finalize(), and LineMaterialSamplerBase< Real >::finalize().
|
protectedvirtual |
Initialize the datastructures.
YOU MUST CALL THIS DURING initialize() in the child class!
Reimplemented in LineMaterialSamplerBase< T >, LineMaterialSamplerBase< Real >, PointSamplerBase, PointVariableSamplerBase, PositionsFunctorValueSampler, ElementValueSampler, NodalValueSampler, LineFunctionSampler, PointValueSampler, and SideValueSampler.
Definition at line 75 of file SamplerBase.C.
Referenced by SideValueSampler::initialize(), LineFunctionSampler::initialize(), NodalValueSampler::initialize(), ElementValueSampler::initialize(), PointVariableSamplerBase::initialize(), PointSamplerBase::initialize(), and LineMaterialSamplerBase< Real >::initialize().
|
protected |
You MUST call this in the constructor of the child class and pass down the name of the variables.
variable_names | The names of the variables. Note: The order of the variables sets the order of the values for addSample() |
Definition at line 51 of file SamplerBase.C.
Referenced by ElementValueSampler::ElementValueSampler(), LineFunctionSampler::LineFunctionSampler(), LineMaterialSamplerBase< Real >::LineMaterialSamplerBase(), NodalValueSampler::NodalValueSampler(), PointVariableSamplerBase::PointVariableSamplerBase(), PositionsFunctorValueSampler::PositionsFunctorValueSampler(), and SideValueSampler::SideValueSampler().
|
protectedvirtual |
Join the values.
YOU MUST CALL THIS DURING threadJoin() in the child class!
y | You must cast the UserObject to your child class type first then you can pass it in here. |
Definition at line 145 of file SamplerBase.C.
Referenced by SideValueSampler::threadJoin(), ElementValueSampler::threadJoin(), and NodalValueSampler::threadJoin().
|
static |
Definition at line 22 of file SamplerBase.C.
Referenced by SideValueSampler::validParams(), LineFunctionSampler::validParams(), NodalValueSampler::validParams(), ElementValueSampler::validParams(), PointVariableSamplerBase::validParams(), PointSamplerBase::validParams(), and LineMaterialSamplerBase< Real >::validParams().
|
protected |
The communicator of the child.
Definition at line 100 of file SamplerBase.h.
Referenced by PointSamplerBase::finalize(), finalize(), and initialize().
|
protected |
The node ID of each point.
Definition at line 116 of file SamplerBase.h.
Referenced by addSample(), finalize(), LineValueSampler::getValue(), initialize(), and threadJoin().
|
protected |
The child params.
Definition at line 94 of file SamplerBase.h.
|
protected |
What to sort by.
Definition at line 106 of file SamplerBase.h.
Referenced by finalize(), and LineValueSampler::getValue().
|
protected |
Definition at line 118 of file SamplerBase.h.
Referenced by addSample(), finalize(), LineValueSampler::getValue(), initialize(), setupVariables(), and threadJoin().
|
protected |
The variable names.
Definition at line 103 of file SamplerBase.h.
Referenced by addSample(), setupVariables(), and threadJoin().
|
protected |
The child VectorPostprocessor.
Definition at line 97 of file SamplerBase.h.
Referenced by initialize(), and setupVariables().
|
protected |
x coordinate of the points
Definition at line 109 of file SamplerBase.h.
Referenced by addSample(), finalize(), initialize(), and threadJoin().
|
protected |
y coordinate of the points
Definition at line 111 of file SamplerBase.h.
Referenced by addSample(), finalize(), initialize(), and threadJoin().
|
protected |
x coordinate of the points
Definition at line 113 of file SamplerBase.h.
Referenced by addSample(), finalize(), initialize(), and threadJoin().