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.
NetgenMeshGenDriver.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
*******************************************************************************/
29
#include "
Drivers/MeshGen/NetgenMeshGenDriver.H
"
30
31
#include "
AuxiliaryFunctions.H
"
32
#include "
Mesh/meshBase.H
"
33
#include "
MeshGeneration/netgenGen.H
"
34
35
namespace
NEM
{
36
namespace
DRV {
37
38
NetgenMeshGenDriver::Opts::Opts
(
netgenParams
params)
39
: params(
std
::move(params)) {}
40
41
NetgenMeshGenDriver::NetgenMeshGenDriver
(
Files
files,
netgenParams
params
)
42
:
files_
(
std
::move(files)),
opts_
(
std
::move(params)) {}
43
44
NetgenMeshGenDriver::NetgenMeshGenDriver
()
45
:
NetgenMeshGenDriver
({{}, {}}, {}) {}
46
47
const
NetgenMeshGenDriver::Files
&
NetgenMeshGenDriver::getFiles
()
const
{
48
return
files_
;
49
}
50
51
void
NetgenMeshGenDriver::setFiles
(
Files
files) {
52
this->
files_
= std::move(files);
53
}
54
55
const
netgenParams
&
NetgenMeshGenDriver::getParams
()
const
{
56
return
getOpts
().
params
;
57
}
58
59
void
NetgenMeshGenDriver::setParams
(
netgenParams
params) {
60
setOpts
(
Opts
{std::move(params)});
61
}
62
63
const
NetgenMeshGenDriver::Opts
&
NetgenMeshGenDriver::getOpts
()
const
{
64
return
opts_
;
65
}
66
67
void
NetgenMeshGenDriver::setOpts
(
Opts
opts) { this->
opts_
= std::move(opts); }
68
69
void
NetgenMeshGenDriver::execute
()
const
{
70
netgenGen
generator{&this->
opts_
.
params
};
71
int
status = generator.createMeshFromSTL(this->
files_
.
inputGeoFile
.c_str());
72
if
(status) {
73
std::cerr <<
"Mesh Generation encountered error."
<< std::endl;
74
exit(1);
75
}
76
std::string newname =
nemAux::trim_fname
(this->
files_
.
inputGeoFile
,
".vol"
);
77
auto
mesh
=
meshBase::CreateShared
(
meshBase::exportVolToVtk
(newname));
78
mesh
->setFileName(this->
files_
.
outputMeshFile
);
79
mesh
->report();
80
mesh
->write();
81
}
82
83
}
// namespace DRV
84
}
// namespace NEM
NEM::DRV::MeshGenDriver::MeshGenFiles::inputGeoFile
std::string inputGeoFile
Definition:
MeshGenDriver.H:44
meshBase::exportVolToVtk
static meshBase * exportVolToVtk(const std::string &fname)
construct vtkMesh from netgen vol file (called in Create methods)
Definition:
meshBase.C:766
netgenParams
Definition:
netgenParams.H:37
NEM::DRV::NetgenMeshGenDriver::execute
void execute() const override
Run the workflow represented by the driver.
Definition:
NetgenMeshGenDriver.C:69
NEM::DRV::MeshGenDriver::MeshGenFiles
Definition:
MeshGenDriver.H:40
std
STL namespace.
NEM::DRV::NetgenMeshGenDriver::setFiles
void setFiles(Files files)
Definition:
NetgenMeshGenDriver.C:51
NEM::DRV::NetgenMeshGenDriver::getParams
const netgenParams & getParams() const
Definition:
NetgenMeshGenDriver.C:55
NEM
Definition:
AutoVerificationDriver.C:38
NEM::DRV::NetgenMeshGenDriver::files_
Files files_
Definition:
NetgenMeshGenDriver.H:67
nemAux::trim_fname
std::string trim_fname(const std::string &name, const std::string &ext)
Definition:
AuxiliaryFunctions.H:440
AuxiliaryFunctions.H
netgenGen
Definition:
netgenGen.H:46
NEM::DRV::MeshGenDriver::MeshGenFiles::outputMeshFile
std::string outputMeshFile
Definition:
MeshGenDriver.H:45
NEM::DRV::NetgenMeshGenDriver::getOpts
const Opts & getOpts() const
Definition:
NetgenMeshGenDriver.C:63
NEM::DRV::NetgenMeshGenDriver::opts_
Opts opts_
Definition:
NetgenMeshGenDriver.H:68
NEM::DRV::NetgenMeshGenDriver::Opts
Definition:
NetgenMeshGenDriver.H:52
netgenGen.H
mesh
std::shared_ptr< meshBase > mesh
Definition:
RocPartCommGenDriver.C:145
meshBase::CreateShared
static std::shared_ptr< meshBase > CreateShared(const std::string &fname)
Create shared ptr from fname.
Definition:
meshBase.C:171
NEM::DRV::NetgenMeshGenDriver::Opts::params
netgenParams params
Definition:
NetgenMeshGenDriver.H:55
meshBase.H
NetgenMeshGenDriver.H
NEM::DRV::NetgenMeshGenDriver::NetgenMeshGenDriver
NetgenMeshGenDriver()
Definition:
NetgenMeshGenDriver.C:44
NEM::DRV::NetgenMeshGenDriver::setParams
void setParams(netgenParams params)
Definition:
NetgenMeshGenDriver.C:59
NEM::DRV::NetgenMeshGenDriver::getFiles
const Files & getFiles() const
Definition:
NetgenMeshGenDriver.C:47
NEM::DRV::NetgenMeshGenDriver::setOpts
void setOpts(Opts opts)
Definition:
NetgenMeshGenDriver.C:67
NEM::DRV::NetgenMeshGenDriver::Opts::Opts
Opts()=default
NEM::DRV::NetgenMeshGenDriver
Definition:
NetgenMeshGenDriver.H:40
src
Drivers
MeshGen
NetgenMeshGenDriver.C
Generated on Wed Jan 26 2022 16:40:01 for NEMoSys by
1.8.13