Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Functions::FEFieldFunction< dim, VectorType, spacedim > Class Template Reference

#include <deal.II/numerics/fe_field_function.h>

Inheritance diagram for Functions::FEFieldFunction< dim, VectorType, spacedim >:

Public Types

using time_type
 

Public Member Functions

 FEFieldFunction (const DoFHandler< dim, spacedim > &dh, const VectorType &data_vector, const Mapping< dim > &mapping=StaticMappingQ1< dim >::mapping)
 
void set_active_cell (const typename DoFHandler< dim, spacedim >::active_cell_iterator &newcell)
 
virtual void vector_value (const Point< dim > &p, Vector< typename VectorType::value_type > &values) const override
 
virtual VectorType::value_type value (const Point< dim > &p, const unsigned int component=0) const override
 
virtual void value_list (const std::vector< Point< dim > > &points, std::vector< typename VectorType::value_type > &values, const unsigned int component=0) const override
 
virtual void vector_value_list (const std::vector< Point< dim > > &points, std::vector< Vector< typename VectorType::value_type > > &values) const override
 
virtual void vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim, typename VectorType::value_type > > &gradients) const override
 
virtual Tensor< 1, dim, typename VectorType::value_type > gradient (const Point< dim > &p, const unsigned int component=0) const override
 
virtual void vector_gradient_list (const std::vector< Point< dim > > &p, std::vector< std::vector< Tensor< 1, dim, typename VectorType::value_type > > > &gradients) const override
 
virtual void gradient_list (const std::vector< Point< dim > > &p, std::vector< Tensor< 1, dim, typename VectorType::value_type > > &gradients, const unsigned int component=0) const override
 
virtual VectorType::value_type laplacian (const Point< dim > &p, const unsigned int component=0) const override
 
virtual void vector_laplacian (const Point< dim > &p, Vector< typename VectorType::value_type > &values) const override
 
virtual void laplacian_list (const std::vector< Point< dim > > &points, std::vector< typename VectorType::value_type > &values, const unsigned int component=0) const override
 
virtual void vector_laplacian_list (const std::vector< Point< dim > > &points, std::vector< Vector< typename VectorType::value_type > > &values) const override
 
unsigned int compute_point_locations (const std::vector< Point< dim > > &points, std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > &cells, std::vector< std::vector< Point< dim > > > &qpoints, std::vector< std::vector< unsigned int > > &maps) 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 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
 
virtual std::size_t memory_consumption () const
 
numbers::NumberTraits< double >::real_type get_time () const
 
virtual void set_time (const numbers::NumberTraits< double >::real_type new_time)
 
virtual void advance_time (const numbers::NumberTraits< double >::real_type delta_t)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
Subscriptor functionality

Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class.

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
 

Static Public Member Functions

static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 

Public Attributes

const unsigned int n_components
 

Static Public Attributes

static constexpr unsigned int dimension = dim
 

Private Types

using cell_hint_t
 
using map_value_type = decltype(counter_map)::value_type
 
using map_iterator = decltype(counter_map)::iterator
 

Private Member Functions

std::optional< Point< dim > > get_reference_coordinates (const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, const Point< dim > &point) const
 
void check_no_subscribers () const noexcept
 

Private Attributes

SmartPointer< const DoFHandler< dim, spacedim >, FEFieldFunction< dim, VectorType, spacedim > > dh
 
const VectorType & data_vector
 
const Mapping< dim > & mapping
 
GridTools::Cache< dim, spacedim > cache
 
cell_hint_t cell_hint
 
numbers::NumberTraits< double >::real_type time
 
std::atomic< unsigned intcounter
 
std::map< std::string, unsigned intcounter_map
 
std::vector< std::atomic< bool > * > validity_pointers
 
const std::type_info * object_info
 

Static Private Attributes

static std::mutex mutex
 

Detailed Description

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
class Functions::FEFieldFunction< dim, VectorType, spacedim >

This is an interpolation function for the given dof handler and the given solution vector. The points at which this function can be evaluated MUST be inside the domain of the dof handler, but except from this, no other requirement is given. This function is rather slow, as it needs to construct a quadrature object for the point (or set of points) where you want to evaluate your finite element function. In order to do so, it needs to find out where the points lie.

If you know in advance in which cell your points lie, you can accelerate things a bit, by calling set_active_cell() before asking for values or gradients of the function. If you don't do this, and your points don't lie in the cell that is currently stored, the function GridTools::find_active_cell_around_point is called to find out where the point is. You can specify an optional mapping to use when looking for points in the grid. If you don't do so, this function uses a Q1 mapping.

