ParMooN
 All Classes Functions Variables Friends Pages
CircularChannel.h
1 // channel with circular cross section
2 
3 
4 
5 #include <InterfaceJoint3D.h>
6 #include <IsoInterfaceJoint3D.h>
7 #include <IsoBoundFace.h>
8 #include <MacroCell.h>
9 #include <BdSphere.h>
10 #include <tetgen.h>
11 
12 
13 void ExampleFile()
14 {
15  OutPut("Example: CircularChannel.h" << endl) ;
16 
17  #define __Cylinder__
18 }
19 
20 // ========================================================================
21 // exact solution
22 // ========================================================================
23 void ExactU1(double x, double y, double z, double *values)
24 {
25  values[0] = 0;
26  values[1] = 0;
27  values[2] = 0;
28  values[3] = 0;
29  values[4] = 0;
30 }
31 
32 void ExactU2(double x, double y, double z, double *values)
33 {
34  values[0] = 0;
35  values[1] = 0;
36  values[2] = 0;
37  values[3] = 0;
38  values[4] = 0;
39 }
40 
41 void ExactU3(double x, double y, double z, double *values)
42 {
43 
44  values[0] = 1-(x*x+y*y);
45  values[1] = -2*x;
46  values[2] = -2*y;
47  values[3] = 0;
48  values[4] = -4;
49 }
50 
51 void ExactP(double x, double y, double z, double *values)
52 {
53  static double eps = 1/TDatabase::ParamDB->RE_NR;
54 
55  values[0] = 4*eps*(10-z);
56  values[1] = 0;
57  values[2] = 0;
58  values[3] = -4*eps;
59  values[4] = 0;
60 }
61 
62 // kind of boundary condition (for FE space needed)
63 void BoundCondition(int CompID, double x, double y, double z, BoundCond &cond)
64 {
65  TDatabase::ParamDB->INTERNAL_PROJECT_PRESSURE = 0;
66  if (fabs(z-10)<1e-6)
67  {
68  cond = NEUMANN;
69  TDatabase::ParamDB->INTERNAL_PROJECT_PRESSURE = 0;
70  }
71  else
72  cond = DIRICHLET;
73 }
74 
75 
76 // value of boundary condition
77 void U2BoundValue(int CompID, double x, double y, double z, double &value)
78 {
79  value = 0;
80 }
81 
82 // value of boundary condition
83 void U1BoundValue(int CompID, double x, double y, double z, double &value)
84 {
85  value = 0;
86 }
87 
88 // value of boundary condition
89 void U3BoundValue(int CompID, double x, double y, double z, double &value)
90 {
91  double r2;
92  if (fabs(z)<1e-8)
93  {
94  r2 = x*x+y*y;
95  value = 1-r2;
96  }
97  else
98  {
99  value = 0;
100  }
101 }
102 
103 // ========================================================================
104 // coefficients for Stokes form: A, B1, B2, f1, f2
105 // ========================================================================
106 void LinCoeffs(int n_points, double *X, double *Y, double *Z,
107  double **parameters, double **coeffs)
108 {
109  static double eps = 1./TDatabase::ParamDB->RE_NR;
110  int i;
111  double *coeff, x, y, z;
112 
113  for(i=0;i<n_points;i++)
114  {
115  coeff = coeffs[i];
116 
117  coeff[0] = eps;
118  coeff[1] = 0;
119  coeff[2] = 0;
120  coeff[3] = 0;
121  }
122 }
123 
124 void ReadMeditMesh(char *SMESH, tetgenio &In)
125 {
126  int i, j, k, dimension, N_FVert, N_Faces, N_Vertices;
127  int BDComp_Min=10000000;
128 
129  char line[100];
130  tetgenio::facet *F;
131  tetgenio::polygon *P;
132 
133  std::ifstream dat(SMESH);
134 
135  if (!dat)
136  {
137  cerr << "cannot open '" << SMESH << "' for input" << endl;
138  exit(-1);
139  }
140 
141  // check the dimension
142  while (!dat.eof())
143  {
144  dat >> line;
145 
146  if ( (!strcmp(line, "Dimension")) || (!strcmp(line, "dimension")) || (!strcmp(line, "DIMENSION")))
147  {
148  dat.getline (line, 99);
149  dat >> dimension;
150  break;
151  }
152  // read until end of line
153  dat.getline (line, 99);
154  }
155 
156  if(dimension!=3)
157  {
158  cerr << "dimension: " << dimension << endl;
159  exit(-1);
160  }
161 
162  // find the N_Vertices
163  while (!dat.eof())
164  {
165  dat >> line;
166 
167  if ( (!strcmp(line, "Vertices")) || (!strcmp(line, "vertices")) || (!strcmp(line, "VERTICES")) )
168  {
169  dat.getline (line, 99);
170  dat >> N_Vertices;
171  break;
172  }
173  // read until end of line
174  dat.getline (line, 99);
175  }
176 
177  In.numberofpoints = N_Vertices;
178  In.pointlist = new double[3*N_Vertices];
179  In.pointmtrlist = new double[N_Vertices];
180  In.numberofpointmtrs = 1;
181 
182  //read from file
183  for(i=0;i<N_Vertices; i++)
184  {
185  dat.getline (line, 99);
186  dat >> In.pointlist[3*i] >> In.pointlist[3*i+1] >> In.pointlist[3*i+2];
187  In.pointmtrlist[i] = 10.;
188  //cout<< i << " vert X: " <<In.pointlist[3*i] << " vert Y: " <<In.pointlist[3*i+1] <<endl;
189  }
190 
191 // In.pointmtrlist[0] = 0.75;
192 
193  // find the N_Triangles
194  // find the N_Vertices
195  while (!dat.eof())
196  {
197  dat >> line;
198 
199  if ( (!strcmp(line, "Triangles")) || (!strcmp(line, "triangles")) || (!strcmp(line, "TRIANGLES")) )
200  {
201  N_FVert = 3;
202  dat.getline (line, 99);
203  dat >> N_Faces;
204  break;
205  }
206  else if ( (!strcmp(line, "Quadrilaterals")) || (!strcmp(line, "quadrilaterals")) || (!strcmp(line, "QUADRILATERALS")) )
207  {
208  N_FVert = 4;
209  dat.getline (line, 99);
210  dat >> N_Faces;
211  break;
212  }
213 
214  // read until end of line
215  dat.getline (line, 99);
216  }
217 
218  In.numberoffacets = N_Faces;
219  In.facetlist = new tetgenio::facet[In.numberoffacets];
220  In.facetmarkerlist = new int[In.numberoffacets];
221 
222  for(i=0;i<N_Faces; i++)
223  {
224  dat.getline (line, 99);
225 
226  F = &In.facetlist[i];
227  tetgenio::init(F);
228  F->numberofpolygons = 1;
229  F->polygonlist = new tetgenio::polygon[F->numberofpolygons];
230  F->numberofholes = 0;
231  F->holelist = NULL;
232  P = &F->polygonlist[0];
233  tetgenio::init(P);
234  P->numberofvertices = N_FVert;
235  P->vertexlist = new int[P->numberofvertices];
236 
237  for(j=0;j<N_FVert;j++)
238  {
239  dat >> k;
240  P->vertexlist[j] = k-1; // c numbering
241  }
242 
243  dat >> In.facetmarkerlist[i];
244 
245  if(BDComp_Min > In.facetmarkerlist[i])
246  BDComp_Min=In.facetmarkerlist[i];
247 
248  // cout << i<< " P->vertexlist[j]: " << In.facetmarkerlist[i] << endl;
249  } // for(i=0;i<N_Faces; i++)
250 
251  BDComp_Min--;
252 
253  for(i=0;i<N_Faces; i++)
254  In.facetmarkerlist[i] -= BDComp_Min;
255 
256 // cout << i<< " P->vertexlist[j]: " << BDComp_Min << endl;
257 
258 
259  dat.close();
260 // exit(0);
261 } // ReadMeditMesh
262 
263 
264 void TetrameshGen(TDomain *&Domain)
265 {
266  //======================================================================
267  // Tetgen for grid generation begin
268  //======================================================================
269  int i, j, k, l, N_Coord, *N_FVerts, N_Faces, *Facets;
270  int N, N_RootCells, N_Cells, CurrVertex, N_Vertices, ID, N_G, RefLevel=0;
271  int CurrNeib, len1, len2, len3, maxEpV = 0, a, b, c, Neib[2], Neighb_tmp, CurrComp;
272  int *Tetrahedrals, *PointNeighb, dimension;
273  int *Facelist, *Facemarkerlist;
274 
275  double X, Y, Z, DispX, DispY, DispZ;
276  double *Coordinates, N_x, N_y, N_z;
277  double *Vertices;
278  double Xmin = 1e10, Xmax = -1e10, Ymin = 1e10, Ymax = -1e10;
279  double Zmin = 1e10, Zmax = -1e10, T[4]={0,0,0,0}, S[4]={0,0,0,0};
280  double StartX, StartY, StartZ, BoundX, BoundY, BoundZ;
281 
282  tetgenio In, Out, Out_New;
283 
284  TBaseCell **CellTree;
285  TGridCell **DelCell;
286  TVertex **VertexDel, **NewVertices, **NewSurfVertices;
287  TBoundPart *BoundPart;
288  TBdPlane **UpdateFaceParams;
289  TJoint *Joint;
290  TBoundComp3D *bdcomp;
291  TCollection *coll, *SurfColl;
292  TBaseCell *cell;
293  TBdSphere *UpdateParam;
294 
295  char *SMESH, line[100];
296  SMESH = TDatabase::ParamDB->SMESHFILE;
297 
298 #ifdef _MPI
299  int rank, size;
300  MPI_Comm Comm = TDatabase::ParamDB->Comm;
301 
302  MPI_Comm_rank(Comm, &rank);
303  MPI_Comm_size(Comm, &size);
304 
305 #endif
306 
307 
308 
310 #ifdef _MPI
311  if(rank==0)
312 #endif
313  {
314 
315 // In.initialize();
316 // Out.initialize();
317 
318  std::ostringstream opts;
319  opts << " ";
320 
321  opts.seekp(std::ios::beg);
322  opts<<'p'; // Tetrahedralize the PLC. Switches are chosen to read a PLC (p)
323 // opts<<'r'; // -r Reconstructs a previously generated mesh
324  opts<<"q"<<1.5; // quality mesh generation(q) with a specified quality bound
325 // opts<<"a"<<0.1; // maximum volume constraint
326 // opts<<'i'; // Inserts a list of additional points into mesh.
327  opts<<'z'; // numbers all output items starting from zero
328 // opts<<'d'; // Detect intersections of PLC facets.
329  opts<<'f'; // Outputs all faces (including non-boundary)
330  opts<<'e'; // Outputs a list of edges of the triangulation
331 // opts<<'I'; // Suppresses mesh iteration numbers.
332  opts<<'C'; // Checks the consistency of the final mesh.
333 // opts<<'Q'; // Quiet: No terminal output except errors.
334 // opts<<'g'; // Outputs mesh to .mesh file for viewing by Medit
335 // opts<<'Y'; // Suppresses boundary facets/segments splitting
336 // opts<<'m'; //
337 
338 
339  opts<<'V'; //verbose mode
340  opts<<ends;
341 
342 // cout << " SMESHFILE is " << SMESH << endl;
344  ReadMeditMesh(SMESH, In);
345 
346 // for(i=0;i<In.numberofpoints;i++)
347 // OutPut(" (x, y, z) = "<< In.pointlist[3*i]<<' '<<In.pointlist[3*i+1]<<' '<<In.pointlist[3*i+2]<<endl);
348 // exit(0);
349  // Calling tetrahedralize function of 3dtetgen mesh generator
350  tetrahedralize((char*)opts.str().c_str(), &In, &Out);
351 
352  } // if(rank==0)
353 
354 // MPI_Finalize();
355 // exit(0);
356 //
357 
358  // output: coordinates of all vertices
359  for(i=0;i<Out.numberofpoints;i++)
360  OutPut(" (x, y, z) = "<< Out.pointlist[3*i]<<' '<<Out.pointlist[3*i+1]<<' '<<Out.pointlist[3*i+2]<<endl);
361 exit(0);
362 
363  Domain->GetTreeInfo(CellTree,N_RootCells);
364  coll = Domain->GetCollection(It_Finest, 0);
365  N_Cells = coll->GetN_Cells();
366 
367 // cout<<"N_RootCells: "<<N_RootCells<<endl;
368  // remove all existing vertices and joints
369  VertexDel = new TVertex*[8*N_RootCells];
370  CurrVertex = 0;
371 
372  for(i=0;i<N_Cells;i++)
373  {
374  cell = coll->GetCell(i);
375  N_Faces = cell->GetN_Faces();
376  N_Vertices = cell->GetN_Vertices();
377  for(j=0;j<N_Faces;j++)
378  {
379  if(CurrVertex==0)
380  {
381  VertexDel[CurrVertex++] = cell->GetVertex(j);
382  }
383  else
384  {
385  ID = 0;
386  for(k=0;k<CurrVertex;k++)
387  if(VertexDel[k]==cell->GetVertex(j))
388  {
389  ID = 1; break;
390  }
391  if(ID!=1)
392  {
393  VertexDel[CurrVertex++] = cell->GetVertex(j);
394  }
395  } // else if(CurrVertex==0)
396 
397  ID = 0;
398  for(k=0;k<CurrVertex;k++)
399  if(VertexDel[k]==cell->GetVertex((j+1)%N_Vertices))
400  {
401  ID = 1; break;
402  }
403  if(ID!=1)
404  {
405  VertexDel[CurrVertex++] = cell->GetVertex((j+1)%N_Vertices);
406  }
407 
408  ID = 0;
409  for(k=0;k<CurrVertex;k++)
410  if(VertexDel[k]==cell->GetVertex((j+2)%N_Vertices))
411  {
412  ID = 1; break;
413  }
414  if(ID!=1)
415  {
416  VertexDel[CurrVertex++] = cell->GetVertex((j+2)%N_Vertices);
417  }
418  if(N_Faces==6) // If old cell is hexahedrol
419  {
420  ID = 0;
421  for(k=0;k<CurrVertex;k++)
422  if(VertexDel[k]==cell->GetVertex((j+4)%N_Vertices))
423  {
424  ID = 1; break;
425  }
426  if(ID!=1)
427  {
428  VertexDel[CurrVertex++] = cell->GetVertex((j+4)%N_Vertices);
429  }
430  }
431  } // for j
432  } // for i
433 
434  for(i=0;i<CurrVertex;i++)
435  delete VertexDel[i];
436  delete [] VertexDel;
437  OutPut(CurrVertex<<" vertices were deleted"<<endl);
438 
439  // remove all existing cells and joints
440 
441  for(i=0;i<N_RootCells;i++)
442  delete (TGridCell*)CellTree[i];
443  delete [] CellTree;
444  OutPut(N_RootCells<<" cells were deleted"<<endl);
445 
446 
447 #ifdef _MPI
448  if(rank==0)
449 #endif
450  {
451  N_RootCells = Out.numberoftetrahedra;
452  N_G = Out.numberofpoints;
453 
454  // allocate auxillary fields
455  Coordinates = Out.pointlist;
456  Tetrahedrals = Out.tetrahedronlist;
457  }
458 
459 
460 
461 #ifdef _MPI
462  MPI_Bcast(&N_RootCells, 1, MPI_INT, 0, Comm);
463  MPI_Bcast(&N_G, 1, MPI_INT, 0, Comm);
464 
465 
466  if(rank!=0)
467  {
468  Coordinates = new double [3*N_G];
469  Tetrahedrals = new int[4*N_RootCells];
470  }
471 
472  MPI_Bcast(Coordinates, 3*N_G, MPI_DOUBLE, 0, Comm);
473  MPI_Bcast(Tetrahedrals, 4*N_RootCells, MPI_INT, 0, Comm);
474 #endif
475 
476  // generate new vertices
477  NewVertices = new TVertex*[N_G];
478 
479  for (i=0;i<N_G;i++)
480  {
481  NewVertices[i] = new TVertex( Coordinates[3*i], Coordinates[3*i+1], Coordinates[3*i+2]);
482 
483  // set bounding box
484  if (Coordinates[3*i] > Xmax) Xmax = Coordinates[3*i];
485  if (Coordinates[3*i] < Xmin) Xmin = Coordinates[3*i];
486  if (Coordinates[3*i+1] > Ymax) Ymax = Coordinates[3*i+1];
487  if (Coordinates[3*i+1] < Ymin) Ymin = Coordinates[3*i+1];
488  if (Coordinates[3*i+2] > Zmax) Zmax = Coordinates[3*i+2];
489  if (Coordinates[3*i+2] < Zmin) Zmin = Coordinates[3*i+2];
490  }
491 
492  // set bounding box
493  StartX = Xmin;
494  StartY = Ymin;
495  StartZ = Zmin;
496  BoundX = Xmax - Xmin;
497  BoundY = Ymax - Ymin;
498  BoundZ = Zmax - Zmin;
499 
500 
501  Domain->SetBoundBox(StartX, StartY, StartZ, BoundX, BoundY, BoundZ);
502 // cout<<Xmin <<" "<<Ymin <<" "<<Zmin<<endl;
503 // cout<<Xmax <<" "<<Ymax <<" "<<Zmax<<endl;
504 
505  CellTree = new TBaseCell*[N_RootCells];
506  // output of each tetraheron vertex indices (four vertices for each)
507 // for (i=0;i<N_RootCells;i++)
508 // cout<< Tetrahedrals[4*i]<<" "<<Tetrahedrals[4*i + 1]<<" "
509 // <<Tetrahedrals[4*i + 2]<<" "<<Tetrahedrals[4*i + 3]<<endl;
510 
511 
512  for (i=0;i<N_RootCells;i++)
513  {
514  CellTree[i] = new TMacroCell(TDatabase::RefDescDB[Tetrahedron],
515  RefLevel);
516 
517  CellTree[i]->SetVertex(0, NewVertices[Tetrahedrals[4*i ]]);
518  CellTree[i]->SetVertex(1, NewVertices[Tetrahedrals[4*i + 1]]);
519  CellTree[i]->SetVertex(2, NewVertices[Tetrahedrals[4*i + 2]]);
520  CellTree[i]->SetVertex(3, NewVertices[Tetrahedrals[4*i + 3]]);
521 
522  CellTree[i]->SetClipBoard(i);
523  ((TMacroCell *) CellTree[i])->SetSubGridID(0);
524 
525  //default all cells will be treated as skull
526  CellTree[i]->SetRegionID(1);
527  CellTree[i]->SetAsLayerCell(1);
528  }
529 
530  Domain->SetTreeInfo(CellTree, N_RootCells);
531 
532 
533  // initialize iterators
534  TDatabase::IteratorDB[It_EQ]->SetParam(Domain);
535  TDatabase::IteratorDB[It_LE]->SetParam(Domain);
536  TDatabase::IteratorDB[It_Finest]->SetParam(Domain);
537  TDatabase::IteratorDB[It_Between]->SetParam(Domain);
538  TDatabase::IteratorDB[It_OCAF]->SetParam(Domain);
539 
540 
541  // search neighbours
542  PointNeighb = new int[N_G];
543 #ifdef _MPI
544  if(rank==0)
545 #endif
546  cout<<"numberofpoints "<<N_G<<endl;
547  memset(PointNeighb, 0, N_G *SizeOfInt);
548 
549  for (i=0;i<4*N_RootCells;i++)
550  PointNeighb[Tetrahedrals[i]]++;
551 
552  for (i=0;i<N_G;i++)
553  if (PointNeighb[i] > maxEpV) maxEpV = PointNeighb[i];
554  delete [] PointNeighb;
555 
556 #ifdef _MPI
557  if(rank==0)
558 #endif
559  cout<<"maxEpV "<< maxEpV<<endl;
560 
561  PointNeighb = new int[++maxEpV * N_G];
562 
563  memset(PointNeighb, 0, maxEpV*N_G*SizeOfInt);
564 
565  // every vertex contains "maxEpV" columns
566  // for every vertex at first colomn contains the number of cells containing this vertex
567  // at further columns we set the index of corresponding cells containing this vertex
568  // cout<<"maxEpV*N_G "<<maxEpV*N_G<<endl;
569 
570  for(i=0;i<4*N_RootCells;i++)
571  {
572  j = Tetrahedrals[i]*maxEpV;
573  PointNeighb[j]++;
574  //cout<<"j + PointNeighb[j] " << j <<endl;
575  PointNeighb[j + PointNeighb[j]] = i / 4;
576  }
577  // output of PointNeighb columns for each point
578 // for (i=0;i<N_G;i++)
579 // {
580 // for (j=0;j<maxEpV;j++)
581 // cout<<" "<< PointNeighb[i*maxEpV+j];
582 // cout<<endl;
583 // }
584 
585 
586 
587  // generate new faces
588 
589 #ifdef _MPI
590  if(rank==0)
591 #endif
592  {
593  N_G = Out.numberoftrifaces;
594  Facelist = Out.trifacelist;
595  Facemarkerlist = Out.trifacemarkerlist;
596  }
597 
598 #ifdef _MPI
599  MPI_Bcast(&N_G, 1, MPI_INT, 0, Comm);
600 
601  if(rank!=0)
602  {
603  Facelist = new int [3*N_G];
604  Facemarkerlist = new int[N_G];
605  }
606 
607 
608  MPI_Bcast(Facelist, 3*N_G, MPI_INT, 0, Comm);
609  MPI_Bcast(Facemarkerlist, N_G, MPI_INT, 0, Comm);
610 
611  if(rank==0)
612 #endif
613  cout<<"numberoftrifaces "<<N_G<<endl;
614 
615  for (i=0;i<N_G;i++)
616  {
617  a = Facelist[3*i];
618  b = Facelist[3*i+1];
619  c = Facelist[3*i+2];
620 
621 // cout<<" "<< a<<" "<< b<<" "<< c<<endl;
622 
623  Neib[0] = -1;
624  Neib[1] = -1;
625  CurrNeib = 0;
626 
627  len1 = PointNeighb[a*maxEpV];
628  len2 = PointNeighb[b*maxEpV];
629  len3 = PointNeighb[c*maxEpV];
630 
631  // find the index of the cells containing current face with point indices a,b,c
632  for (j=1;j<=len1;j++)
633  {
634  Neighb_tmp = PointNeighb[a*maxEpV + j];
635  for (k=1;k<=len2;k++)
636  {
637  if (Neighb_tmp == PointNeighb[b*maxEpV + k])
638  {
639  for (l=1;l<=len3;l++)
640  if (Neighb_tmp == PointNeighb[c*maxEpV + l])
641  {
642  Neib[CurrNeib++] = Neighb_tmp;
643  break;
644  }
645  }
646  }
647  if (CurrNeib == 2) break;
648  }
649  // cout<<"CurrNeib " << CurrNeib <<endl;
650 // cout<<"Facemarkerlist[i] : "<<Facemarkerlist[i]<<endl;
651  if (Facemarkerlist[i]) // 0 for inner edges and Boundcomp+1 for Boundedge respect
652  {
653 
654  CurrComp = Facemarkerlist[i] - 1;
655 // cout<<"Boundary face CurrComp: "<<CurrComp<<endl;
656 // exit(0);
657  CurrComp = 0; // not yet implemented fully
658 
659 
660 
661  bdcomp = Domain->GetBdPart(0)->GetBdComp(CurrComp);
662 
663 
664  if(bdcomp->GetTSofXYZ(NewVertices[a]->GetX(), NewVertices[a]->GetY(),
665  NewVertices[a]->GetY(), T[1], S[1]) ||
666  bdcomp->GetTSofXYZ(NewVertices[b]->GetX(), NewVertices[b]->GetY(),
667  NewVertices[b]->GetY(), T[2], S[2]) ||
668  bdcomp->GetTSofXYZ(NewVertices[c]->GetX(), NewVertices[c]->GetY(),
669  NewVertices[c]->GetY(), T[3], S[3]) )
670  {
671  cerr<<"Error: could not set parameter values"<<endl;
672  OutPut(NewVertices[a]<<endl);
673  OutPut(NewVertices[b]<<endl);
674  OutPut(NewVertices[c]<<endl);
675  exit(0);
676  }
677 
678  if (CurrNeib == 2)
679  {
680  if(bdcomp->IsFreeBoundary())
681  Joint = new TIsoInterfaceJoint3D(bdcomp, T, S,
682  CellTree[Neib[0]], CellTree[Neib[1]] );
683  else
684  Joint = new TInterfaceJoint3D(bdcomp, T, S,
685  CellTree[Neib[0]], CellTree[Neib[1]] );
686  }
687  else
688  {
689  if(bdcomp->IsFreeBoundary())
690  Joint = new TIsoBoundFace(bdcomp, T, S);
691  else
692  Joint = new TBoundFace(bdcomp, T, S);
693  }
694  }
695  else
696  {
697 // // cout<<"Inner face"<<endl;
698  if (CurrNeib != 2)
699  cerr << "Error !!!!!!!! not enough neighbours!" << endl;
700 
701  Joint = new TJointEqN(CellTree[Neib[0]], CellTree[Neib[1]]);
702 
703  }
704 
705  // First element containing the current face
706  // find the local index for the point 'a' on the cell
707  for (j=0;j<4;j++)
708  if (Tetrahedrals[4*Neib[0]+j] == a) break;
709 
710  // find the local index for the point 'b' on the cell
711  for (k=0;k<4;k++)
712  if (Tetrahedrals[4*Neib[0]+k] == b) break;
713 
714  // find the local index for the point 'c' on the cell
715  for (l=0;l<4;l++)
716  if (Tetrahedrals[4*Neib[0]+l] == c) break;
717 
718  l = l*100 + k*10 + j;
719 
720 // cout<<""<< l <<endl;
721 
722  switch (l) // j will contain the local index for the current face
723  {
724  case 210: case 21: case 102:
725  case 120: case 12: case 201:
726  j = 0;
727  break;
728  case 310: case 31: case 103:
729  case 130: case 13: case 301:
730  j = 1;
731  break;
732  case 321: case 132: case 213:
733  case 231: case 123: case 312:
734  j = 2;
735  break;
736  case 230: case 23: case 302:
737  case 320: case 32: case 203:
738  j = 3;
739  break;
740 
741  default:
742  Error("Unable to set the face !!!!!!!!!!!!" << endl);
743  exit(0);
744  }
745  CellTree[Neib[0]]->SetJoint(j, Joint);
746 
747  if (Neib[1] != -1) // second element containing the current face
748  {
749  // find the local index for the point 'a' on the cell
750  for (j=0;j<4;j++)
751  if (Tetrahedrals[4*Neib[1]+j] == a) break;
752 
753  // find the local index for the point 'b' on the cell
754  for (k=0;k<4;k++)
755  if (Tetrahedrals[4*Neib[1]+k] == b) break;
756 
757  // find the local index for the point 'c' on the cell
758  for (l=0;l<4;l++)
759  if (Tetrahedrals[4*Neib[1]+l] == c) break;
760 
761  l = l*100 + k*10 + j;
762 
763 // cout<<""<< l <<endl;
764 
765  switch (l) // j will contain the local index for the current face
766  {
767  case 210: case 21: case 102:
768  case 120: case 12: case 201:
769  j = 0;
770  break;
771  case 310: case 31: case 103:
772  case 130: case 13: case 301:
773  j = 1;
774  break;
775  case 321: case 132: case 213:
776  case 231: case 123: case 312:
777  j = 2;
778  break;
779  case 230: case 23: case 302:
780  case 320: case 32: case 203:
781  j = 3;
782  break;
783 
784  default:
785  Error("Unable to set the face !!!!!!!!!!!!" << endl);
786  exit(0);
787  }
788  CellTree[Neib[1]]->SetJoint(j, Joint);
789  }
790 
791  if (Joint->GetType() == InterfaceJoint3D ||
792  Joint->GetType() == IsoInterfaceJoint3D)
793  {
794  ((TInterfaceJoint3D*)Joint)->SetMapType();
795  ((TInterfaceJoint3D*)(Joint))->CheckOrientation();
796  }
797  else
798  if (Joint->GetType() == JointEqN)
799  Joint->SetMapType();
800 
801  }
802 
803 #ifdef _MPI
804  if(rank==0)
805 #endif
806  {
807 // In.deinitialize();
808 // Out.deinitialize();
809  }
810 
811 
812 
813 
814 #ifdef _MPI
815  if(rank!=0)
816  {
817  delete [] Tetrahedrals ;
818  delete [] Coordinates;
819  delete [] Facelist;
820  delete [] Facemarkerlist;
821  }
822 #endif
823 
824  delete [] PointNeighb;
825 
826 // #ifdef _MPI
827 // if(rank==3)
828 // printf(" TetrameshGen %d \n", N_G );
829 // MPI_Finalize();
830 // #endif
831 // exit(0);
832 //
833 
834 }
835 
836 
837 
void SetMapType()
Definition: Joint.C:107
Definition: BdPlane.h:18
void GetTreeInfo(TBaseCell **&celltree, int &N_rootcells)
get tree of cells
Definition: Domain.h:176
virtual int GetTSofXYZ(double X, double Y, double Z, double &T, double &S)=0
JointType GetType()
Definition: Joint.h:75
TBaseCell * GetCell(int i) const
return Cell with index i in Cells-array
Definition: Collection.h:50
int GetN_Faces()
return the number of faces of the cell
Definition: BaseCell.h:190
TBoundComp2D * GetBdComp(int i)
Definition: BoundPart.h:49
int SetJoint(int J_i, TJoint *J)
set the pointer to face J_i to J
Definition: BaseCell.h:168
contains the boundary description, the virtual cell tree and macro grid
Definition: Domain.h:36
void SetClipBoard(int value)
set value in ClipBoard
Definition: BaseCell.h:263
double RE_NR
Definition: Database.h:313
int SetParam(TDomain *domain)
Definition: Iterator.C:17
static TIterator ** IteratorDB
Definition: Database.h:1131
Definition: IsoBoundFace.h:18
store cells in an array, used by cell iterators
Definition: Collection.h:18
virtual TVertex * GetVertex(int Vert_i)=0
return the pointer to vertex with number i
represent a unit of the macro grid
Definition: MacroCell.h:15
Definition: JointEqN.h:20
int GetN_Cells() const
return number of cells
Definition: Collection.h:46
MPI_Comm Comm
Definition: Database.h:978
Definition: Joint.h:48
TBoundPart * GetBdPart(int i)
get i-th boundary part
Definition: Domain.h:172
Definition: BoundComp3D.h:17
double GetY() const
Definition: Vertex.h:99
int GetN_Vertices()
return the number of vertices of the cell
Definition: BaseCell.h:179
Definition: BoundPart.h:21
void SetTreeInfo(TBaseCell **celltree, int N_rootcells)
set tree of cells
Definition: Domain.h:183
bool IsFreeBoundary() const
Definition: BoundComp.h:57
TCollection * GetCollection(Iterators it, int level)
produce a collection with all cells returned by iterator it
Definition: Domain.C:1982
Definition: IsoInterfaceJoint3D.h:19
information for finite element data structure
Definition: BaseCell.h:25
Definition: Vertex.h:19
static TRefDesc ** RefDescDB
Definition: Database.h:1125
void SetRegionID(int val)
set region number to this cell
Definition: BaseCell.h:347
Definition: BoundFace.h:18
double GetX() const
Definition: Vertex.h:96
virtual int SetVertex(int Vert_i, TVertex *Vert)=0
set the pointer of vertex Vert_i to Vert
represent geometric information of the cell
Definition: GridCell.h:15
void SetAsLayerCell(int val)
set as LayerCell cell
Definition: BaseCell.h:355
Definition: BdSphere.h:18
static TParamDB * ParamDB
Definition: Database.h:1134
Definition: InterfaceJoint3D.h:18