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.
SurfacePackMeshDriver.H
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 #ifndef NEMOSYS_SURFACEPACKMESHDRIVER_H_
30 #define NEMOSYS_SURFACEPACKMESHDRIVER_H_
31 
32 #include "nemosys_export.h"
34 
35 namespace NEM {
36 namespace DRV {
37 
38 class NEMOSYS_EXPORT SurfacePackMeshDriver : public PackMeshDriver {
39  public:
40  struct NEMOSYS_EXPORT Files {
41  public:
42  /**
43  * @brief
44  * @param rocpackFile Input file name (Output from Rocpack)
45  * @param outputMeshFile Output file name (.stl, .vtu, .msh are supported)
46  */
47  Files(std::string rocpackFile, std::string outputMeshFile);
48  std::string rocpackFile{};
49  std::string outputMeshFile{};
50  JSONCONS_TYPE_TRAITS_FRIEND
51  private:
52  Files() = default;
53  };
54 
55  enum class NEMOSYS_EXPORT PhysGrpOpts { NONE, MULTI, TWO, PER_SHAPE };
56 
57  struct NEMOSYS_EXPORT CustomDomain {
58  std::array<double, 3> initial{};
59  std::array<double, 3> length{};
60  };
61 
62  struct NEMOSYS_EXPORT Periodic3DOpts {
63  PhysGrpOpts physGrpOptions{PhysGrpOpts::NONE};
64  /**
65  * @brief Boolean for enabling cohesive elements creation
66  */
67  bool createCohesive{false};
68  /**
69  * @brief Boolean for enabling patches.
70  */
71  bool enablePatches{false};
72  /**
73  * @brief Boolean for setting periodic geometry
74  */
75  bool setPeriodicGeo{false};
76  /**
77  * @brief for users to specify custom domain size.
78  */
79  jsoncons::optional<CustomDomain> customDomain{};
80  /**
81  * @brief Parameters for translating mesh from origin.
82  */
83  std::array<double, 3> transferMesh{};
84  /**
85  * @brief Element order selected by user
86  */
87  int elemOrder{1};
88  };
89 
90  struct NEMOSYS_EXPORT Opts {
91  public:
92  explicit Opts(jsoncons::optional<Periodic3DOpts> periodic3DOpts);
93  /**
94  * @brief Mesh size
95  */
96  jsoncons::optional<double> meshSize{};
97  /**
98  * @brief Meshing algorithm of choice.
99  */
100  int meshAlgorithm{1};
101  /**
102  * @brief Value of scaling between 0 to 1 with 1 being no scaling.
103  */
104  jsoncons::optional<double> scaleValue{};
105  /**
106  * @brief Boolean for removal of volumes intersecting boundary
107  */
108  bool removeBoundaryPacks{false};
109  /**
110  * @brief Enable default output formats
111  */
112  bool enableDefaultOut{false};
113  /**
114  * @brief Boolean for preserving pack sizes instead of packing fraction
115  */
116  bool preserveSize{false};
117  /**
118  * @brief Refinement applied to original mesh
119  */
120  jsoncons::optional<int> refineLevel{};
121  /**
122  * @brief Upper threshold for filtering (w.r.t mean)
123  */
124  jsoncons::optional<double> upperThreshold{};
125  /**
126  * @brief Lower threshold for filtering (w.r.t mean)
127  */
128  jsoncons::optional<double> lowerThreshold{};
129  /**
130  * @brief If @c periodic3D has value, then options for the 3D mesh.
131  * Otherwise, only stl file is generated
132  */
133  jsoncons::optional<Periodic3DOpts> periodic3DOpts;
134 
135  JSONCONS_TYPE_TRAITS_FRIEND
136 
137  private:
138  Opts() = default;
139  static constexpr const char *type = "surface";
140  static constexpr const char *engine = "packmesh";
141  };
142 
143  SurfacePackMeshDriver(Files files, Opts opts);
144 
145  const Files &getFiles() const;
146  void setFiles(Files files);
147  const Opts &getOpts() const;
148  void setOpts(Opts opts);
149  void execute() const override;
150 
151  JSONCONS_TYPE_TRAITS_FRIEND
152 
153  private:
155 
158 };
159 
160 } // namespace DRV
161 } // namespace NEM
162 
163 #endif // NEMOSYS_SURFACEPACKMESHDRIVER_H_
jsoncons::optional< Periodic3DOpts > periodic3DOpts
If periodic3D has value, then options for the 3D mesh.
This class drives the flow of pack meshing by using parameters provided by users. ...