Once the FEFieldFunction knows where the points lie, it creates a quadrature formula for those points, and calls FEValues::get_function_values or FEValues::get_function_gradients with the given quadrature points.

If you only need the quadrature points but not the values of the finite element function (you might want this for the adjoint interpolation), you can also use the function compute_point_locations() alone.

An example of how to use this function is the following:

// Generate two triangulations
// Read the triangulations from files, or build them up, or get them
// from some place. Assume that tria_2 is *entirely* included in tria_1.
// Associate a dof handler and a solution to the first triangulation
DoFHandler<dim> dh1 (tria_1);
Vector<double> solution_1;
// On this first domain, set up the various data structures,
// assemble matrices, solve the linear system, and get a Nobel
// prize for the work we have done here:
[...]
// Then create a DoFHandler and solution vector for the second domain:
DoFHandler<dim> dh2 (tria_2);
Vector<double> solution_2;
// Finally, project the solution on the first domain onto the
// second domain, assuming that this does not require querying
// values from outside the first domain:
Functions::FEFieldFunction<dim> fe_function_1 (dh_1, solution_1);
VectorTools::project (dh_2, constraints_2, quad,
fe_function_1, solution_2);
// Alternatively, we could have also interpolated it:
Vector<double> solution_3;
VectorTools::interpolate (dh_2, fe_function_1, solution_3);
void interpolate(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Function< spacedim, typename VectorType::value_type > &function, VectorType &vec, const ComponentMask &component_mask={})
void project(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const AffineConstraints< typename VectorType::value_type > &constraints, const Quadrature< dim > &quadrature, const Function< spacedim, typename VectorType::value_type > &function, VectorType &vec, const bool enforce_zero_boundary=false, const Quadrature< dim - 1 > &q_boundary=(dim > 1 ? QGauss< dim - 1 >(2) :Quadrature< dim - 1 >()), const bool project_to_boundary_first=false)

The snippet of code above will work assuming that the second triangulation is entirely included in the first one.

FEFieldFunction is designed to be an easy way to get the results of your computations across different, possibly non matching, grids. No knowledge of the location of the points is assumed in this class, which makes it rely entirely on the GridTools::find_active_cell_around_point utility for its job. However the class can be fed an "educated guess" of where the points that will be computed actually are by using the FEFieldFunction::set_active_cell method, so if you have a smart way to tell where your points are, you will save a lot of computational time by letting this class know.

Using FEFieldFunction with parallel triangulations

When using this class with a parallel distributed triangulation object and evaluating the solution at a particular point, not every processor will own the cell at which the solution should be evaluated. Rather, it may be that the cell in which this point is found is in fact a ghost or artificial cell (see GlossArtificialCell and GlossGhostCell). The solution can be evaluated on ghost cells, but for artificial cells we have no access to the solution there and functions that evaluate the solution at such a point will trigger an exception of type VectorTools::ExcPointNotAvailableHere.

To deal with this situation, you will want to use code as follows when, for example, evaluating the solution at the origin (here using a parallel TrilinosWrappers vector to hold the solution):

solution_function (dof_handler, solution);
double solution_at_origin;
bool point_found = true;
try
{
solution_at_origin = solution_function.value (origin);
}
{
point_found = false;
}
if (point_found == true)
...do something...;
Definition point.h:111
static ::ExceptionBase & ExcPointNotAvailableHere()

The last part (the ...do something...) part needs to be application specific. If you really do need the information on this process, you need to communicate with the process that actually owns the cell in which the point at which you want the solution is located. Since you don't know which process that may be, this will necessarily require a global communication step. The FERemoteEvaluation class may be useful in this context.

Finally, there is the case of the value_list(), gradient_list(), and similar functions of this class that take a list of points. For these functions, it may be that some of the points are on locally owned cells, and others are not – in which case, again, you will receive an exception. Because these functions do not return information about which of the points can and which cannot be evaluated, the correct approach is to call the *_list() function within a try block, and if it fails fall back to calling value(), gradient(), or similar in a loop over the points you wanted evaluated to find out for which point the call fails.

Definition at line 184 of file fe_field_function.h.

Member Typedef Documentation

