https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LayeredBase.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 "Moose.h"
14#include "MooseEnum.h"
15#include "MooseTypes.h"
16#include "Restartable.h"
17
18// Forward Declarations
19class InputParameters;
20class SubProblem;
21class UserObject;
22
23namespace libMesh
24{
25class Point;
26}
27
28template <typename T>
30
36class LayeredBase : private Restartable
37{
38public:
40
41 LayeredBase(const InputParameters & parameters);
42
48 virtual Real integralValue(const Point & p) const;
49
55 virtual Real getLayerValue(unsigned int layer) const;
56
62 virtual unsigned int getLayer(const 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
79protected:
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
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
150private:
153
155 std::vector<SubdomainID> _layer_bounding_blocks;
156
159};
InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
This base class computes volume integrals of a variable storing partial sums for the specified number...
Definition LayeredBase.h:37
virtual void threadJoin(const UserObject &y)
const std::vector< Real > & getLayerCenters() const
Get the center coordinates for the layers (along given direction)
Definition LayeredBase.h:67
SubProblem & _layered_base_subproblem
Subproblem for the child object.
bool _has_direction_max_min
whether the max/min coordinate in the direction is known from user input
unsigned int _num_layers
Number of layers to split the mesh into.
bool layerHasValue(unsigned int layer) const
Whether or not a layer has a value.
Definition LayeredBase.h:90
virtual Real getLayerValue(unsigned int layer) const
Get the value for a given layer.
std::string _layered_base_name
Name of this object.
bool _interval_based
Whether or not this object is based on equally spaced intervals or "bounds".
Real _direction_max
unsigned int direction() const
Get direction of the layers.
Definition LayeredBase.h:73
bool _using_displaced_mesh
true if this object operates on the displaced mesh, otherwise false
virtual unsigned int getLayer(const Point &p) const
Helper function to return the layer the point lies in.
void setLayerValue(unsigned int layer, Real value)
Set the value for a particular layer.
std::vector< SubdomainID > _layer_bounding_blocks
List of SubdomainIDs, if given.
std::vector< int > & _layer_has_value
Whether or not each layer has had any value summed into it.
void computeLayerCenters()
Compute the center points for each layer.
std::vector< Real > _layer_centers
center coordinates of each layer
unsigned int _sample_type
How to sample the values.
bool _cumulative
Whether the values are cumulative over the layers.
const bool _positive_cumulative_direction
Whether the cumulative values should be summed in the positive or negative direction.
virtual Real integralValue(const Point &p) const
Given a Point return the integral value associated with the layer that point falls in.
static InputParameters validParams()
Definition LayeredBase.C:22
const InputParameters & _layered_base_params
Params for this object.
MooseEnum _direction_enum
The MooseEnum direction the layers are going in.
unsigned int _direction
The component direction the layers are going in. We cache this for speed (so we're not always going t...
Real _direction_min
unsigned int _average_radius
How many layers both above and below the found layer will be used in the average.
std::vector< Real > _layer_bounds
The boundaries of the layers.
virtual void finalize()
virtual void initialize()
std::vector< Real > & _layer_values
Value of the integral for each layer.
void getBounds()
Compute bounds, restricted to blocks if given.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
A class for creating restricted objects.
Definition Restartable.h:29
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
Base class for user-specific data.
Definition UserObject.h:20
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...