deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40:00+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\}}\)
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim > Class Template Reference
Inheritance diagram for NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >:
Inheritance graph
[legend]

Public Member Functions

 QGenerator (const hp::QCollection< 1 > &q_collection1D, const AdditionalQGeneratorData &additional_data)
 
void generate (const std::vector< std::reference_wrapper< const Function< dim > > > &level_sets, const BoundingBox< dim > &box, const unsigned int n_box_splits)
 
void set_1D_quadrature (const unsigned int q_index)
 
void clear_quadratures ()
 
const QPartitioning< dim > & get_quadratures () const
 

Protected Attributes

const AdditionalQGeneratorData additional_data
 
unsigned int q_index
 
const ObserverPointer< const hp::QCollection< 1 > > q_collection1D
 
QPartitioning< dim > q_partitioning
 

Private Member Functions

void create_low_dim_quadratures (const unsigned int height_function_direction, const std::vector< std::reference_wrapper< const Function< dim > > > &level_sets, const BoundingBox< dim > &box, const unsigned int n_box_splits)
 
void create_high_dim_quadratures (const unsigned int height_function_direction, const std::vector< std::reference_wrapper< const Function< dim > > > &level_sets, const BoundingBox< dim > &box)
 
void split_box_and_recurse (const std::vector< std::reference_wrapper< const Function< dim > > > &level_sets, const BoundingBox< dim > &box, const std::optional< HeightDirectionData > &direction_data, const unsigned int n_box_splits)
 
void use_midpoint_method (const std::vector< std::reference_wrapper< const Function< dim > > > &level_sets, const BoundingBox< dim > &box)
 

Private Attributes

QGenerator< dim - 1, spacedim > low_dim_algorithm
 
UpThroughDimensionCreator< dim, spacedim > up_through_dimension_creator
 
hp::QCollection< dim > tensor_products
 

Detailed Description

template<int dim, int spacedim>
class NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >

This class implements the Saye-algorithm cited in the documentation of the QuadratureGenerator class.

The generate function takes a number of \(dim\)-dimensional level set functions, \(\psi_i\), and a BoundingBox<dim>, and builds a partitioning of quadratures, as defined in documentation of the QPartitioning class. That is, this class builds an object of type QPartitioning<dim>.

If all \(\psi_i\) passed to generate can be determined to be positive or negative definite, the QPartitioning will consist of a single quadrature forming a tensor product.

If this is not the case, the algorithm uses recursion over the spatial dimension. The spacedim template parameter denotes the dimension we started with and dim denotes on what level we are in the recursion. That is, we first construct a QPartitioning<dim - 1> and then build the higher dimensional quadratures from these. What we in the end actually want is a spacedim-dimensional partitioning of quadratures, for a single level set function, \(\psi\).

The algorithm is based on the implicit function theorem. Starting with a single level set function, \(\psi\), we try to find a direction \(i\), such that

\(|\frac{\partial \psi}{\partial x_i}| > 0\).

throughout the whole box. This means that the zero-contour of the level set function can be parameterized by an implicit function

\(H = H(x_0, ..., x_{i-1}, x_{i+1}, ..., x_{dim-1})\),

so that

\(\psi(..., x_{i-1}, H(..., x_{i-1}, x_{i+1}, ...), x_{i+1}, ...) = 0\),

over a subset, \(I \subset C \subset \mathbb{R}^{dim-1}\), of the cross section, \(C\), of the box (see BoundingBox::cross_section). Here, \(I\) is the "indefinite"-region defined in the QPartitioning class. To follow convention in the original paper, we will -refer to \(H\) as the "height-function" and to \(i\) as the "height-function direction".

If a height function direction can be found, we go down in dimension by creating two new level set functions, \(\{\psi_0, \psi_1\}\), which are the restriction of \(\psi\) to the top and bottom faces of the box (in the height function direction). We then delegate to QGenerator<dim-1, spacedim> to create a QPartitioning<dim-1> over the cross section.

When we reach the base case, \(dim = 1\), the creation of QPartitioning<1> is simple. See the documentation in specialized class: QGenerator<1, spacedim>.

As we go up through the dimensions and create the higher dimensional quadratures, we need to know the function value of the height functions at the lower dimensional quadrature points. Since the functions are implicit, we need to do root-finding on the level set functions to find the function values. For this we use the class UpThroughDimensionCreator, see documentation there.

When we have \(n\) level set functions (i.e. after having gone down in dimension), we try to find a height function direction, which works for all those \(\psi_i\) which are intersected by the zero contour (i.e. those not positive or negative definite). If such a direction exist, we will have a maximum of \(n\) associated implicit height functions, \(H_j\). Each \(H_j\) parametrize the \(x_i\)-coordinate of the zero-contour over a region, \(I_j\). The indefinite region in the lower dimensional partitioning is the union of these \(I = \cup_j I_j\).

As we try to find a height function direction, we estimate bounds on the gradient components by approximating each component as a 1st-order Taylor-polynomial. If a direction can not be found, the box is split and we recurse on each smaller box. This makes an implicit function more likely to exist since we seek it over a smaller portion of the zero contour. It also makes the estimated bounds tighter since we extrapolate the Taylor-polynomial a shorter distance.

Since we can not split a box forever, there is an maximum number of allowed splits on the additional data struct passed to the constructor. If this is reached, the algorithm uses the midpoint method as a last resort.

Definition at line 1150 of file quadrature_generator.h.

Constructor & Destructor Documentation

◆ QGenerator()

template<int dim, int spacedim>
NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::QGenerator ( const hp::QCollection< 1 > &  q_collection1D,
const AdditionalQGeneratorData additional_data 
)