◆ cell_hint_t

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
using Functions::FEFieldFunction< dim, VectorType, spacedim >::cell_hint_t
private
Initial value:
A class that provides a separate storage location on each thread that accesses the object.
typename ActiveSelector::active_cell_iterator active_cell_iterator

Typedef holding the local cell_hint.

Definition at line 466 of file fe_field_function.h.

◆ time_type

template<int dim, typename RangeNumberType = double>
using Function< dim, RangeNumberType >::time_type
inherited
Initial value:
typename FunctionTime<
typename FunctionTime< typename numbers::NumberTraits< RangeNumberType >::real_type >::time_type time_type
Definition function.h:168

The scalar-valued real type used for representing time.

Definition at line 168 of file function.h.

◆ map_value_type

using Subscriptor::map_value_type = decltype(counter_map)::value_type
privateinherited

The data type used in counter_map.

Definition at line 229 of file subscriptor.h.

◆ map_iterator

using Subscriptor::map_iterator = decltype(counter_map)::iterator
privateinherited

The iterator type used in counter_map.

Definition at line 234 of file subscriptor.h.

Constructor & Destructor Documentation

◆ FEFieldFunction()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
Functions::FEFieldFunction< dim, VectorType, spacedim >::FEFieldFunction ( const DoFHandler< dim, spacedim > & dh,
const VectorType & data_vector,
const Mapping< dim > & mapping = StaticMappingQ1< dim >::mapping )

Construct a vector function. A smart pointers is stored to the dof handler, so you have to make sure that it make sense for the entire lifetime of this object. The number of components of this functions is equal to the number of components of the finite element object. If a mapping is specified, that is what is used to find out where the points lay. Otherwise the standard Q1 mapping is used.

Member Function Documentation

◆ set_active_cell()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
void Functions::FEFieldFunction< dim, VectorType, spacedim >::set_active_cell ( const typename DoFHandler< dim, spacedim >::active_cell_iterator & newcell)

Set the current cell. If you know in advance where your points lie, you can tell this object by calling this function. This will speed things up a little.

◆ vector_value() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::vector_value ( const Point< dim > & p,
Vector< typename VectorType::value_type > & values ) const
overridevirtual

Get one vector value at the given point. It is inefficient to use single points. If you need more than one at a time, use the vector_value_list() function. For efficiency reasons, it is better if all the points lie on the same cell. This is not mandatory, however it does speed things up.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ value()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual VectorType::value_type Functions::FEFieldFunction< dim, VectorType, spacedim >::value ( const Point< dim > & p,
const unsigned int component = 0 ) const
overridevirtual

Return the value of the function at the given point. Unless there is only one component (i.e. the function is scalar), you should state the component you want to have evaluated; it defaults to zero, i.e. the first component. It is inefficient to use single points. If you need more than one at a time, use the vector_value_list() function. For efficiency reasons, it is better if all the points lie on the same cell. This is not mandatory, however it does speed things up.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

Reimplemented from Function< dim, RangeNumberType >.

◆ value_list() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::value_list ( const std::vector< Point< dim > > & points,
std::vector< typename VectorType::value_type > & values,
const unsigned int component = 0 ) const
overridevirtual

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. This is rather efficient if all the points lie on the same cell. If this is not the case, things may slow down a bit.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ vector_value_list() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::vector_value_list ( const std::vector< Point< dim > > & points,
std::vector< Vector< typename VectorType::value_type > > & values ) const
overridevirtual

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. This is rather efficient if all the points lie on the same cell. If this is not the case, things may slow down a bit.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ vector_gradient() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::vector_gradient ( const Point< dim > & p,
std::vector< Tensor< 1, dim, typename VectorType::value_type > > & gradients ) const
overridevirtual

Return the gradient of all components of the function at the given point. It is inefficient to use single points. If you need more than one at a time, use the vector_value_list() function. For efficiency reasons, it is better if all the points lie on the same cell. This is not mandatory, however it does speed things up.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ gradient()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual Tensor< 1, dim, typename VectorType::value_type > Functions::FEFieldFunction< dim, VectorType, spacedim >::gradient ( const Point< dim > & p,
const unsigned int component = 0 ) const
overridevirtual

Return the gradient of the specified component of the function at the given point. It is inefficient to use single points. If you need more than one at a time, use the vector_value_list() function. For efficiency reasons, it is better if all the points lie on the same cell. This is not mandatory, however it does speed things up.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

Reimplemented from Function< dim, RangeNumberType >.

