Peano
Loading...
Searching...
No Matches
Enumeration.cpp
Go to the documentation of this file.
1#include "Enumeration.h"
2
3
5 const tarch::la::Vector<Dimensions,int>& overlapCell,
6 int numberOfDoFsPerAxisInPatch,
7 int overlap,
8 int normal
9) {
10 assertion4(normal>=0, overlapCell, numberOfDoFsPerAxisInPatch, overlap, normal);
11 assertion4(normal<Dimensions, overlapCell, numberOfDoFsPerAxisInPatch, overlap, normal);
12
13 int base = 1;
14 int result = 0;
15 for (int d=0; d<Dimensions; d++) {
16 result += overlapCell(d) * base;
17 if (d==normal) {
18 assertion4(overlapCell(d)>=0, overlapCell, numberOfDoFsPerAxisInPatch, overlap, normal);
19 assertion4(overlapCell(d)<2*overlap, overlapCell, numberOfDoFsPerAxisInPatch, overlap, normal);
20 base *= overlap*2;
21 }
22 else {
23 assertion4(overlapCell(d)>=0, overlapCell, numberOfDoFsPerAxisInPatch, overlap, normal);
24 assertion4(overlapCell(d)<numberOfDoFsPerAxisInPatch, overlapCell, numberOfDoFsPerAxisInPatch, overlap, normal);
25 base *= numberOfDoFsPerAxisInPatch;
26 }
27 }
28 return result;
29}
30
31
33 const tarch::la::Vector<Dimensions,int>& patchIndex,
34 int normal
35) {
36 assertion2(normal>=0, patchIndex, normal);
37 assertion2(normal<Dimensions, patchIndex, normal);
38
39 int base = 1;
40 int result = 0;
41 for (int d=0; d<Dimensions; d++) {
42 if (d!=normal) {
43 result += patchIndex(d) * base;
44 assertion2(patchIndex(d)>=0, patchIndex, normal);
45 assertion2(patchIndex(d)<3, patchIndex, normal);
46 base *= 3;
47 }
48 }
49 return result;
50}
51
52
54 const tarch::la::Vector<Dimensions,int>& markerIndex,
55 int numberOfDoFsPerAxisInPatch
56) {
57 #if Dimensions==2
58 const int patchSize = numberOfDoFsPerAxisInPatch*numberOfDoFsPerAxisInPatch;
59 return (markerIndex(0) + markerIndex(1)*3) * patchSize;
60 #else
61 const int patchSize = numberOfDoFsPerAxisInPatch*numberOfDoFsPerAxisInPatch*numberOfDoFsPerAxisInPatch;
62 return (markerIndex(0) + markerIndex(1)*3 + markerIndex(2)*3*3) * patchSize;
63 #endif
64}
65
#define assertion2(expr, param0, param1)
#define assertion4(expr, param0, param1, param2, param3)
int serialisePatchIndexInOverlap(const tarch::la::Vector< Dimensions, int > &patchIndex, int normal)
Patches along a face are basically organised as arrays, i.e.
int serialiseMarkerIn3x3PatchAssembly(const tarch::la::Vector< Dimensions, int > &markerIndex, int numberOfDoFsPerAxisInPatch)
If you have a marker identifying one element within a 3x3 or 3x3x3, respectively, set of patches,...
int serialiseVoxelIndexInOverlap(const tarch::la::Vector< Dimensions, int > &overlapCell, int numberOfDoFsPerAxisInPatch, int overlap, int normal)
The volumes or elements within an overlap are always enumerated lexicographically.
Simple vector class.
Definition Vector.h:134