https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
24public:
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
43protected:
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};
DualNumber< Real, DNDerivativeType, true > ADReal
Base class for function objects.
Definition Function.h:30
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:30
MooseUtils::SemidynamicVector< Real, 4 > GridPoint
Definition GriddedData.h:42
MooseUtils::SemidynamicVector< unsigned int, 4 > GridIndex
Definition GriddedData.h:44
MooseUtils::SemidynamicVector< ADReal, 4 > ADGridPoint
Definition GriddedData.h:43
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Uses GriddedData to define data on a grid, and does linear interpolation on that data to provide func...
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...
static InputParameters validParams()
Create new PiecewiseMultiInterpolation object.
virtual Real value(Real t, const Point &pt) const override
Given t and p, return the interpolated value.
std::vector< std::vector< Real > > _grid
the grid
unsigned int _dim
dimension of the grid
virtual Real sample(const GridPoint &pt) const =0
This does the core work.
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
void getNeighborIndices(std::vector< Real > in_arr, Real x, unsigned int &lower_x, unsigned int &upper_x) const
Operates on monotonically increasing in_arr.
typename std::conditional< is_ad, typename ADType< T >::type, T >::type GenericType
Definition MooseTypes.h:694