www.mooseframework.org
SamplerBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
67  virtual void addSample(const Point & p, const Real & id, const std::vector<Real> & values);
68 
74  virtual void initialize();
75 
81  virtual void finalize();
82 
91  virtual void threadJoin(const SamplerBase & y);
92 
95 
98 
101 
103  std::vector<std::string> _variable_names;
104 
106  const unsigned int _sort_by;
107 
114 
117 
118  std::vector<VectorPostprocessorValue *> _values;
119 };
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:75
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:103
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
VectorPostprocessorValue & _y
y coordinate of the points
Definition: SamplerBase.h:111
const unsigned int _sort_by
What to sort by.
Definition: SamplerBase.h:106
std::vector< VectorPostprocessorValue * > _values
Definition: SamplerBase.h:118
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:51
VectorPostprocessor * _vpp
The child VectorPostprocessor.
Definition: SamplerBase.h:97
virtual void threadJoin(const SamplerBase &y)
Join the values.
Definition: SamplerBase.C:145
VectorPostprocessorValue & _x
x coordinate of the points
Definition: SamplerBase.h:109
static InputParameters validParams()
Definition: SamplerBase.C:22
const InputParameters & _sampler_params
The child params.
Definition: SamplerBase.h:94
SamplerBase(const InputParameters &parameters, VectorPostprocessor *vpp, const libMesh::Parallel::Communicator &comm)
Definition: SamplerBase.C:36
virtual void finalize()
Finalize the values.
Definition: SamplerBase.C:91
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:192
VectorPostprocessorValue & _id
The node ID of each point.
Definition: SamplerBase.h:116
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:61
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:113
const libMesh::Parallel::Communicator & _comm
The communicator of the child.
Definition: SamplerBase.h:100
Base class for Postprocessors that produce a vector of values.