FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
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
10
11// includes, system
12#include <array>
13
14namespace FEAT
15{
16 namespace Geometry
17 {
28 template<typename Mesh_>
29#ifndef DOXYGEN
30 class Factory;
31#else
32 class Factory
33 {
34 public:
35 virtual ~Factory()
36 {
37 }
38 }; // class Factory<...>
39#endif // DOXYGEN
40
52 template<typename Mesh_>
53#ifndef DOXYGEN
54 class StandardRefinery;
55#else
57 public Factory<Mesh_>
58 {
59 public:
61 typedef Mesh_ MeshType;
62
69 explicit StandardRefinery(const MeshType& coarse_mesh);
70 };
71#endif
72
74 namespace Intern
75 {
76 template<int n_>
77 struct NumEntitiesWrapper
78 {
79 Index num_entities[n_+1];
80
81 template<typename Factory_>
82 explicit NumEntitiesWrapper(Factory_& factory)
83 {
84 for(int i(0); i <= n_; ++i)
85 {
86 num_entities[i] = factory.get_num_entities(i);
87 }
88 }
89
90 template<typename Factory_>
91 static void apply(Factory_& factory, Index* num_ent)
92 {
93 for(int i(0); i <= n_; ++i)
94 {
95 num_ent[i] = factory.get_num_entities(i);
96 }
97 }
98
99 template<typename Factory_, std::size_t m_>
100 static void apply(Factory_& factory, std::array<Index, m_>& num_ent)
101 {
102 static_assert(int(m_) >= n_+1, "invalid array size");
103 for(int i(0); i <= n_; ++i)
104 {
105 num_ent[std::size_t(i)] = factory.get_num_entities(i);
106 }
107 }
108 };
109
110 template<int n_>
111 struct NumSlicesWrapper
112 {
113 Index num_slices[n_];
114
115 template<typename Factory_>
116 explicit NumSlicesWrapper(Factory_& factory)
117 {
118 for(int i(0); i < n_; ++i)
119 {
120 num_slices[i] = factory.get_num_slices(i);
121 }
122 }
123
124 template<typename Factory_>
125 static void apply(Factory_& factory, Index* num_slic)
126 {
127 for(int i(0); i < n_; ++i)
128 {
129 num_slic[i] = factory.get_num_slices(i);
130 }
131 }
132
133 template<typename Factory_, std::size_t m_>
134 static void apply(Factory_& factory, std::array<Index, m_>& num_slic)
135 {
136 static_assert(int(m_) >= n_, "invalid array size");
137 for(int i(0); i < n_; ++i)
138 {
139 num_slic[i] = factory.get_num_slices(i);
140 }
141 }
142 };
143 } // namespace Intern
145 } // namespace Geometry
146} // namespace FEAT
FEAT Kernel base header.
Mesh Factory class template.
Definition: factory.hpp:33
Standard Refinery class template.
Definition: factory.hpp:58
StandardRefinery(const MeshType &coarse_mesh)
Constructor.
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.