Reference documentation for deal.II version GIT 1e9e64a91d 2022-09-28 19:20:02+00:00
\(\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\}}\)
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
NonMatching::FEValues< dim > Class Template Reference

#include <deal.II/non_matching/fe_values.h>

Public Types

using AdditionalData = typename QuadratureGenerator< dim >::AdditionalData
 

Public Member Functions

template<class VectorType >
 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 VectorType &level_set, const AdditionalData &additional_data=AdditionalData())
 
template<class VectorType >
 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 VectorType &level_set, const AdditionalData &additional_data=AdditionalData())
 
template<bool level_dof_access>
void reinit (const TriaIterator< DoFCellAccessor< dim, dim, level_dof_access >> &cell)
 
const std_cxx17::optional<::FEValues< dim > > & get_inside_fe_values () const
 
const std_cxx17::optional<::FEValues< dim > > & get_outside_fe_values () const
 
const std_cxx17::optional< FEImmersedSurfaceValues< dim > > & get_surface_fe_values () const
 

Private Member Functions

void initialize (const hp::QCollection< dim > &q_collection)
 

Private Attributes

const SmartPointer< const hp::MappingCollection< dim > > mapping_collection
 
const SmartPointer< 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 SmartPointer< const MeshClassifier< dim > > mesh_classifier
 
std::deque< std_cxx17::optional<::FEValues< dim > > > fe_values_inside_full_quadrature
 
std::deque< std_cxx17::optional<::FEValues< dim > > > fe_values_outside_full_quadrature
 
std_cxx17::optional<::FEValues< dim > > fe_values_inside
 
std_cxx17::optional<::FEValues< dim > > fe_values_outside
 
std_cxx17::optional< NonMatching::FEImmersedSurfaceValues< dim > > fe_values_surface
 
DiscreteQuadratureGenerator< dim > quadrature_generator
 

Detailed Description

template<int dim>
class NonMatching::FEValues< dim >

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_cxx17::optional. This requires us to check if the returned FEValues-like object contains a value before we use it:

for (const auto &cell : dof_handler.active_cell_iterators())
{
fe_values.reinit(cell);
const std_cxx17::optional<FEValues<dim>> &fe_values_inside =
fe_values.get_inside_fe_values();
{
// Assemble locally
for (const unsigned int q_index :
fe_values_inside->quadrature_point_indices())
{
// ...
}
}
}
std_cxx17::optional<::FEValues< dim > > fe_values_inside
Definition: fe_values.h:345

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 144 of file fe_values.h.

Member Typedef Documentation

◆ AdditionalData

template<int dim>
using NonMatching::FEValues< dim >::AdditionalData = typename QuadratureGenerator<dim>::AdditionalData

Definition at line 147 of file fe_values.h.

Constructor & Destructor Documentation

◆ FEValues() [1/2]

template<int dim>
template<class VectorType >
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 VectorType &  level_set,
const AdditionalData additional_data = AdditionalData() 
)

Constructor.

Parameters
fe_collectionCollection of FiniteElements to be used.
quadrature1-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_classifierObject used to determine when the immersed quadrature rules need to be generated.
region_update_flagsStruct storing UpdateFlags for the inside/outside/surface region of the cell.
dof_handlerThe DoFHandler associated with the discrete level set function.
level_setThe degrees of freedom of the discrete level set function.
additional_dataAdditional data passed to the QuadratureGenerator class.
Note
Pointers to 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 49 of file fe_values.cc.

◆ FEValues() [2/2]

template<int dim>
template<class VectorType >
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 VectorType &  level_set,
const AdditionalData additional_data = AdditionalData() 
)

Constructor.

Parameters
mapping_collectionCollection of Mappings to be used.
fe_collectionCollection of FiniteElements to be used.
q_collectionCollection 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_1DCollection of 1-dimensional quadrature rules used to generate the immersed quadrature rules. See the QuadratureGenerator class.
mesh_classifierObject used to determine when the immersed quadrature rules need to be generated.
region_update_flagsStruct storing UpdateFlags for the inside/outside/surface region of the cell.
dof_handlerThe DoFHandler associated with the discrete level set function.
level_setThe degrees of freedom of the discrete level set function.
additional_dataAdditional data passed to the QuadratureGenerator class.
Note
Pointers to 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 79 of file fe_values.cc.

Member Function Documentation

◆ reinit()

template<int dim>
template<bool level_dof_access>
void FEValues< dim >::reinit ( const TriaIterator< DoFCellAccessor< dim, dim, level_dof_access >> &  cell)

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().

Definition at line 154 of file fe_values.cc.

