www.mooseframework.org
LayeredBase.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 "Moose.h"
14 #include "MooseEnum.h"
15 #include "MooseTypes.h"
16 #include "Restartable.h"
17 
18 // Forward Declarations
19 class InputParameters;
20 class SubProblem;
21 class UserObject;
22 
23 namespace libMesh
24 {
25 class Point;
26 }
27 
28 template <typename T>
30 
36 class LayeredBase : private Restartable
37 {
38 public:
40 
41  LayeredBase(const InputParameters & parameters);
42 
48  virtual Real integralValue(Point p) const;
49 
55  virtual Real getLayerValue(unsigned int layer) const;
56 
62  virtual unsigned int getLayer(Point p) const;
63 
67  const std::vector<Real> & getLayerCenters() const { return _layer_centers; }
68 
73  unsigned int direction() const { return _direction; }
74 
75  virtual void initialize();
76  virtual void finalize();
77  virtual void threadJoin(const UserObject & y);
78 
79 protected:
85  void setLayerValue(unsigned int layer, Real value);
86 
90  bool layerHasValue(unsigned int layer) const { return _layer_has_value[layer]; }
91 
95  void getBounds();
96 
100  void computeLayerCenters();
101 
103  std::string _layered_base_name;
104 
107 
110 
112  unsigned int _direction;
113 
116 
118  unsigned int _num_layers;
119 
121  std::vector<Real> _layer_bounds;
122 
124  unsigned int _sample_type;
125 
127  unsigned int _average_radius;
128 
131 
133  std::vector<Real> _layer_centers;
134 
137 
139  std::vector<Real> & _layer_values;
140 
142  std::vector<int> & _layer_has_value;
143 
146 
149 
150 private:
153 
155  std::vector<SubdomainID> _layer_bounding_blocks;
156 
159 };
std::vector< Real > & _layer_values
Value of the integral for each layer.
Definition: LayeredBase.h:139
bool _using_displaced_mesh
true if this object operates on the displaced mesh, otherwise false
Definition: LayeredBase.h:130
unsigned int direction() const
Get direction of the layers.
Definition: LayeredBase.h:73
A class for creating restricted objects.
Definition: Restartable.h:28
std::string _layered_base_name
Name of this object.
Definition: LayeredBase.h:103
SubProblem & _layered_base_subproblem
Subproblem for the child object.
Definition: LayeredBase.h:152
bool _interval_based
Whether or not this object is based on equally spaced intervals or "bounds".
Definition: LayeredBase.h:115
bool _cumulative
Whether the values are cumulative over the layers.
Definition: LayeredBase.h:145
void getBounds()
Compute bounds, restricted to blocks if given.
Definition: LayeredBase.C:414
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< int > & _layer_has_value
Whether or not each layer has had any value summed into it.
Definition: LayeredBase.h:142
static InputParameters validParams()
Definition: LayeredBase.C:22
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const InputParameters & _layered_base_params
Params for this object.
Definition: LayeredBase.h:106
std::vector< Real > _layer_centers
center coordinates of each layer
Definition: LayeredBase.h:133
virtual void threadJoin(const UserObject &y)
Definition: LayeredBase.C:339
unsigned int _direction
The component direction the layers are going in. We cache this for speed (so we&#39;re not always going t...
Definition: LayeredBase.h:112
std::vector< SubdomainID > _layer_bounding_blocks
List of SubdomainIDs, if given.
Definition: LayeredBase.h:155
unsigned int _average_radius
How many layers both above and below the found layer will be used in the average. ...
Definition: LayeredBase.h:127
bool layerHasValue(unsigned int layer) const
Whether or not a layer has a value.
Definition: LayeredBase.h:90
virtual Real integralValue(Point p) const
Given a Point return the integral value associated with the layer that point falls in...
Definition: LayeredBase.C:182
virtual Real getLayerValue(unsigned int layer) const
Get the value for a given layer.
Definition: LayeredBase.C:293
void computeLayerCenters()
Compute the center points for each layer.
Definition: LayeredBase.C:388
const std::vector< Real > & getLayerCenters() const
Get the center coordinates for the layers (along given direction)
Definition: LayeredBase.h:67
void setLayerValue(unsigned int layer, Real value)
Set the value for a particular layer.
Definition: LayeredBase.C:407
const bool _positive_cumulative_direction
Whether the cumulative values should be summed in the positive or negative direction.
Definition: LayeredBase.h:148
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
virtual void initialize()
Definition: LayeredBase.C:301
unsigned int _num_layers
Number of layers to split the mesh into.
Definition: LayeredBase.h:118
virtual void finalize()
Definition: LayeredBase.C:314
std::vector< Real > _layer_bounds
The boundaries of the layers.
Definition: LayeredBase.h:121
InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
virtual unsigned int getLayer(Point p) const
Helper function to return the layer the point lies in.
Definition: LayeredBase.C:348
This base class computes volume integrals of a variable storing partial sums for the specified number...
Definition: LayeredBase.h:36
Real _direction_min
Definition: LayeredBase.h:135
unsigned int _sample_type
How to sample the values.
Definition: LayeredBase.h:124
LayeredBase(const InputParameters &parameters)
Definition: LayeredBase.C:78
Real _direction_max
Definition: LayeredBase.h:136
Base class for user-specific data.
Definition: UserObject.h:39
bool _has_direction_max_min
whether the max/min coordinate in the direction is known from user input
Definition: LayeredBase.h:158
MooseEnum _direction_enum
The MooseEnum direction the layers are going in.
Definition: LayeredBase.h:109