www.mooseframework.org
TrilinearInterpolation.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 TRILINEARINTERPOLATION_H
16 #define TRILINEARINTERPOLATION_H
17 
18 #include <vector>
19 #include "Moose.h"
20 
63 {
64 public:
72  TrilinearInterpolation(const std::vector<Real> & x,
73  const std::vector<Real> & y,
74  const std::vector<Real> & z,
75  const std::vector<Real> & data);
76 
77  virtual ~TrilinearInterpolation() = default;
78 
87  Real sample(Real x, Real y, Real z) const;
88 
89 protected:
91  std::vector<Real> _x_axis;
92 
94  std::vector<Real> _y_axis;
95 
97  std::vector<Real> _z_axis;
98 
100  std::vector<Real> _fxyz;
101 
110  void
111  getCornerIndices(const std::vector<Real> & v, Real x, int & lower, int & upper, Real & d) const;
112 
121  Real getCornerValues(int x, int y, int z) const;
122 };
123 
124 #endif /* TRILINEARINTERPOLATION_H */
std::vector< Real > _y_axis
vector of y-values
Real sample(Real x, Real y, Real z) const
Interpolates for the desired (x,y,z) coordinate and returns the value based on the function values ve...
Real getCornerValues(int x, int y, int z) const
Searches the function value vector for the value at a given corner coordinate from the getCornerIndic...
virtual ~TrilinearInterpolation()=default
std::vector< Real > _x_axis
vector of x-values
This class interpolates a function of three values (f(x,y,z)).
std::vector< Real > _fxyz
vector of function values, f(x,y,z)
void getCornerIndices(const std::vector< Real > &v, Real x, int &lower, int &upper, Real &d) const
Finds the indices of the cube that point (x,y,z) is in.
static PetscErrorCode Vec x
TrilinearInterpolation(const std::vector< Real > &x, const std::vector< Real > &y, const std::vector< Real > &z, const std::vector< Real > &data)
Constructor initializes data for interpolation.
std::vector< Real > _z_axis
vector of z-values