Reference documentation for deal.II version 9.6.0
\(\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
internal::TriangulationImplementation::Implementation Struct Reference

Static Public Member Functions

template<int dim, int spacedim>
static void compute_number_cache_dim (const Triangulation< dim, spacedim > &triangulation, const unsigned int level_objects, internal::TriangulationImplementation::NumberCache< 1 > &number_cache)
 
template<int dim, int spacedim>
static void compute_number_cache_dim (const Triangulation< dim, spacedim > &triangulation, const unsigned int level_objects, internal::TriangulationImplementation::NumberCache< 2 > &number_cache)
 
template<int dim, int spacedim>
static void compute_number_cache_dim (const Triangulation< dim, spacedim > &triangulation, const unsigned int level_objects, internal::TriangulationImplementation::NumberCache< 3 > &number_cache)
 
template<int dim, int spacedim>
static void compute_number_cache (const Triangulation< dim, spacedim > &triangulation, const unsigned int level_objects, internal::TriangulationImplementation::NumberCache< dim > &number_cache)
 
template<int spacedim>
static void update_neighbors (Triangulation< 1, spacedim > &)
 
template<int dim, int spacedim>
static void update_neighbors (Triangulation< dim, spacedim > &triangulation)
 
template<int dim, int spacedim>
static void create_triangulation (const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata, Triangulation< dim, spacedim > &tria)
 
template<int structdim, int spacedim, typename T >
static void process_subcelldata (const CRS< T > &crs, TriaObjects &obj, const std::vector< CellData< structdim > > &boundary_objects_in, const std::vector< Point< spacedim > > &vertex_locations)
 
static void reserve_space_ (TriaFaces &faces, const unsigned structdim, const unsigned int size)
 
static void reserve_space_ (TriaLevel &level, const unsigned int spacedim, const unsigned int size, const bool orientation_needed)
 
static void reserve_space_ (TriaObjects &obj, const unsigned int size)
 
template<int spacedim>
static void delete_children (Triangulation< 1, spacedim > &triangulation, typename Triangulation< 1, spacedim >::cell_iterator &cell, std::vector< unsigned int > &, std::vector< unsigned int > &)
 
template<int spacedim>
static void delete_children (Triangulation< 2, spacedim > &triangulation, typename Triangulation< 2, spacedim >::cell_iterator &cell, std::vector< unsigned int > &line_cell_count, std::vector< unsigned int > &)
 
template<int spacedim>
static void delete_children (Triangulation< 3, spacedim > &triangulation, typename Triangulation< 3, spacedim >::cell_iterator &cell, std::vector< unsigned int > &line_cell_count, std::vector< unsigned int > &quad_cell_count)
 
template<int spacedim>
static void create_children (Triangulation< 2, spacedim > &triangulation, unsigned int &next_unused_vertex, typename Triangulation< 2, spacedim >::raw_line_iterator &next_unused_line, typename Triangulation< 2, spacedim >::raw_cell_iterator &next_unused_cell, const typename Triangulation< 2, spacedim >::cell_iterator &cell)
 
template<int dim, int spacedim>
static Triangulation< dim, spacedim >::DistortedCellList execute_refinement_isotropic (Triangulation< dim, spacedim > &triangulation, const bool check_for_distorted_cells)
 
template<int spacedim>
static Triangulation< 1, spacedim >::DistortedCellList execute_refinement (Triangulation< 1, spacedim > &triangulation, const bool)
 
template<int spacedim>
static Triangulation< 2, spacedim >::DistortedCellList execute_refinement (Triangulation< 2, spacedim > &triangulation, const bool check_for_distorted_cells)
 
template<int spacedim>
static Triangulation< 3, spacedim >::DistortedCellList execute_refinement_isotropic (Triangulation< 3, spacedim > &triangulation, const bool check_for_distorted_cells)
 
template<int spacedim>
static Triangulation< 3, spacedim >::DistortedCellList execute_refinement (Triangulation< 3, spacedim > &triangulation, const bool check_for_distorted_cells)
 
template<int spacedim>
static void prevent_distorted_boundary_cells (Triangulation< 1, spacedim > &)
 
template<int dim, int spacedim>
static void prevent_distorted_boundary_cells (Triangulation< dim, spacedim > &triangulation)
 
template<int dim, int spacedim>
static void prepare_refinement_dim_dependent (const Triangulation< dim, spacedim > &)
 
template<int spacedim>
static void prepare_refinement_dim_dependent (Triangulation< 3, spacedim > &triangulation)
 
template<int dim, int spacedim>
static bool coarsening_allowed (const typename Triangulation< dim, spacedim >::cell_iterator &cell)
 

Detailed Description

A class into which we put many of the functions that implement functionality of the Triangulation class. The main reason for this class is as follows: the majority of the functions in Triangulation need to be implemented differently for dim==1, dim==2, and dim==3. However, their implementation is largly independent of the spacedim template parameter. So we would like to write things like

template <int spacedim>
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)

Unfortunately, C++ doesn't allow this: member functions of class templates have to be either not specialized at all, or fully specialized. No partial specialization is allowed. One possible solution would be to just duplicate the bodies of the functions and have equally implemented functions

template <>
template <>

but that is clearly an unsatisfactory solution. Rather, what we do is introduce the current Implementation class in which we can write these functions as member templates over spacedim, i.e. we can have

template <int dim_, int spacedim_>
template <int spacedim>

The outer template parameters are here unused, only the inner ones are of real interest.

One may ask why we put these functions into an class rather than an anonymous namespace, for example?

First, these implementation functions need to be friends of the Triangulation class. It is simpler to make the entire class a friend rather than listing all members of an implementation namespace as friends of the Triangulation class (there is no such thing as a "friend namespace XXX" directive).

Ideally, we would make this class a member class of the Triangulation<dim,spacedim> class, since then our implementation functions have immediate access to the alias and static functions of the surrounding Triangulation class. I.e., we do not have to write "typename Triangulation<dim,spacedim>::active_cell_iterator" but can write "active_cell_iterator" right away. This is, in fact, the way it was implemented first, but we ran into a bug in gcc4.0:

Here, friendship (per C++ standard) is supposed to extend to all members of the befriended class, including its 'Implementation' member class. But gcc4.0 gets this wrong: the members of Triangulation::Implementation are not friends of TriaAccessor and the other way around. Ideally, one would fix this by saying

friend class TriaAccessor;
friend class TriaAccessor::Implementation; // **
};
class TriaAccessor {
friend class Triangulation;
};
friend struct ::internal::TriangulationImplementation::Implementation
friend struct ::internal::TriaAccessorImplementation::Implementation
Definition tria.h:4553

but that's not legal because in ** we don't know yet that TriaAccessor has a member class Implementation and so we can't make it a friend. The only way forward at this point was to make Implementation a class in the internal namespace so that we can forward declare it and make it a friend of the respective other outer class – not quite what we wanted but the only way I could see to make it work...

Definition at line 2689 of file tria.cc.

Member Function Documentation

◆ compute_number_cache_dim() [1/3]

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::compute_number_cache_dim ( const Triangulation< dim, spacedim > & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache< 1 > & number_cache )
inlinestatic

For a given Triangulation, update that part of the number cache that relates to lines. For 1d, we have to deal with the fact that lines have levels, whereas for higher dimensions they do not.

The second argument indicates for how many levels the Triangulation has objects, though the highest levels need not contain active cells if they have previously all been coarsened away.

Definition at line 2704 of file tria.cc.

◆ compute_number_cache_dim() [2/3]

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::compute_number_cache_dim ( const Triangulation< dim, spacedim > & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache< 2 > & number_cache )
inlinestatic

For a given Triangulation, update that part of the number cache that relates to quads. For 2d, we have to deal with the fact that quads have levels, whereas for higher dimensions they do not.

The second argument indicates for how many levels the Triangulation has objects, though the highest levels need not contain active cells if they have previously all been coarsened away.

At the beginning of the function, we call the respective function to update the number cache for lines.

Definition at line 2792 of file tria.cc.

◆ compute_number_cache_dim() [3/3]

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::compute_number_cache_dim ( const Triangulation< dim, spacedim > & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache< 3 > & number_cache )
inlinestatic

For a given Triangulation, update that part of the number cache that relates to hexes. For 3d, we have to deal with the fact that hexes have levels, whereas for higher dimensions they do not.

