Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Functions::InterpolatedTensorProductGridData< dim > Class Template Reference

#include <deal.II/base/function_lib.h>

Inheritance diagram for Functions::InterpolatedTensorProductGridData< dim >:
[legend]

Public Member Functions

 InterpolatedTensorProductGridData (const std::array< std::vector< double >, dim > &coordinate_values, const Table< dim, double > &data_values)
 
virtual double value (const Point< dim > &p, const unsigned int component=0) const override
 
virtual Tensor< 1, dim > gradient (const Point< dim > &p, const unsigned int component=0) const override
 
- Public Member Functions inherited from Function< dim >
 Function (const unsigned int n_components=1, const time_type initial_time=0.0)
 
virtual ~Function () override=0
 
Functionoperator= (const Function &f)
 
virtual void vector_value (const Point< dim > &p, Vector< double > &values) const
 
virtual void value_list (const std::vector< Point< dim >> &points, std::vector< double > &values, const unsigned int component=0) const
 
virtual void vector_value_list (const std::vector< Point< dim >> &points, std::vector< Vector< double >> &values) const
 
virtual void vector_values (const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const
 
virtual void vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim, double >> &gradients) const
 
virtual void gradient_list (const std::vector< Point< dim >> &points, std::vector< Tensor< 1, dim, double >> &gradients, const unsigned int component=0) const
 
virtual void vector_gradients (const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim, double >>> &gradients) const
 
virtual void vector_gradient_list (const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim, double >>> &gradients) const
 
