Microflow 3D  v1.0
MF::GB::AutoSettingNode Class Reference

A class of methods that automatically classify nodes of any geometry. More...

#include <AutoSettingNode.h>

Public Member Functions

 AutoSettingNode (const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr, const openvdb::Int64Grid::Ptr &GeometryGrid_Ptr, const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr, const openvdb::Int32Grid::Ptr &PropagationGrid_Ptr)
 
 ~AutoSettingNode ()=default
 
void DefaultTypeSet ()
 Sets default node types on walls, edges and corners of geometry that are automatically detected and were set to type 3. The default node types are defined in case_parameters.cfg, section: "DefaultBoundaryCondition". More...
 
void NodeTypeClass ()
 Classifies primary node types (e.g 20,30,40) into subtypes 21,22,23... for North/South/Est/West/Top/Bottom walls. More...
 
void BoundaryFind ()
 Finds geometry boundary nodes and set its value to 3. More...
 

Static Public Member Functions

static std::shared_ptr< MF::GB::AutoSettingNodeNew (const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr, const openvdb::Int64Grid::Ptr &GeometryGrid_Ptr, const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr, const openvdb::Int32Grid::Ptr &PropagationGrid_Ptr)
 

Detailed Description

A class of methods that automatically classify nodes of any geometry.

Definition at line 27 of file AutoSettingNode.h.

Constructor & Destructor Documentation

◆ AutoSettingNode()

MF::GB::AutoSettingNode::AutoSettingNode ( const std::shared_ptr< MF::Database::ConfigData > &  ConfigData_Ptr,
const openvdb::Int64Grid::Ptr &  GeometryGrid_Ptr,
const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &  LatticeParameters_Ptr,
const openvdb::Int32Grid::Ptr &  PropagationGrid_Ptr 
)
inline

Definition at line 30 of file AutoSettingNode.h.

References ~AutoSettingNode().

31  :
32  m_ConfigData_Ptr(ConfigData_Ptr),
33  m_GeometryGrid_Ptr(GeometryGrid_Ptr),
34  m_LatticeParameters_Ptr(LatticeParameters_Ptr),
35  m_PropagationGrid_Ptr(PropagationGrid_Ptr)
36  {};

◆ ~AutoSettingNode()

MF::GB::AutoSettingNode::~AutoSettingNode ( )
default

Referenced by AutoSettingNode().

Member Function Documentation

◆ BoundaryFind()

void MF::GB::AutoSettingNode::BoundaryFind ( )

Finds geometry boundary nodes and set its value to 3.

Definition at line 324 of file AutoSettingNode.cpp.

References MF::GU::DirectionsD3Q19::FF, MF::GB::NodeID::Node, MF::GB::NodeID::node_id, MF::GU::DirectionsD3Q19::node_t, and MF::GB::NodeID::NodeID.

Referenced by New().

324  {
325  openvdb::Coord xyz;
327  auto accessor = m_GeometryGrid_Ptr->getAccessor();
328  MF::GB::NodeID nodeTMP;
329 
330  // Iterate over all active values.
331  for (openvdb::Int32Grid::ValueOnIter iter = m_PropagationGrid_Ptr->beginValueOn(); iter.test(); ++iter) {
332  xyz = iter.getCoord();
333  value.node_t.FF = iter.getValue();
334  if ((value.node_t.FF & 134217727) != 134217727) {
335  nodeTMP.node_id.NodeID = accessor.getValue(xyz);
336  nodeTMP.node_id.Node.nodeType = 3;
337  accessor.setValue(xyz, nodeTMP.node_id.NodeID);
338  }
339  }
340 
341 }
struct MF::GB::NodeID::@0::@1 Node
A class that allows to determine the proper NodeID from combined nodeType, uidThreadNr, ThreadCount, ComponentNr and PhaseNr.
Definition: NodeID.h:18
A structure that allows to code/decode in unsigned int number (32bit) the propagation directions of t...
uint64_t NodeID
Definition: NodeID.h:29
union MF::GB::NodeID::@0 node_id
union MF::GU::DirectionsD3Q19::@2 node_t

◆ DefaultTypeSet()

void MF::GB::AutoSettingNode::DefaultTypeSet ( )

Sets default node types on walls, edges and corners of geometry that are automatically detected and were set to type 3. The default node types are defined in case_parameters.cfg, section: "DefaultBoundaryCondition".

