Reference documentation for deal.II version GIT d91250a7db 2022-12-07 13:00:01+00:00
NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim > Class Template Reference

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

Inheritance diagram for NonMatching::internal::QuadratureGeneratorImplementation::QGenerator< dim, spacedim >:
[legend]

## Public Member Functions

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)

const QPartitioning< dim > & get_quadratures () const

## Protected Attributes

unsigned int q_index

const SmartPointer< 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_cxx17::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 1085 of file quadrature_generator.h.

## ◆ QGenerator()

template<int dim, int spacedim>

Constructor. Takes the same parameters QuadratureGenerator.

Definition at line 857 of file quadrature_generator.cc.

## ◆ 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 890 of file quadrature_generator.cc.

template<int dim, int spacedim>

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

Definition at line 1174 of file quadrature_generator.cc.

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 1089 of file quadrature_generator.cc.

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 1118 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_cxx17::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 1056 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 1155 of file quadrature_generator.cc.

template<int dim, int spacedim>
inherited

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

Definition at line 872 of file quadrature_generator.cc.

template<int dim, int spacedim>
inherited

Definition at line 881 of file quadrature_generator.cc.

## ◆ low_dim_algorithm

template<int dim, int spacedim>
private

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

Definition at line 1176 of file quadrature_generator.h.

## ◆ up_through_dimension_creator

template<int dim, int spacedim>
private

Object responsible for creating the $$dim$$-dimensional quadratures from

Definition at line 1182 of file quadrature_generator.h.

## ◆ tensor_products

template<int dim, int spacedim>
private

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

Definition at line 1188 of file quadrature_generator.h.

template<int dim, int spacedim>
protectedinherited

Stores options/settings for the algorithm.

Definition at line 980 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 986 of file quadrature_generator.h.

## ◆ q_collection1D

template<int dim, int spacedim>
 const SmartPointer > 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 992 of file quadrature_generator.h.

## ◆ q_partitioning

template<int dim, int spacedim>