FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
sub_index_mapping.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
9#include <kernel/geometry/intern/congruency_mapping.hpp>
10#include <kernel/geometry/intern/face_index_mapping.hpp>
11
12namespace FEAT
13{
14 namespace Geometry
15 {
17 namespace Intern
18 {
26 template<
27 typename Shape_,
28 int cell_dim_,
29 int face_dim_>
30 class SubIndexMapping
31 {
32 static_assert(cell_dim_ < Shape_::dimension, "invalid cell dimension");
33 static_assert(face_dim_ < cell_dim_, "invalid cell/face dimension");
34 static_assert(face_dim_ >= 0, "invalid face dimension");
35
36 protected:
37 typedef typename Shape::FaceTraits<Shape_, cell_dim_>::ShapeType CellType;
38
39 template<typename Outer_>
40 class CompIndexMap
41 {
42 protected:
43 const Outer_& _outer;
44 int _idx;
45
46 public:
47 explicit CompIndexMap(
48 const Outer_& outer,
49 int idx)
50 :
51 _outer(outer),
52 _idx(idx)
53 {
54 }
55
56 Index operator[](int i) const
57 {
58 typedef FaceIndexMapping<Shape_, cell_dim_, 0> LimType;
59 return _outer[LimType::map(_idx,i)];
60 }
61 }; // class CompIndexMap
62
64 static constexpr int num_cells = Shape::FaceTraits<Shape_, cell_dim_>::count;
65
67 int _cell_orient[num_cells];
68
69 public:
70 template<
71 typename ShapeVerts_,
72 typename ShapeCells_,
73 typename CellVerts_>
74 explicit SubIndexMapping(
75 const ShapeVerts_& shape_verts,
76 const ShapeCells_& shape_cells,
77 const CellVerts_& cell_verts)
78 {
79 typedef CongruencySampler<CellType> SamplerType;
80
81 // calculate orientations
82 for(int cell(0); cell < num_cells; ++cell)
83 {
84 CompIndexMap<ShapeVerts_> comp_index_map(shape_verts, cell);
85 _cell_orient[cell] = SamplerType::compare(comp_index_map, cell_verts[shape_cells[cell]]);
86 }
87 }
88
89 Index map(int cell, int face) const
90 {
91 return Index(CongruencyMapping<CellType, face_dim_>::map(_cell_orient[cell], face));
92 }
93 }; // class SubIndexMapping
94 } // namespace Intern
96 } // namespace Geometry
97} // namespace FEAT
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.