FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Geometry::TemplateBuilder< RawData_ > Class Template Reference

Constructs RefinementTemplates from RawTemplates. More...

#include <template_builder.hpp>

Public Member Functions

template<int dim_, int codim_>
std::pair< Index, int > correct_for_orientation (RefinementTypeByDim< dim_ > type, int orientation, Index idx)
 Correct an index for orientation. More...
 
template<int dim_>
const RefinementTemplateByDim< dim_ > & get_template (RefinementTypeByDim< dim_ > type)
 
template<int dim_>
bool has_template (RefinementTypeByDim< dim_ > type)
 
void stats ()
 print some stats about maximum children in the raw data More...
 
template<int dim_>
const std::array< std::uint64_t, Shape::FaceTraits< Shape::Hypercube< dim_ >, 0 >::count > & type_adjustment (Index type)
 

Private Types

using CellMap = TemplateMapByDim< 3 >
 Map type from refinement types to cell templates. More...
 
using EdgeMap = TemplateMapByDim< 1 >
 Map type from refinement types to edge templates. More...
 
using FaceMap = TemplateMapByDim< 2 >
 Map type from refinement types to face templates. More...
 
using MaxShape = typename RawData_::MaxShape
 Maximum shape supported by the raw data. More...
 
using RawCellMap = typename RawData_::CellMap
 Map type from refinement types to raw cell templates. More...
 
using RawEdgeMap = typename RawData_::EdgeMap
 Map type from refinement types to raw edge templates. More...
 
using RawFaceMap = typename RawData_::FaceMap
 Map type from refinement types to raw face templates. More...
 
template<int dim_>
using RawTemplateMapByDim = typename RawData_::template TemplateMapByDim< dim_ >
 Accessor for raw template maps. More...
 
template<int dim_>
using RefinementTemplateByDim = RefinementTemplate< typename Shape::FaceTraits< MaxShape, dim_ >::ShapeType >
 Accessor for refinement template types. More...
 
template<int dim_>
using RefinementTypeByDim = typename RawData_::template RefinementTypeByDim< dim_ >
 Accessor for refinement types. More...
 
template<int dim_>
using TemplateMapByDim = std::unordered_map< RefinementTypeByDim< dim_ >, RefinementTemplate< Shape::Hypercube< dim_ > > >
 Accessor for template map types. More...
 

Private Member Functions

template<int dim_>
TemplateMapByDim< dim_ > _build (const RawTemplateMapByDim< dim_ > &raw_templates)
 Build all templates of a certain dimension. More...
 
template<typename TemplateShape_ , int dim_ = TemplateShape_::dimension>
void _build_template (const RawTemplate< TemplateShape_ > &raw_template, RefinementTemplate< TemplateShape_ > &tmplt, TemplateSearchSpace< TemplateShape_ > &search_space)
 Constructs a RefinementTemplate from the given RawTemplate. More...
 
template<typename TemplateShape_ , typename TopologyShape_ , int dim_ = TopologyShape_::dimension - 1>
void _build_topology (const RawEntity< TopologyShape_, TemplateShape_::dimension > &raw_entity, const TemplateSearchSpace< TemplateShape_ > &search_space, TopologyTemplate< TopologyShape_ > &topo)
 Constructs a TopologyTemplate for the given RawEntity. More...
 
template<typename Shape_ , typename TemplateMap_ >
void _create_type_adjustments (const TemplateMap_ &available_templates)
 Calculate adjustments of the subdivision levels. More...
 
template<typename TemplateShape_ , int dim_ = TemplateShape_::dimension>
void _fill_orientation_mappings (const RefinementTypeByDim< TemplateShape_::dimension > &oriented_type, const int orientation, const RefinementTemplate< TemplateShape_ > &local_template, const TemplateSearchSpace< TemplateShape_ > &local_search_space, const RefinementTemplate< TemplateShape_ > &oriented_template, const TemplateSearchSpace< TemplateShape_ > &oriented_search_space)
 Fill orientation mappings for a given template. More...
 
template<int n_>
Index _find_vertex (const std::vector< Tiny::Vector< Real, n_ > > &vertices, const Tiny::Vector< Real, n_ > &vertex)
 Determines the index of a vertex in a list of vertices. More...
 
template<typename Shape_ >
TemplateSearchSpace< Shape_ > _setup_search_space (RefinementTypeByDim< Shape_::dimension > type) const
 Helper function for creating a search space with boundary and topology entities. More...
 
const CellMapcells ()
 Cell-template accessor. More...
 
const EdgeMapedges ()
 Edge-template accessor. More...
 
const FaceMapfaces ()
 Face-template accessor. More...
 
template<int dim_>
auto & type_adjustments ()
 dim-based accessor for type adjustment arrays More...
 

Private Attributes

CellMap _cell_templates = {}
 Cell-templates constructed by this template builder. More...
 
std::array< std::array< std::uint64_t, 8 >, 256 > _cell_type_adjustments = {}
 Type adjustments for cells. More...
 
EdgeMap _edge_templates = {}
 Edge-templates constructed by this template builder. More...
 
std::array< std::array< std::uint64_t, 2 >, 4 > _edge_type_adjustments = {}
 Type adjustments for edges. More...
 
FaceMap _face_templates = {}
 Face-templates constructed by this template builder. More...
 
std::array< std::array< std::uint64_t, 4 >, 16 > _face_type_adjustments = {}
 Type adjustments for faces. More...
 
OrientationMappingHolder< RawData_, Shape::Hexahedron_orientation_mappings = {}
 Container for orientation mappings. More...
 
std::array< bool, 4 > _type_adjustment_initialized = {false, false, false, false}
 Bookkeeping for which type adjustments have been created already. More...
 

Detailed Description

template<class RawData_>
class FEAT::Geometry::TemplateBuilder< RawData_ >

Constructs RefinementTemplates from RawTemplates.

Template Parameters
RawData_Raw template data. See Geometry::SchneidersData for an example.

The TemplateBuilder is lazy. Templates will be constructed the first time they are accessed. This especially means hexahedral templates will not be constructed for 2D meshes and defined but unused template sets inccur no overhead.

Definition at line 1322 of file template_builder.hpp.

Member Typedef Documentation

◆ CellMap

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::CellMap = TemplateMapByDim<3>
private

Map type from refinement types to cell templates.

Definition at line 1355 of file template_builder.hpp.

◆ EdgeMap

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::EdgeMap = TemplateMapByDim<1>
private

Map type from refinement types to edge templates.

Definition at line 1351 of file template_builder.hpp.

◆ FaceMap

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::FaceMap = TemplateMapByDim<2>
private

Map type from refinement types to face templates.

Definition at line 1353 of file template_builder.hpp.

◆ MaxShape

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::MaxShape = typename RawData_::MaxShape
private

Maximum shape supported by the raw data.

Definition at line 1325 of file template_builder.hpp.

◆ RawCellMap

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::RawCellMap = typename RawData_::CellMap
private

Map type from refinement types to raw cell templates.

Definition at line 1336 of file template_builder.hpp.

◆ RawEdgeMap

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::RawEdgeMap = typename RawData_::EdgeMap
private

Map type from refinement types to raw edge templates.

Definition at line 1332 of file template_builder.hpp.

◆ RawFaceMap

template<class RawData_ >
using FEAT::Geometry::TemplateBuilder< RawData_ >::RawFaceMap = typename RawData_::FaceMap
private

Map type from refinement types to raw face templates.

Definition at line 1334 of file template_builder.hpp.

◆ RawTemplateMapByDim

template<class RawData_ >
template<int dim_>
using FEAT::Geometry::TemplateBuilder< RawData_ >::RawTemplateMapByDim = typename RawData_::template TemplateMapByDim<dim_>
private

Accessor for raw template maps.

Definition at line 1329 of file template_builder.hpp.

◆ RefinementTemplateByDim

template<class RawData_ >
template<int dim_>
using FEAT::Geometry::TemplateBuilder< RawData_ >::RefinementTemplateByDim = RefinementTemplate<typename Shape::FaceTraits<MaxShape, dim_>::ShapeType>
private

Accessor for refinement template types.

Definition at line 1344 of file template_builder.hpp.

