rsvs3D  0.0.0
Codes for the c++ implementation of the 3D RSVS
RSVSintegration.hpp
Go to the documentation of this file.
1 
8 #ifndef RSVSINTEGRATION_H_INCLUDED
9 #define RSVSINTEGRATION_H_INCLUDED
10 
11 //=================================
12 // forward declared dependencies
13 // class foo; //when you only need a pointer not the actual object
14 // and to avoid circular dependencies
15 namespace integrate
16 {
17 class RSVSclass;
18 } // namespace integrate
19 namespace rsvs3d
20 {
21 class SnakeVelocityCalculator;
22 }
23 class triangulation;
24 class snake;
25 class mesh;
26 class tecplotfile;
27 namespace param
28 {
29 class grid;
30 class snaking;
31 class parameters;
32 class rsvs;
33 class voxel;
34 class voronoi;
35 class ioin;
36 class ioout;
37 class tecplottemplate;
38 } // namespace param
39 namespace polyscopersvs
40 {
41 class PolyScopeRSVS;
42 } // namespace polyscopersvs
43 //=================================
44 // included dependencies
45 #include <fstream>
46 #include <memory>
47 #include <tuple>
48 #include <vector>
49 
50 namespace integrate
51 {
52 typedef std::shared_ptr<rsvs3d::SnakeVelocityCalculator> RSVSCalculator;
53 } // namespace integrate
54 // ================================
55 // declarations
56 
57 void SnakeConnectivityUpdate(snake &testSnake, std::vector<int> &isImpact, double impactAlmostRange = 0.2);
58 void SnakeConnectivityUpdate_2D(snake &testSnake, std::vector<int> &isImpact);
59 void SnakeConnectivityUpdate_legacy(snake &snakein, std::vector<int> &isImpact);
60 void SnakeConnectivityUpdate_robust(snake &snakein, std::vector<int> &isImpact);
61 double SnakePositionUpdate(snake &rsvsSnake, std::vector<double> &dt, double snaxtimestep, double snaxdiststep);
62 namespace integrate
63 {
64 namespace constants
65 {
66 namespace outputs
67 {
68 static const int numberdefined = 7;
69 bool printBaseSnake(int lvl);
70 bool printFullSnake(int lvl);
71 bool printGradientsSnake(int lvl);
72 bool printVectorSnake(int lvl);
73 bool plotSnakeInPolyscope(int lvl);
74 } // namespace outputs
75 static const std::string tecplotsnake = "rsvs3D_";
76 static const std::string tecplotgradient = "rsvsgradients3D_";
77 static const std::string tecplotvectors = "rsvsvectors3D_";
78 static const std::string polyscopeSnakeName = "RSVS-Snake";
79 } // namespace constants
81 {
82  public:
83  int nVoluZone = 0;
84  int stepNum = 0;
85  double timeT = 0.0;
86 
87  iteratereturns(int n, int s, double t)
88  {
89  this->nVoluZone = n;
90  this->stepNum = s;
91  this->timeT = t;
92  }
93 };
94 
95 void Prepare(RSVSclass &RSVSobj);
96 void ApplyDevSettings(RSVSclass &RSVSobj);
97 namespace prepare
98 {
99 void Mesh(const param::grid &gridconf, const param::ioin &ioinconf, mesh &snakeMesh, mesh &voluMesh);
100 void Snake(const param::snaking &snakconf, const param::rsvs &rsvsconf, const param::ioin &ioinconf, mesh &snakeMesh,
101  mesh &voluMesh, snake &rsvsSnake);
102 void Triangulation(mesh &snakeMesh, snake &rsvsSnake, triangulation &rsvsTri);
103 void Output(const param::parameters &paramconf, const param::parameters &origcong, tecplotfile &outSnake,
104  tecplotfile &outgradientsnake, tecplotfile &outvectorsnake, std::ofstream &logFile, std::ofstream &coutFile,
105  std::ofstream &cerrFile);
106 namespace grid
107 {
108 void Voxel(const param::grid &gridconf, mesh &snakeMesh, mesh &voluMesh);
109 void Voronoi(const param::grid &gridconf, mesh &snakeMesh, mesh &voluMesh);
110 void Load(const param::ioin &ioinconf, mesh &snakeMesh, mesh &voluMesh);
111 } // namespace grid
112 } // namespace prepare
113 
114 namespace execute
115 {
116 
117 void All(integrate::RSVSclass &RSVSobj);
118 void Interactive(integrate::RSVSclass &RSVSobj);
119 iteratereturns RSVSiterate(RSVSclass &RSVSobj);
120 void Logging(RSVSclass &RSVSobj, double totT, int nVoluZone, int stepNum);
121 void PostProcessing(RSVSclass &RSVSobj, double totT, int nVoluZone, int stepNum);
122 void Exporting(RSVSclass &RSVSobj);
123 
124 namespace logging
125 {
126 // Log only convergence data
127 void Log(std::ofstream &logFile, RSVSCalculator &calcObj, int loglvl);
128 // Store the Snake in a file
129 void Snake(tecplotfile &outSnake, snake &rsvsSnake, mesh &voluMesh, double totT, int nVoluZone);
130 // Store All the available information
131 void FullTecplot(tecplotfile &outSnake, snake &rsvsSnake, triangulation &rsvsTri, mesh &voluMesh, double totT,
132  int nVoluZone, int stepNum);
133 void Gradients(const RSVSCalculator &calcObj, const triangulation &rsvsTri, tecplotfile &outgradientsnake, double totT,
134  const std::string &snakingEngine);
135 void SnakeVectors(tecplotfile &outSnake, snake &rsvsSnake, double totT);
136 void SnakePolyscope(polyscopersvs::PolyScopeRSVS &viewer, const snake &rsvsSnake);
137 } // namespace logging
138 
139 namespace postprocess
140 {
141 // Log only convergence data
142 // Log only convergence data
143 void Log(std::ofstream &logFile, RSVSCalculator &calcObj, int loglvl);
144 // Store the Snake in a file
145 void Snake(snake &rsvsSnake, mesh &voluMesh, param::parameters &paramconf);
146 // Store All the available information
147 void FullTecplot(tecplotfile &outSnake, snake &rsvsSnake, triangulation &rsvsTri, mesh &voluMesh, double totT,
148  int nVoluZone, int stepNum);
149 void Gradients(const RSVSCalculator &calcObj, const triangulation &rsvsTri, tecplotfile &outgradientsnake, double totT,
150  const std::string &snakingEngine);
151 } // namespace postprocess
152 
153 namespace exporting
154 {
155 void SU2(std::string exportStr, snake &rsvsSnake, param::parameters &paramconf);
156 
157 }
158 } // namespace execute
159 namespace utils
160 {
161 
172 std::string OutputFileName(const param::parameters &paramconf, std::string fileName, std::string extension);
185 std::string OutputFileName(const std::string rootDirectory, const std::string &filePattern, std::string fileName,
186  std::string extension);
187 
188 void WriteModifiedTemplate(const std::string &fileIn, const std::string &fileOut, const std::string &oldLine,
189  const std::string newLine);
190 
191 void SpecialiseTemplateFiles(const param::parameters &paramconf);
192 void SpecialiseTemplateFile(const param::tecplottemplate &tecconfig, int logLvl, const param::ioout &ioout,
193  std::string fileName);
194 } // namespace utils
195 namespace test
196 {
197 int Prepare();
198 int All();
199 int CompareSurfCentreDerivatives();
200 int CompareDerivativesSpike();
201 int CompareDerivativesSpikeNoDPos();
202 int StudyDerivatives();
203 } // namespace test
204 } // namespace integrate
205 
206 //==================================
207 // Code
208 // NOTE: function in a class definition are IMPLICITELY INLINED
209 // ie replaced by their code at compile time
210 
211 #endif // RSVSINTEGRATION_H_INCLUDED
std::string OutputFileName(const param::parameters &paramconf, std::string fileName, std::string extension)
Convenience function to generate file names for RSVS.
Class for mesh handling.
Definition: mesh.hpp:592
Class for parameters of the grid generation.
Definition: parameters.hpp:167
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
Root class for all the parameters.
Definition: parameters.hpp:288
Parameters related to the Velocity calculation and VOS steps.
Definition: parameters.hpp:75
Parameters controlling tuning parameters for the stepping of the restricted surface.
Definition: parameters.hpp:100
A structure containing the information about the polyscope display and the RSVS elements to display.
Definition: snake.hpp:83
Namespace containing the parameter classes used to control execution of the 3D-RSVS program.
Definition: main.hpp:15
Namespace containing interfaces to polyscope for RSVS objects.
Namespace for general purpose tools of the RSVS project.
Definition: snake.cpp:1464