virtual double laplacian (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_laplacian (const Point< dim > &p, Vector< double > &values) const
 
virtual void laplacian_list (const std::vector< Point< dim >> &points, std::vector< double > &values, const unsigned int component=0) const
 
virtual void vector_laplacian_list (const std::vector< Point< dim >> &points, std::vector< Vector< double >> &values) const
 
virtual SymmetricTensor< 2, dim, double > hessian (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_hessian (const Point< dim > &p, std::vector< SymmetricTensor< 2, dim, double >> &values) const
 
virtual void hessian_list (const std::vector< Point< dim >> &points, std::vector< SymmetricTensor< 2, dim, double >> &values, const unsigned int component=0) const
 
virtual void vector_hessian_list (const std::vector< Point< dim >> &points, std::vector< std::vector< SymmetricTensor< 2, dim, double >>> &values) const
 
std::size_t memory_consumption () const
 
- Public Member Functions inherited from FunctionTime< Number >
 FunctionTime (const Number initial_time=Number(0.0))
 
virtual ~FunctionTime ()=default
 
Number get_time () const
 
virtual void set_time (const Number new_time)
 
virtual void advance_time (const Number delta_t)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Protected Member Functions

TableIndices< dim > table_index_of_point (const Point< dim > &p) const
 

Protected Attributes

const std::array< std::vector< double >, dim > coordinate_values
 
const Table< dim, double > data_values
 

Additional Inherited Members

- Public Types inherited from Function< dim >
using time_type = typename FunctionTime< typename numbers::NumberTraits< double >::real_type >::time_type
 
- Public Types inherited from FunctionTime< Number >
using time_type = Number
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
- Public Attributes inherited from Function< dim >
const unsigned int n_components
 
- Static Public Attributes inherited from Function< dim >
static const unsigned int dimension
 

Detailed Description

template<int dim>
class Functions::InterpolatedTensorProductGridData< dim >

A scalar function that computes its values by (bi-, tri-)linear interpolation from a set of point data that are arranged on a possibly non-uniform tensor product mesh. In other words, considering the three- dimensional case, let there be points \(x_0,\ldots, x_{K-1}\), \(y_0,\ldots,y_{L-1}\), \(z_1,\ldots,z_{M-1}\), and data \(d_{klm}\) defined at point \((x_k,y_l,z_m)^T\), then evaluating the function at a point \(\mathbf x=(x,y,z)\) will find the box so that \(x_k\le x\le x_{k+1}, y_l\le y\le y_{l+1}, z_m\le z\le z_{m+1}\), and do a trilinear interpolation of the data on this cell. Similar operations are done in lower dimensions.

This class is most often used for either evaluating coefficients or right hand sides that are provided experimentally at a number of points inside the domain, or for comparing outputs of a solution on a finite element mesh against previously obtained data defined on a grid.

Note
If the points \(x_i\) are actually equally spaced on an interval \([x_0,x_1]\) and the same is true for the other data points in higher dimensions, you should use the InterpolatedUniformGridData class instead.

If a point is requested outside the box defined by the end points of the coordinate arrays, then the function is assumed to simply extend by constant values beyond the last data point in each coordinate direction. (The class does not throw an error if a point lies outside the box since it frequently happens that a point lies just outside the box by an amount on the order of numerical roundoff.)

Note
The use of the related class InterpolatedUniformGridData is discussed in step-53.
Author
Wolfgang Bangerth, 2013

Definition at line 1426 of file function_lib.h.

Constructor & Destructor Documentation

◆ InterpolatedTensorProductGridData()

template<int dim>
Functions::InterpolatedTensorProductGridData< dim >::InterpolatedTensorProductGridData ( const std::array< std::vector< double >, dim > &  coordinate_values,
const Table< dim, double > &  data_values 
)

Constructor.

Parameters
coordinate_valuesAn array of dim arrays. Each of the inner arrays contains the coordinate values \(x_0,\ldots, x_{K-1}\) and similarly for the other coordinate directions. These arrays need not have the same size. Obviously, we need dim such arrays for a dim- dimensional function object. The coordinate values within this array are assumed to be strictly ascending to allow for efficient lookup.
data_valuesA dim-dimensional table of data at each of the mesh points defined by the coordinate arrays above. Note that the Table class has a number of conversion constructors that allow converting other data types into a table where you specify this argument.

Definition at line 2479 of file function_lib.cc.

Member Function Documentation

◆ value()

template<int dim>
double Functions::InterpolatedTensorProductGridData< dim >::value ( const Point< dim > &  p,
const unsigned int  component = 0 
) const
overridevirtual

Compute the value of the function set by bilinear interpolation of the given data set.

Parameters
pThe point at which the function is to be evaluated.
componentThe vector component. Since this function is scalar, only zero is a valid argument here.
Returns
The interpolated value at this point. If the point lies outside the set of coordinates, the function is extended by a constant.

Reimplemented from Function< dim >.

Definition at line 2544 of file function_lib.cc.

◆ gradient()

template<int dim>
Tensor< 1, dim > Functions::InterpolatedTensorProductGridData< dim >::gradient ( const Point< dim > &  p,
const unsigned int  component = 0 
) const
overridevirtual

Compute the gradient of the function defined by bilinear interpolation of the given data set.

Parameters
pThe point at which the function gradient is to be evaluated.
componentThe vector component. Since this function is scalar, only zero is a valid argument here.
Returns
The value of the gradient of the interpolated function at this point. If the point lies outside the set of coordinates, the function is extended by a constant and so its gradient is extended by 0.

Reimplemented from Function< dim >.

Definition at line 2575 of file function_lib.cc.

◆ table_index_of_point()

template<int dim>
TableIndices< dim > Functions::InterpolatedTensorProductGridData< dim >::table_index_of_point ( const Point< dim > &  p) const
protected

Find the index in the table of the rectangle containing an input point

Definition at line 2507 of file function_lib.cc.

Member Data Documentation

◆ coordinate_values

template<int dim>
const std::array<std::vector<double>, dim> Functions::InterpolatedTensorProductGridData< dim >::coordinate_values
protected

The set of coordinate values in each of the coordinate directions.

Definition at line 1484 of file function_lib.h.

◆ data_values

template<int dim>
const Table<dim, double> Functions::InterpolatedTensorProductGridData< dim >::data_values
protected

The data that is to be interpolated.

Definition at line 1489 of file function_lib.h.


The documentation for this class was generated from the following files: