Peano
Loading...
Searching...
No Matches
InterpolationRestrictionTest.cpp
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
4
8
9#include <algorithm>
10#include <iomanip>
11
12// @todo It seems as if these tests should be in the toolbox
13
15 TestCase ("exahype2::fv::tests::InterpolationRestrictionTest") {
16}
17
18
20 testMethod (testPiecewiseConstantInterpolationWithTensorProduct1);
21
22 testMethod( testAverageRestrictionWithTensorProduct );
23 testMethod( testInjectionExtrapolationRestrictionWithTensorProduct );
24
25 // @todo Han copy in if yuo wanna test more things
26 // testMethod (testPiecewiseConstantInterpolationWithTensorProduct2);
27}
28
29
31 static constexpr double NormalInterpolationMatrix1d[] = {
32 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
33 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
34 0.0, 1.0, 0.0, 0.0, 0.0, 0.0
35 };
36 static constexpr double TangentialInterpolationMatrix1d[] = {
37 1.0,0.0,0.0,0.0,0.0,
38 1.0,0.0,0.0,0.0,0.0,
39 1.0,0.0,0.0,0.0,0.0,
40 0.0,1.0,0.0,0.0,0.0,
41 0.0,1.0,0.0,0.0,0.0,
42
43 0.0,1.0,0.0,0.0,0.0,
44 0.0,0.0,1.0,0.0,0.0,
45 0.0,0.0,1.0,0.0,0.0,
46 0.0,0.0,1.0,0.0,0.0,
47 0.0,0.0,0.0,1.0,0.0,
48
49 0.0,0.0,0.0,1.0,0.0,
50 0.0,0.0,0.0,1.0,0.0,
51 0.0,0.0,0.0,0.0,1.0,
52 0.0,0.0,0.0,0.0,1.0,
53 0.0,0.0,0.0,0.0,1.0
54 };
55
56
57 #if Dimensions==2
59 dummEvent.setRelativePositionToFather( {0,0} );
60
61 peano4::datamanagement::FaceMarker marker(dummEvent);
62
63 {
64 double coarseGridFaceValues[] = {
65 0.1,-0.1, 0.2,-0.2, 0.3,-0.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
66 1.1,-1.1, 1.2,-1.2, 1.3,-1.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
67 2.1,-2.1, 2.2,-2.2, 2.3,-2.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
68 3.1,-3.1, 3.2,-3.2, 3.3,-3.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
69 4.1,-4.1, 4.2,-4.2, 4.3,-4.3, 0.0,0.0, 0.0,0.0, 0.0,0.0
70 };
71 double fineGridFaceValues[ 3*5*2*2 ]; // three width, five dofs per axis, two unknowns, two sides
72 std::fill_n(fineGridFaceValues, 3*5*2*2, 0.0 );
73
74 marker.select(0);
75
77 marker,
78 5, // numberOfDoFsPerAxisInPatch
79 3, // overlap
80 2, // unknowns
81 NormalInterpolationMatrix1d,
82 TangentialInterpolationMatrix1d,
83 coarseGridFaceValues,
84 fineGridFaceValues
85 );
86
87 validateNumericalEquals( fineGridFaceValues[0*2+0], 0.2 );
88 validateNumericalEquals( fineGridFaceValues[0*2+1], -0.2 );
89 validateNumericalEquals( fineGridFaceValues[1*2+0], 0.2 );
90 validateNumericalEquals( fineGridFaceValues[1*2+1], -0.2 );
91 validateNumericalEquals( fineGridFaceValues[2*2+0], 0.2 );
92 validateNumericalEquals( fineGridFaceValues[2*2+1], -0.2 );
93 validateNumericalEquals( fineGridFaceValues[3*2+0], 0.0 );
94 validateNumericalEquals( fineGridFaceValues[3*2+1], 0.0 );
95
96 validateNumericalEquals( fineGridFaceValues[6*2+0], 0.2 );
97 validateNumericalEquals( fineGridFaceValues[6*2+1], -0.2 );
98
99 validateNumericalEquals( fineGridFaceValues[12*2+0], 0.2 );
100 validateNumericalEquals( fineGridFaceValues[12*2+1], -0.2 );
101
102 validateNumericalEquals( fineGridFaceValues[18*2+0], 1.2 );
103 validateNumericalEquals( fineGridFaceValues[18*2+1], -1.2 );
104 }
105
106 {
107 double coarseGridFaceValues[] = {
108 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0,
109 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0,
110 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0,
111
112 0.1,-0.1, 0.2,-0.2, 0.3,-0.3, 0.4,-0.4, 0.5,-0.5,
113 1.1,-1.1, 1.2,-1.2, 1.3,-0.3, 1.4,-1.4, 1.5,-1.5,
114 2.1,-2.1, 2.2,-2.2, 2.3,-0.3, 2.4,-2.4, 2.5,-2.5
115 };
116 double fineGridFaceValues[ 3*5*2*2 ]; // three width, five dofs per axis, two unknowns, two sides
117 std::fill_n(fineGridFaceValues, 3*5*2*2, 0.0 );
118
119 marker.select(3);
120
122 marker,
123 5, // numberOfDoFsPerAxisInPatch
124 3, // overlap
125 2, // unknowns
126 NormalInterpolationMatrix1d,
127 TangentialInterpolationMatrix1d,
128 coarseGridFaceValues,
129 fineGridFaceValues
130 );
131
132 validateNumericalEquals( fineGridFaceValues[0*2+0], 0.0 );
133 validateNumericalEquals( fineGridFaceValues[0*2+1], 0.0 );
134
135 validateNumericalEquals( fineGridFaceValues[4*2+0], 0.0 );
136 validateNumericalEquals( fineGridFaceValues[4*2+1], 0.0 );
137
138 validateNumericalEquals( fineGridFaceValues[5*2+0], 0.0 );
139 validateNumericalEquals( fineGridFaceValues[5*2+1], 0.0 );
140
141 validateNumericalEquals( fineGridFaceValues[10*2+0], 0.0 );
142 validateNumericalEquals( fineGridFaceValues[10*2+1], 0.0 );
143
144 validateNumericalEquals( fineGridFaceValues[15*2+0], 1.1 );
145 validateNumericalEquals( fineGridFaceValues[15*2+1], -1.1 );
146 }
147 #endif
148}
149
150
152 // Testing a patch with size of 5. See header documentation: these are
153 // the operators for the right face.
154 static constexpr double NormalRestrictionMatrix1d[] = {
155 0.0, 0.0, 0.0, 1.0/3.0, 1.0/3.0, 1.0/3.0,
156 0.0, 0.0, 0.0, 1.0/3.0, 1.0/3.0, 1.0/3.0,
157 0.0, 0.0, 0.0, 1.0/3.0, 1.0/3.0, 1.0/3.0
158 };
159/*
160 static constexpr double NormalRestrictionMatrix1d[] = {
161 6.0, -5.0, 0.0, 0.0, 0.0, 0.0,
162 3.0, -2.0, 0.0, 0.0, 0.0, 0.0,
163 1.0/3.0, 1.0/3.0, 1.0/3.0, 0.0, 0.0, 0.0
164 };
165*/
166 static constexpr double TangentialRestrictionMatrix1d[] = {
167 1.0/3.0, 1.0/3.0, 1.0/3.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
168 0, 0, 0, 1.0/3.0, 1.0/3.0, 1.0/3.0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
169 0, 0, 0, 0, 0, 0, 1.0/3.0, 1.0/3.0, 1.0/3.0, 0, 0, 0, 0, 0, 0,
170 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0/3.0, 1.0/3.0, 1.0/3.0, 0, 0, 0,
171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0/3.0, 1.0/3.0, 1.0/3.0
172 };
173
175 int face=3;
176 #if Dimensions==2
177 dummEvent.setRelativePositionToFather( {0,0} );
178
179 //peano4::datamanagement::FaceMarker marker(dummEvent);
180 //marker.select(face);
181
182 constexpr int NumberOfFaceValues = 3*5 * 2 * 2; // three width, five dofs per axis, two unknowns, two sides
183
184 double fineGridFaceValues[] = {
185 0.1,-0.1, 0.1,-0.1, 0.1,-0.1, 0.0,0.0, 0.0,0.0, 0.0,0.0,
186 0.1,-0.1, 0.1,-0.1, 0.1,-0.1, 0.0,0.0, 0.0,0.0, 0.0,0.0,
187 0.1,-0.1, 0.1,-0.1, 0.1,-0.1, 0.0,0.0, 0.0,0.0, 0.0,0.0,
188 0.1,-0.1, 0.1,-0.1, 0.1,-0.1, 0.0,0.0, 0.0,0.0, 0.0,0.0,
189 0.1,-0.1, 0.1,-0.1, 0.1,-0.1, 0.0,0.0, 0.0,0.0, 0.0,0.0
190 };
191 #else
192 dummEvent.setRelativePositionToFather( {0,0,0} );
193
194 constexpr int NumberOfFaceValues = 3*5*5 * 2 * 2; // three width, five dofs per axis, two unknowns, two sides
195
196 double fineGridFaceValues[] = {
197 10.1,-10.1, 10.2,-10.2, 10.3,-10.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
198 11.1,-11.1, 11.2,-11.2, 11.3,-11.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
199 12.1,-12.1, 12.2,-12.2, 12.3,-12.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
200 13.1,-13.1, 13.2,-13.2, 13.3,-13.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
201 14.1,-14.1, 14.2,-14.2, 14.3,-14.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
202
203 20.1,-20.1, 20.2,-20.2, 20.3,-20.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
204 21.1,-21.1, 21.2,-21.2, 21.3,-21.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
205 22.1,-22.1, 22.2,-22.2, 22.3,-22.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
206 23.1,-23.1, 23.2,-23.2, 23.3,-23.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
207 24.1,-24.1, 24.2,-24.2, 24.3,-24.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
208
209 30.1,-30.1, 30.2,-30.2, 30.3,-30.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
210 31.1,-31.1, 31.2,-31.2, 31.3,-31.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
211 32.1,-32.1, 32.2,-32.2, 32.3,-32.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
212 33.1,-33.1, 33.2,-33.2, 33.3,-33.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
213 34.1,-34.1, 34.2,-34.2, 34.3,-34.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
214
215 40.1,-40.1, 40.2,-40.2, 40.3,-40.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
216 41.1,-41.1, 41.2,-41.2, 41.3,-41.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
217 42.1,-42.1, 42.2,-42.2, 42.3,-42.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
218 43.1,-43.1, 43.2,-43.2, 43.3,-43.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
219 44.1,-44.1, 44.2,-44.2, 44.3,-44.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
220
221 50.1,-50.1, 50.2,-50.2, 50.3,-50.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
222 51.1,-51.1, 51.2,-51.2, 51.3,-51.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
223 52.1,-52.1, 52.2,-52.2, 52.3,-52.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
224 53.1,-53.1, 53.2,-53.2, 53.3,-53.3, 0.0,0.0, 0.0,0.0, 0.0,0.0,
225 54.1,-54.1, 54.2,-54.2, 54.3,-54.3, 0.0,0.0, 0.0,0.0, 0.0,0.0
226 };
227 #endif
228
229 double coarseGridFaceValues[ NumberOfFaceValues ];
230 peano4::datamanagement::FaceMarker marker1(dummEvent);
231 marker1.select(Dimensions);
232
233 std::fill_n(coarseGridFaceValues, NumberOfFaceValues, 0.0 );
234
236 marker1,
237 5, // numberOfDoFsPerAxisInPatch
238 3, // overlap
239 2, // unknowns
240 NormalRestrictionMatrix1d,
241 TangentialRestrictionMatrix1d,
242 fineGridFaceValues,
243 coarseGridFaceValues
244 );
245
246 #if Dimensions==2
248 coarseGridFaceValues[0*2+0], 0.1,
249 coarseGridFaceValues[0*2+0], coarseGridFaceValues[1*2+0], coarseGridFaceValues[2*2+0],
250 coarseGridFaceValues[3*2+0], coarseGridFaceValues[4*2+0], coarseGridFaceValues[5*2+0]
251 );
252 #endif
253}
254
255
257
258 //@tobias: you can just ignore it as I am just testing the schme in my stupid way.
259
260 static constexpr double NormalInterpolationMatrix1d[] = {
261 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
262 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
263 0.0, 0.0, 1.0, 0.0, 0.0, 0.0
264 };
265 static constexpr double TangentialInterpolationMatrix1d[] = {
266 1.0,0.0,0.0,0.0,0.0,
267 1.0,0.0,0.0,0.0,0.0,
268 1.0,0.0,0.0,0.0,0.0,
269 0.0,1.0,0.0,0.0,0.0,
270 0.0,1.0,0.0,0.0,0.0,
271
272 0.0,1.0,0.0,0.0,0.0,
273 0.0,0.0,1.0,0.0,0.0,
274 0.0,0.0,1.0,0.0,0.0,
275 0.0,0.0,1.0,0.0,0.0,
276 0.0,0.0,0.0,1.0,0.0,
277
278 0.0,0.0,0.0,1.0,0.0,
279 0.0,0.0,0.0,1.0,0.0,
280 0.0,0.0,0.0,0.0,1.0,
281 0.0,0.0,0.0,0.0,1.0,
282 0.0,0.0,0.0,0.0,1.0
283 };
284
285
286 #if Dimensions==2
288 dummEvent.setRelativePositionToFather( {0,2} );
289
290 peano4::datamanagement::FaceMarker marker(dummEvent);
291
292 {
293 double coarseGridFaceValues[] = {
294 0.1,-0.1, 0.2,-0.2, 0.3,-0.3, 5.1,-5.1, 5.2,-5.2, 5.3,-5.3,
295 1.1,-1.1, 1.2,-1.2, 1.3,-1.3, 6.1,-6.1, 6.2,-6.2, 6.3,-6.3,
296 2.1,-2.1, 2.2,-2.2, 2.3,-2.3, 7.1,-7.1, 7.2,-7.2, 7.3,-7.3,
297 3.1,-3.1, 3.2,-3.2, 3.3,-3.3, 8.1,-8.1, 8.2,-8.2, 8.3,-8.3,
298 4.1,-4.1, 4.2,-4.2, 4.3,-4.3, 9.1,-9.1, 9.2,-9.2, 9.3,-9.3
299 };
300 double fineGridFaceValues[ 3*5*2*2 ]; // three width, five dofs per axis, two unknowns, two sides
301 std::fill_n(fineGridFaceValues, 3*5*2*2, 0.0 );
302
303 marker.select(0);
304
306 marker,
307 5, // numberOfDoFsPerAxisInPatch
308 3, // overlap
309 2, // unknowns
310 NormalInterpolationMatrix1d,
311 TangentialInterpolationMatrix1d,
312 coarseGridFaceValues,
313 fineGridFaceValues
314 );
315
316 std::cout<<std::setprecision(1);
317 for (int i=0;i<5;i++){
318 for (int j=0;j<12;j++){
319 std::cout<<fineGridFaceValues[i*12+j] << " ";
320 }
321 std::cout<<"\n";
322 }
323 }
324/*
325 {
326 double coarseGridFaceValues[] = {
327 0.1,-0.1, 0.2,-0.2, 0.3,-0.3, 0.4,-0.4, 0.5,-0.5,
328 1.1,-1.1, 1.2,-1.2, 1.3,-1.3, 1.4,-1.4, 1.5,-1.5,
329 2.1,-2.1, 2.2,-2.2, 2.3,-2.3, 2.4,-2.4, 2.5,-2.5,
330
331 3.1,-3.1, 3.2,-3.2, 3.3,-3.3, 3.4,-3.4, 3.5,-3.5,
332 4.1,-4.1, 4.2,-4.2, 4.3,-4.3, 4.4,-4.4, 4.5,-4.5,
333 5.1,-5.1, 5.2,-5.2, 5.3,-5.3, 5.4,-5.4, 5.5,-5.5
334 };
335 double fineGridFaceValues[ 3*5*2*2 ]; // three width, five dofs per axis, two unknowns, two sides
336 std::fill_n(fineGridFaceValues, 3*5*2*2, 0.0 );
337
338 marker.select(1);
339
340 ::toolbox::blockstructured::interpolateHaloLayer_AoS_tensor_product(
341 marker,
342 5, // numberOfDoFsPerAxisInPatch
343 3, // overlap
344 2, // unknowns
345 NormalInterpolationMatrix1d,
346 TangentialInterpolationMatrix1d,
347 coarseGridFaceValues,
348 fineGridFaceValues
349 );
350
351 std::cout<<std::setprecision(1);
352 for (int i=0;i<6;i++){
353 for (int j=0;j<10;j++){
354 std::cout<<fineGridFaceValues[i*10+j] << " ";
355 }
356 std::cout<<"\n";
357 }
358 }*/
359 #endif
360}
361
362
364 static constexpr double TangentialRestrictionMatrix1d[] = {
365 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
366 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
367 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
368 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
369 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0};
370
371 static constexpr double NormalRestrictionMatrix1d[] = {
372 0.0, 0.0, 0.0, 0.3333333333333333, 0.3333333333333333, 0.3333333333333333,
373 0.0, 0.0, 0.0, 0.0, -2.0, 3.0,
374 0.0, 0.0, 0.0, 0.0, -5.0, 6.0};
375
377 #if Dimensions==2
378 dummEvent.setRelativePositionToFather( {0,0} );
379
380 constexpr int NumberOfFaceValues = 3*5 * 2 * 2; // three width, five dofs per axis, two unknowns, two sides
381
382 double fineGridFaceValues[] = {
383 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
384 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
385 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
386 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
387 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
388
389 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
390 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
391 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
392 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
393 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
394 };
395 #else
396 dummEvent.setRelativePositionToFather( {0,0,2} );
397
398 constexpr int NumberOfFaceValues = 3*5*5 * 5 * 2; // three width, five dofs per axis, five unknowns, two sides
399
400 double fineGridFaceValues[] = {
401 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
402 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
403 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
404 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
405 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
406
407 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
408 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
409 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
410 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
411 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
412
413 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
414 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
415 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
416 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
417 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0, 0.1,0,0,0,0,
418
419 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
420 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
421 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
422 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
423 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
424
425 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
426 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
427 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
428 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
429 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
430
431 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
432 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
433 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
434 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
435 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0
436 };
437 #endif
438
439 double coarseGridFaceValues[ NumberOfFaceValues ];
440 peano4::datamanagement::FaceMarker marker1(dummEvent);
441 marker1.select(2*Dimensions-1);
442
443 std::fill_n(coarseGridFaceValues, NumberOfFaceValues, 0.0 );
444
446 marker1,
447 5, // numberOfDoFsPerAxisInPatch
448 3, // overlap
449 5, // unknowns
450 NormalRestrictionMatrix1d,
451 TangentialRestrictionMatrix1d,
452 fineGridFaceValues,
453 coarseGridFaceValues
454 );
455
456 #if Dimensions==2
458 coarseGridFaceValues[0*2+0], 0.1,
459 coarseGridFaceValues[0*2+0], coarseGridFaceValues[1*2+0], coarseGridFaceValues[2*2+0],
460 coarseGridFaceValues[3*2+0], coarseGridFaceValues[4*2+0], coarseGridFaceValues[5*2+0]
461 );
462 #else
463 validateNumericalEquals( coarseGridFaceValues[0*5+0], 0.1 );
464 validateNumericalEquals( coarseGridFaceValues[1*5+0], 0.1 );
465 validateNumericalEquals( coarseGridFaceValues[5*5+0], 0.1 );
466 validateNumericalEquals( coarseGridFaceValues[6*5+0], 0.1 );
467
468 dummEvent.setRelativePositionToFather( {1,0,2} );
469 peano4::datamanagement::FaceMarker marker102(dummEvent);
470 marker102.select(2*Dimensions-1);
472 marker102,
473 5, // numberOfDoFsPerAxisInPatch
474 3, // overlap
475 5, // unknowns
476 NormalRestrictionMatrix1d,
477 TangentialRestrictionMatrix1d,
478 fineGridFaceValues,
479 coarseGridFaceValues
480 );
481
482 dummEvent.setRelativePositionToFather( {2,0,2} );
483 peano4::datamanagement::FaceMarker marker202(dummEvent);
484 marker202.select(2*Dimensions-1);
486 marker202,
487 5, // numberOfDoFsPerAxisInPatch
488 3, // overlap
489 5, // unknowns
490 NormalRestrictionMatrix1d,
491 TangentialRestrictionMatrix1d,
492 fineGridFaceValues,
493 coarseGridFaceValues
494 );
495
496 dummEvent.setRelativePositionToFather( {0,1,2} );
497 peano4::datamanagement::FaceMarker marker012(dummEvent);
498 marker012.select(2*Dimensions-1);
500 marker012,
501 5, // numberOfDoFsPerAxisInPatch
502 3, // overlap
503 5, // unknowns
504 NormalRestrictionMatrix1d,
505 TangentialRestrictionMatrix1d,
506 fineGridFaceValues,
507 coarseGridFaceValues
508 );
509
510 dummEvent.setRelativePositionToFather( {1,1,2} );
511 peano4::datamanagement::FaceMarker marker112(dummEvent);
512 marker112.select(2*Dimensions-1);
514 marker112,
515 5, // numberOfDoFsPerAxisInPatch
516 3, // overlap
517 5, // unknowns
518 NormalRestrictionMatrix1d,
519 TangentialRestrictionMatrix1d,
520 fineGridFaceValues,
521 coarseGridFaceValues
522 );
523
524 dummEvent.setRelativePositionToFather( {2,1,2} );
525 peano4::datamanagement::FaceMarker marker212(dummEvent);
526 marker212.select(2*Dimensions-1);
528 marker212,
529 5, // numberOfDoFsPerAxisInPatch
530 3, // overlap
531 5, // unknowns
532 NormalRestrictionMatrix1d,
533 TangentialRestrictionMatrix1d,
534 fineGridFaceValues,
535 coarseGridFaceValues
536 );
537
538 dummEvent.setRelativePositionToFather( {0,2,2} );
539 peano4::datamanagement::FaceMarker marker022(dummEvent);
540 marker022.select(2*Dimensions-1);
542 marker022,
543 5, // numberOfDoFsPerAxisInPatch
544 3, // overlap
545 5, // unknowns
546 NormalRestrictionMatrix1d,
547 TangentialRestrictionMatrix1d,
548 fineGridFaceValues,
549 coarseGridFaceValues
550 );
551
552 dummEvent.setRelativePositionToFather( {1,2,2} );
553 peano4::datamanagement::FaceMarker marker122(dummEvent);
554 marker122.select(2*Dimensions-1);
556 marker122,
557 5, // numberOfDoFsPerAxisInPatch
558 3, // overlap
559 5, // unknowns
560 NormalRestrictionMatrix1d,
561 TangentialRestrictionMatrix1d,
562 fineGridFaceValues,
563 coarseGridFaceValues
564 );
565
566 dummEvent.setRelativePositionToFather( {2,2,2} );
567 peano4::datamanagement::FaceMarker marker222(dummEvent);
568 marker222.select(2*Dimensions-1);
570 marker222,
571 5, // numberOfDoFsPerAxisInPatch
572 3, // overlap
573 5, // unknowns
574 NormalRestrictionMatrix1d,
575 TangentialRestrictionMatrix1d,
576 fineGridFaceValues,
577 coarseGridFaceValues
578 );
579
580 for (int i=0; i<5*5*3; i++) {
581 validateNumericalEquals( coarseGridFaceValues[i*5+0], 0.1 );
582 }
583 #endif
584}
585
586
#define testMethod(name)
Run a test method and check for errors.
Definition TestMacros.h:24
#define validateNumericalEquals(actualValue, validValue)
Definition TestMacros.h:428
#define validateNumericalEqualsWithParams6(actualValue, validValue, param0, param1, param2, param3, param4, param5)
Definition TestMacros.h:542
virtual void run()
This routine is triggered by the TestCaseCollection.
void interpolateHaloLayer_AoS_tensor_product(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
This is a wrapper around the toolbox routines.
void restrictInnerHalfOfHaloLayer_AoS_tensor_product(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, double *fineGridValues, double *coarseGridValues, bool swapInsideOutside=false)
Provide information about selected face.
Definition FaceMarker.h:35
FaceMarker & select(int face)
Selects a face within a cell, i.e.
void setRelativePositionToFather(const tarch::la::Vector< Dimensions, int > &value)