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 class TransientBase;
19 
20 namespace libMesh
21 {
22 class Point;
23 
24 namespace Parallel
25 {
26 class Communicator;
27 }
28 }
29 
30 template <typename T>
32 
38 {
39 public:
41 
47  SamplerBase(const InputParameters & parameters,
48  VectorPostprocessor * vpp,
49  const libMesh::Parallel::Communicator & comm);
50  virtual ~SamplerBase() = default;
51 
52 protected:
60  void setupVariables(const std::vector<std::string> & variable_names);
61 
69  const std::string & var_param_name = "variable") const;
70 
77  virtual void addSample(const Point & p, const Real & id, const std::vector<Real> & values);
78 
84  virtual void initialize();
85 
91  virtual void finalize();
92 
101  virtual void threadJoin(const SamplerBase & y);
102 
105 
108 
111 
114 
116  std::vector<std::string> _variable_names;
117 
119  const unsigned int _sort_by;
120 
127 
130 
131  std::vector<VectorPostprocessorValue *> _values;
132 
133 private:
135  std::size_t _curr_num_samples = 0;
137  std::set<std::size_t, std::greater<std::size_t>> _curr_indices;
139  std::size_t _curr_total_samples = 0;
140 };
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition: SamplerBase.h:37
virtual void initialize()
Initialize the datastructures.
Definition: SamplerBase.C:86
const TransientBase *const _sampler_transient
Transient executioner used to determine if the last solve converged.
Definition: SamplerBase.h:113
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:116
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:124
const unsigned int _sort_by
What to sort by.
Definition: SamplerBase.h:119
std::vector< VectorPostprocessorValue * > _values
Definition: SamplerBase.h:131
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:60
VectorPostprocessor * _vpp
The child VectorPostprocessor.
Definition: SamplerBase.h:107
virtual void threadJoin(const SamplerBase &y)
Join the values.
Definition: SamplerBase.C:225
std::set< std::size_t, std::greater< std::size_t > > _curr_indices
The indices of the samples in the last execution.
Definition: SamplerBase.h:137
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
Definition: TransientBase.h:27
VectorPostprocessorValue & _x
x coordinate of the points
Definition: SamplerBase.h:122
static InputParameters validParams()
Definition: SamplerBase.C:27
const InputParameters & _sampler_params
The child params.
Definition: SamplerBase.h:104
SamplerBase(const InputParameters &parameters, VectorPostprocessor *vpp, const libMesh::Parallel::Communicator &comm)
Definition: SamplerBase.C:41
virtual void finalize()
Finalize the values.
Definition: SamplerBase.C:159
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:203
VectorPostprocessorValue & _id
The node ID of each point.
Definition: SamplerBase.h:129
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:70
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ~SamplerBase()=default
std::size_t _curr_total_samples
The full size of the vector since the last execution.
Definition: SamplerBase.h:139
InputParameters validParams()
VectorPostprocessorValue & _z
x coordinate of the points
Definition: SamplerBase.h:126
const libMesh::Parallel::Communicator & _comm
The communicator of the child.
Definition: SamplerBase.h:110
std::size_t _curr_num_samples
The number of samples added in the last execution.
Definition: SamplerBase.h:135
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:132