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

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

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

Public Member Functions

 InterpolatedUniformGridData (const std::array< std::pair< double, double >, dim > &interval_endpoints, const std::array< unsigned int, dim > &n_subintervals, const Table< dim, double > &data_values)
 
virtual double value (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 Tensor< 1, dim, double > gradient (const Point< dim > &p, const unsigned int component=0) 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)
 

Private Attributes

const std::array< std::pair< double, double >, dim > interval_endpoints
 
const std::array< unsigned int, dim > n_subintervals
 
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::InterpolatedUniformGridData< dim >

A scalar function that computes its values by (bi-, tri-)linear interpolation from a set of point data that are arranged on a uniformly spaced tensor product mesh. In other words, considering the three- dimensional case, let there be points \(x_0,\ldots, x_{K-1}\) that result from a uniform subdivision of the interval \([x_0,x_{K-1}]\) into \(K-1\) sub-intervals of size \(\Delta x = (x_{K-1}-x_0)/(K-1)\), and similarly \(y_0,\ldots,y_{L-1}\), \(z_1,\ldots,z_{M-1}\). Also consider 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 you have a problem where the points \(x_i\) are not equally spaced (e.g., they result from a computation on a graded mesh that is denser closer to one boundary), then use the InterpolatedTensorProductGridData 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 this class is discussed in step-53.
Author
Wolfgang Bangerth, 2013

Definition at line 1530 of file function_lib.h.

Constructor & Destructor Documentation

◆ InterpolatedUniformGridData()

template<int dim>
Functions::InterpolatedUniformGridData< dim >::InterpolatedUniformGridData ( const std::array< std::pair< double, double >, dim > &  interval_endpoints,
const std::array< unsigned int, dim > &  n_subintervals,
const Table< dim, double > &  data_values 
)

Constructor

Parameters
interval_endpointsThe left and right end points of the (uniformly subdivided) intervals in each of the coordinate directions.
n_subintervalsThe number of subintervals in each coordinate direction. A value of one for a coordinate means that the interval is considered as one subinterval consisting of the entire range. A value of two means that there are two subintervals each with one half of the range, etc.
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 2604 of file function_lib.cc.

Member Function Documentation

◆ value()

template<int dim>
double Functions::InterpolatedUniformGridData< 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 2628 of file function_lib.cc.

Member Data Documentation

◆ interval_endpoints

template<int dim>
const std::array<std::pair<double, double>, dim> Functions::InterpolatedUniformGridData< dim >::interval_endpoints
private

The set of interval endpoints in each of the coordinate directions.

Definition at line 1569 of file function_lib.h.

◆ n_subintervals

template<int dim>
const std::array<unsigned int, dim> Functions::InterpolatedUniformGridData< dim >::n_subintervals
private

The number of subintervals in each of the coordinate directions.

Definition at line 1574 of file function_lib.h.

◆ data_values

template<int dim>
const Table<dim, double> Functions::InterpolatedUniformGridData< dim >::data_values
private

The data that is to be interpolated.

Definition at line 1579 of file function_lib.h.


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