The second argument indicates for how many levels the Triangulation has objects, though the highest levels need not contain active cells if they have previously all been coarsened away.

At the end of the function, we call the respective function to update the number cache for quads, which will in turn call the respective function for lines.

Definition at line 2899 of file tria.cc.

◆ compute_number_cache()

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::compute_number_cache ( const Triangulation< dim, spacedim > & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache< dim > & number_cache )
inlinestatic

Definition at line 2992 of file tria.cc.

◆ update_neighbors() [1/2]

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::update_neighbors ( Triangulation< 1, spacedim > & )
inlinestatic

Definition at line 3014 of file tria.cc.

◆ update_neighbors() [2/2]

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::update_neighbors ( Triangulation< dim, spacedim > & triangulation)
inlinestatic

Definition at line 3020 of file tria.cc.

◆ create_triangulation()

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::create_triangulation ( const std::vector< Point< spacedim > > & vertices,
const std::vector< CellData< dim > > & cells,
const SubCellData & subcelldata,
Triangulation< dim, spacedim > & tria )
inlinestatic

Create a triangulation from given data.

Definition at line 3199 of file tria.cc.

◆ process_subcelldata()

template<int structdim, int spacedim, typename T >
static void internal::TriangulationImplementation::Implementation::process_subcelldata ( const CRS< T > & crs,
TriaObjects & obj,
const std::vector< CellData< structdim > > & boundary_objects_in,
const std::vector< Point< spacedim > > & vertex_locations )
inlinestatic

Definition at line 3462 of file tria.cc.

◆ reserve_space_() [1/3]

static void internal::TriangulationImplementation::Implementation::reserve_space_ ( TriaFaces & faces,
const unsigned structdim,
const unsigned int size )
inlinestatic

Definition at line 3570 of file tria.cc.

◆ reserve_space_() [2/3]

static void internal::TriangulationImplementation::Implementation::reserve_space_ ( TriaLevel & level,
const unsigned int spacedim,
const unsigned int size,
const bool orientation_needed )
inlinestatic

Definition at line 3592 of file tria.cc.

◆ reserve_space_() [3/3]

static void internal::TriangulationImplementation::Implementation::reserve_space_ ( TriaObjects & obj,
const unsigned int size )
inlinestatic

Definition at line 3631 of file tria.cc.

◆ delete_children() [1/3]

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::delete_children ( Triangulation< 1, spacedim > & triangulation,
typename Triangulation< 1, spacedim >::cell_iterator & cell,
std::vector< unsigned int > & ,
std::vector< unsigned int > &  )
inlinestatic

Actually delete a cell, or rather all its children, which is the main step for the coarsening process. This is the dimension dependent part of execute_coarsening. The second argument is a vector which gives for each line index the number of cells containing this line. This information is needed to decide whether a refined line may be coarsened or not in 3d. In 1d and 2d this argument is not needed and thus ignored. The same applies for the last argument and quads instead of lines.

Definition at line 3684 of file tria.cc.

◆ delete_children() [2/3]

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::delete_children ( Triangulation< 2, spacedim > & triangulation,
typename Triangulation< 2, spacedim >::cell_iterator & cell,
std::vector< unsigned int > & line_cell_count,
std::vector< unsigned int > &  )
inlinestatic

Definition at line 3788 of file tria.cc.

◆ delete_children() [3/3]

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::delete_children ( Triangulation< 3, spacedim > & triangulation,
typename Triangulation< 3, spacedim >::cell_iterator & cell,
std::vector< unsigned int > & line_cell_count,
std::vector< unsigned int > & quad_cell_count )
inlinestatic

Definition at line 3926 of file tria.cc.

◆ create_children()

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::create_children ( Triangulation< 2, spacedim > & triangulation,
unsigned int & next_unused_vertex,
typename Triangulation< 2, spacedim >::raw_line_iterator & next_unused_line,
typename Triangulation< 2, spacedim >::raw_cell_iterator & next_unused_cell,
const typename Triangulation< 2, spacedim >::cell_iterator & cell )
inlinestatic

Create the children of a 2d cell. The arguments indicate the next free spots in the vertices, lines, and cells arrays.

