NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
SnappyMeshMeshGenDriver.C
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
30 
31 #include "AuxiliaryFunctions.H"
32 #include "Mesh/meshBase.H"
34 
35 namespace NEM {
36 namespace DRV {
37 
39  : params(std::move(params)) {}
40 
43  : files_(std::move(files)), opts_(std::move(params)) {}
44 
46  : SnappyMeshMeshGenDriver({{}, {}}, {}) {}
47 
49  const {
50  return files_;
51 }
52 
54  this->opts_.params.geomFileName = files.inputGeoFile;
55  this->files_ = std::move(files);
56 }
57 
59  return getOpts().params;
60 }
61 
63  setOpts(Opts{std::move(params)});
64 }
65 
67  return opts_;
68 }
69 
71  if (!opts.params.geomFileName.empty()) {
73  this->opts_ = std::move(opts);
74  } else {
75  this->opts_ = std::move(opts);
77  }
78 }
79 
81  auto paramsCopy = this->opts_.params;
82  snappymeshGen generator{&paramsCopy};
83  // TODO: Make sure blockMeshGen::createMeshFromSTL sets return value and check
84  // it here
85  // Parameter not used
86  generator.createMeshFromSTL(nullptr);
87  std::string newname = nemAux::trim_fname(this->files_.inputGeoFile, ".vtu");
88  auto mesh =
89  meshBase::CreateShared(meshBase::Create(generator.getDataSet(), newname));
90  mesh->setFileName(this->files_.outputMeshFile);
91  mesh->report();
92  mesh->write();
93 }
94 
95 } // namespace DRV
96 } // namespace NEM
snappymeshGen facilitates full-hexahedral/hex-dominent meshing of complex geometries with surface...
Definition: snappymeshGen.H:55
snappymeshParams contains all parameters essential for mesh generation using snappymeshGen class meth...
void execute() const override
Run the workflow represented by the driver.
int createMeshFromSTL(const char *fname) override
Creates mesh from input STL file.
Definition: snappymeshGen.C:91
STL namespace.
static meshBase * Create(const std::string &fname)
Construct vtkMesh from filename.
Definition: meshBase.C:78
std::string geomFileName
Input geometry STL name.
std::string trim_fname(const std::string &name, const std::string &ext)
const snappymeshParams & getParams() const
std::shared_ptr< meshBase > mesh
static std::shared_ptr< meshBase > CreateShared(const std::string &fname)
Create shared ptr from fname.
Definition: meshBase.C:171
void setParams(snappymeshParams params)