◆ vector_gradient_list() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::vector_gradient_list ( const std::vector< Point< dim > > & p,
std::vector< std::vector< Tensor< 1, dim, typename VectorType::value_type > > > & gradients ) const
overridevirtual

Return the gradient of all components of the function at all the given points. This is rather efficient if all the points lie on the same cell. If this is not the case, things may slow down a bit.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ gradient_list() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::gradient_list ( const std::vector< Point< dim > > & p,
std::vector< Tensor< 1, dim, typename VectorType::value_type > > & gradients,
const unsigned int component = 0 ) const
overridevirtual

Return the gradient of the specified component of the function at all the given points. This is rather efficient if all the points lie on the same cell. If this is not the case, things may slow down a bit.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ laplacian()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual VectorType::value_type Functions::FEFieldFunction< dim, VectorType, spacedim >::laplacian ( const Point< dim > & p,
const unsigned int component = 0 ) const
overridevirtual

Compute the Laplacian of a given component at point p.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

Reimplemented from Function< dim, RangeNumberType >.

◆ vector_laplacian() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::vector_laplacian ( const Point< dim > & p,
Vector< typename VectorType::value_type > & values ) const
overridevirtual

Compute the Laplacian of all components at point p and store them in values.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ laplacian_list() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::laplacian_list ( const std::vector< Point< dim > > & points,
std::vector< typename VectorType::value_type > & values,
const unsigned int component = 0 ) const
overridevirtual

Compute the Laplacian of one component at a set of points.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ vector_laplacian_list() [1/2]

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
virtual void Functions::FEFieldFunction< dim, VectorType, spacedim >::vector_laplacian_list ( const std::vector< Point< dim > > & points,
std::vector< Vector< typename VectorType::value_type > > & values ) const
overridevirtual

Compute the Laplacians of all components at a set of points.

Note
When using this function on a parallel::distributed::Triangulation you may get an exception when trying to evaluate the solution at a point that lies on an artificial cell (see GlossLocallyOwnedCell). See the section in the general documentation of this class for more information.

◆ compute_point_locations()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
unsigned int Functions::FEFieldFunction< dim, VectorType, spacedim >::compute_point_locations ( const std::vector< Point< dim > > & points,
std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > & cells,
std::vector< std::vector< Point< dim > > > & qpoints,
std::vector< std::vector< unsigned int > > & maps ) const

Given a set of points located in the domain (or, in the case of a parallel Triangulation, in the locally owned part of the domain or on the ghost cells for the current processor), sort these points into buckets for each of the cells on which at least one of the points is located.

This function fills three output vectors: cells, qpoints and maps. The first is a list of the cells that contain the points, the second is a list of quadrature points matching each cell of the first list, and the third contains the index of the given quadrature points, i.e., points[maps[3][4]] ends up as the 5th quadrature point in the 4th cell.

Returns
This function returns the number of cells that collectively contain the set of points give as points. This also equals the lengths of the output arrays.

This function simply calls GridTools::compute_point_locations : using the original function avoids computing a new Cache at every function call.

◆ get_reference_coordinates()

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
std::optional< Point< dim > > Functions::FEFieldFunction< dim, VectorType, spacedim >::get_reference_coordinates ( const typename DoFHandler< dim, spacedim >::active_cell_iterator & cell,
const Point< dim > & point ) const
private

Given a cell, return the reference coordinates of the given point within this cell if it indeed lies within the cell. Otherwise return an uninitialized std::optional object.

◆ vector_value() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_value ( const Point< dim > & p,
Vector< RangeNumberType > & values ) const
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, double >.

◆ value_list() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::value_list ( const std::vector< Point< dim > > & points,
std::vector< RangeNumberType > & values,
const unsigned int component = 0 ) const
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, double >.

◆ vector_value_list() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_value_list ( const std::vector< Point< dim > > & points,
std::vector< Vector< RangeNumberType > > & values ) const
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, double >.

◆ vector_values()

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_values ( const std::vector< Point< dim > > & points,
std::vector< std::vector< RangeNumberType > > & values ) const
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.

◆ vector_gradient() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_gradient ( const Point< dim > & p,
std::vector< Tensor< 1, dim, RangeNumberType > > & gradients ) const
virtualinherited

Return the gradient of all components of the function at the given point.

Reimplemented in Functions::ConstantFunction< dim, double >.

◆ gradient_list() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::gradient_list ( const std::vector< Point< dim > > & points,
std::vector< Tensor< 1, dim, RangeNumberType > > & gradients,
const unsigned int component = 0 ) const
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::ConstantFunction< dim, double >.