◆ RefinementTypeByDim

template<class RawData_ >
template<int dim_>
using FEAT::Geometry::TemplateBuilder< RawData_ >::RefinementTypeByDim = typename RawData_::template RefinementTypeByDim<dim_>
private

Accessor for refinement types.

Definition at line 1340 of file template_builder.hpp.

◆ TemplateMapByDim

template<class RawData_ >
template<int dim_>
using FEAT::Geometry::TemplateBuilder< RawData_ >::TemplateMapByDim = std::unordered_map<RefinementTypeByDim<dim_>, RefinementTemplate<Shape::Hypercube<dim_> >>
private

Accessor for template map types.

Definition at line 1348 of file template_builder.hpp.

Member Function Documentation

◆ _build()

template<class RawData_ >
template<int dim_>
TemplateMapByDim< dim_ > FEAT::Geometry::TemplateBuilder< RawData_ >::_build ( const RawTemplateMapByDim< dim_ > &  raw_templates)
inlineprivate

Build all templates of a certain dimension.

Template Parameters
dim_Dimension to build templates for
Parameters
[in]raw_templatesMap of raw templates
Returns
A map of refinement templates

Definition at line 1801 of file template_builder.hpp.

◆ _build_template()

template<class RawData_ >
template<typename TemplateShape_ , int dim_ = TemplateShape_::dimension>
void FEAT::Geometry::TemplateBuilder< RawData_ >::_build_template ( const RawTemplate< TemplateShape_ > &  raw_template,
RefinementTemplate< TemplateShape_ > &  tmplt,
TemplateSearchSpace< TemplateShape_ > &  search_space 
)
inlineprivate

Constructs a RefinementTemplate from the given RawTemplate.

Template Parameters
TemplateShape_Shape of the template
dim_Dimension the algorithm is currently working on
Parameters
[in]raw_templateThe raw template to construct a refinement template for
[in,out]tmpltThe refinement template being constructed
[in,out]search_spaceThe TemplateSearchSpace for the current template.

Definition at line 1618 of file template_builder.hpp.

References FEAT::Geometry::TemplateSearchSpace< Shape_, num_coords_ >::add_sibling().

◆ _build_topology()

template<class RawData_ >
template<typename TemplateShape_ , typename TopologyShape_ , int dim_ = TopologyShape_::dimension - 1>
void FEAT::Geometry::TemplateBuilder< RawData_ >::_build_topology ( const RawEntity< TopologyShape_, TemplateShape_::dimension > &  raw_entity,
const TemplateSearchSpace< TemplateShape_ > &  search_space,
TopologyTemplate< TopologyShape_ > &  topo 
)
inlineprivate

Constructs a TopologyTemplate for the given RawEntity.

Template Parameters
TemplateShape_Shape of the template the topology is part of
TopologyShape_Shape of the entity the topology is for
dim_Dimension the algorithm is currently working on
Parameters
[in]raw_entityThe raw entity to construct a topology template for
[in,out]topoThe topology being constructed
[in]search_spaceThe TemplateSearchSpace for the current template.

Definition at line 1581 of file template_builder.hpp.

References FEAT::Geometry::TemplateSearchSpace< Shape_, num_coords_ >::search().

◆ _create_type_adjustments()

template<class RawData_ >
template<typename Shape_ , typename TemplateMap_ >
void FEAT::Geometry::TemplateBuilder< RawData_ >::_create_type_adjustments ( const TemplateMap_ &  available_templates)
inlineprivate

Calculate adjustments of the subdivision levels.

Template Parameters
Shape_Shape to calculate adjustments for

A template set does not necessarily contain templates for all possible markings of a mesh element. In that case the AdaptiveMesh corrects the markings during the creation of the final refinement field. This method supplies the necessary corrections.

It does so by determining the "closest" template, i.e. the template with the least required changes to the subidivision levels, to all possible markings and saving the neccessary changes to apply that template to the element.

Definition at line 1914 of file template_builder.hpp.

◆ _fill_orientation_mappings()

