www.mooseframework.org
TrilinearInterpolation.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 #include <vector>
13 #include "Moose.h"
14 
57 {
58 public:
66  TrilinearInterpolation(const std::vector<Real> & x,
67  const std::vector<Real> & y,
68  const std::vector<Real> & z,
69  const std::vector<Real> & data);
70 
71  virtual ~TrilinearInterpolation() = default;
72 
81  Real sample(Real x, Real y, Real z) const;
82 
83 protected:
85  std::vector<Real> _x_axis;
86 
88  std::vector<Real> _y_axis;
89 
91  std::vector<Real> _z_axis;
92 
94  std::vector<Real> _fxyz;
95 
104  void
105  getCornerIndices(const std::vector<Real> & v, Real x, int & lower, int & upper, Real & d) const;
106 
115  Real getCornerValues(int x, int y, int z) const;
116 };
std::vector< Real > _y_axis
vector of y-values
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.
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...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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