Microflow 3D  v1.0
GeometryBuildFromSTL.h
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 #pragma once
11 
12 // OpenVDB
13 #include <openvdb/openvdb.h>
14 
15 #include <memory>
16 #include <iostream>
17 #include <fstream>
18 
19 //boost
20 #include "boost/lexical_cast.hpp"
21 
22 #include "MFDatabase/ConfigData.h"
25 #include "PropagationD3Q19.h"
26 #include "LatticeParametersD3Q19.h"
28 #include "MFDatabase/GridVDB.h"
34 #include "GeometryBuilder/NodeID.h"
35 #include "NodeID.h"
36 
37 
38 namespace MF {
39  namespace GB {
40 
42  public:
43  GeometryBuildFromSTL()= default;
44 
45  ~GeometryBuildFromSTL() = default;
46 
47  static std::shared_ptr<MF::GB::GeometryBuildFromSTL> New(const std::shared_ptr<MF::Database::ConfigData>& ConfigData_Ptr, const std::shared_ptr<MF::GU::LatticeParametersD3Q19>& LatticeParameters_Ptr) {
48  auto GeometryBuildFromSTL_Ptr = std::make_shared<MF::GB::GeometryBuildFromSTL>();
49  GeometryBuildFromSTL_Ptr->m_ConfigData_Ptr = ConfigData_Ptr;
50  GeometryBuildFromSTL_Ptr->m_LatticeParameters_Ptr = LatticeParameters_Ptr;
51  GeometryBuildFromSTL_Ptr->m_voxelSize = ConfigData_Ptr->getCaseFloatParam("GeometryParams.VoxelSize");
52  return GeometryBuildFromSTL_Ptr;
53  };
54 
55  void ReadGrid(bool verbose = false);
56  void AutomaticBoundaryFind();
58  void FluidAddFromThreadFile();
59  void SolidAddFromThreadFile();
62  void Clean();
63 
64  openvdb::FloatGrid::Ptr m_STLGeometryGrid_Ptr;
65  openvdb::Int64Grid::Ptr m_VDBInt64GeometryGrid_Ptr;
66  openvdb::Int32Grid::Ptr m_VDBPropagationGrid_Ptr;
67  std::shared_ptr<MF::Database::GridVDB<openvdb::Int64Grid>> m_MFGrid_GeometryGrid_Ptr;
68  private:
69  std::shared_ptr<MF::Database::ConfigData> m_ConfigData_Ptr;
70  std::shared_ptr<MF::GU::LatticeParametersD3Q19> m_LatticeParameters_Ptr;
71  std::shared_ptr<MF::GB::AutoSettingNode> m_AutoSettingNode_Ptr;
72  std::shared_ptr<MF::Database::GridVDB<openvdb::Int32Grid>> m_PropagationGrid_Ptr;
73  std::shared_ptr<MF::GU::PropagationD3Q19> m_PropagationTest_Ptr;
74  std::shared_ptr<MF::GB::StlMesher> m_STLMesher_Ptr;
75  double m_voxelSize {};
76 
78  void SubtractsSTLGridsFromGeometryGrid(bool verbose = false);
79  void AddInnerWallToGrid(const openvdb::FloatGrid::Ptr & VDBGrid_Ptr, double ThinWallValue);
80  void NewPropagationTest();
81  };
82 
83  } /* namespace GB */
84 } /* namespase MF */
void Clean()
Delete some unnecessary objects.
static std::shared_ptr< MF::GB::GeometryBuildFromSTL > New(const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr, const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr)
void AutomaticBoundaryFind()
Boundary nodes automatic finding.
void FluidAddFromThreadFile()
Adds fluid from thread.cfg file.
void ReadGrid(bool verbose=false)
Reads grid from .stl 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.
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.
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.