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.
VtkToCobaltConversionDriver.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/Conversion/VtkToCobaltConversionDriver.H
"
30
31
#include "
Mesh/cobalt.H
"
32
33
namespace
NEM
{
34
namespace
DRV {
35
36
VtkToCobaltConversionDriver::Files::Files
(std::string input,
37
std::string outputCgr,
38
std::string outputCgi)
39
: inputMeshFile(
std
::move(input)),
40
outputCgrFile(
std
::move(outputCgr)),
41
outputCgiFile(
std
::move(outputCgi)) {}
42
43
VtkToCobaltConversionDriver::VtkToCobaltConversionDriver
(
Files
files)
44
:
files_
(
std
::move(files)) {}
45
46
VtkToCobaltConversionDriver::VtkToCobaltConversionDriver
()
47
:
VtkToCobaltConversionDriver
({{}, {}, {}}) {}
48
49
const
VtkToCobaltConversionDriver::Files
&
50
VtkToCobaltConversionDriver::getFiles
()
const
{
51
return
files_
;
52
}
53
54
void
VtkToCobaltConversionDriver::setFiles
(
Files
files) {
55
this->
files_
= std::move(files);
56
}
57
58
void
VtkToCobaltConversionDriver::execute
()
const
{
59
if
(this->
files_
.
inputMeshFile
.find(
".vt"
) != std::string::npos) {
60
std::cout <<
"Detected file in VTK format"
<< std::endl;
61
std::cout <<
"Converting to COBALT ...."
<< std::endl;
62
}
else
{
63
std::cerr <<
"Source mesh file is not in VTK format"
<< std::endl;
64
}
65
66
std::ifstream meshStream(this->
files_
.
inputMeshFile
);
67
if
(!meshStream.good()) {
68
std::cerr <<
"Error opening file "
<< this->
files_
.
inputMeshFile
69
<< std::endl;
70
exit(1);
71
}
72
73
// create meshBase object
74
std::shared_ptr<meshBase> myMesh =
75
meshBase::CreateShared
(this->
files_
.
inputMeshFile
);
76
77
// create Cobalt object from meshBase
78
COBALT::cobalt
*cm =
new
COBALT::cobalt
(myMesh, this->
files_
.
inputMeshFile
,
79
this->files_.outputCgrFile,
80
this->files_.outputCgiFile);
81
// write to file
82
cm->
write
();
83
}
84
85
const
VtkToCobaltConversionDriver::Opts
&
VtkToCobaltConversionDriver::getOpts
()
86
const
{
87
static
constexpr
Opts
opts{};
88
return
opts;
89
}
90
91
}
// namespace DRV
92
}
// namespace NEM
NEM::DRV::VtkToCobaltConversionDriver::execute
void execute() const override
Run the workflow represented by the driver.
Definition:
VtkToCobaltConversionDriver.C:58
NEM::DRV::VtkToCobaltConversionDriver::setFiles
void setFiles(Files files)
Definition:
VtkToCobaltConversionDriver.C:54
std
STL namespace.
NEM::DRV::VtkToCobaltConversionDriver::Files::Files
Files()=default
NEM::DRV::VtkToCobaltConversionDriver::files_
Files files_
Definition:
VtkToCobaltConversionDriver.H:62
NEM::DRV::VtkToCobaltConversionDriver::Files::inputMeshFile
std::string inputMeshFile
Definition:
VtkToCobaltConversionDriver.H:43
NEM::DRV::VtkToCobaltConversionDriver::Files
Definition:
VtkToCobaltConversionDriver.H:40
NEM
Definition:
AutoVerificationDriver.C:38
VtkToCobaltConversionDriver.H
meshBase::CreateShared
static std::shared_ptr< meshBase > CreateShared(const std::string &fname)
Create shared ptr from fname.
Definition:
meshBase.C:171
cobalt.H
COBALT::cobalt::write
void write() const
Definition:
cobalt.C:115
NEM::DRV::VtkToCobaltConversionDriver::getFiles
const Files & getFiles() const
Definition:
VtkToCobaltConversionDriver.C:50
NEM::DRV::VtkToCobaltConversionDriver::VtkToCobaltConversionDriver
VtkToCobaltConversionDriver()
Definition:
VtkToCobaltConversionDriver.C:46
NEM::DRV::VtkToCobaltConversionDriver
Definition:
VtkToCobaltConversionDriver.H:38
NEM::DRV::VtkToCobaltConversionDriver::Opts
Definition:
VtkToCobaltConversionDriver.H:65
NEM::DRV::VtkToCobaltConversionDriver::getOpts
const Opts & getOpts() const
Definition:
VtkToCobaltConversionDriver.C:85
COBALT::cobalt
Definition:
cobalt.H:37
src
Drivers
Conversion
VtkToCobaltConversionDriver.C
Generated on Wed Jan 26 2022 16:40:02 for NEMoSys by
1.8.13