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.
NucMeshDriver.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/NucMeshDriver.H"
30 
31 #include "Mesh/geoMeshFactory.H"
32 #include "Mesh/smeshGeoMesh.H"
33 #include "Services/NucMeshSrv.H"
34 
35 namespace NEM {
36 namespace DRV {
37 
39  : file_(std::move(file)), opts_(std::move(opts)) {}
40 
42 
44 
45 void NucMeshDriver::setFiles(Files files) { file_ = std::move(files); }
46 
48 
49 void NucMeshDriver::setOpts(Opts opts) { opts_ = std::move(opts); }
50 
51 jsoncons::string_view NucMeshDriver::getProgramType() const {
52  return programType;
53 }
54 
55 vtkSmartPointer<NEM::MSH::geoMeshBase> NucMeshDriver::draw() const {
56  vtkNew<NEM::SRV::NucMeshSrv> nucMeshRunner{};
57  nucMeshRunner->SetConfiguration(opts_);
58  nucMeshRunner->Update();
59  return NEM::MSH::smeshGeoMesh::SafeDownCast(nucMeshRunner->GetOutput());
60 }
61 
62 void NucMeshDriver::execute() const {
63  auto outNative = this->draw();
64  auto outType = vtkSmartPointer<NEM::MSH::geoMeshBase>::Take(
66  outType->takeGeoMesh(outNative);
67  outType->write(file_.outputFile);
68 }
69 
70 } // namespace DRV
71 } // namespace NEM
std::string outputFile
Definition: NemDriver.H:78
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
void setFiles(Files files)
Set the output file for the driver.
Definition: NucMeshDriver.C:45
STL namespace.
jsoncons::string_view getProgramType() const override
Definition: NucMeshDriver.C:51
void execute() const override
Construct the mesh and write to file.
Definition: NucMeshDriver.C:62
vtkSmartPointer< NEM::MSH::geoMeshBase > draw() const
Construct the mesh.
Definition: NucMeshDriver.C:55
const Opts & getOpts() const
Get the options set on a driver object.
Definition: NucMeshDriver.C:47
void setOpts(Opts opts)
Set the geometry/mesh and extrusion to execute.
Definition: NucMeshDriver.C:49
static constexpr const char * programType
const Files & getFiles() const
Get the output file name.
Definition: NucMeshDriver.C:43
Class to create 2d geometry from polygons and circles and mesh it.
Definition: NucMeshDriver.H:50