◆ vector_gradients()

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_gradients ( const std::vector< Point< dim > > & points,
std::vector< std::vector< Tensor< 1, dim, RangeNumberType > > > & gradients ) const
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.

◆ vector_gradient_list() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_gradient_list ( const std::vector< Point< dim > > & points,
std::vector< std::vector< Tensor< 1, dim, RangeNumberType > > > & gradients ) const
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::ConstantFunction< dim, double >.

◆ vector_laplacian() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_laplacian ( const Point< dim > & p,
Vector< RangeNumberType > & values ) const
virtualinherited

Compute the Laplacian of all components at point p and store them in values.

◆ laplacian_list() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::laplacian_list ( const std::vector< Point< dim > > & points,
std::vector< RangeNumberType > & values,
const unsigned int component = 0 ) const
virtualinherited

Compute the Laplacian of one component at a set of points.

◆ vector_laplacian_list() [2/2]

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_laplacian_list ( const std::vector< Point< dim > > & points,
std::vector< Vector< RangeNumberType > > & values ) const
virtualinherited

Compute the Laplacians of all components at a set of points.

◆ hessian()

◆ vector_hessian()

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_hessian ( const Point< dim > & p,
std::vector< SymmetricTensor< 2, dim, RangeNumberType > > & values ) const
virtualinherited

Compute the Hessian of all components at point p and store them in values.

◆ hessian_list()

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::hessian_list ( const std::vector< Point< dim > > & points,
std::vector< SymmetricTensor< 2, dim, RangeNumberType > > & values,
const unsigned int component = 0 ) const
virtualinherited

Compute the Hessian of one component at a set of points.

◆ vector_hessian_list()

template<int dim, typename RangeNumberType = double>
virtual void Function< dim, RangeNumberType >::vector_hessian_list ( const std::vector< Point< dim > > & points,
std::vector< std::vector< SymmetricTensor< 2, dim, RangeNumberType > > > & values ) const
virtualinherited

Compute the Hessians of all components at a set of points.

◆ memory_consumption()

template<int dim, typename RangeNumberType = double>
virtual std::size_t Function< dim, RangeNumberType >::memory_consumption ( ) const
virtualinherited

◆ get_time()

numbers::NumberTraits< double >::real_type FunctionTime< numbers::NumberTraits< double >::real_type >::get_time ( ) const
inherited

Return the value of the time variable.

◆ set_time()

virtual void FunctionTime< numbers::NumberTraits< double >::real_type >::set_time ( const numbers::NumberTraits< double >::real_type new_time)
virtualinherited

Set the time to new_time, overwriting the old value.

◆ advance_time()

virtual void FunctionTime< numbers::NumberTraits< double >::real_type >::advance_time ( const numbers::NumberTraits< double >::real_type delta_t)
virtualinherited

Advance the time by the given time step delta_t.

◆ subscribe()

void Subscriptor::subscribe ( std::atomic< bool > *const validity,
const std::string & identifier = "" ) const
inherited

Subscribes a user of the object by storing the pointer validity. The subscriber may be identified by text supplied as identifier.

Definition at line 135 of file subscriptor.cc.

◆ unsubscribe()

void Subscriptor::unsubscribe ( std::atomic< bool > *const validity,
const std::string & identifier = "" ) const
inherited

Unsubscribes a user from the object.

Note
The identifier and the validity pointer must be the same as the one supplied to subscribe().

Definition at line 155 of file subscriptor.cc.

◆ n_subscriptions()

unsigned int Subscriptor::n_subscriptions ( ) const
inlineinherited

Return the present number of subscriptions to this object. This allows to use this class for reference counted lifetime determination where the last one to unsubscribe also deletes the object.

Definition at line 300 of file subscriptor.h.

◆ list_subscribers() [1/2]

template<typename StreamType >
void Subscriptor::list_subscribers ( StreamType & stream) const
inlineinherited

List the subscribers to the input stream.

Definition at line 317 of file subscriptor.h.

◆ list_subscribers() [2/2]

void Subscriptor::list_subscribers ( ) const
inherited

List the subscribers to deallog.

Definition at line 203 of file subscriptor.cc.

◆ serialize()

template<class Archive >
void Subscriptor::serialize ( Archive & ar,
const unsigned int version )
inlineinherited

Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.