◆ get_inside_fe_values()

template<int dim>
const std_cxx17::optional<::FEValues< dim > > & FEValues< dim >::get_inside_fe_values

Return an FEValues object reinitialized with a quadrature for the inside region of the cell: \(\{x \in K : \psi(x) < 0 \}\).

Note
If the quadrature rule over the region is empty, e.g. because the cell is completely located in the outside domain, the returned optional will not contain a value.

Definition at line 241 of file fe_values.cc.

◆ get_outside_fe_values()

template<int dim>
const std_cxx17::optional<::FEValues< dim > > & FEValues< dim >::get_outside_fe_values

Return an FEValues object reinitialized with a quadrature for the outside region of the cell: \(\{x \in K : \psi(x) > 0 \}\).

Note
If the quadrature rule over the region is empty, e.g. because the cell is completely located in the inside domain, the returned optional will not contain a value.

Definition at line 253 of file fe_values.cc.

◆ get_surface_fe_values()

template<int dim>
const std_cxx17::optional< FEImmersedSurfaceValues< dim > > & FEValues< dim >::get_surface_fe_values

Return an FEValues object reinitialized with a quadrature for the surface region of the cell: \(\{x \in K : \psi(x) = 0 \}\).

Note
If the quadrature rule over the region is empty, e.g. because the cell is not intersected, the returned optional will not contain a value.

Definition at line 265 of file fe_values.cc.

◆ initialize()

template<int dim>
void FEValues< dim >::initialize ( const hp::QCollection< dim > &  q_collection)
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 105 of file fe_values.cc.

Member Data Documentation

◆ mapping_collection

template<int dim>
const SmartPointer<const hp::MappingCollection<dim> > NonMatching::FEValues< dim >::mapping_collection
private

A pointer to the collection of mappings to be used.

Definition at line 273 of file fe_values.h.

◆ fe_collection

template<int dim>
const SmartPointer<const hp::FECollection<dim> > NonMatching::FEValues< dim >::fe_collection
private

A pointer to the collection of finite elements to be used.

Definition at line 278 of file fe_values.h.

◆ q_collection_1D

template<int dim>
const hp::QCollection<1> NonMatching::FEValues< dim >::q_collection_1D
private

Collection of 1-dimensional quadrature rules that are used by QuadratureGenerator as base for generating the immersed quadrature rules.

Definition at line 284 of file fe_values.h.

◆ current_cell_location

template<int dim>
LocationToLevelSet NonMatching::FEValues< dim >::current_cell_location
private

Location of the last cell that reinit was called with.

Definition at line 289 of file fe_values.h.

◆ active_fe_index

template<int dim>
unsigned int NonMatching::FEValues< dim >::active_fe_index
private

Active fe index of the last cell that reinit was called with.

Definition at line 294 of file fe_values.h.

◆ region_update_flags

template<int dim>
const RegionUpdateFlags NonMatching::FEValues< dim >::region_update_flags
private

The update flags passed to the constructor.

Definition at line 299 of file fe_values.h.

◆ mesh_classifier

template<int dim>
const SmartPointer<const MeshClassifier<dim> > NonMatching::FEValues< dim >::mesh_classifier
private

Pointer to the MeshClassifier passed to the constructor.

Definition at line 304 of file fe_values.h.

◆ fe_values_inside_full_quadrature

template<int dim>
std::deque<std_cxx17::optional<::FEValues<dim> > > NonMatching::FEValues< dim >::fe_values_inside_full_quadrature
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 320 of file fe_values.h.

◆ fe_values_outside_full_quadrature

template<int dim>
std::deque<std_cxx17::optional<::FEValues<dim> > > NonMatching::FEValues< dim >::fe_values_outside_full_quadrature
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 336 of file fe_values.h.

◆ fe_values_inside

template<int dim>
std_cxx17::optional<::FEValues<dim> > NonMatching::FEValues< dim >::fe_values_inside
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 345 of file fe_values.h.

◆ fe_values_outside

template<int dim>
std_cxx17::optional<::FEValues<dim> > NonMatching::FEValues< dim >::fe_values_outside
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 354 of file fe_values.h.

◆ fe_values_surface

template<int dim>
std_cxx17::optional<NonMatching::FEImmersedSurfaceValues<dim> > NonMatching::FEValues< dim >::fe_values_surface
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 364 of file fe_values.h.

◆ quadrature_generator

template<int dim>
DiscreteQuadratureGenerator<dim> NonMatching::FEValues< dim >::quadrature_generator
private

Object that generates the immersed quadrature rules.

Definition at line 369 of file fe_values.h.


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