The faces of the cell have to be refined already, whereas the inner lines in 2d will be created in this function. Therefore iterator pointers into the vectors of lines, quads and cells have to be passed, which point at (or "before") the reserved space.

Definition at line 4554 of file tria.cc.

◆ execute_refinement_isotropic() [1/2]

template<int dim, int spacedim>
static Triangulation< dim, spacedim >::DistortedCellList internal::TriangulationImplementation::Implementation::execute_refinement_isotropic ( Triangulation< dim, spacedim > & triangulation,
const bool check_for_distorted_cells )
inlinestatic

Definition at line 4921 of file tria.cc.

◆ execute_refinement() [1/3]

template<int spacedim>
static Triangulation< 1, spacedim >::DistortedCellList internal::TriangulationImplementation::Implementation::execute_refinement ( Triangulation< 1, spacedim > & triangulation,
const bool  )
inlinestatic

A function that performs the refinement of a triangulation in 1d.

Definition at line 5380 of file tria.cc.

◆ execute_refinement() [2/3]

template<int spacedim>
static Triangulation< 2, spacedim >::DistortedCellList internal::TriangulationImplementation::Implementation::execute_refinement ( Triangulation< 2, spacedim > & triangulation,
const bool check_for_distorted_cells )
inlinestatic

A function that performs the refinement of a triangulation in 2d.

Definition at line 5615 of file tria.cc.

◆ execute_refinement_isotropic() [2/2]

template<int spacedim>
static Triangulation< 3, spacedim >::DistortedCellList internal::TriangulationImplementation::Implementation::execute_refinement_isotropic ( Triangulation< 3, spacedim > & triangulation,
const bool check_for_distorted_cells )
inlinestatic

Definition at line 5925 of file tria.cc.

◆ execute_refinement() [3/3]

template<int spacedim>
static Triangulation< 3, spacedim >::DistortedCellList internal::TriangulationImplementation::Implementation::execute_refinement ( Triangulation< 3, spacedim > & triangulation,
const bool check_for_distorted_cells )
inlinestatic

A function that performs the refinement of a triangulation in 3d.

Definition at line 7118 of file tria.cc.

◆ prevent_distorted_boundary_cells() [1/2]

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::prevent_distorted_boundary_cells ( Triangulation< 1, spacedim > & )
inlinestatic

At the boundary of the domain, the new point on the face may be far inside the current cell, if the boundary has a strong curvature. If we allow anisotropic refinement here, the resulting cell may be strongly distorted. To prevent this, this function flags such cells for isotropic refinement. It is called automatically from prepare_coarsening_and_refinement().

This function does nothing in 1d (therefore the specialization).

Definition at line 11479 of file tria.cc.

◆ prevent_distorted_boundary_cells() [2/2]

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::prevent_distorted_boundary_cells ( Triangulation< dim, spacedim > & triangulation)
inlinestatic

Definition at line 11486 of file tria.cc.

◆ prepare_refinement_dim_dependent() [1/2]

template<int dim, int spacedim>
static void internal::TriangulationImplementation::Implementation::prepare_refinement_dim_dependent ( const Triangulation< dim, spacedim > & )
inlinestatic

Some dimension dependent stuff for mesh smoothing.

At present, this function does nothing in 1d and 2d, but makes sure no two cells with a level difference greater than one share one line in 3d. This is a requirement needed for the interpolation of hanging nodes, since otherwise two steps of interpolation would be necessary. This would make the processes implemented in the AffineConstraints class much more complex, since these two steps of interpolation do not commute.

Definition at line 11567 of file tria.cc.

◆ prepare_refinement_dim_dependent() [2/2]

template<int spacedim>
static void internal::TriangulationImplementation::Implementation::prepare_refinement_dim_dependent ( Triangulation< 3, spacedim > & triangulation)
inlinestatic

Definition at line 11577 of file tria.cc.

◆ coarsening_allowed()

template<int dim, int spacedim>
static bool internal::TriangulationImplementation::Implementation::coarsening_allowed ( const typename Triangulation< dim, spacedim >::cell_iterator & cell)
inlinestatic

Helper function for fix_coarsen_flags. Return whether coarsening of this cell is allowed. Coarsening can be forbidden if the neighboring cells are or will be refined twice along the common face.

Definition at line 11800 of file tria.cc.


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