FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
reference_cell_factory.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/conformal_mesh.hpp>
10#include <kernel/geometry/intern/macro_index_mapping.hpp>
11
12namespace FEAT
13{
14 namespace Geometry
15 {
17 namespace Intern
18 {
19 template<typename Shape_>
20 struct RefCellVertexer;
21 }
23
31 template<typename Shape_, typename CoordType_ = Real>
33 public Factory< ConformalMesh<Shape_, Shape_::dimension, CoordType_> >
34 {
35 public:
44
46 static constexpr int shape_dim = ShapeType::dimension;
47
48 public:
49 virtual Index get_num_entities(int dim) override
50 {
51 return Index(Intern::DynamicNumFaces<Shape_>::value(dim));
52 }
53
54 virtual void fill_vertex_set(VertexSetType& vertex_set) override
55 {
56 Intern::RefCellVertexer<ShapeType>::fill(vertex_set);
57 }
58
59 virtual void fill_index_sets(IndexSetHolderType& index_set_holder) override
60 {
61 Intern::MacroIndexWrapper<Shape_>::build(index_set_holder);
62 }
63 }; // class ReferenceCellFactory<...>
64
66 namespace Intern
67 {
68 template<int dim_>
69 struct RefCellVertexer< Shape::Simplex<dim_> >
70 {
71 template<typename VertexSet_>
72 static void fill(VertexSet_& vtx)
73 {
74 typedef typename VertexSet_::CoordType CoordType;
75 // loop over all vertices
76 for(int i(0); i < (dim_+1); ++i)
77 {
78 // loop over all coords
79 for(int j(0); j < dim_; ++j)
80 {
81 vtx[Index(i)][j] = CoordType(j+1 == i ? 1 : 0);
82 }
83 }
84 }
85 };
86
87 template<int dim_>
88 struct RefCellVertexer< Shape::Hypercube<dim_> >
89 {
90 template<typename VertexSet_>
91 static void fill(VertexSet_& vtx)
92 {
93 typedef typename VertexSet_::CoordType CoordType;
94 // loop over all vertices
95 for(int i(0); i < (1 << dim_); ++i)
96 {
97 // loop over all coords
98 for(int j(0); j < dim_; ++j)
99 {
100 vtx[Index(i)][j] = CoordType((((i >> j) & 1) << 1) - 1);
101 }
102 }
103 }
104 };
105 }
107 } // namespace Geometry
108} // namespace FEAT
Conformal mesh class template.
IndexSetHolder< ShapeType > IndexSetHolderType
index set holder type
Mesh Factory class template.
Definition: factory.hpp:33
MeshType::IndexSetHolderType IndexSetHolderType
index holder type
MeshType::VertexSetType VertexSetType
vertex set type
ConformalMesh< Shape_, Shape_::dimension, CoordType_ > MeshType
mesh type
MeshType::ShapeType ShapeType
shape type
static constexpr int shape_dim
shape dimension
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.
Fixed-Sized Vertex Set class template.
Definition: vertex_set.hpp:37