Definition at line 13 of file AutoSettingNode.cpp.

References MF::GB::NodeID::Node, MF::GB::NodeID::node_id, and MF::GB::NodeID::NodeID.

Referenced by New().

13  {
14  int32_t nodeType;
15  MF::GB::NodeID nodeTMP; // Extracts nodeType fom joined values of nodeType and uid-ThreadNr +1.
16  auto accessor = m_PropagationGrid_Ptr->getAccessor();
17 
18  for (openvdb::Int64Grid::ValueOnIter iter = m_GeometryGrid_Ptr->beginValueOn(); iter.test(); ++iter) {
19  nodeTMP.node_id.NodeID = iter.getValue();
20  nodeType = nodeTMP.node_id.Node.nodeType;
21  if (nodeType == 0) {} // do nothing.
22  else if (nodeType == 3 || nodeType % 10 == 0) {
23  int32_t nodePropagation = accessor.getValue(iter.getCoord());
24  if (isOnWall_N(nodePropagation) && nodeType == 3){
25  nodeTMP.node_id.Node.nodeType = BN;
26  iter.setValue(nodeTMP.node_id.NodeID); //N wall
27  }
28  else if (isOnWall_S(nodePropagation) && nodeType == 3) {
29  nodeTMP.node_id.Node.nodeType = BN;
30  iter.setValue(nodeTMP.node_id.NodeID); //S wall
31  }
32  else if (isOnWall_W(nodePropagation) && nodeType == 3) {
33  nodeTMP.node_id.Node.nodeType = BN;
34  iter.setValue(nodeTMP.node_id.NodeID); //W wall
35  }
36  else if (isOnWall_E(nodePropagation) && nodeType == 3) {
37  nodeTMP.node_id.Node.nodeType = BN;
38  iter.setValue(nodeTMP.node_id.NodeID); //E wall
39  }
40  else if (isOnWall_T(nodePropagation) && nodeType == 3) {
41  nodeTMP.node_id.Node.nodeType = BN;
42  iter.setValue(nodeTMP.node_id.NodeID); //T wall
43  }
44  else if (isOnWall_B(nodePropagation) && nodeType == 3) {
45  nodeTMP.node_id.Node.nodeType = BN;
46  iter.setValue(nodeTMP.node_id.NodeID); //B wall
47  }
48  else if (isOnWall_N(nodePropagation) && nodeType % 10 == 0); //From thread N wall
49  else if (isOnWall_S(nodePropagation) && nodeType % 10 == 0); //From thread S wall
50  else if (isOnWall_W(nodePropagation) && nodeType % 10 == 0); //From thread W wall
51  else if (isOnWall_E(nodePropagation) && nodeType % 10 == 0); //From thread E wall
52  else if (isOnWall_T(nodePropagation) && nodeType % 10 == 0); //From thread T wall
53  else if (isOnWall_B(nodePropagation) && nodeType % 10 == 0); //From thread B wall
54  /* adds BB 61 on periodic edges
55  else if (isOnWall_N(nodePropagation) && nodeType == 4); //Periodic from thread N wall
56  else if (isOnWall_S(nodePropagation) && nodeType == 4); //Periodic from thread S wall
57  else if (isOnWall_W(nodePropagation) && nodeType == 4); //Periodic from thread W wall
58  else if (isOnWall_E(nodePropagation) && nodeType == 4); //Periodic from thread E wall
59  else if (isOnWall_T(nodePropagation) && nodeType == 4); //Periodic from thread T wall
60  else if (isOnWall_B(nodePropagation) && nodeType == 4); //Periodic from thread B wall
61  */
62  else {
63  nodeTMP.node_id.Node.nodeType = NN;
64  iter.setValue(nodeTMP.node_id.NodeID); // edge/corner/undefined node
65  }
66  }
67  }
68 }
struct MF::GB::NodeID::@0::@1 Node
A class that allows to determine the proper NodeID from combined nodeType, uidThreadNr, ThreadCount, ComponentNr and PhaseNr.
Definition: NodeID.h:18
uint64_t NodeID
Definition: NodeID.h:29
union MF::GB::NodeID::@0 node_id

◆ New()