template<class RawData_ >
template<typename TemplateShape_ , int dim_ = TemplateShape_::dimension>
void FEAT::Geometry::TemplateBuilder< RawData_ >::_fill_orientation_mappings ( const RefinementTypeByDim< TemplateShape_::dimension > &  oriented_type,
const int  orientation,
const RefinementTemplate< TemplateShape_ > &  local_template,
const TemplateSearchSpace< TemplateShape_ > &  local_search_space,
const RefinementTemplate< TemplateShape_ > &  oriented_template,
const TemplateSearchSpace< TemplateShape_ > &  oriented_search_space 
)
inlineprivate

Fill orientation mappings for a given template.

Template Parameters
TemplateShape_Shape of the template
dim_Current working dim
Parameters
[in]oriented_typeThe refinement type of the given oriented template
[in]orientationThe orientation to fill the mappings of
[in]local_templateThe refinement template, as seen by the current mesh entity \parma[in] local_search_space Search space containing all elements of local_template
[in]oriented_templateRefinement template as seen by sub-entity with orientation orientation
[in]oriented_search_spaceSearch space containing all elements of oriented_template

Fills orientation mapping for (oriented_type, orientation) as a side effect.

To compute these mappings, we use the following idea.

Let e be a mesh entity with dimension >= 2, i.e. at least a face, and let s be a sub-entity of e, i.e. an edge or face of e's topology.

The sub-entity s then has two refinement types. A local type, as determined by the vertex-ordering of e, and a foreign tye, as determined by the vertex ordering of s itself. We can predict the foreign type using the local type and the relative orientation of s as stored in the entities topology.

This allows us to fill the orientation mappings by finding the foreign type for each pair of local type and possible orientation. Given a local template and the corresponding oriented template, as are passed to this function, we can retrieve the vertices of all entities from their respective search spaces, and determine the orientation mapping by finding identical entities in both templates.

Because the templates determine how mesh entities will be constructed in the adaptive mesh, we can also pre-compute these entities relative orientations to each other at this point. This means no orientations have to be computed by the adaptive mesh beyond the intial collection of root topologies.

Definition at line 1693 of file template_builder.hpp.

References FEAT::Geometry::OrientationMapping::get_mapping().

◆ _find_vertex()

template<class RawData_ >
template<int n_>
Index FEAT::Geometry::TemplateBuilder< RawData_ >::_find_vertex ( const std::vector< Tiny::Vector< Real, n_ > > &  vertices,
const Tiny::Vector< Real, n_ > &  vertex 
)
inlineprivate

Determines the index of a vertex in a list of vertices.

Definition at line 1544 of file template_builder.hpp.

◆ _setup_search_space()

template<class RawData_ >
template<typename Shape_ >
TemplateSearchSpace< Shape_ > FEAT::Geometry::TemplateBuilder< RawData_ >::_setup_search_space ( RefinementTypeByDim< Shape_::dimension >  type) const
inlineprivate

Helper function for creating a search space with boundary and topology entities.

Template Parameters
Shape_Shape of the search space
Parameters
typeRefinement type for determining boundary entities
Returns
A TemplateSearchSpace with all necessary boundary and topology elements for creating a refinement template for the given type.

Definition at line 1866 of file template_builder.hpp.

References FEAT::Geometry::TemplateSearchSpace< Shape_, num_coords_ >::add_boundary_entity(), and FEAT::Geometry::TemplateSearchSpace< Shape_, num_coords_ >::add_topology().

◆ cells()

template<class RawData_ >
const CellMap & FEAT::Geometry::TemplateBuilder< RawData_ >::cells ( )
inlineprivate

Cell-template accessor.

Definition at line 1398 of file template_builder.hpp.

◆ correct_for_orientation()

template<class RawData_ >
template<int dim_, int codim_>
std::pair< Index, int > FEAT::Geometry::TemplateBuilder< RawData_ >::correct_for_orientation ( RefinementTypeByDim< dim_ >  type,
int  orientation,
Index  idx 
)
inline

Correct an index for orientation.

Definition at line 1448 of file template_builder.hpp.

◆ edges()

template<class RawData_ >
const EdgeMap & FEAT::Geometry::TemplateBuilder< RawData_ >::edges ( )
inlineprivate