Constructor. Takes the same parameters QuadratureGenerator.

Definition at line 880 of file quadrature_generator.cc.

Member Function Documentation

◆ generate()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::generate ( const std::vector< std::reference_wrapper< const Function< dim > > > &  level_sets,
const BoundingBox< dim > &  box,
const unsigned int  n_box_splits 
)

Create immersed quadrature rules over the incoming box and add these to the internal QPartitioning<dim> object in the base class. These quadratures can then be obtained using the get_quadratures-function.

This function calls itself if the incoming box need to be split. n_box_splits counts the number of times this function has called itself.

Definition at line 913 of file quadrature_generator.cc.

◆ set_1D_quadrature()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::set_1D_quadrature ( const unsigned int  q_index)

Set which 1d-quadrature in the collection passed to the constructor should be used to create the immersed quadratures.

Definition at line 1197 of file quadrature_generator.cc.

◆ create_low_dim_quadratures()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::create_low_dim_quadratures ( const unsigned int  height_function_direction,
const std::vector< std::reference_wrapper< const Function< dim > > > &  level_sets,
const BoundingBox< dim > &  box,
const unsigned int  n_box_splits 
)
private

Restricts the incoming level set functions to the top and bottom of the incoming box (w.r.t height_function_direction). Then call the lower dimensional QGenerator with the cross section of the box to generate the lower dimensional immersed quadrature rules.

Definition at line 1112 of file quadrature_generator.cc.

◆ create_high_dim_quadratures()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::create_high_dim_quadratures ( const unsigned int  height_function_direction,
const std::vector< std::reference_wrapper< const Function< dim > > > &  level_sets,
const BoundingBox< dim > &  box 
)
private

Gets the \((dim - 1)\)-dimensional quadratures from the lower dimensional algorithm and creates the \(dim\)-dimensional quadrature rules over the box from the lower dimensional ones.

Definition at line 1141 of file quadrature_generator.cc.

◆ split_box_and_recurse()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::split_box_and_recurse ( const std::vector< std::reference_wrapper< const Function< dim > > > &  level_sets,
const BoundingBox< dim > &  box,
const std::optional< HeightDirectionData > &  direction_data,
const unsigned int  n_box_splits 
)
private

Split the incoming box and call generate() recursively with each box. The box is split in 2 or 4 parts depending on the value of AdditionalQGeneratorData::split_in_half.

Definition at line 1079 of file quadrature_generator.cc.

◆ use_midpoint_method()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::use_midpoint_method ( const std::vector< std::reference_wrapper< const Function< dim > > > &  level_sets,
const BoundingBox< dim > &  box 
)
private

Uses the midpoint-method to create a quadrature over the box. That is, add a single quadrature point at the center of the box with weight corresponding to the volume of the box.

The point is added to the region defined in QPartitioning according to the signs of the level set functions at the center of the box.

Definition at line 1178 of file quadrature_generator.cc.

◆ clear_quadratures()

template<int dim, int spacedim>
void NonMatching::internal::QuadratureGeneratorImplementation::QGeneratorBase< dim, spacedim >::clear_quadratures ( )
inherited

Clear the quadratures created by the previous call to generate().

Definition at line 895 of file quadrature_generator.cc.

◆ get_quadratures()

template<int dim, int spacedim>
const QPartitioning< dim > & NonMatching::internal::QuadratureGeneratorImplementation::QGeneratorBase< dim, spacedim >::get_quadratures ( ) const
inherited

Return the created quadratures.

Definition at line 904 of file quadrature_generator.cc.

Member Data Documentation

◆ low_dim_algorithm

template<int dim, int spacedim>
QGenerator<dim - 1, spacedim> NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::low_dim_algorithm
private

The same algorithm as this, but creating immersed quadratures in one dimension lower.

Definition at line 1241 of file quadrature_generator.h.

◆ up_through_dimension_creator

template<int dim, int spacedim>
UpThroughDimensionCreator<dim, spacedim> NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::up_through_dimension_creator
private

Object responsible for creating the \(dim\)-dimensional quadratures from

Definition at line 1247 of file quadrature_generator.h.

◆ tensor_products

template<int dim, int spacedim>
hp::QCollection<dim> NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >::tensor_products
private

Stores tensor products of each of the Quadrature<1>'s in q_collection1d.

Definition at line 1253 of file quadrature_generator.h.

◆ additional_data

template<int dim, int spacedim>
const AdditionalQGeneratorData NonMatching::internal::QuadratureGeneratorImplementation::QGeneratorBase< dim, spacedim >::additional_data
protectedinherited

Stores options/settings for the algorithm.

Definition at line 1045 of file quadrature_generator.h.

◆ q_index

template<int dim, int spacedim>
unsigned int NonMatching::internal::QuadratureGeneratorImplementation::QGeneratorBase< dim, spacedim >::q_index
protectedinherited

Which 1d-quadrature in the collection we should use to generate the immersed quadrature.

Definition at line 1051 of file quadrature_generator.h.

◆ q_collection1D

template<int dim, int spacedim>
const ObserverPointer<const hp::QCollection<1> > NonMatching::internal::QuadratureGeneratorImplementation::QGeneratorBase< dim, spacedim >::q_collection1D
protectedinherited

Index of the quadrature in q_collection1d that should use to generate the immersed quadrature rules.

Definition at line 1057 of file quadrature_generator.h.

◆ q_partitioning

template<int dim, int spacedim>
QPartitioning<dim> NonMatching::internal::QuadratureGeneratorImplementation::QGeneratorBase< dim, spacedim >::q_partitioning
protectedinherited

Quadratures that the derived classes create.

Definition at line 1062 of file quadrature_generator.h.


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