FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
index_calculator_meshes.cpp
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#include <kernel/geometry/test_aux/index_calculator_meshes.hpp>
7#include <kernel/geometry/test_aux/copy_comp_set.hpp>
8
9namespace FEAT
10{
11 namespace Geometry
12 {
13 namespace TestAux
14 {
15 void validate_hypercube_edge_index_set(const HEdgeIndexTree& tree)
16 {
17 // vertices-at-edge array
18 static const Index v_e[] =
19 {
20 0, 1, // v0
21 1, 3,
22 10, 8,
23 42, // v1
24 2, 4,
25 11, 9,
26 42, //v2
27 3, 3,
28 5, 5,
29 12, 10,
30 42, //v3
31 4, 4,
32 6, 6,
33 13, 11,
34 42, //v4
35 7, 7,
36 14, 12,
37 42, //v5
38 8, 6,
39 15, 13,
40 42, //v6
41 9, 7,
42 16, 14,
43 42, //v7
44 17, 15,
45 42, //v8
46 18, 9,
47 19, 11,
48 28, 16,
49 42, //v9
50 20, 12,
51 29, 17,
52 42, //v10
53 21, 11,
54 23, 13,
55 42, //v11
56 22, 12,
57 24, 14,
58 30, 18,
59 42, //v12
60 25, 15,
61 31, 19,
62 42, //v13
63 26, 14,
64 42, //v14
65 27, 15,
66 42, //v15
67 42, //v16
68 32, 17,
69 33, 18,
70 42, //v17
71 34, 19,
72 42, //v18
73 35, 19,
74 42, //v19
75 42
76 };
77
78 // checking
79 Index count = 0;
80 Index current_value;
81 Index vector_size = 19;
82 int num_indices = tree.get_num_indices();
83
84 for(Index i(0); i < vector_size; ++i)
85 {
86 Index current_set_size = tree.get_set_size(i);
87 for(Index j(0); j < current_set_size; ++j)
88 {
89 for(int k(0); k < num_indices; ++k)
90 {
91 current_value = tree.get_index(i, j, k);
92
93 // if there is a wrong value
94 if(current_value != v_e[count])
95 throw String("IndexTree hypercube-edge-mesh parsing failure");
96 ++count;
97 }
98 }
99
100 // if something is missing
101 if (v_e[count] !=42)
102 throw String("IndexTree hypercube-edge-mesh parsing failure");
103 count++;
104 }
105
106 } // validate_hypercube_edge_index_set
107
108 void validate_hypercube_quad_index_set(const QuadIndexTree& tree)
109 {
110
111 // vertices-at-quad array
112 static const Index v_q[] =
113 {
114 0, 1, 3, 4,
115 3, 1, 8, 9,
116 4, 3, 8, 11,
117 42,
118 5, 4, 9, 12,
119 42,
120 1, 3, 5, 6,
121 6, 3, 10, 11,
122 8, 5, 10, 13,
123 42,
124 2, 4, 6, 7,
125 7, 4, 11, 12,
126 9, 6, 11, 14,
127 42,
128 10, 7, 12, 15,
129 42,
130 11, 6, 13, 14,
131 42,
132 12, 7, 14, 15,
133 42,
134 42,
135 13, 9, 11, 12,
136 16, 9, 16, 17,
137 17, 11, 16, 18,
138 42,
139 18, 12, 17, 19,
140 42,
141 14, 11, 13, 14,
142 42,
143 15, 12, 14, 15,
144 19, 12, 18, 19,
145 42,
146 42,
147 42,
148 42,
149 42,
150 20, 17, 18, 19,
151 42,
152 42,
153 42
154 };
155
156 // checking
157 Index count = 0;
158 Index current_value;
159 Index vector_size = 19;
160 int num_indices = tree.get_num_indices();
161
162 for(Index i(0); i < vector_size; ++i)
163 {
164 Index current_set_size = tree.get_set_size(i);
165 for(Index j(0); j < current_set_size; ++j)
166 {
167 for(int k(0); k < num_indices; ++k)
168 {
169 current_value = tree.get_index(i, j, k);
170
171 // if there is a wrong value
172 if(current_value != v_q[count])
173 throw String("IndexTree hypercube-quad-mesh parsing failure");
174 ++count;
175 }
176 }
177
178 // if something is missing
179 if (v_q[count] !=42)
180 throw String("IndexTree hypercube-quad-mesh parsing failure");
181 count++;
182 }
183
184 } // validate_hypercube_quad_index_set
185
186 void validate_simplex_edge_index_set(const SEdgeIndexTree& tree)
187 {
188
189 // vertices-at-edge array
190 static const Index v_e[] =
191 {
192 7, 1,
193 9, 2,
194 4, 3,
195 1, 4,
196 42,
197 8, 2,
198 5, 3,
199 2, 4,
200 42,
201 6, 3,
202 3, 4,
203 42,
204 0, 4,
205 42,
206 42
207 };
208
209 //checking
210 Index count = 0;
211 Index current_value;
212 Index vector_size = 4;
213 int num_indices = tree.get_num_indices();
214
215 for(Index i(0); i < vector_size; ++i)
216 {
217 Index current_set_size = tree.get_set_size(i);
218 for(Index j(0); j < current_set_size; ++j)
219 {
220 for(int k(0); k < num_indices; ++k)
221 {
222 current_value = tree.get_index(i, j, k);
223
224 // if there is a wrong value
225 if(current_value != v_e[count])
226 throw String("IndexTreesimplex-edge-mesh parsing failure");
227 ++count;
228 }
229 }
230
231 // if something is missing
232 if (v_e[count] !=42)
233 throw String("IndexTree simplex-edge-mesh parsing failure");
234 count++;
235 }
236
237 } // validate_simplex_edge_index_set
238
239 void validate_simplex_triangle_index_set(const TriaIndexTree& tree)
240 {
241
242 // vertices-at-triangle array
243 static const Index v_t[] =
244 {
245 2, 1, 3,
246 6, 1, 4,
247 3, 2, 3,
248 5, 2, 4,
249 8, 3, 4,
250 42,
251 1, 2, 3,
252 4, 2, 4,
253 0, 3, 4,
254 42,
255 7, 3, 4,
256 42,
257 42
258 };
259
260 //checking
261 Index count = 0;
262 Index current_value;
263 Index vector_size = 4;
264 int num_indices = tree.get_num_indices();
265
266 for(Index i(0); i < vector_size; ++i)
267 {
268 Index current_set_size = tree.get_set_size(i);
269 for(Index j(0); j < current_set_size; ++j)
270 {
271 for(int k(0); k < num_indices; ++k)
272 {
273 current_value = tree.get_index(i, j, k);
274
275 // if there is a wrong value
276 if(current_value != v_t[count])
277 throw String("IndexTree simplex-triangle-mesh parsing failure");
278 ++count;
279 }
280 }
281
282 // if there is something missing
283 if (v_t[count] !=42)
284 throw String("IndexTree simplex-triangle-mesh parsing failure");
285 count++;
286 }
287
288 } // validate_simplex_triangle_index_set
289
290 } // namespace TestAux
291 } // namespace Geometry
292} // namespace FEAT
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.