static std::shared_ptr<MF::GB::AutoSettingNode> MF::GB::AutoSettingNode::New ( const std::shared_ptr< MF::Database::ConfigData > &  ConfigData_Ptr,
const openvdb::Int64Grid::Ptr &  GeometryGrid_Ptr,
const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &  LatticeParameters_Ptr,
const openvdb::Int32Grid::Ptr &  PropagationGrid_Ptr 
)
inlinestatic

Definition at line 40 of file AutoSettingNode.h.

References BoundaryFind(), DefaultTypeSet(), and NodeTypeClass().

Referenced by MF::GB::GeometryBuildFromSTL::AutomaticBoundaryFind().

43  {
44  auto AutoSettingNode_Ptr = std::make_shared<MF::GB::AutoSettingNode>(ConfigData_Ptr, GeometryGrid_Ptr, LatticeParameters_Ptr, PropagationGrid_Ptr);
45  return AutoSettingNode_Ptr;
46  };

◆ NodeTypeClass()

void MF::GB::AutoSettingNode::NodeTypeClass ( )

Classifies primary node types (e.g 20,30,40) into subtypes 21,22,23... for North/South/Est/West/Top/Bottom walls.

Definition at line 70 of file AutoSettingNode.cpp.

References MF::GB::NodeID::Node, MF::GB::NodeID::node_id, and MF::GB::NodeID::NodeID.

Referenced by New().

