Reference documentation for deal.II version 9.4.1
|
#include <deal.II/numerics/fe_field_function.h>
Public Types | |
using | time_type = typename FunctionTime< typename numbers::NumberTraits< VectorType::value_type >::real_type >::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_values (const std::vector< Point< dim > > &points, std::vector< std::vector< VectorType::value_type > > &values) const |
virtual void | vector_gradients (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, VectorType::value_type > > > &gradients) const |
virtual SymmetricTensor< 2, dim, VectorType::value_type > | hessian (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_hessian (const Point< dim > &p, std::vector< SymmetricTensor< 2, dim, VectorType::value_type > > &values) const |
virtual void | hessian_list (const std::vector< Point< dim > > &points, std::vector< SymmetricTensor< 2, dim, VectorType::value_type > > &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, VectorType::value_type > > > &values) const |
virtual std::size_t | memory_consumption () 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 |
Private Types | |
using | cell_hint_t = Threads::ThreadLocalStorage< typename DoFHandler< dim, spacedim >::active_cell_iterator > |
Private Member Functions | |
std_cxx17::optional< Point< dim > > | get_reference_coordinates (const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, const Point< dim > &point) const |
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 |
Number | time |
Subscriptor functionality | |
Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class. | |
using | map_value_type = decltype(counter_map)::value_type |
using | map_iterator = decltype(counter_map)::iterator |
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) |
void | check_no_subscribers () const noexcept |
static std::mutex | mutex |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
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:
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.
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 is 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):
Definition at line 167 of file fe_field_function.h.
|
private |
Typedef holding the local cell_hint.
Definition at line 449 of file fe_field_function.h.
|
inherited |
The scalar-valued real type used for representing time.
Definition at line 169 of file function.h.
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.
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.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
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.
Reimplemented from Function< dim, VectorType::value_type >.
|
overridevirtual |
Compute the Laplacian of a given component at point p
.
Reimplemented from Function< dim, VectorType::value_type >.
|
overridevirtual |
Compute the Laplacian of all components at point p
and store them in values
.
Reimplemented from Function< dim, VectorType::value_type >.
|
overridevirtual |
Compute the Laplacian of one component at a set of points.
Reimplemented from Function< dim, VectorType::value_type >.
|
overridevirtual |
Compute the Laplacians of all components at a set of points.
Reimplemented from Function< dim, VectorType::value_type >.
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.
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.
|
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_cxx17::optional object.
|
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 |
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 |
Compute the Hessian of a given component at point p
, that is the gradient of the gradient of the function.
|
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.
|
virtualinherited |
Return an estimate for the memory consumption, in bytes, of this object.
This function is virtual and can be overloaded by derived classes.
|
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 |
Pointer to the dof handler.
Definition at line 457 of file fe_field_function.h.
|
private |
A reference to the actual data vector.
Definition at line 462 of file fe_field_function.h.
|
private |
A reference to the mapping being used.
Definition at line 467 of file fe_field_function.h.
|
private |
The Cache object
Definition at line 472 of file fe_field_function.h.
|
mutableprivate |
The latest cell hint.
Definition at line 477 of file fe_field_function.h.
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.
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.