Microflow 3D  v1.0
PropagationD3Q19.cpp
Go to the documentation of this file.
1 // ==============================================================================================
2 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 01.05.19.
4 // Copyright (c) 2019 Wroclaw University of Science and Technology.
5 // Distributed under the Apache License, Version 2.0. You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0 or see accompanying file license.txt.
7 // Redistributions of source code must retain the above copyright and license notice.
8 // ==============================================================================================
9 
10 #include "PropagationD3Q19.h"
11 
13  unsigned char k;
14  openvdb::Coord xyz, XYZ;
16  openvdb::Int32Grid::Accessor accessor = m_VDBPropagationGrid_Ptr->getAccessor();
17 
18  // Iterate over all active values.
19  for (openvdb::Int32Grid::ValueOnIter iter = m_VDBPropagationGrid_Ptr->beginValueOn(); iter.test(); ++iter) {
20  xyz = iter.getCoord();
21  value.node_t.FF = 0;
22  for (k = 0; k < MFQ27; k++) {
23  XYZ.z() = xyz.z() + m_LatticeParameters_Ptr->DirectionVectorComponent_Cz[k];
24  XYZ.y() = xyz.y() + m_LatticeParameters_Ptr->DirectionVectorComponent_Cy[k];
25  XYZ.x() = xyz.x() + m_LatticeParameters_Ptr->DirectionVectorComponent_Cx[k];
26  if (accessor.isValueOn(XYZ)) {
27  switch (k) {
28  case 0: {
29  value.node_t.ff.f0 = 1;
30  break;
31  }
32  case 1: {
33  value.node_t.ff.f1 = 1;
34  break;
35  }
36  case 2: {
37  value.node_t.ff.f2 = 1;
38  break;
39  }
40  case 3: {
41  value.node_t.ff.f3 = 1;
42  break;
43  }
44  case 4: {
45  value.node_t.ff.f4 = 1;
46  break;
47  }
48  case 5: {
49  value.node_t.ff.f5 = 1;
50  break;
51  }
52  case 6: {
53  value.node_t.ff.f6 = 1;
54  break;
55  }
56  case 7: {
57  value.node_t.ff.f7 = 1;
58  break;
59  }
60  case 8: {
61  value.node_t.ff.f8 = 1;
62  break;
63  }
64  case 9: {
65  value.node_t.ff.f9 = 1;
66  break;
67  }
68  case 10: {
69  value.node_t.ff.f10 = 1;
70  break;
71  }
72  case 11: {
73  value.node_t.ff.f11 = 1;
74  break;
75  }
76  case 12: {
77  value.node_t.ff.f12 = 1;
78  break;
79  }
80  case 13: {
81  value.node_t.ff.f13 = 1;
82  break;
83  }
84  case 14: {
85  value.node_t.ff.f14 = 1;
86  break;
87  }
88  case 15: {
89  value.node_t.ff.f15 = 1;
90  break;
91  }
92  case 16: {
93  value.node_t.ff.f16 = 1;
94  break;
95  }
96  case 17: {
97  value.node_t.ff.f17 = 1;
98  break;
99  }
100  case 18: {
101  value.node_t.ff.f18 = 1;
102  break;
103  }
104  case 19: {
105  value.node_t.ff.f19 = 1;
106  break;
107  }
108  case 20: {
109  value.node_t.ff.f20 = 1;
110  break;
111  }
112  case 21: {
113  value.node_t.ff.f21 = 1;
114  break;
115  }
116  case 22: {
117  value.node_t.ff.f22 = 1;
118  break;
119  }
120  case 23: {
121  value.node_t.ff.f23 = 1;
122  break;
123  }
124  case 24: {
125  value.node_t.ff.f24 = 1;
126  break;
127  }
128  case 25: {
129  value.node_t.ff.f25 = 1;
130  break;
131  }
132  case 26: {
133  value.node_t.ff.f26 = 1;
134  break;
135  }
136  default: {
137  std::cout << "Error in propagationD3Q19 test" << std::endl;
138  exit(EXIT_FAILURE);
139  }
140  }
141  }
142  }
143  accessor.setValue(xyz, value.node_t.FF);
144  }
145 }
146 
#define MFQ27
Number of lattice directions D3Q27.
void PropagationTest()
Propagation test.
struct MF::GU::DirectionsD3Q19::@2::@3 ff
A structure that allows to code/decode in unsigned int number (32bit) the propagation directions of t...
union MF::GU::DirectionsD3Q19::@2 node_t