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.
InputGenDriver.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/InputGenDriver.H"
30 
31 #include <iostream>
32 #include "AuxiliaryFunctions.H"
35 
36 namespace NEM {
37 namespace DRV {
38 
39 InputGenDriver::InputGenDriver(std::string service, jsoncons::json opts)
40  : service_(std::move(service)), opts_(std::move(opts)) {}
41 
42 const std::string &InputGenDriver::getService() const { return service_; }
43 
44 void InputGenDriver::setService(std::string service) {
45  this->service_ = std::move(service);
46 }
47 
48 const jsoncons::json &InputGenDriver::getOpts() const { return opts_; }
49 
50 void InputGenDriver::setOpts(jsoncons::json opts) {
51  this->opts_ = std::move(opts);
52 }
53 
54 jsoncons::string_view InputGenDriver::getProgramType() const {
55  return programType;
56 }
57 
59  std::string srvName = this->service_;
60  nemAux::toLower(srvName);
61  nemAux::Timer T;
62  T.start();
63  if (srvName == "epic_2016") {
64 #ifdef HAVE_EPIC
65  ep16Prep::readJSON(this->opts_);
66 #else
67  std::cerr << "Compile the code with EPIC module enabled." << std::endl;
68  exit(0);
69 #endif
70  } else if (srvName == "epic_2016_post") {
71 #ifdef HAVE_EPIC
72  int ret;
73  NEM::EPC::ep16Post::readJSON(this->opts_, ret);
74 #else
75  std::cerr << "Compile the code with EPIC module enabled." << std::endl;
76  exit(0);
77 #endif
78  } else {
79  std::cerr << "The input generation service " << srvName << "is unsupported."
80  << std::endl;
81  }
82  T.stop();
83 }
84 
85 } // namespace DRV
86 } // namespace NEM
const jsoncons::json & getOpts() const
void execute() const override
Run the workflow represented by the driver.
static constexpr const char * programType
STL namespace.
void toLower(std::string &str)
const std::string & getService() const
jsoncons::string_view getProgramType() const override
void setService(std::string service)
void setOpts(jsoncons::json opts)