12 void MF::GB::GeometryBuildFromSTL::SubtractsSTLGridsFromGeometryGrid(
const bool verbose) {
14 float voxelSize = m_ConfigData_Ptr->getCaseFloatParam(
"GeometryParams.VoxelSize");
16 std::string GridFileNameWithoutExtension = m_ConfigData_Ptr->GeometryFile.substr(0, m_ConfigData_Ptr->GeometryFile.length() - 4);
17 std::string NewGridFileName = (GridFileNameWithoutExtension + std::to_string(nr) +
".stl");
18 std::ifstream isFile(NewGridFileName);
19 while (isFile.good()) {
21 if (m_ConfigData_Ptr->getCaseFloatParam (
"GeometryParams.AddInnerWall") != 0)
22 MF::GB::GeometryBuildFromSTL::AddInnerWallToGrid(NewSTLMesher_Ptr->getVDBGrid_Ptr(),
23 m_ConfigData_Ptr->getCaseFloatParam(
24 "GeometryParams.AddInnerWall"));
26 std::cout <<
"Grid " << NewGridFileName <<
" has been subtracted from the geometry grid " << std::endl;
27 NewSTLMesher_Ptr.reset();
30 NewGridFileName = (GridFileNameWithoutExtension + std::to_string(nr) +
".stl");
31 isFile.open(NewGridFileName);
37 m_AutoSettingNode_Ptr->BoundaryFind();
40 void MF::GB::GeometryBuildFromSTL::AddInnerWallToGrid(
const openvdb::FloatGrid::Ptr & VDBGrid_Ptr,
const double ThinWallValue) {
41 for (openvdb::FloatGrid::ValueOnIter iter = VDBGrid_Ptr->beginValueOn(); iter.test(); ++iter) {
42 if ((iter.getValue() < ThinWallValue) and (iter.getValue() > -ThinWallValue))
49 m_AutoSettingNode_Ptr->DefaultTypeSet();
50 m_AutoSettingNode_Ptr->NodeTypeClass();
55 m_AutoSettingNode_Ptr->BoundaryFind();
60 MF::GB::GeometryBuildFromSTL::NewPropagationTest();
61 m_AutoSettingNode_Ptr->BoundaryFind();
65 std::string GridFileName = (m_ConfigData_Ptr->GeometryFile.substr(0, m_ConfigData_Ptr->GeometryFile.length() - 4));
66 double PhysVoxelSize = m_ConfigData_Ptr->getCaseFloatParam(
"GeometryParams.PhysicalVoxelSize");
71 std::string GridFileName = (m_ConfigData_Ptr->GeometryFile.substr(0, m_ConfigData_Ptr->GeometryFile.length() - 4));
72 std::string GeometryName = m_ConfigData_Ptr->getCaseStringParam(
"GeometryParams.GeometryName");
74 double PhysVoxelSize = m_ConfigData_Ptr->getCaseFloatParam(
"GeometryParams.PhysicalVoxelSize");
80 m_PropagationTest_Ptr.reset();
81 m_PropagationGrid_Ptr.reset();
83 m_STLMesher_Ptr.reset();
85 m_AutoSettingNode_Ptr.reset();
88 void MF::GB::GeometryBuildFromSTL::GeometryBuildFromSTL::ReadGrid(
const bool verbose) {
96 MF::GB::GeometryBuildFromSTL::SubtractsSTLGridsFromGeometryGrid(verbose);
103 for (openvdb::FloatGrid::ValueOnIter iter = m_STLGeometryGrid_Ptr->beginValueOn(); iter.test(); ++iter)
110 for (openvdb::FloatGrid::ValueOnIter iter = m_STLGeometryGrid_Ptr->beginValueOn(); iter.test(); ++iter)
111 accessor.setValue(iter.getCoord(),1);
113 m_PropagationTest_Ptr->PropagationTest();
119 for (openvdb::FloatGrid::ValueOnIter iter = m_STLGeometryGrid_Ptr->beginValueOn(); iter.test(); ++iter)
120 accessor2.setValue(iter.getCoord(),1);
123 void MF::GB::GeometryBuildFromSTL::NewPropagationTest() {
129 accessor.setValueOff(iter.getCoord(), 0);
132 m_PropagationTest_Ptr->PropagationTest();
void Clean()
Delete some unnecessary objects.
struct MF::GB::NodeID::@0::@1 Node
static void VDBBoundaryAdd(const openvdb::Int64Grid::Ptr &VDBGrid, const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr)
static std::shared_ptr< MF::Database::GridVDB< T_VDBGridType > > New()
static std::shared_ptr< MF::GU::PropagationD3Q19 > New(const openvdb::Int32Grid::Ptr &VDBPropagationGrid_Ptr, const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr)
A class that allows to determine the proper NodeID from combined nodeType, uidThreadNr, ThreadCount, ComponentNr and PhaseNr.
static void VDBFluidAdd(const openvdb::Int64Grid::Ptr &VDBGrid, const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr)
void differenceOfTwoGrids(const openvdb::FloatGrid::Ptr &gridA, const openvdb::FloatGrid::Ptr &gridB)
Difference of two VDBGrids.
void AutomaticBoundaryFind()
Boundary nodes automatic finding.
void FluidAddFromThreadFile()
Adds fluid from thread.cfg file.
void SolidAddFromThreadFile()
Adds solid from thread.cfg file.
openvdb::Int32Grid::Ptr m_VDBPropagationGrid_Ptr
Shared pointer to the VDB propagation grid of int value.
static std::shared_ptr< MF::GB::StlMesher > New(const std::string &fileName, const double voxelSize, const bool verbose=false)
static void VDBSolidAdd(const openvdb::Int64Grid::Ptr &VDBGrid, const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr)
static std::shared_ptr< 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)
void WriteGeometryGridToVtiFile()
Writes geometry Int32 geometry grid to .vti file.
std::shared_ptr< MF::Database::GridVDB< openvdb::Int64Grid > > m_MFGrid_GeometryGrid_Ptr
Shared pointer to the MFGrid geometry grid of Int64 value.
union MF::GB::NodeID::@0 node_id
openvdb::FloatGrid::Ptr m_STLGeometryGrid_Ptr
Shared pointer to the VDB geometry grid of float value - a volumetric mesh created from the ...
void WriteGeometryGridToVDBFile()
Writes geometry Int32 geometry grid to .vti file.
openvdb::Int64Grid::Ptr m_VDBInt64GeometryGrid_Ptr
Shared pointer to the VDB geometry grid of Int64 value.
void BoundaryAddFromThreadFile()
Adds boundary from thread.cfg file.