This function does not actually serialize any of the member variables of this class. The reason is that what this class stores is only who subscribes to this object, but who does so at the time of storing the contents of this object does not necessarily have anything to do with who subscribes to the object when it is restored. Consequently, we do not want to overwrite the subscribers at the time of restoring, and then there is no reason to write the subscribers out in the first place.

Definition at line 309 of file subscriptor.h.

◆ check_no_subscribers()

void Subscriptor::check_no_subscribers ( ) const
privatenoexceptinherited

Check that there are no objects subscribing to this object. If this check passes then it is safe to destroy the current object. It this check fails then this function will either abort or print an error message to deallog (by using the AssertNothrow mechanism), but will not throw an exception.

Note
Since this function is just a consistency check it does nothing in release mode.
If this function is called when there is an uncaught exception then, rather than aborting, this function prints an error message to the standard error stream and returns.

Definition at line 52 of file subscriptor.cc.

Member Data Documentation

◆ dh

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
SmartPointer<const DoFHandler<dim, spacedim>, FEFieldFunction<dim, VectorType, spacedim> > Functions::FEFieldFunction< dim, VectorType, spacedim >::dh
private

Pointer to the dof handler.

Definition at line 474 of file fe_field_function.h.

◆ data_vector

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
const VectorType& Functions::FEFieldFunction< dim, VectorType, spacedim >::data_vector
private

A reference to the actual data vector.

Definition at line 479 of file fe_field_function.h.

◆ mapping

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
const Mapping<dim>& Functions::FEFieldFunction< dim, VectorType, spacedim >::mapping
private

A reference to the mapping being used.

Definition at line 484 of file fe_field_function.h.

◆ cache

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
GridTools::Cache<dim, spacedim> Functions::FEFieldFunction< dim, VectorType, spacedim >::cache
private

The Cache object

Definition at line 489 of file fe_field_function.h.

◆ cell_hint

template<int dim, typename VectorType = Vector<double>, int spacedim = dim>
cell_hint_t Functions::FEFieldFunction< dim, VectorType, spacedim >::cell_hint
mutableprivate

The latest cell hint.

Definition at line 494 of file fe_field_function.h.

◆ dimension

template<int dim, typename RangeNumberType = double>
unsigned int Function< dim, RangeNumberType >::dimension = dim
staticconstexprinherited

Export the value of the template parameter as a static member constant. Sometimes useful for some expression template programming.

Definition at line 158 of file function.h.

◆ n_components

template<int dim, typename RangeNumberType = double>
const unsigned int Function< dim, RangeNumberType >::n_components
inherited

Number of vector components.

Definition at line 163 of file function.h.

◆ time

numbers::NumberTraits< double >::real_type FunctionTime< numbers::NumberTraits< double >::real_type >::time
privateinherited

Store the present time.

Definition at line 112 of file function_time.h.

◆ counter

std::atomic<unsigned int> Subscriptor::counter
mutableprivateinherited

Store the number of objects which subscribed to this object. Initially, this number is zero, and upon destruction it shall be zero again (i.e. all objects which subscribed should have unsubscribed again).

The creator (and owner) of an object is counted in the map below if HE manages to supply identification.

We use the mutable keyword in order to allow subscription to constant objects also.

This counter may be read from and written to concurrently in multithreaded code: hence we use the std::atomic class template.

Definition at line 218 of file subscriptor.h.

◆ counter_map

std::map<std::string, unsigned int> Subscriptor::counter_map
mutableprivateinherited

In this map, we count subscriptions for each different identification string supplied to subscribe().

Definition at line 224 of file subscriptor.h.

◆ validity_pointers

std::vector<std::atomic<bool> *> Subscriptor::validity_pointers
mutableprivateinherited

In this vector, we store pointers to the validity bool in the SmartPointer objects that subscribe to this class.

Definition at line 240 of file subscriptor.h.

◆ object_info

const std::type_info* Subscriptor::object_info
mutableprivateinherited

Pointer to the typeinfo object of this object, from which we can later deduce the class name. Since this information on the derived class is neither available in the destructor, nor in the constructor, we obtain it in between and store it here.

Definition at line 248 of file subscriptor.h.

◆ mutex

std::mutex Subscriptor::mutex
staticprivateinherited

A mutex used to ensure data consistency when accessing the mutable members of this class. This lock is used in the subscribe() and unsubscribe() functions, as well as in list_subscribers().

Definition at line 271 of file subscriptor.h.


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