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

Adds fluid nodes from thread_params.cfg file to VDBGrid. More...

#include <FluidFromThread.h>

Public Member Functions

 FluidFromThread ()=default
 
 ~FluidFromThread ()=default
 

Static Public Member Functions

static void VDBFluidAdd (const openvdb::Int64Grid::Ptr &VDBGrid, const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr)
 

Detailed Description

Adds fluid nodes from thread_params.cfg file to VDBGrid.

Reads point data from the .csv file and sets nodeID (nodeType + MFThread number) in VDBGrid.

Definition at line 29 of file FluidFromThread.h.

Constructor & Destructor Documentation

◆ FluidFromThread()

MF::GB::FluidFromThread::FluidFromThread ( )
default

◆ ~FluidFromThread()

MF::GB::FluidFromThread::~FluidFromThread ( )
default

Member Function Documentation

◆ VDBFluidAdd()

void MF::GB::FluidFromThread::VDBFluidAdd ( const openvdb::Int64Grid::Ptr &  VDBGrid,
const std::shared_ptr< MF::Database::ConfigData > &  ConfigData_Ptr 
)
static

Definition at line 14 of file FluidFromThread.cpp.

References MF::RW::CSVReader::DataReadFromCSVFile(), MF::GB::NodeID::Node, MF::GB::NodeID::node_id, and MF::GB::NodeID::NodeID.

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

14  {
15  MF::GB::NodeID nodeTMP, PresentNodeID;
16  nodeTMP.node_id.NodeID = {0};
17  for (unsigned int iter = 0; iter < ConfigData_Ptr->getThreadsNumber(); iter++) {
18  if (ConfigData_Ptr->getThreadStringParam(iter, "GridType") == "VDB") {
19  if (ConfigData_Ptr->getThreadParamLength(iter, "NodeFilePath") > 0) {
20  if (ConfigData_Ptr->getThreadIntParam(iter, "NodeTypeID") == 1) { //process only threads with definition of fluid nodes
21  auto nodeID = (int16_t) ConfigData_Ptr->getThreadIntParam(iter, "NodeTypeID");
22  std::string FilePath =
23  ConfigData_Ptr->CaseFolder + ConfigData_Ptr->getProgramStringParam("GeometryFolder") +
24  ConfigData_Ptr->getThreadStringParam(iter, "NodeFilePath");
25  auto data_Ptr = std::make_unique<std::vector<double>>();
26  std::vector<std::string> VariableNameList{
27  ConfigData_Ptr->getThreadStringVectorParam(0, iter, "NodeCoordinateFileColumnNames"),
28  ConfigData_Ptr->getThreadStringVectorParam(1, iter, "NodeCoordinateFileColumnNames"),
29  ConfigData_Ptr->getThreadStringVectorParam(2, iter, "NodeCoordinateFileColumnNames")};
30  MF::RW::CSVReader::DataReadFromCSVFile(FilePath, VariableNameList, data_Ptr.get());
31  auto accessor = VDBGrid->getAccessor();
32  openvdb::Coord xyz;
33  int32_t &i = xyz[0], &j = xyz[1], &h = xyz[2];
34 
35  for (auto it = data_Ptr->begin(); it < data_Ptr->end(); it += 3) {
36  i = int32_t(*it);
37  j = int32_t(*(it + 1));
38  h = int32_t(*(it + 2));
39  PresentNodeID.node_id.NodeID = accessor.getValue(xyz);
40  nodeTMP.node_id.Node.nodeType = nodeID;
41  nodeTMP.node_id.Node.uidThreadNr = (uint16_t) iter + 1; // uidThreadNr added from the thread_params.cfg starts from 1 because automatically created threads have uidThreadNr = 0;
42  accessor.setValue(xyz, nodeTMP.node_id.NodeID);
43  }
44  data_Ptr.reset();
45  }
46  }
47  }
48  }
49 }
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
static void DataReadFromCSVFile(const std::string &DataFilePath, const std::vector< std::string > &VariableNameList, std::vector< double > *pDataArray)
Reads data from text file.
Definition: CSVReader.cpp:13
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: