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.
MeshQualityDriver.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 #ifdef HAVE_CFMSH
32 # include "MeshQuality/MeshQuality.H"
33 #endif
34 
35 namespace NEM {
36 namespace DRV {
37 
38 jsoncons::string_view MeshQualityDriver::getProgramType() const {
39  return programType;
40 }
41 
42 CheckMeshQualDriver::Files::Files(std::string input, std::string output)
43  : inputMeshFile(std::move(input)), outputFile(std::move(output)) {}
44 
46  : files_(std::move(files)) {}
47 
49 
51 
53  return files_;
54 }
55 
57  this->files_ = std::move(files);
58 }
59 
62  mesh->checkMesh(this->files_.outputFile);
63 }
64 
65 #ifdef HAVE_CFMSH
66 OptimizeMeshQualDriver::Opts::Opts(std::vector<cfmeshQualityParams> params)
67  : params(std::move(params)) {}
68 
70  std::vector<cfmeshQualityParams> params)
71  : opts_(std::move(params)) {}
72 
75 
76 const std::vector<cfmeshQualityParams> &OptimizeMeshQualDriver::getParams()
77  const {
78  return getOpts().params;
79 }
80 
81 void OptimizeMeshQualDriver::setParams(std::vector<cfmeshQualityParams> params) {
82  setOpts(Opts{std::move(params)});
83 }
84 
86  this->opts_.params.emplace_back(std::move(params));
87 }
88 
90  return opts_;
91 }
92 
94  this->opts_ = std::move(opts);
95 }
96 
98  for (const auto &param : this->opts_.params) {
99  MeshQuality mq{&param};
100  mq.cfmOptimize();
101  }
102 }
103 #endif
104 
105 } // namespace DRV
106 } // namespace NEM
const Files & getFiles() const
void execute() const override
Run the workflow represented by the driver.
void execute() const override
Run the workflow represented by the driver.
STL namespace.
static meshBase * Create(const std::string &fname)
Construct vtkMesh from filename.
Definition: meshBase.C:78
static constexpr const char * programType
void setParams(std::vector< cfmeshQualityParams > params)
std::vector< cfmeshQualityParams > params
std::shared_ptr< meshBase > mesh
void addParams(cfmeshQualityParams params)
jsoncons::string_view getProgramType() const override
const std::vector< cfmeshQualityParams > & getParams() const
void cfmOptimize()
Definition: MeshQuality.C:179