ParMooN
 All Classes Functions Variables Friends Pages
Domain.h
1 
13 #ifndef __DOMAIN__
14 #define __DOMAIN__
15 
16 #include <BaseCell.h>
17 #include <BoundPart.h>
18 #include <Collection.h>
19 #include <Iterator.h>
20 #include <Vertex.h>
21 
22 class TDatabase;
23 
24 #ifdef __MORTAR__
26  {
27  TBaseCell *Cell;
28  int LocFaceNumber[2];
29  };
30 
31 typedef struct TMortarFaceStruct TMortarFace;
32 #endif
33 
36 class TDomain
37 {
38  protected:
39 
42 
45 
48 
51 
53  int *Interfaces;
54 
56  int N_Holes;
57 
59  double *PointInHole;
60 
62  int N_Regions;
63 
65  double *PointInRegion;
66 
69 
72 
75 
77  double StartX;
79  double StartY;
81  double BoundX;
83  double BoundY;
84 
85 #ifdef __3D__
86 
87  double StartZ;
91  double BoundZ;
92 #endif
93 
95  int RefLevel;
96 
97 #ifdef __MORTAR__
98 
102 
105 #endif
106 
107  friend class TTetGenMeshLoader;
108 
109 #ifdef _MPI
110 
112 
115 #endif
116 
117  public:
118  // Constructors
119  TDomain();
120 
121  TDomain(char *ParamFile);
122 
123  // Methods
125  int ReadGeo(char *GeoFile);
126 
128  int GmshGen(char *GeoFile);
129 
130 #ifdef __3D__
131 
132  int ReadSandwichGeo(char *GeoFile);
133 
136 
137  int CloseGrid(int level);
138 
140  int TetrameshGen(char *GeoFile);
141 
142 #endif
143 
144 #ifdef __2D__
145 
148 
150  void TriMeshGen(struct triangulateio *In);
151 #endif
152 
154  int ReadParam(char *ParamFile);
156  int ReadBdParam(char *ParamFile, int &Flag);
158  int ReadMapFile(char *MapFile, TDatabase *database);
159 
161  int GetBdPartID(int BdCompID);
163  int GetLocalBdCompID(int BdCompID);
165  int GetLastLocalComp(int BdPartID)
166  { return StartBdCompID[BdPartID+1] - StartBdCompID[BdPartID] - 1; }
168  void SetStartBdCompID(int BdCompID, int i)
169  { StartBdCompID[i] = BdCompID; }
170 
173  { return BdParts[i]; }
174 
176  void GetTreeInfo(TBaseCell **&celltree, int &N_rootcells)
177  {
178  celltree = CellTree;
179  N_rootcells = N_RootCells;
180  }
181 
183  void SetTreeInfo(TBaseCell **celltree, int N_rootcells)
184  {
185  CellTree = celltree;
186  N_RootCells = N_rootcells;
187 
188  #ifdef _MPI
189  N_OwnCells = 0;
190  #endif
191  }
192 
193  #ifdef __MORTAR__
194 
195  int SetSubGridIDs(IntFunct2D *TestFunc);
197  int GenMortarStructs();
200  { return N_MortarFaces; }
203  { return &(MortarFaces[i]); }
204 
206  TCollection *GetMortarColl(Iterators it, int level);
207 
209  int InitMortarJoints(Iterators it, int level, TCollection *coll);
210  #endif
211 
213  int GenInitGrid();
214  #ifdef __2D__
215 
216  int MakeGrid(double *DCORVG, int *KVERT, int *KNPR, int N_Vertices,
217  int NVE);
220  int MakeGrid(double *DCORVG, int *KVERT, int *KNPR, int *ELEMSREF,
221  int N_Vertices, int NVE);
222  #else
223 
224  int MakeGrid(double *DCORVG, int *KVERT, int *KNPR, int *ELEMSREF,
225  int N_Vertices, int NVE, int *BoundFaces, int *FaceParam,
226  int NBF, int NVpF,
227  int *Interfaceparam, int N_Interfaces);
229  int MakeSandwichGrid(double *DCORVG, int *KVERT, int *KNPR,
230  int N_Vertices, int NVE,
231  double DriftX, double DriftY, double DriftZ,
232  int N_Layers, double *Lambda);
233  #endif
234 
236  void Init(char *PRM, char *GEO);
237 
239  int Draw(char *name, Iterators iterator, int arg);
241  int PS(const char *name, Iterators iterator, int arg);
243  int PS(const char *name, TCollection *Coll);
245  int MD_raw(const char *name, Iterators iterator, int arg);
246 
248  int Refine();
250  int RegRefineAll();
252  int RegRefineSub(int ID);
254  int RefineallxDirection();
256  int Gen1RegGrid();
258  int RefineByIndicator(DoubleFunct2D *Indicator);
261  int MakeConfClosure();
262 
264  int RefineByErrorEstimator(TCollection *Collection,double *eta_K,
265  double eta_max,double tolerance,
266  bool ConfClosure);
267 
270  void Refine1Reg(int MinLevel, int MaxLevel);
271 
273  void DeRefine();
274 
276  int ConvertQuadToTri(int type);
277 
279  TCollection *GetCollection(Iterators it, int level);
280 
286  TCollection *GetCollection(TCollection *coll, int reference);
287 
288 #ifdef _MPI
289 
290  TCollection *GetOwnCollection(Iterators it, int level, int ID);
291 #endif
292 
296  void GetSortedCollection(TCollection* &Coll, int* &Indices);
297 
299  void GetBoundBox(double &startx, double &starty,
300  double &boundx, double &boundy)
301  {
302  startx = StartX;
303  starty = StartY;
304  boundx = BoundX;
305  boundy = BoundY;
306  }
307 
308 #ifdef __3D__
309 
310  void GetBoundBox(double &startx, double &starty, double &startz,
311  double &boundx, double &boundy, double &boundz)
312  {
313  startx = StartX;
314  starty = StartY;
315  startz = StartZ;
316  boundx = BoundX;
317  boundy = BoundY;
318  boundz = BoundZ;
319  }
320 
321  void SetBoundBox(double startx, double starty, double startz,
322  double boundx, double boundy, double boundz)
323  {
324  StartX = startx;
325  StartY = starty;
326  StartZ = startz;
327  BoundX = boundx;
328  BoundY = boundy;
329  BoundZ = boundz;
330  }
331 #endif
332 
333  // test
334  #ifndef __3D__
335  void TestGrid1();
336  void TestGrid2();
337  void TestGrid3();
338  void TestMortar();
339  void TestShishkin();
340  void TriangleShishkin();
341  void UnitSquare();
342  void UnitSquareRef();
343  void TwoTriangles();
344  void TwoTrianglesRef();
345  void SquareInSquare();
346  void SquareInSquareRef();
347  void SetBoundBox(double boundx, double boundy);
348  void SetBoundBoxstart(double startx , double starty);
349  void RefOnMortarEdge();
350  void RefCardioide(double A);
351  void PeriodicSquares();
352  void PeriodicSquaresLarge();
353  void PeriodicRectangle_2_4();
354  void PeriodicTrianglesLarge();
355  void QuadShishkin(double tau1, double tau2);
356  void Rectangular(int dimx, int dimy);
357  void TestTriaConf();
358  void TestTriaConf2();
359  void CheckCells();
360 
361  #else
362  void TestGrid3D();
363  void SetBoundBox(double boundx, double boundy, double boundz);
364  #endif
365 
366  #ifdef __3D__
367  int Grape(const char *name, TCollection *coll);
368 
369  #endif
370 
371  void TetrameshGen();
372 
373 
374  #ifdef _MPI
375  void ReplaceTreeInfo(int n_cells, TBaseCell **cells, int *GLOB_cellIndex, int n_OwnCells)
376  {
377  if(CellTree) delete CellTree;
378  N_RootCells = n_cells;
379  CellTree = cells;
380  GlobalCellIndex = GLOB_cellIndex;
381  N_OwnCells = n_OwnCells;
382  }
383 
384  void SetN_OwnCells(int n_OwnCells)
385  { N_OwnCells = n_OwnCells; }
386 
387  int GetN_OwnCells()
388  { return N_OwnCells; }
389 
390  int GetN_HaloCells()
391  { return (N_RootCells - N_OwnCells); }
392  #endif
393 
394 #ifdef __3D__
395  public:
396 
397 // int Tetgen(const char*);
398 
400  int GenerateEdgeInfo();
401 
402 #endif
403 
405  int AdaptRefineAll();
406 
407 };
408 
409 #endif
TCollection * GetOwnCollection(Iterators it, int level, int ID)
produce a own collection with all cells returned by iterator it
Definition: Domain.C:2020
int Refine()
refine the grid according the cell refinement descriptors
Definition: Domain.C:1022
int ReadGeo(char *GeoFile)
read geometry file
Definition: ReadGeo.C:46
int RefineallxDirection()
refine only in one direction
Definition: Domain.C:2846
void TriMeshGen(struct triangulateio *In)
mesh genration using Triangle for give IN
Definition: MeshGen.C:117
int * StartBdCompID
start id of boundary component on each boundary part
Definition: Domain.h:50
TBaseCell ** CellTree
array of all root cells of cell tree
Definition: Domain.h:68
void GetTreeInfo(TBaseCell **&celltree, int &N_rootcells)
get tree of cells
Definition: Domain.h:176
int N_MortarFaces
number of mortar faces
Definition: Domain.h:99
double BoundY
y length of bounding box
Definition: Domain.h:83
void GetBoundBox(double &startx, double &starty, double &boundx, double &boundy)
get bounding box parameters
Definition: Domain.h:299
int GetBdPartID(int BdCompID)
get boundary part of BdCompID
Definition: Domain.C:88
int N_InitVCells
number of virtuell cells on initial level
Definition: Domain.h:74
double * PointInHole
point in each hole
Definition: Domain.h:59
int RefLevel
current refinment level
Definition: Domain.h:95
Definition: TetGenMeshLoader.h:30
void DeRefine()
derefinemnt
Definition: Domain.C:2396
double * PointInRegion
point in each region
Definition: Domain.h:65
int SetSubGridIDs(IntFunct2D *TestFunc)
set subgrid ID&#39;s on all MacroCells and generate mortar structurs
Definition: Domain.C:109
Definition: gridgen.h:21
int ReadSandwichGeo(char *GeoFile)
read sandwich geometry
Definition: ReadGeo.C:1521
int MakeSandwichGrid(double *DCORVG, int *KVERT, int *KNPR, int N_Vertices, int NVE, double DriftX, double DriftY, double DriftZ, int N_Layers, double *Lambda)
make initial sandwich grid
Definition: ReadGeo.C:2077
void Refine1Reg(int MinLevel, int MaxLevel)
refine/derefine algorithm for a 1-regular grid, geolevel of all cells on the finest grid is between M...
contains the boundary description, the virtual cell tree and macro grid
Definition: Domain.h:36
int InitMortarJoints(Iterators it, int level, TCollection *coll)
initialize all mortar joints with FE-information
Definition: Domain.C:271
int ReadMapFile(char *MapFile, TDatabase *database)
read mapping and mortar information
Definition: ReadParam.C:3846
int GetLastLocalComp(int BdPartID)
get local number of last boundary component on part BdPartID
Definition: Domain.h:165
int MakeConfClosure()
refine the finest grid if necessary in order to get a grid with conforming closures ...
Definition: Domain.C:1272
int * Interfaces
boundary part id&#39;s of all Interfaces
Definition: Domain.h:53
void GetSortedCollection(TCollection *&Coll, int *&Indices)
produce a collection with all cells in the finest grid, sort they according to their geometry level a...
Definition: Domain.C:2054
int RegRefineAll()
refine all cells regular
Definition: Domain.C:1038
int N_InitVCellsY
return number of cell in Y direction
Definition: Domain.h:89
int Gen1RegGrid()
generate a 1-regular grid
Definition: Domain.C:1866
int N_Holes
number of holes
Definition: Domain.h:56
int RefineByIndicator(DoubleFunct2D *Indicator)
refine the finest grid according the given indicator function
Definition: Domain.C:1077
int ConvertQuadToTri(int type)
convert all finest quadrangles into two triangles
Definition: Domain.C:1898
void CorrectParametersAndShapes()
set boundary parameters and cell shape according to possibly moving vertices
Definition: Domain.C:2671
int * GlobalCellIndex
array contains the global cell number of local cells (including Halo cells)
Definition: Domain.h:111
store cells in an array, used by cell iterators
Definition: Collection.h:18
double StartZ
third coordinate of start point (3D)
Definition: Domain.h:87
int ReadParam(char *ParamFile)
read parameter file
Definition: ReadParam.C:40
int N_OwnCells
Number of own cells (excluding Halo cells)
Definition: Domain.h:114
int GetN_MortarFace()
return number of mortar face structs
Definition: Domain.h:199
double StartY
y coordinate of the start point (2D)
Definition: Domain.h:79
TBoundPart * GetBdPart(int i)
get i-th boundary part
Definition: Domain.h:172
int ReadBdParam(char *ParamFile, int &Flag)
read boundary parameterization
Definition: ReadParam.C:3636
void Init(char *PRM, char *GEO)
Init process for current domain.
Definition: Domain.C:763
TMortarFace * MortarFaces
structur for mortar faces
Definition: Domain.h:101
int RefineByErrorEstimator(TCollection *Collection, double *eta_K, double eta_max, double tolerance, bool ConfClosure)
refine the finest grid according a given error estimate
Definition: Domain.C:1113
TCollection * GetMortarColl(Iterators it, int level)
get a collection of all mortar cells
Definition: Domain.C:214
int GenerateEdgeInfo()
generate edge info in 3D mesh
Definition: Domain.C:2896
int N_Regions
number of regions
Definition: Domain.h:62
int TetrameshGen(char *GeoFile)
read TetGen mesh
Definition: ReadGeo.C:3970
int RegRefineSub(int ID)
refine all cells in subgrid ID regular
Definition: Domain.C:1057
Definition: BoundPart.h:21
int PS(const char *name, Iterators iterator, int arg)
write mesh into a postscript file
Definition: Domain.C:842
void SetTreeInfo(TBaseCell **celltree, int N_rootcells)
set tree of cells
Definition: Domain.h:183
int * BeginMFace
begin of each mortar face on coll
Definition: Domain.h:104
int GenInitGrid()
generate initial grid using external mesh generator
Definition: Domain.C:342
TCollection * GetCollection(Iterators it, int level)
produce a collection with all cells returned by iterator it
Definition: Domain.C:1982
void SetStartBdCompID(int BdCompID, int i)
set start BdCompID on boundary part i
Definition: Domain.h:168
Definition: Domain.h:25
int AdaptRefineAll()
adaptive refine
Definition: AdaptiveRefine.C:112
information for finite element data structure
Definition: BaseCell.h:25
int N_BoundComps
number of all boundary components
Definition: Domain.h:47
int MakeGrid(double *DCORVG, int *KVERT, int *KNPR, int N_Vertices, int NVE)
make initial 2D grid
Definition: ReadGeo.C:656
double StartX
x coordinate of the start point (2D)
Definition: Domain.h:77
void GetBoundBox(double &startx, double &starty, double &startz, double &boundx, double &boundy, double &boundz)
get bounding box parameters
Definition: Domain.h:310
int MD_raw(const char *name, Iterators iterator, int arg)
write files for MD-Out format
Definition: Domain.C:961
TBoundPart ** BdParts
boundary parts of domain
Definition: Domain.h:44
int Draw(char *name, Iterators iterator, int arg)
write domain boundary into a postscript file
Definition: Database.h:1118
int N_BoundParts
number of boundary parts
Definition: Domain.h:41
void MakeBdParamsConsistent(TCollection *coll)
make boundary parameter consistent
Definition: Domain.C:2599
int GmshGen(char *GeoFile)
read Gmsh mesh
Definition: ReadGeo.C:1051
TMortarFace * GetMortarFace(int i)
return mortar face struct
Definition: Domain.h:202
int GenMortarStructs()
generate mortar structurs
Definition: Domain.C:132
double BoundZ
z length of the bounding box
Definition: Domain.h:91
double BoundX
x length of bounding box
Definition: Domain.h:81
int N_RootCells
number of all root cells of cell tree
Definition: Domain.h:71
int GetLocalBdCompID(int BdCompID)
get local number of boundary component
Definition: Domain.C:98