https://mooseframework.inl.gov
PiecewiseMultiInterpolation.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 #include "Function.h"
13 #include "GriddedData.h"
14 
23 {
24 public:
30 
32 
33  // Necessary for using forward declaration of GriddedData in std::unique_ptr
35 
36  using Function::value;
40  virtual Real value(Real t, const Point & pt) const override;
41  virtual ADReal value(const ADReal & t, const ADPoint & p) const override;
42 
43 protected:
47 
49  template <bool is_ad>
52  const Moose::GenericType<Point, is_ad> & p) const;
53 
59  virtual Real sample(const GridPoint & pt) const = 0;
60  virtual ADReal sample(const ADGridPoint & pt) const;
61 
63  std::unique_ptr<GriddedData> _gridded_data;
65  unsigned int _dim;
66 
74  std::vector<int> _axes;
75 
77  std::vector<std::vector<Real>> _grid;
78 
90  void getNeighborIndices(std::vector<Real> in_arr,
91  Real x,
92  unsigned int & lower_x,
93  unsigned int & upper_x) const;
94 };
Base class for function objects.
Definition: Function.h:36
Uses GriddedData to define data on a grid, and does linear interpolation on that data to provide func...
static InputParameters validParams()
Create new PiecewiseMultiInterpolation object.
std::unique_ptr< GriddedData > _gridded_data
object to provide function evaluations at points on the grid
std::vector< std::vector< Real > > _grid
the grid
Moose::GenericType< GridPoint, is_ad > pointInGrid(const Moose::GenericType< Real, is_ad > &t, const Moose::GenericType< Point, is_ad > &p) const
convert cartesian+time coordinates into grid coordinates
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:47
typename std::conditional< is_ad, typename ADType< T >::type, T >::type GenericType
Definition: MooseTypes.h:644
Utility class template for a semidynamic vector with a maximum size N and a chosen dynamic size...
Definition: MooseUtils.h:1096
void getNeighborIndices(std::vector< Real > in_arr, Real x, unsigned int &lower_x, unsigned int &upper_x) const
Operates on monotonically increasing in_arr.
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...
unsigned int _dim
dimension of the grid
GriddedData::ADGridPoint ADGridPoint
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PiecewiseMultiInterpolation(const InputParameters &parameters)
const InputParameters & parameters() const
Get the parameters of the object.
virtual Real value(Real t, const Point &pt) const override
Given t and p, return the interpolated value.
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:44
virtual Real sample(const GridPoint &pt) const =0
This does the core work.