Edge-template accessor.

Definition at line 1378 of file template_builder.hpp.

◆ faces()

template<class RawData_ >
const FaceMap & FEAT::Geometry::TemplateBuilder< RawData_ >::faces ( )
inlineprivate

Face-template accessor.

Definition at line 1388 of file template_builder.hpp.

◆ get_template()

template<class RawData_ >
template<int dim_>
const RefinementTemplateByDim< dim_ > & FEAT::Geometry::TemplateBuilder< RawData_ >::get_template ( RefinementTypeByDim< dim_ >  type)
inline

Definition at line 1409 of file template_builder.hpp.

◆ has_template()

template<class RawData_ >
template<int dim_>
bool FEAT::Geometry::TemplateBuilder< RawData_ >::has_template ( RefinementTypeByDim< dim_ >  type)
inline

Definition at line 1427 of file template_builder.hpp.

◆ stats()

template<class RawData_ >
void FEAT::Geometry::TemplateBuilder< RawData_ >::stats ( )
inline

print some stats about maximum children in the raw data

Definition at line 1501 of file template_builder.hpp.

References FEAT::Math::max(), and FEAT::stringify().

◆ type_adjustment()

template<class RawData_ >
template<int dim_>
const std::array< std::uint64_t, Shape::FaceTraits< Shape::Hypercube< dim_ >, 0 >::count > & FEAT::Geometry::TemplateBuilder< RawData_ >::type_adjustment ( Index  type)
inline

Definition at line 1471 of file template_builder.hpp.

◆ type_adjustments()

template<class RawData_ >
template<int dim_>
auto & FEAT::Geometry::TemplateBuilder< RawData_ >::type_adjustments ( )
inlineprivate

dim-based accessor for type adjustment arrays

Definition at line 1552 of file template_builder.hpp.

References XABORTM.

Member Data Documentation

◆ _cell_templates

template<class RawData_ >
CellMap FEAT::Geometry::TemplateBuilder< RawData_ >::_cell_templates = {}
private

Cell-templates constructed by this template builder.

Definition at line 1362 of file template_builder.hpp.

◆ _cell_type_adjustments

template<class RawData_ >
std::array<std::array<std::uint64_t, 8>, 256> FEAT::Geometry::TemplateBuilder< RawData_ >::_cell_type_adjustments = {}
private

Type adjustments for cells.

Definition at line 1372 of file template_builder.hpp.

◆ _edge_templates

template<class RawData_ >
EdgeMap FEAT::Geometry::TemplateBuilder< RawData_ >::_edge_templates = {}
private

Edge-templates constructed by this template builder.

Definition at line 1358 of file template_builder.hpp.

◆ _edge_type_adjustments

template<class RawData_ >
std::array<std::array<std::uint64_t, 2>, 4> FEAT::Geometry::TemplateBuilder< RawData_ >::_edge_type_adjustments = {}
private

Type adjustments for edges.

Definition at line 1368 of file template_builder.hpp.

◆ _face_templates

template<class RawData_ >
FaceMap FEAT::Geometry::TemplateBuilder< RawData_ >::_face_templates = {}
private

Face-templates constructed by this template builder.

Definition at line 1360 of file template_builder.hpp.

◆ _face_type_adjustments

template<class RawData_ >
std::array<std::array<std::uint64_t, 4>, 16> FEAT::Geometry::TemplateBuilder< RawData_ >::_face_type_adjustments = {}
private

Type adjustments for faces.

Definition at line 1370 of file template_builder.hpp.

◆ _orientation_mappings

template<class RawData_ >
OrientationMappingHolder<RawData_, Shape::Hexahedron> FEAT::Geometry::TemplateBuilder< RawData_ >::_orientation_mappings = {}
private

Container for orientation mappings.

Definition at line 1365 of file template_builder.hpp.

◆ _type_adjustment_initialized

template<class RawData_ >
std::array<bool, 4> FEAT::Geometry::TemplateBuilder< RawData_ >::_type_adjustment_initialized = {false, false, false, false}
private

Bookkeeping for which type adjustments have been created already.

Definition at line 1375 of file template_builder.hpp.


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