FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
dof_assignment_base.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/space/base.hpp>
10
11namespace FEAT
12{
13 namespace Space
14 {
32 template<
33 typename Space_,
34 int shape_dim_,
35 typename DataType_>
37 {
38 public:
40 typedef Space_ SpaceType;
41
42 protected:
47
49 explicit DofAssignmentBase(const SpaceType& space) :
50 _space(space),
52 {
53 }
54
55 public:
56 void prepare(Index cell_index)
57 {
58 _cell_index = cell_index;
59 }
60
61 void finish()
62 {
64 }
65
66#ifdef DOXYGEN
67 int get_max_assigned_dofs() const;
68
69 int get_num_assigned_dofs() const;
70
71 Index get_index(int assign_idx) const;
72#endif // DOXYGEN
73 }; // class DofAssignmentBase
74
76 namespace Intern
77 {
78 template<typename Tag_, template<typename, int> class Traits_, int cell_dim_>
79 struct UniformDofAssignHelper
80 {
81 template<typename Mesh_>
82 static Index dof_offset(const Mesh_& mesh)
83 {
84 return UniformDofAssignHelper<Tag_, Traits_, cell_dim_ - 1>::dof_offset(mesh)
85 + mesh.get_num_entities(cell_dim_-1) * Index(Traits_<Tag_, cell_dim_ - 1>::count);
86 }
87 };
88
89 template<typename Tag_, template<typename, int> class Traits_>
90 struct UniformDofAssignHelper<Tag_, Traits_, 0>
91 {
92 template<typename Mesh_>
93 static Index dof_offset(const Mesh_&)
94 {
95 return Index(0);
96 }
97 };
98 } // namespace Intern
100
121 template<
122 typename Space_,
123 int shape_dim_,
124 typename DataType_,
125 template<typename Tag_, int dim_> class DofTraits_,
126 typename DofTag_>
128 : public DofAssignmentBase<Space_, shape_dim_, DataType_>
129 {
130 public:
132 typedef Space_ SpaceType;
133 typedef typename SpaceType::ShapeType ShapeType;
134
135 // number of dofs for each cell
136 static constexpr int dofs_per_cell = DofTraits_<DofTag_, shape_dim_>::count;
137
138 protected:
141
142 public:
143 explicit DofAssignmentUniform(const SpaceType& space) :
144 BaseClass(space),
145 _dof_offset(Intern::UniformDofAssignHelper<DofTag_, DofTraits_, shape_dim_>::dof_offset(space.get_mesh()))
146 {
147 }
148
151 {
152 return dofs_per_cell;
153 }
154
157 {
158 return dofs_per_cell;
159 }
160
162 Index get_index(int assign_idx) const
163 {
164 return _dof_offset + Index(dofs_per_cell) * this->_cell_index + Index(assign_idx);
165 }
166 };
167 } // namespace Space
168} // namespace FEAT
Mapping of mesh entities to FE basis functions associated with them.
Index _cell_index
currently active cell index
DofAssignmentBase(const SpaceType &space)
constructor
const SpaceType & _space
space reference
Uniform Dof-Assignment class template.
Index get_index(int assign_idx) const
Index _dof_offset
the offset of the first dof of this cell dimension
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.