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 *******************************************************************************/
30 
31 #include "Mesh/cobalt.H"
32 
33 namespace NEM {
34 namespace DRV {
35 
37  std::string outputCgr,
38  std::string outputCgi)
39  : inputMeshFile(std::move(input)),
40  outputCgrFile(std::move(outputCgr)),
41  outputCgiFile(std::move(outputCgi)) {}
42 
44  : files_(std::move(files)) {}
45 
47  : VtkToCobaltConversionDriver({{}, {}, {}}) {}
48 
51  return files_;
52 }
53 
55  this->files_ = std::move(files);
56 }
57 
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 =
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 
86  const {
87  static constexpr Opts opts{};
88  return opts;
89 }
90 
91 } // namespace DRV
92 } // namespace NEM
void execute() const override
Run the workflow represented by the driver.
STL namespace.
static std::shared_ptr< meshBase > CreateShared(const std::string &fname)
Create shared ptr from fname.
Definition: meshBase.C:171
void write() const
Definition: cobalt.C:115