70  {
71 
72  MF::GB::NodeID nodeTMP;
73  unsigned int nodeType, nodePropagation;
74  openvdb::Coord ijh;
75  int &i = ijh[0], &j = ijh[1], &h = ijh[2];
76  auto accessorG = m_GeometryGrid_Ptr->getAccessor(); // Geometry grid accessor
77  auto accessorP = m_PropagationGrid_Ptr->getAccessor(); // Propagation grid accessor
78 
79  for (openvdb::Int64Grid::ValueOnIter iter = m_GeometryGrid_Ptr->beginValueOn(); iter.test(); ++iter) {
80  nodeTMP.node_id.NodeID = iter.getValue();
81  nodeType = nodeTMP.node_id.Node.nodeType;
82  ijh = iter.getCoord();
83  nodePropagation = accessorP.getValue(ijh);
84 
85  switch (nodeType) {
86  case 0: {
87  break;
88  } //solid
89  case 1: {
90  break;
91  } //fluid
92  case 4: {
93  break;
94  } //periodic boundary node
95  case 61: {
96  break;
97  } //BB 2
98 //---------------------------------------------------------------------------------------------------
99 //Dirichlet velocity
100 //---------------------------------------------------------------------------------------------------
101  case 21: {
102  break;
103  }
104  case 22: {
105  break;
106  }
107  case 23: {
108  break;
109  }
110  case 24: {
111  break;
112  }
113  case 25: {
114  break;
115  }
116  case 26: {
117  break;
118  }
119  case 20: {
120  if (isOnWall_N(nodePropagation)) {
121  nodeTMP.node_id.Node.nodeType = 21;
122  iter.setValue(nodeTMP.node_id.NodeID); //N wall
123  }
124  else if (isOnWall_S(nodePropagation)) {
125  nodeTMP.node_id.Node.nodeType = 22;
126  iter.setValue(nodeTMP.node_id.NodeID); //S wall
127  }
128  else if (isOnWall_E(nodePropagation)) {
129  nodeTMP.node_id.Node.nodeType = 23;
130  iter.setValue(nodeTMP.node_id.NodeID); //E wall
131  }
132  else if (isOnWall_W(nodePropagation)) {
133  nodeTMP.node_id.Node.nodeType = 24;
134  iter.setValue(nodeTMP.node_id.NodeID); //W wall
135  }
136  else if (isOnWall_B(nodePropagation)) {
137  nodeTMP.node_id.Node.nodeType = 25;
138  iter.setValue(nodeTMP.node_id.NodeID); //B wall
139  }
140  else if (isOnWall_T(nodePropagation)) {
141  nodeTMP.node_id.Node.nodeType = 26;
142  iter.setValue(nodeTMP.node_id.NodeID); //T wall
143  }
144  else {
145  nodeTMP.node_id.Node.nodeType = NN;
146  iter.setValue(nodeTMP.node_id.NodeID); // edge/corner/unrecognized node
147  }
148  break;
149  }
150 //-----------------------------------------------------------------------------------------------------------------------------------
151 //Neumann pressure
152 //-----------------------------------------------------------------------------------------------------------------------------------
153  case 31: {
154  break;
155  }
156  case 32: {
157  break;
158  }
159  case 33: {
160  break;
161  }
162  case 34: {
163  break;
164  }
165  case 35: {
166  break;
167  }
168  case 36: {
169  break;
170  }
171  case 30: {
172  if (isOnWall_N(nodePropagation)) {
173  nodeTMP.node_id.Node.nodeType = 31;
174  iter.setValue(nodeTMP.node_id.NodeID); //N wall
175  }
176  else if (isOnWall_S(nodePropagation)) {
177  nodeTMP.node_id.Node.nodeType = 32;
178  iter.setValue(nodeTMP.node_id.NodeID); //S wall
179  }
180  else if (isOnWall_E(nodePropagation)) {
181  nodeTMP.node_id.Node.nodeType = 33;
182  iter.setValue(nodeTMP.node_id.NodeID); //E wall
183  }
184  else if (isOnWall_W(nodePropagation)) {
185  nodeTMP.node_id.Node.nodeType = 34;
186  iter.setValue(nodeTMP.node_id.NodeID); //W wall
187  }
188  else if (isOnWall_B(nodePropagation)) {
189  nodeTMP.node_id.Node.nodeType = 35;
190  iter.setValue(nodeTMP.node_id.NodeID); //B wall
191  }
192  else if (isOnWall_T(nodePropagation)) {
193  nodeTMP.node_id.Node.nodeType = 36;
194  iter.setValue(nodeTMP.node_id.NodeID); //T wall
195  }
196  else {
197  nodeTMP.node_id.Node.nodeType = NN;
198  iter.setValue(nodeTMP.node_id.NodeID); // edge/corner/unrecognized node
199  }
200  break;
201  }
202 //---------------------------------------------------------------------------------------------------
203 //Dirichlet velocity = 0 na scianach
204 //---------------------------------------------------------------------------------------------------
205  case 41: {
206  break;
207  }
208  case 42: {
209  break;
210  }
211  case 43: {
212  break;
213  }
214  case 44: {
215  break;
216  }
217  case 45: {
218  break;
219  }
220  case 46: {
221  break;
222  }
223  case 40: {
224  if (isOnWall_N(nodePropagation)) {
225  nodeTMP.node_id.Node.nodeType = 41;
226  iter.setValue(nodeTMP.node_id.NodeID); //N wall
227  }
228  else if (isOnWall_S(nodePropagation)) {
229  nodeTMP.node_id.Node.nodeType = 42;
230  iter.setValue(nodeTMP.node_id.NodeID); //S wall
231  }
232  else if (isOnWall_E(nodePropagation)) {
233  nodeTMP.node_id.Node.nodeType = 43;
234  iter.setValue(nodeTMP.node_id.NodeID); //E wall
235  }
236  else if (isOnWall_W(nodePropagation)) {
237  nodeTMP.node_id.Node.nodeType = 44;
238  iter.setValue(nodeTMP.node_id.NodeID); //W wall
239  }
240  else if (isOnWall_B(nodePropagation)) {
241  nodeTMP.node_id.Node.nodeType = 45;
242  iter.setValue(nodeTMP.node_id.NodeID); //B wall
243  }
244  else if (isOnWall_T(nodePropagation)) {
245  nodeTMP.node_id.Node.nodeType = 46;
246  iter.setValue(nodeTMP.node_id.NodeID); //T wall
247  }
248  else {
249  nodeTMP.node_id.Node.nodeType = NN;
250  iter.setValue(nodeTMP.node_id.NodeID); // edge/corner/unrecognized node
251  }
252  break;
253  }
254 //--------------------------------------------------------------------------------------------------------------------------------------------
255  default : {
256  std::cout << "Undefined type of boundary node " << (int) nodeType << " (" << i << ", " << j << ", " << h << ")" << std::endl;
257  exit(EXIT_FAILURE);
258  }
259  }
260  }
261 }
struct MF::GB::NodeID::@0::@1 Node
A class that allows to determine the proper NodeID from combined nodeType, uidThreadNr, ThreadCount, ComponentNr and PhaseNr.
Definition: NodeID.h:18
uint64_t NodeID
Definition: NodeID.h:29
union MF::GB::NodeID::@0 node_id

The documentation for this class was generated from the following files: