Reference documentation for deal.II version GIT relicensing-1062-gc06da148b8 2024-07-15 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\}}\)
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
RefinementCase< dim > Class Template Reference

#include <deal.II/base/geometry_info.h>

Inheritance diagram for RefinementCase< dim >:
Inheritance graph

Public Types

enum  Possibilities : std::uint8_t { no_refinement = 0 , isotropic_refinement = 0xFF }

Public Member Functions

 RefinementCase ()
 RefinementCase (const typename RefinementPossibilities< dim >::Possibilities refinement_case)
 RefinementCase (const std::uint8_t refinement_case)
 operator std::uint8_t () const
RefinementCase operator| (const RefinementCase &r) const
RefinementCase operator& (const RefinementCase &r) const
RefinementCase operator~ () const
template<class Archive >
void serialize (Archive &ar, const unsigned int version)

Static Public Member Functions

static RefinementCase cut_axis (const unsigned int i)
static std::array< RefinementCase< dim >, n_refinement_casesall_refinement_cases ()
static std::size_t memory_consumption ()
static ::ExceptionBaseExcInvalidRefinementCase (int arg1)

Static Public Attributes

static constexpr unsigned int n_refinement_cases = (1 << dim)

Private Attributes

std::uint8_t value: (dim > 0 ? dim : 1)

Detailed Description

template<int dim>
class RefinementCase< dim >

A class storing the possible anisotropic and isotropic refinement cases of an object with dim dimensions (for example, for a line dim=1 in whatever space dimension we are, for a quad dim=2, etc.). Possible values of this class are the ones listed in the enumeration declared within the base class; see there for more information.

Definition at line 778 of file geometry_info.h.

Member Enumeration Documentation

◆ Possibilities

template<int dim>
enum RefinementPossibilities::Possibilities : std::uint8_t

Possible values for refinement cases in the current dimension.

Note the construction of the values: the lowest bit describes a cut of the x-axis, the second to lowest bit corresponds to a cut of the y-axis and the third to lowest bit corresponds to a cut of the z-axis. Thus, the following relations hold (among others):

cut_xy == cut_x | cut_y
cut_xyz == cut_xy | cut_xz
cut_x == cut_xy & cut_xz

Only those cuts that are reasonable in a given space dimension are offered, of course.

In addition, the tag isotropic_refinement denotes isotropic refinement in the space dimension selected by the template argument of this class.

If you choose anisotropic refinement, for example by passing as argument to CellIterator::set_refine_flag() one of the flags RefinementCase::cut_x, RefinementCase::cut_y, RefinementCase::cut_z, or a combination of these, then keep in mind that refining in x-, y-, or z-direction happens with regard to the local coordinate system of the cell. In other words, these flags determine which edges and faces of the cell will be cut into new edges and faces. On the other hand, this process is independent of how the cell is oriented within the global coordinate system, and you should not assume any particular orientation of the cell's local coordinate system within the global coordinate system of the space it lives in.


Do not perform refinement.


Perform isotropic refinement. This implies refining in all coordinate directions. For the current general template class – which is never used because there are specializations for the 1d, 2d, and 3d cases –, we simply set this number to a value that has all bits set. The specializations in RefinementPossibilities<1>, RefinementPossibilities<2>, and RefinementPossibilities<3> set the corresponding enum element to more reasonable values.

Definition at line 520 of file geometry_info.h.

Constructor & Destructor Documentation

◆ RefinementCase() [1/3]

template<int dim>
RefinementCase< dim >::RefinementCase ( )

Default constructor. Initialize the refinement case with no_refinement.

◆ RefinementCase() [2/3]

template<int dim>
RefinementCase< dim >::RefinementCase ( const typename RefinementPossibilities< dim >::Possibilities  refinement_case)

Constructor. Take and store a value indicating a particular refinement from the list of possible refinements specified in the base class.

◆ RefinementCase() [3/3]

template<int dim>
RefinementCase< dim >::RefinementCase ( const std::uint8_t  refinement_case)

Constructor. Take and store a value indicating a particular refinement as a bit field. To avoid implicit conversions to and from integral values, this constructor is marked as explicit.

Member Function Documentation

◆ operator std::uint8_t()

template<int dim>
RefinementCase< dim >::operator std::uint8_t ( ) const

Return the numeric value stored by this class. While the presence of this operator might seem dangerous, it is useful in cases where one would like to have code like switch (refinement_flag)... case RefinementCase<dim>::cut_x: ... , which can be written as switch (static_cast<std::uint8_t>(refinement_flag). Another application is to use an object of the current type as an index into an array; however, this use is deprecated as it assumes a certain mapping from the symbolic flags defined in the RefinementPossibilities base class to actual numerical values (the array indices).

◆ operator|()

template<int dim>
RefinementCase RefinementCase< dim >::operator| ( const RefinementCase< dim > &  r) const

Return the union of the refinement flags represented by the current object and the one given as argument.

◆ operator&()

template<int dim>
RefinementCase RefinementCase< dim >::operator& ( const RefinementCase< dim > &  r) const

Return the intersection of the refinement flags represented by the current object and the one given as argument.

◆ operator~()

template<int dim>
RefinementCase RefinementCase< dim >::operator~ ( ) const

Return the negation of the refinement flags represented by the current object. For example, in 2d, if the current object holds the flag cut_x, then the returned value will be cut_y; if the current value is isotropic_refinement then the result will be no_refinement; etc.

◆ cut_axis()

template<int dim>
static RefinementCase RefinementCase< dim >::cut_axis ( const unsigned int  i)

Return the flag that corresponds to cutting a cell along the axis given as argument. For example, if i=0 then the returned value is RefinementPossibilities<dim>::cut_x.

◆ all_refinement_cases()

template<int dim>
static std::array< RefinementCase< dim >, n_refinement_cases > RefinementCase< dim >::all_refinement_cases ( )

Return an array that lists all possible refinement cases possible in the given space dimension. For example, for dim==1, it returns an array that only contains { RefinementCase::no_refinement, RefinementCase::cut_x }. In dim==2, it returns { RefinementCase::no_refinement, RefinementCase::cut_x, RefinementCase::cut_y, RefinementCase::cut_xy }.

◆ memory_consumption()

template<int dim>
static std::size_t RefinementCase< dim >::memory_consumption ( )

Return the amount of memory occupied by an object of this type.

◆ serialize()

template<int dim>
template<class Archive >
void RefinementCase< dim >::serialize ( Archive &  ar,
const unsigned int  version 

Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.

Member Data Documentation

◆ n_refinement_cases

template<int dim>
constexpr unsigned int RefinementCase< dim >::n_refinement_cases = (1 << dim)

A variable indicating the number of possible refinement cases.

Definition at line 784 of file geometry_info.h.

◆ value

template<int dim>
std::uint8_t RefinementCase< dim >::value

Store the refinement case as a bit field with as many bits as are necessary in any given dimension.

Definition at line 892 of file geometry_info.h.

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