www.mooseframework.org
PiecewiseMultilinear.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef PIECEWISEMULTILINEAR_H
16 #define PIECEWISEMULTILINEAR_H
17 
18 #include "Function.h"
19 
20 // Forward declarations
21 class GriddedData;
22 
31 
32 template <>
34 
36 {
37 public:
43 
44  // Necessary for using forward declaration of GriddedData in std::unique_ptr
45  virtual ~PiecewiseMultilinear();
46 
50  virtual Real value(Real t, const Point & pt) override;
51 
52 private:
54  std::unique_ptr<GriddedData> _gridded_data;
56  unsigned int _dim;
57 
65  std::vector<int> _axes;
66 
68  std::vector<std::vector<Real>> _grid;
69 
75  Real sample(const std::vector<Real> & pt);
76 
88  void getNeighborIndices(std::vector<Real> in_arr,
89  Real x,
90  unsigned int & lower_x,
91  unsigned int & upper_x);
92 };
93 
94 #endif // PIECEWISEMULTILINEAR_H
Container for holding a function defined on a grid of arbitrary dimension.
Definition: GriddedData.h:39
Base class for function objects.
Definition: Function.h:46
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static PetscErrorCode Vec x
PiecewiseMultilinear(const InputParameters &parameters)
Create new PiecewiseMultilinear object.
void getNeighborIndices(std::vector< Real > in_arr, Real x, unsigned int &lower_x, unsigned int &upper_x)
Operates on monotonically increasing in_arr.
std::unique_ptr< GriddedData > _gridded_data
object to provide function evaluations at points on the grid
std::vector< int > _axes
_axes specifies how to embed the grid into the MOOSE coordinate frame if _axes[i] = 0 then the i_th a...
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
virtual Real value(Real t, const Point &pt) override
Given t and p, return the interpolated value.
unsigned int _dim
dimension of the grid
std::vector< std::vector< Real > > _grid
the grid
Real sample(const std::vector< Real > &pt)
This does the core work.
InputParameters validParams< PiecewiseMultilinear >()