Reference documentation for deal.II version 9.4.1
|
#include <deal.II/base/function_lib.h>
Public Types | |
using | time_type = typename FunctionTime< typename numbers::NumberTraits< RangeNumberType >::real_type >::time_type |
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) | |
InterpolatedUniformGridData (std::array< std::pair< double, double >, dim > &&interval_endpoints, std::array< unsigned int, dim > &&n_subintervals, 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 |
virtual std::size_t | memory_consumption () const override |
const Table< dim, double > & | get_data () const |
virtual void | vector_value (const Point< dim > &p, Vector< RangeNumberType > &values) const |
virtual void | value_list (const std::vector< Point< dim > > &points, std::vector< RangeNumberType > &values, const unsigned int component=0) const |
virtual void | vector_value_list (const std::vector< Point< dim > > &points, std::vector< Vector< RangeNumberType > > &values) const |
virtual void | vector_values (const std::vector< Point< dim > > &points, std::vector< std::vector< RangeNumberType > > &values) const |
virtual void | vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim, RangeNumberType > > &gradients) const |
virtual void | gradient_list (const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim, RangeNumberType > > &gradients, const unsigned int component=0) const |
virtual void | vector_gradients (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, RangeNumberType > > > &gradients) const |
virtual void | vector_gradient_list (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, RangeNumberType > > > &gradients) const |
virtual RangeNumberType | laplacian (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_laplacian (const Point< dim > &p, Vector< RangeNumberType > &values) const |
virtual void | laplacian_list (const std::vector< Point< dim > > &points, std::vector< RangeNumberType > &values, const unsigned int component=0) const |
virtual void | vector_laplacian_list (const std::vector< Point< dim > > &points, std::vector< Vector< RangeNumberType > > &values) const |
virtual SymmetricTensor< 2, dim, RangeNumberType > | hessian (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_hessian (const Point< dim > &p, std::vector< SymmetricTensor< 2, dim, RangeNumberType > > &values) const |
virtual void | hessian_list (const std::vector< Point< dim > > &points, std::vector< SymmetricTensor< 2, dim, RangeNumberType > > &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, RangeNumberType > > > &values) const |
Number | get_time () const |
virtual void | set_time (const Number new_time) |
virtual void | advance_time (const Number delta_t) |
Public Attributes | |
const unsigned int | n_components |
Static Public Attributes | |
static constexpr unsigned int | dimension = dim |
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 |
Number | time |
Subscriptor functionality | |
Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class. | |
std::atomic< unsigned int > | counter |
std::map< std::string, unsigned int > | counter_map |
std::vector< std::atomic< bool > * > | validity_pointers |
const std::type_info * | object_info |
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) |
using | map_value_type = decltype(counter_map)::value_type |
using | map_iterator = decltype(counter_map)::iterator |
static std::mutex | mutex |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
void | check_no_subscribers () const noexcept |
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.
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.)
This class supports the same facilities for dealing with large data sets as the InterpolatedTensorProductGridData class. See there for more information and example codes.
Definition at line 1593 of file function_lib.h.
|
inherited |
The scalar-valued real type used for representing time.
Definition at line 169 of file function.h.
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
interval_endpoints | The left and right end points of the (uniformly subdivided) intervals in each of the coordinate directions. |
n_subintervals | The 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_values | A 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 2666 of file function_lib.cc.
Functions::InterpolatedUniformGridData< dim >::InterpolatedUniformGridData | ( | std::array< std::pair< double, double >, dim > && | interval_endpoints, |
std::array< unsigned int, dim > && | n_subintervals, | ||
Table< dim, double > && | data_values | ||
) |
Like the previous constructor, but take the arguments as rvalue references and move, instead of copy the data. This is often useful in cases where the data stored in these tables is large and the information used to initialize the current object is no longer needed separately. In other words, there is no need to keep the original object from which this object could copy its information, but it might as well take over ("move") the data.
Definition at line 2690 of file function_lib.cc.
|
overridevirtual |
Compute the value of the function set by bilinear interpolation of the given data set.
p | The point at which the function is to be evaluated. |
component | The vector component. Since this function is scalar, only zero is a valid argument here. |
Reimplemented from Function< dim, RangeNumberType >.
Definition at line 2716 of file function_lib.cc.
|
overridevirtual |
Compute the gradient of the function set by bilinear interpolation of the given data set.
p | The point at which the function is to be evaluated. |
component | The vector component. Since this function is scalar, only zero is a valid argument here. |
Reimplemented from Function< dim, RangeNumberType >.
Definition at line 2765 of file function_lib.cc.
|
overridevirtual |
Return an estimate for the memory consumption, in bytes, of this object.
Reimplemented from Function< dim, RangeNumberType >.
Definition at line 2816 of file function_lib.cc.
const Table< dim, double > & Functions::InterpolatedUniformGridData< dim >::get_data |
Return a reference to the internally stored data.
Definition at line 2826 of file function_lib.cc.
|
virtualinherited |
Return all components of a vector-valued function at a given point.
values
shall have the right size beforehand, i.e. n_components.
The default implementation will call value() for each component.
Reimplemented in Functions::ConstantFunction< dim, RangeNumberType >, ComponentSelectFunction< dim, RangeNumberType >, VectorFunctionFromScalarFunctionObject< dim, RangeNumberType >, VectorFunctionFromTensorFunction< dim, RangeNumberType >, Functions::IncrementalFunction< dim, RangeNumberType >, and Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
Set values
to the point values of the specified component of the function at the points
. It is assumed that values
already has the right size, i.e. the same size as the points
array.
By default, this function repeatedly calls value() for each point separately, to fill the output array.
Reimplemented in Functions::ConstantFunction< dim, RangeNumberType >, and Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
Set values
to the point values of the function at the points
. It is assumed that values
already has the right size, i.e. the same size as the points
array, and that all elements be vectors with the same number of components as this function has.
By default, this function repeatedly calls vector_value() for each point separately, to fill the output array.
Reimplemented in Functions::ConstantFunction< dim, RangeNumberType >, VectorFunctionFromTensorFunction< dim, RangeNumberType >, ComponentSelectFunction< dim, RangeNumberType >, and Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
For each component of the function, fill a vector of values, one for each point.
The default implementation of this function in Function calls value_list() for each component. In order to improve performance, this can be reimplemented in derived classes to speed up performance.
|
virtualinherited |
Return the gradient of all components of the function at the given point.
Reimplemented in Functions::ConstantFunction< dim, RangeNumberType >, and Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
Set gradients
to the gradients of the specified component of the function at the points
. It is assumed that gradients
already has the right size, i.e. the same size as the points
array.
Reimplemented in Functions::FEFieldFunction< dim, VectorType, spacedim >, and Functions::ConstantFunction< dim, RangeNumberType >.
|
virtualinherited |
For each component of the function, fill a vector of gradient values, one for each point.
The default implementation of this function in Function calls value_list() for each component. In order to improve performance, this can be reimplemented in derived classes to speed up performance.
|
virtualinherited |
Set gradients
to the gradients of the function at the points
, for all components. It is assumed that gradients
already has the right size, i.e. the same size as the points
array.
The outer loop over gradients
is over the points in the list, the inner loop over the different components of the function.
Reimplemented in Functions::FEFieldFunction< dim, VectorType, spacedim >, and Functions::ConstantFunction< dim, RangeNumberType >.
|
virtualinherited |
Compute the Laplacian of a given component at point p
.
Reimplemented in Functions::CosineGradFunction< dim >, Functions::IdentityFunction< dim, RangeNumberType >, Functions::CSpline< dim >, Functions::SquareFunction< dim >, Functions::Q1WedgeFunction< dim >, Functions::PillowFunction< dim >, Functions::CosineFunction< dim >, Functions::ExpFunction< dim >, Functions::SlitSingularityFunction< dim >, Functions::JumpFunction< dim >, Functions::FourierCosineFunction< dim >, Functions::FourierSineFunction< dim >, Functions::FourierSineSum< dim >, Functions::FourierCosineSum< dim >, Functions::SymbolicFunction< dim, RangeNumberType >, Functions::FEFieldFunction< dim, VectorType, spacedim >, Functions::ConstantFunction< dim, RangeNumberType >, and Functions::ConstantFunction< dim, double >.
|
virtualinherited |
Compute the Laplacian of all components at point p
and store them in values
.
Reimplemented in Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
Compute the Laplacian of one component at a set of points.
Reimplemented in Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
Compute the Laplacians of all components at a set of points.
Reimplemented in Functions::FEFieldFunction< dim, VectorType, spacedim >.
|
virtualinherited |
Compute the Hessian of a given component at point p
, that is the gradient of the gradient of the function.
Reimplemented in Functions::SignedDistance::Plane< dim >, Functions::IdentityFunction< dim, RangeNumberType >, Functions::CSpline< dim >, Functions::CosineFunction< dim >, Functions::Spherical< dim >, Functions::SymbolicFunction< dim, RangeNumberType >, Functions::CoordinateRestriction< dim >, Functions::ConstantFunction< dim, RangeNumberType >, Functions::ConstantFunction< dim, double >, Functions::SignedDistance::Sphere< dim >, and NonMatching::internal::DiscreteQuadratureGeneratorImplementation::RefSpaceFEFieldFunction< dim, VectorType >.
|
virtualinherited |
Compute the Hessian of all components at point p
and store them in values
.
|
virtualinherited |
Compute the Hessian of one component at a set of points.
|
virtualinherited |
Compute the Hessians of all components at a set of points.
|
inherited |
Return the value of the time variable.
|
virtualinherited |
Set the time to new_time
, overwriting the old value.
|
virtualinherited |
Advance the time by the given time step delta_t
.
|
private |
The set of interval endpoints in each of the coordinate directions.
Definition at line 1673 of file function_lib.h.
|
private |
The number of subintervals in each of the coordinate directions.
Definition at line 1678 of file function_lib.h.
|
private |
The data that is to be interpolated.
Definition at line 1683 of file function_lib.h.
|
staticconstexprinherited |
Export the value of the template parameter as a static member constant. Sometimes useful for some expression template programming.
Definition at line 159 of file function.h.
|
inherited |
Number of vector components.
Definition at line 164 of file function.h.
|
privateinherited |
Store the present time.
Definition at line 113 of file function_time.h.