deal.II version GIT relicensing-2206-gaa53ff9447 2024-12-02 09:10:00+00:00
|
#include <deal.II/non_matching/fe_values.h>
Public Types | |
using | AdditionalData = typename QuadratureGenerator< dim >::AdditionalData |
Public Member Functions | |
template<typename Number > | |
FEValues (const hp::FECollection< dim > &fe_collection, const Quadrature< 1 > &quadrature, const RegionUpdateFlags region_update_flags, const MeshClassifier< dim > &mesh_classifier, const DoFHandler< dim > &dof_handler, const ReadVector< Number > &level_set, const AdditionalData &additional_data=AdditionalData()) | |
template<typename Number > | |
FEValues (const hp::MappingCollection< dim > &mapping_collection, const hp::FECollection< dim > &fe_collection, const hp::QCollection< dim > &q_collection, const hp::QCollection< 1 > &q_collection_1d, const RegionUpdateFlags region_update_flags, const MeshClassifier< dim > &mesh_classifier, const DoFHandler< dim > &dof_handler, const ReadVector< Number > &level_set, const AdditionalData &additional_data=AdditionalData()) | |
template<bool level_dof_access> | |
void | reinit (const TriaIterator< DoFCellAccessor< dim, dim, level_dof_access > > &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int) |
void | reinit (const TriaIterator< CellAccessor< dim, dim > > &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int) |
const std::optional<::FEValues< dim > > & | get_inside_fe_values () const |
const std::optional<::FEValues< dim > > & | get_outside_fe_values () const |
const std::optional< FEImmersedSurfaceValues< dim > > & | get_surface_fe_values () const |
Private Member Functions | |
template<typename CellIteratorType > | |
void | reinit_internal (const CellIteratorType &cell, const unsigned int q_index, const unsigned int mapping_index, const unsigned int fe_index) |
void | initialize (const hp::QCollection< dim > &q_collection) |
Private Attributes | |
const ObserverPointer< const hp::MappingCollection< dim > > | mapping_collection |
const ObserverPointer< const hp::FECollection< dim > > | fe_collection |
const hp::QCollection< 1 > | q_collection_1D |
LocationToLevelSet | current_cell_location |
unsigned int | active_fe_index |
const RegionUpdateFlags | region_update_flags |
const ObserverPointer< const MeshClassifier< dim > > | mesh_classifier |
std::deque< std::optional<::FEValues< dim > > > | fe_values_inside_full_quadrature |
std::deque< std::optional<::FEValues< dim > > > | fe_values_outside_full_quadrature |
std::optional<::FEValues< dim > > | fe_values_inside |
std::optional<::FEValues< dim > > | fe_values_outside |
std::optional< NonMatching::FEImmersedSurfaceValues< dim > > | fe_values_surface |
DiscreteQuadratureGenerator< dim > | quadrature_generator |
This class is intended to facilitate assembling in immersed (in the sense of cut) finite element methods when the domain is described by a level set function, \(\psi : \mathbb{R}^{dim} \to \mathbb{R}\). In this type of method, we typically need to integrate over 3 different regions of each cell, \(K\):
\[ N = \{x \in K : \psi(x) < 0 \}, \\ P = \{x \in K : \psi(x) > 0 \}, \\ S = \{x \in K : \psi(x) = 0 \}. \]
Thus we need quadrature rules for these 3 regions:
As in the QuadratureGenerator class, we refer to \(N\), \(P\), and \(S\) as the inside, outside, and surface regions. The constructor of this class takes a discrete level set function described by a DoFHandler and a Vector. When the reinit() function is called, the QuadratureGenerator will be called in the background to create these immersed quadrature rules. This class then creates FEValues objects for the inside/outside regions and an FEImmersedSurfaceValues object for the surface region. These objects can then be accessed through one of the functions: get_inside_fe_values(), get_outside_fe_values(), or get_surface_fe_values(). Since a cut between a cell and the domain can be arbitrarily small, the underlying algorithm may generate a quadrature rule with 0 points. This can, for example, happen if the relative size of the cut is similar to the floating-point accuracy. Since the FEValues-like objects are not allowed to contain 0 points, the object that get_inside/outside/surface_fe_values() returns is wrapped in a std::optional. This requires us to check if the returned FEValues-like object contains a value before we use it:
Of course, it is somewhat expensive to generate the immersed quadrature rules and create FEValues objects with the generated quadratures. To reduce the amount of work, the reinit() function of this class uses the MeshClassifier passed to the constructor to check how the incoming cell relates to the level set function. It only generates the immersed quadrature rules if the cell is intersected. If the cell is completely inside or outside, it returns a cached FEValues object created with a quadrature over the reference cell: \([0, 1]^{dim}\).
Definition at line 143 of file fe_values.h.
using NonMatching::FEValues< dim >::AdditionalData = typename QuadratureGenerator<dim>::AdditionalData |
Definition at line 146 of file fe_values.h.
FEValues< dim >::FEValues | ( | const hp::FECollection< dim > & | fe_collection, |
const Quadrature< 1 > & | quadrature, | ||
const RegionUpdateFlags | region_update_flags, | ||
const MeshClassifier< dim > & | mesh_classifier, | ||
const DoFHandler< dim > & | dof_handler, | ||
const ReadVector< Number > & | level_set, | ||
const AdditionalData & | additional_data = AdditionalData() |
||
) |
Constructor.
fe_collection | Collection of FiniteElements to be used. |
quadrature | 1-dimensional quadrature rule used to generate the immersed quadrature rules. See the QuadratureGenerator class. On the non intersected elements a tensor product of this quadrature will be used. |
mesh_classifier | Object used to determine when the immersed quadrature rules need to be generated. |
region_update_flags | Struct storing UpdateFlags for the inside/outside/surface region of the cell. |
dof_handler | The DoFHandler associated with the discrete level set function. |
level_set | The degrees of freedom of the discrete level set function. |
additional_data | Additional data passed to the QuadratureGenerator class. |
fe_collection
, mesh_classifier
, dof_handler
, and level_set
are stored internally, so these need to have a longer life span than the instance of this class. Definition at line 45 of file fe_values.cc.
FEValues< dim >::FEValues | ( | const hp::MappingCollection< dim > & | mapping_collection, |
const hp::FECollection< dim > & | fe_collection, | ||
const hp::QCollection< dim > & | q_collection, | ||
const hp::QCollection< 1 > & | q_collection_1d, | ||
const RegionUpdateFlags | region_update_flags, | ||
const MeshClassifier< dim > & | mesh_classifier, | ||
const DoFHandler< dim > & | dof_handler, | ||
const ReadVector< Number > & | level_set, | ||
const AdditionalData & | additional_data = AdditionalData() |
||
) |
Constructor.
mapping_collection | Collection of Mappings to be used. |
fe_collection | Collection of FiniteElements to be used. |
q_collection | Collection of Quadrature rules over \([0, 1]^{dim}\) that should be used when a cell is not intersected and we do not need to generate immersed quadrature rules. |
q_collection_1d | Collection of 1-dimensional quadrature rules used to generate the immersed quadrature rules. See the QuadratureGenerator class. |
mesh_classifier | Object used to determine when the immersed quadrature rules need to be generated. |
region_update_flags | Struct storing UpdateFlags for the inside/outside/surface region of the cell. |
dof_handler | The DoFHandler associated with the discrete level set function. |
level_set | The degrees of freedom of the discrete level set function. |
additional_data | Additional data passed to the QuadratureGenerator class. |
mapping_collection
, fe_collection
, mesh_classifier
, dof_handler
, and level_set
are stored internally, so these need to have a longer life span than the instance of this class. Definition at line 75 of file fe_values.cc.
void FEValues< dim >::reinit | ( | const TriaIterator< DoFCellAccessor< dim, dim, level_dof_access > > & | cell, |
const unsigned int | q_index = numbers::invalid_unsigned_int , |
||
const unsigned int | mapping_index = numbers::invalid_unsigned_int |
||
) |
Reinitialize the various FEValues-like objects for the 3 different regions of the cell. After calling this function an FEValues-like object can be retrieved for each region using the functions get_inside_fe_values(), get_outside_fe_values(), or get_surface_fe_values().
If the q_index
argument is left at its default value, then we use that quadrature formula within the hp::QCollection passed to the constructor of this class with index given by cell->active_fe_index()
, i.e. the same index as that of the finite element. In this case, there should be a corresponding quadrature formula for each finite element in the hp::FECollection. As a special case, if the quadrature collection contains only a single element (a frequent case if one wants to use the same quadrature object for all finite elements in an hp-discretization, even if that may not be the most efficient), then this single quadrature is used unless a different value for this argument is specified. On the other hand, if a value is given for this argument, it overrides the choice of cell->active_fe_index()
or the choice for the single quadrature.
If the mapping_index
argument is left at its default value, then we use that mapping object within the hp::MappingCollection passed to the constructor of this class with index given by cell->active_fe_index()
, i.e. the same index as that of the finite element. As above, if the mapping collection contains only a single element (a frequent case if one wants to use a \(Q_1\) mapping for all finite elements in an hp-discretization), then this single mapping is used unless a different value for this argument is specified.
Definition at line 150 of file fe_values.cc.
void FEValues< dim >::reinit | ( | const TriaIterator< CellAccessor< dim, dim > > & | cell, |
const unsigned int | q_index = numbers::invalid_unsigned_int , |
||
const unsigned int | mapping_index = numbers::invalid_unsigned_int , |
||
const unsigned int | fe_index = numbers::invalid_unsigned_int |
||
) |
Like the previous function, but for non-DoFHandler iterators. The reason this function exists is so that one can use NonMatching::FEValues for Triangulation objects too.
Since cell->active_fe_index()
doesn't make sense for triangulation iterators, this function chooses the zero-th finite element, mapping, and quadrature object from the relevant constructions passed to the constructor of this object. The only exception is if you specify a value different from the default value for any of these last three arguments.
Definition at line 165 of file fe_values.cc.
const std::optional<::FEValues< dim > > & FEValues< dim >::get_inside_fe_values | ( | ) | const |
Return an FEValues object reinitialized with a quadrature for the inside region of the cell: \(\{x \in K : \psi(x) < 0 \}\).
Definition at line 306 of file fe_values.cc.
const std::optional<::FEValues< dim > > & FEValues< dim >::get_outside_fe_values | ( | ) | const |
Return an FEValues object reinitialized with a quadrature for the outside region of the cell: \(\{x \in K : \psi(x) > 0 \}\).
Definition at line 318 of file fe_values.cc.
const std::optional< FEImmersedSurfaceValues< dim > > & FEValues< dim >::get_surface_fe_values | ( | ) | const |
Return an FEValues object reinitialized with a quadrature for the surface region of the cell: \(\{x \in K : \psi(x) = 0 \}\).
Definition at line 330 of file fe_values.cc.
|
private |
Internal function called by the reinit() functions.
Definition at line 178 of file fe_values.cc.
|
private |
Do work common to the constructors. The incoming QCollection should be quadratures integrating over \([0, 1]^{dim}\). These will be used on the non-intersected cells.
Definition at line 101 of file fe_values.cc.
|
private |
A pointer to the collection of mappings to be used.
Definition at line 325 of file fe_values.h.
|
private |
A pointer to the collection of finite elements to be used.
Definition at line 330 of file fe_values.h.
|
private |
Collection of 1-dimensional quadrature rules that are used by QuadratureGenerator as base for generating the immersed quadrature rules.
Definition at line 336 of file fe_values.h.
|
private |
Location of the last cell that reinit was called with.
Definition at line 341 of file fe_values.h.
|
private |
Active fe index of the last cell that reinit was called with.
Definition at line 346 of file fe_values.h.
|
private |
The update flags passed to the constructor.
Definition at line 351 of file fe_values.h.
|
private |
Pointer to the MeshClassifier passed to the constructor.
Definition at line 356 of file fe_values.h.
|
private |
For each element in the FECollection passed to the constructor, this object contains an FEValues object created with a quadrature rule over the full reference cell: \([0, 1]^{dim}\) and UpdateFlags for the inside region. Thus, these optionals should always contain a value.
When LocationToLevelSet of the cell is INSIDE (and we do not need to generate an immersed quadrature), we return the FEValues object in this container corresponding to the cell's active_fe_index.
This container is a std::deque, which is compatible with the FEValues
class that does not have a copy-constructor.
Definition at line 372 of file fe_values.h.
|
private |
For each element in the FECollection passed to the constructor, this object contains an FEValues object created with a quadrature rule over the full reference cell: \([0, 1]^{dim}\) and UpdateFlags for the outside region. Thus, these optionals should always contain a value.
When LocationToLevelSet of the cell is OUTSIDE (and we do not need to generate an immersed quadrature), we return the FEValues object in this container corresponding to the cell's active_fe_index.
This container is a std::deque, which is compatible with the FEValues
class that does not have a copy-constructor.
Definition at line 388 of file fe_values.h.
|
private |
FEValues object created with a quadrature rule integrating over the inside region, \(\{x \in B : \psi(x) < 0 \}\), that was generated in the last call to reinit(..). If the cell in the last call was not intersected or if 0 quadrature points were generated, this optional will not contain a value.
Definition at line 397 of file fe_values.h.
|
private |
FEValues object created with a quadrature rule integrating over the outside region, \(\{x \in B : \psi(x) > 0 \}\), that was generated in the last call to reinit(..). If the cell in the last call was not intersected or if 0 quadrature points were generated, this optional will not contain a value.
Definition at line 406 of file fe_values.h.
|
private |
FEImmersedSurfaceValues object created with a quadrature rule integrating over the surface region, \(\{x \in B : \psi(x) = 0 \}\), that was generated in the last call to reinit(..). If the cell in the last call was not intersected or if 0 quadrature points were generated, this optional will not contain a value.
Definition at line 415 of file fe_values.h.
|
private |
Object that generates the immersed quadrature rules.
Definition at line 420 of file fe_values.h.