https://mooseframework.inl.gov
SamplerBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "MooseTypes.h"
14 
15 // Forward Declarations
16 class InputParameters;
18 
19 namespace libMesh
20 {
21 class Point;
22 
23 namespace Parallel
24 {
25 class Communicator;
26 }
27 }
28 
29 template <typename T>
31 
37 {
38 public:
40 
46  SamplerBase(const InputParameters & parameters,
47  VectorPostprocessor * vpp,
48  const libMesh::Parallel::Communicator & comm);
49  virtual ~SamplerBase() = default;
50 
51 protected:
59  void setupVariables(const std::vector<std::string> & variable_names);
60 
68  const std::string & var_param_name = "variable") const;
69 
76  virtual void addSample(const Point & p, const Real & id, const std::vector<Real> & values);
77 
83  virtual void initialize();
84 
90  virtual void finalize();
91 
100  virtual void threadJoin(const SamplerBase & y);
101 
104 
107 
110 
112  std::vector<std::string> _variable_names;
113 
115  const unsigned int _sort_by;
116 
123 
126 
127  std::vector<VectorPostprocessorValue *> _values;
128 };
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition: SamplerBase.h:36
virtual void initialize()
Initialize the datastructures.
Definition: SamplerBase.C:77
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< std::string > _variable_names
The variable names.
Definition: SamplerBase.h:112
This class provides an interface for common operations on field variables of both FE and FV types wit...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
VectorPostprocessorValue & _y
y coordinate of the points
Definition: SamplerBase.h:120
const unsigned int _sort_by
What to sort by.
Definition: SamplerBase.h:115
std::vector< VectorPostprocessorValue * > _values
Definition: SamplerBase.h:127
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...
Definition: SamplerBase.C:53
VectorPostprocessor * _vpp
The child VectorPostprocessor.
Definition: SamplerBase.h:106
virtual void threadJoin(const SamplerBase &y)
Join the values.
Definition: SamplerBase.C:174
VectorPostprocessorValue & _x
x coordinate of the points
Definition: SamplerBase.h:118
static InputParameters validParams()
Definition: SamplerBase.C:24
const InputParameters & _sampler_params
The child params.
Definition: SamplerBase.h:103
SamplerBase(const InputParameters &parameters, VectorPostprocessor *vpp, const libMesh::Parallel::Communicator &comm)
Definition: SamplerBase.C:38
virtual void finalize()
Finalize the values.
Definition: SamplerBase.C:120
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:203
VectorPostprocessorValue & _id
The node ID of each point.
Definition: SamplerBase.h:125
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.
Definition: SamplerBase.C:63
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ~SamplerBase()=default
InputParameters validParams()
VectorPostprocessorValue & _z
x coordinate of the points
Definition: SamplerBase.h:122
const libMesh::Parallel::Communicator & _comm
The communicator of the child.
Definition: SamplerBase.h:109
Base class for Postprocessors that produce a vector of values.
void checkForStandardFieldVariableType(const MooseVariableFieldBase *const var_ptr, const std::string &var_param_name="variable") const
Checks whether the passed variable pointer corresponds to a regular single-valued field variable...
Definition: SamplerBase.C:93