31 #include <boost/filesystem.hpp> 44 std::string outPackMeshFile,
45 std::string outSurroundingFile)
46 : outPackMeshFile(
std::move(outPackMeshFile)),
47 outSurroundingFile(
std::move(outSurroundingFile)),
48 rocpackOrGeoFile(
std::move(inputFile)),
49 useRocpack(isRocpack) {}
83 if (box->autoGenerate.has_value()) {
84 box->autoGenerate.value().packFileName = stlFile;
87 this->
files_ = std::move(files);
98 if (
auto box = dynamic_cast<bmBox *>(opts.
bmParams.
shape.get())) {
99 if (box->autoGenerate.has_value()) {
100 if (!box->autoGenerate.value().packFileName.empty()) {
102 <<
"opts.bmParams.shape.autoGenerate.packFileName is ignored. " 103 "Using getFiles().getInputFile() for geometry file" 106 box->autoGenerate.value().packFileName = stlFile;
109 std::cerr <<
"HexPackMeshDriver only accepts box shape for blockmesh.\n";
114 std::cerr <<
"opts.smParams.geomFileName is ignored. Using " 115 "getFiles().getInputFile() for geometry file" 139 this->
opts_ = std::move(opts);
145 const char dir_path[] =
"./constant";
146 boost::filesystem::path dir(dir_path);
148 boost::filesystem::create_directory(dir);
149 }
catch (boost::filesystem::filesystem_error &e) {
150 std::cerr <<
"Problem in creating triSurface directory" 151 <<
"for the snappyHexMesh" 153 std::cerr << e.what() << std::endl;
157 const char dir_path1[] =
"./constant/triSurface";
158 boost::filesystem::path dir1(dir_path1);
160 boost::filesystem::create_directory(dir1);
161 }
catch (boost::filesystem::filesystem_error &e) {
162 std::cerr <<
"Problem in creating triSurface directory" 163 <<
"for the snappyHexMesh" 165 std::cerr << e.what() << std::endl;
173 auto objMsh = std::unique_ptr<MeshManipulationFoam>(
175 const char *nameFile =
"a";
182 auto objrocPck = std::unique_ptr<NEM::GEO::rocPack>(
185 objrocPck->removeBoundaryVolumes();
186 objrocPck->rocPack2Surf();
189 boost::filesystem::path dir11(hexOutSTL);
191 const std::string dir_path2 =
193 boost::filesystem::path dir2(dir_path2);
195 boost::filesystem::copy_file(
196 dir11, dir2, boost::filesystem::copy_option::overwrite_if_exists);
198 std::cerr <<
"Cannot process rocPack input file without gmsh.\n";
203 boost::filesystem::path dir11(dir_path11);
205 const std::string dir_path2 =
207 boost::filesystem::path dir2(dir_path2);
209 boost::filesystem::copy_file(
210 dir11, dir2, boost::filesystem::copy_option::overwrite_if_exists);
219 auto objBM = std::unique_ptr<blockMeshGen>(
new blockMeshGen(&bmParamsCopy));
220 objBM->createMeshFromSTL(nameFile);
226 smParamsCopy.castMeshControls.locMesh[0] =
227 std::dynamic_pointer_cast<
bmBox>(bmParamsCopy.shape)->coordsBox.first[0] +
229 smParamsCopy.castMeshControls.locMesh[1] =
230 std::dynamic_pointer_cast<bmBox>(bmParamsCopy.shape)->
coordsBox.first[1] +
232 smParamsCopy.castMeshControls.locMesh[2] =
233 std::dynamic_pointer_cast<
bmBox>(bmParamsCopy.shape)->coordsBox.first[2] +
242 std::unique_ptr<snappymeshGen>(
new snappymeshGen(&smParamsCopy));
243 objSHM->createMeshFromSTL(nameFile);
253 std::pair<std::vector<int>, std::vector<std::string>> dirStat =
254 objMsh->splitMshRegions();
256 std::string surroundingRegion = dirStat.second[0];
269 std::vector<std::string> packRegNames =
275 mesh->takeGeoMesh(fgm_);
277 for (
auto &packRegName : packRegNames) {
279 mesh->mergeGeoMesh(fgm_loop);
snappymeshParams smParams
std::string masterCasePath
Specifies directory for master mesh.
snappymeshGen facilitates full-hexahedral/hex-dominent meshing of complex geometries with surface...
blockMeshGen <– meshGen <– meshBase This class incorporates mesh generating method of blockMesh uti...
void execute() const override
Run the workflow represented by the driver.
geoMeshBase * Read(const std::string &fileName)
Read a mesh from file.
This class converts Rockpack output file into periodic geometry and writes into STL, VTK, .MSH, and ExodusII file format.
std::string rocpackOrGeoFile
MeshManipulationFoamParams::CreatePatch mmfCreatePatchParams
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
MeshManipulationFoamParams defines basic parameters needed for utilities in MeshManipulationFoam clas...
std::string outCombinedFile
Combined mesh file name.
void setGeoFile(std::string geoFile)
bool isInputRocpackFile() const
std::string packsPatchType
Defines packs patch type for createPatch utility (this is specific to "Pack Mesh" workflow) ...
std::vector< std::string > pckRegionNames
A vector containing all region names for packs.
const Files & getFiles() const
bool isPackMesh
Boolean for packmesh.
std::string geomFileName
Input geometry STL name.
std::string addCasePath
Specifies directory for mesh to be merge with master mesh.
bool isPackMesh
Boolean for if the operation is packmesh.
MergeMeshes mergeMeshesParams
void setFiles(Files files)
MeshManipulation class contains several OpenFOAM utilities to perform various mesh manipulation opera...
SurfaceSplitByManifold surfSplitParams
double locAdjust
Perturb location in mesh if snappy fails.
std::shared_ptr< meshBase > mesh
std::shared_ptr< bmShape > shape
3D block, sphere, cylinder, or tapered cone
std::string srrndngPatchType
Defines surrounding patch type for createPatch utility (this is specific to "Pack Mesh" workflow) ...
std::pair< std::array< double, 3 >, std::array< double, 3 > > coordsBox
Pair of min and max box locations for autogenerate.
const Opts & getOpts() const
const std::string & getInputFile() const
std::string packsName
Defines packs patch name for createPatch utility (this is specific to "Pack Mesh" workflow) ...
void setRocpackFile(std::string rocpackFile)
std::string surroundingName
Defines surrounding patch name for createPatch utility (this is specific to "Pack Mesh" workflow) ...
CreatePatch createPatchParams
MeshManipulationFoamParams::MergeMeshes mmfMergeParams