File: Parameters.h

package info (click to toggle)
madlib 1.3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,912 kB
  • sloc: cpp: 39,850; sh: 10,088; makefile: 476
file content (264 lines) | stat: -rw-r--r-- 6,271 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information. 
// You should have received a copy of these files along with MAdLib. 
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------

#ifndef _H_PARAMETERS
#define _H_PARAMETERS

#include "AdaptInterface.h"
#include "SizeFieldBase.h"
#include "LocalSizeField.h"

#include <string.h>
using std::string;
#include <list>
#include <set>
#include <vector>
using std::vector;

// ----------------------------------------------------------------------
enum KinematicType {
  KT_DISPLACEMENT,
  KT_VELOCITY
};

// ----------------------------------------------------------------------
enum OrientationType {
  ORT_ISOTROPIC,
  ORT_ANISOTROPIC
};

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
struct LocalSFDef {
  string name;
  bool distToFaces;
  bool isotropic;
  double radius;
  string sizeN, sizeT;
  bool limit;
  double limitSizeTg;
  double maxCurv;
};

// ----------------------------------------------------------------------
struct SizeFieldDef
{
  MAd::sFieldType type; // analytical or piecewise linear

  // analytical size fields
  OrientationType orientation;
  string isoSize;
  vector<string> anisoSize;
  vector<string> anisoDir0, anisoDir1, anisoDir2;

  // piecewise linear size fields
  string pwlSource; // curvature, initial length or file
  
  // curvature parameters
  bool curv_aniso;
  double curv_alpha, curv_hMin;

  // file parameters
  string mshFile;
};

// ----------------------------------------------------------------------
struct ObjectDef {

  string name;

  // geometry
  int geomLevel; // 0=point,1=line,2=surface,3=region
  std::set<int> geomTags;

  // kinematics
  KinematicType kinType;
  vector<string> kinExpression;

  // size fields
  std::list<LocalSFDef> sizes;
};

// ----------------------------------------------------------------------
struct MoveParameters {
  
  // global input specifications
  // ---------------------------

  string meshFileName;
  string geoFileName;
  
  // global output parameters
  // ------------------------

  int outFrequency;
  string outType; // "Msh", "Pos" or "MshAndPos"(def)
  string outPrefix;

  // Global task parameters
  // ----------------------

  string task; // MobileObject(def),...

  // debugging parmeters
  // --------------------

  int debugLevel;
  bool openJournal;
  string referenceJournal;
  bool sliverReports;
  bool testSliverOperators;

  // Mesh adaptation
  // ----------------

  bool adapt;
  bool adaptAlways;
  double adaptQualityThr;
  int maxInnerIter;
  double lowerLength, upperLength;
  double infLength;
  double swapMinImproveRatio;
  double sliverQuality;

  bool splitCanMakeSlivers, collapseCanMakeSlivers;
  double makeSliverInSplitLenSqBound, makeSliverInCollapseLenSqBound;

  bool collapseOnBoundary;
  double clpOnBdryTolerance;

  bool swapOnBoundary;
  double swapOnBdryTolerance;

  bool trackGeometry;
  bool   snap_cavityIsMesh;
  int    snap_thickness;
  double snap_chi;
  bool   snap_check;
  bool   snap_force;

  bool SFSmoothing;
  double SFSmoothGrad;

  // Moving objects
  // --------------

  std::vector<ObjectDef> objects;

  // Size Field parameters
  // ---------------------

  std::list<SizeFieldDef> sizes;
  
  // Node motion
  // -----------

  string nodeMotionType; // None(def), ForceBoundaries, ElasticAnalogy
  bool   elasticSubAdapt;
  double elasticSubAdaptQualThr;
  bool   elasticIsMeshTheCavity;
  int    elasticCavityThickness;
  double elasticStiffnessAlteration;

  // Time parameters
  // ---------------

  int maxNbTimeSteps;
  double timeStep;
  double finalTime;

};

// ----------------------------------------------------------------------
// this function set the parameters to the values of a particular test case
extern void setCurrentParameters(MoveParameters *);

// ----------------------------------------------------------------------
void setDefaultParameters(MoveParameters * params)
{
  params->meshFileName = "";
  params->geoFileName = "";

  params->outFrequency = 1;
  params->outType = "MshAndPos";
  params->outPrefix  = "result/";

  params->task = "MobileObject";

  params->debugLevel = 1;
  params->openJournal = false;
  params->referenceJournal = "";
  params->sliverReports = false;
  params->testSliverOperators = false;

  params->adapt = true;
  params->adaptAlways = true;
  params->adaptQualityThr = 0.02;
  
  params->maxInnerIter = 10;
  params->lowerLength = 1./sqrt(3.);
  params->upperLength = sqrt(3.);
  params->infLength = 1.e14;
  params->swapMinImproveRatio = 1.0;
  params->sliverQuality = 0.02;

  params->splitCanMakeSlivers = true;
  params->makeSliverInSplitLenSqBound = 10.;
  params->collapseCanMakeSlivers = true;
  params->makeSliverInCollapseLenSqBound = 0.1;

  params->collapseOnBoundary = true;
  params->clpOnBdryTolerance = 1.e-6;

  params->swapOnBoundary = true;
  params->swapOnBdryTolerance = 1.e-6;

  params->trackGeometry = false;
  params->snap_cavityIsMesh = false;
  params->snap_thickness = 3;
  params->snap_chi = 1.;
  params->snap_check = false;
  params->snap_force = false;

  params->SFSmoothing = false;
  params->SFSmoothGrad = 1.;

  params->objects.clear();

  params->sizes.clear();

  params->nodeMotionType = "None";
  params->elasticSubAdapt = true;
  params->elasticSubAdaptQualThr = 0.;
  params->elasticIsMeshTheCavity = true;
  params->elasticCavityThickness = 3;
  params->elasticStiffnessAlteration = 1.0;

  params->maxNbTimeSteps = 1000000;
  params->timeStep = 0.1;
  params->finalTime = -1.0;
}

// ----------------------------------------------------------------------
MoveParameters getParameters()
{
  MoveParameters params;
  setDefaultParameters(&params);
  setCurrentParameters(&params);

  return params;
}

// ----------------------------------------------------------------------

#endif