rsvs3D  0.0.0
Codes for the c++ implementation of the 3D RSVS
parameters.hpp
Go to the documentation of this file.
1 
7 #ifndef PARAMETERS_H_INCLUDED
8 #define PARAMETERS_H_INCLUDED
9 
10 //=================================
11 // included dependencies
12 
13 #include <array>
14 #include <cstdlib>
15 #include <ctime>
16 #include <string>
17 #include <vector>
18 
19 //=================================
20 // Code
21 //
22 // This file defines parameters to be used in other parts of the
23 // RSVS snaking framework. Default values are defined in "parameters.cpp"
24 //
25 // Substructure names are all 4-5 letters
26 
31 namespace param
32 {
34 typedef std::array<double, 2> realbounds;
37 typedef std::vector<std::pair<std::string, std::string>> exports;
38 typedef std::vector<std::pair<int, std::string>> varconfig;
40 template <class T> struct filltype
41 {
42  bool active = false;
43  T fill;
44 };
45 
54 {
55  public:
56  std::string directory;
57  std::string templateregex;
58  std::string filenameregex;
59  varconfig loglvlspecialisation;
60 
62 };
63 
65 {
66  public:
67  using outputtemplate::outputtemplate;
68 
69  std::string TemplateLogging(int lvl, bool withPath = true, std::string pattern = "") const;
70 };
74 class rsvs
75 {
76  public:
90  rsvs();
91  ~rsvs();
92  void PrepareForUse();
93 };
94 
99 class snaking
100 {
101  public:
102  // Velocity engine
103  std::string engine;
111  double snaxtimestep;
113  double snaxdiststep;
118  int maxsteps;
121 
122  snaking();
123  ~snaking();
124  void PrepareForUse();
125 };
126 
128 class voxel
129 {
130  public:
132  std::array<int, 3> gridsizebackground;
135  std::array<int, 3> gridsizesnake;
136 
137  voxel();
138  ~voxel();
139  void PrepareForUse();
140 };
141 
143 class voronoi
144 {
145  public:
147  std::vector<double> inputpoints;
149  double distancebox;
151  std::string pointfile;
158 
159  voronoi();
160  ~voronoi();
161  void PrepareForUse();
162  void ReadPoints();
163 };
164 
166 class grid
167 {
168  public:
169  voxel voxel;
172  std::array<realbounds, 3> domain;
174  std::array<realbounds, 3> physdomain;
176  std::string activegrid;
177 
178  grid();
179  void PrepareForUse();
180 };
181 
185 class ioin
186 {
187  public:
188  std::string snakemeshname;
189  std::string volumeshname;
190  std::string snakefile;
191  std::string casename;
192 
193  ioin();
194  void PrepareForUse();
195 };
203 class ioout
204 {
205  private:
206  public:
207  std::string pathoutdir;
208  std::string pathpattern;
209  std::string basenamepattern;
210  std::string basenameoutdir;
211  std::string outdir;
212  std::string pattern;
213 
214  bool redirectcout;
215  bool redirectcerr;
216 
217  int logginglvl;
218  int outputlvl;
219 
220  tecplottemplate tecplot;
221 
222  ioout();
223  void PrepareForUse();
224 };
225 
229 class files
230 {
231  public:
232  bool appcasename2outdir;
233  ioin ioin;
234  ioout ioout;
235  exports exportconfig;
236  files();
237  void PrepareForUse();
238 };
239 
250 namespace dev
251 {
252 
256 class rsvseps
257 {
258  public:
259  double rsvsmath_automatic_eps_edge;
260  double rsvsmath_automatic_eps_surf;
261  double rsvsmath_automatic_eps_volu;
262  double rsvsmath_automatic_eps_centre;
263  double rsvsmath_automatic_eps_centre2;
264 
265  rsvseps();
266 };
267 
271 class devparam
272 {
273  public:
274  double limitlagrangian;
275  int mindesvarsparse;
276  bool surfcentrejacobian;
277  bool surfcentrehessian;
278  bool snaxDistanceLimit_conserveShape;
279  std::string smoothstepmethod;
280  rsvseps rsvsepsilons;
281  devparam();
282 };
283 } // namespace dev
288 {
289  public:
290  rsvs rsvs;
291  snaking snak;
292  grid grid;
293  files files;
294 
295  dev::devparam dev;
296 
297  void PrepareForUse();
298 };
299 
303 namespace io
304 {
305 void read(const std::string &fileName, parameters &p);
306 void readflat(const std::string &fileName, parameters &p);
307 void write(const std::string &fileName, const parameters &p);
308 void writeflat(const std::string &fileName, const parameters &p);
309 int updatefromstring(const std::vector<std::string> &flatjsonKeyVal, parameters &p,
310  const std::string &&sep = std::string(":"));
311 
312 void defaultconf();
313 } // namespace io
314 
318 namespace test
319 {
320 
321 int base();
322 int io();
323 int ioflat();
324 int ipartialread();
325 int prepareforuse();
326 int autoflat();
327 int symmetry();
328 int symmetry_makefillactive();
329 } // namespace test
330 } // namespace param
331 
332 #endif
Class for development parameters.
Definition: parameters.hpp:272
Class for control of rsvs epsilon.
Definition: parameters.hpp:257
Class containing all parameter settings for file operations.
Definition: parameters.hpp:230
Class for parameters of the grid generation.
Definition: parameters.hpp:167
std::string activegrid
The type of grid to use either "voxel" or "voronoi" .
Definition: parameters.hpp:176
std::array< realbounds, 3 > physdomain
Physical domain size for export.
Definition: parameters.hpp:174
std::array< realbounds, 3 > domain
Domain size in internal coordinates.
Definition: parameters.hpp:172
Class containing the input configuration these are files to load.
Definition: parameters.hpp:186
Class containing the output configuration these are files to store and where to store them.
Definition: parameters.hpp:204
Template for generating the correct processing file for the outputs.
Definition: parameters.hpp:54
Root class for all the parameters.
Definition: parameters.hpp:288
Parameters related to the Velocity calculation and VOS steps.
Definition: parameters.hpp:75
filltype< double > cstfill
Fill the VOS values with a constant value.
Definition: parameters.hpp:84
int solveralgorithm
Algorithm used by Eigen to solve the SQP system.
Definition: parameters.hpp:82
filltype< std::string > filefill
Fill the VOS values from file filefill.fill.
Definition: parameters.hpp:86
filltype< std::string > makefill
Fill the VOS values from a run time function accessible from makefill.fill.
Definition: parameters.hpp:89
Parameters controlling tuning parameters for the stepping of the restricted surface.
Definition: parameters.hpp:100
double snaxtimestep
maximum snake time step length
Definition: parameters.hpp:111
int initboundary
Initialisation boundary (either 0 (outer border), 1 (inner border))
Definition: parameters.hpp:116
int maxsteps
maximum number of steps
Definition: parameters.hpp:118
double multiarrivaltolerance
Distance along edge at which converging snaxels are considered arrived.
Definition: parameters.hpp:109
double snaxdiststep
maximum snaxel distance movement
Definition: parameters.hpp:113
double arrivaltolerance
Distance along edge at which a vertex is considered arrived regardless of "d" and "v".
Definition: parameters.hpp:106
double spawnposition
Position of spawn.
Definition: parameters.hpp:120
Class for handling of voronoi VOS meshing parameters.
Definition: parameters.hpp:144
double distancebox
Distance at which to build the bounding box of the mesh.
Definition: parameters.hpp:149
double snakecoarseness
The coarseneness level of the snaking mesh that will be generated.
Definition: parameters.hpp:154
int vorosnakelayers
The number of layers making up the snaking mesh inside each VOS cell [6 6 6] is roughly equal to 2.
Definition: parameters.hpp:157
std::vector< double > inputpoints
Vector of input points, 4 datums per point.
Definition: parameters.hpp:147
std::string pointfile
A string pointing to a file containing the set of inputpoints.
Definition: parameters.hpp:151
Parameters controlling cartesian grid properties.
Definition: parameters.hpp:129
std::array< int, 3 > gridsizesnake
Size of the Snaking grid on which the snake is defined.
Definition: parameters.hpp:135
std::array< int, 3 > gridsizebackground
Size of the Background grid on which the VOS is defined.
Definition: parameters.hpp:132
Namespace containing the parameter classes used to control execution of the 3D-RSVS program.
Definition: main.hpp:15
std::array< double, 2 > realbounds
Collects a lower and an upper bound.
Definition: parameters.hpp:34
std::vector< std::pair< std::string, std::string > > exports
Collects the export settings which is a vector of pairs of strings.
Definition: parameters.hpp:37
The input type of fill information.
Definition: parameters.hpp:41