11 OutPut(
"Example: Aerofoil_expt.h" << endl);
14 void GridBoundCondition(
double x,
double y,
double z, BoundCond &cond)
19 void Exact(
double x,
double y,
double z,
double *values)
29 void InitialCondition(
double x,
double y,
double z,
double *values)
35 void BoundCondition(
double x,
double y,
double z, BoundCond &cond)
42 void BoundValue(
double x,
double y,
double z,
double &value)
47 void BilinearCoeffs(
int n_points,
double *X,
double *Y,
double *Z,
double **parameters,
double **coeffs)
51 double *coeff, *param;
53 for(i=0;i<n_points;i++)
56 param = parameters[i];
67 void ReadAdditionalNodes(
char *NODE, tetgenio &InAddPts)
69 int i, N_Vertices, index, N_Atribude, BDMarker;
71 std::ifstream dat(NODE);
75 cerr <<
"cannot open '" << NODE <<
"' for input" << endl;
79 dat.getline (line, 99);
80 dat >> N_Vertices >> N_Atribude >> BDMarker;
81 dat.getline (line, 99);
83 InAddPts.numberofpoints = N_Vertices;
84 InAddPts.pointlist =
new double[3*N_Vertices];
87 for(i=0;i<N_Vertices; i++)
89 dat.getline (line, 99);
90 dat >> index >> InAddPts.pointlist[3*i] >> InAddPts.pointlist[3*i+1] >> InAddPts.pointlist[3*i+2];
91 cout<< i <<
" vert X: " <<InAddPts.pointlist[3*i] <<
" vert Y: " <<InAddPts.pointlist[3*i+1] <<
" vert Z: " <<InAddPts.pointlist[3*i+2] <<endl;
105 void ReadMeditMeshWithCells(
char *SMESH, tetgenio &In)
107 int i, j, k, dimension, N_FVert, N_Faces, N_Vertices, N_CVert, N_Cells;
108 int BDComp_Min=10000000;
112 cout <<
"test " <<endl;
116 tetgenio::polygon *P;
118 std::ifstream dat(SMESH);
122 cerr <<
"cannot open '" << SMESH <<
"' for input" << endl;
131 if ( (!strcmp(line,
"Dimension")) || (!strcmp(line,
"dimension")) || (!strcmp(line,
"DIMENSION")))
133 dat.getline (line, 99);
138 dat.getline (line, 99);
143 cerr <<
"dimension: " << dimension << endl;
152 if ( (!strcmp(line,
"Vertices")) || (!strcmp(line,
"vertices")) || (!strcmp(line,
"VERTICES")) )
154 dat.getline (line, 99);
159 dat.getline (line, 99);
162 In.numberofpoints = N_Vertices;
163 In.pointlist =
new double[3*N_Vertices];
166 for(i=0;i<N_Vertices; i++)
168 dat.getline (line, 99);
169 dat >> x >> In.pointlist[3*i+1] >> In.pointlist[3*i+2];
171 In.pointlist[3*i] = x - 3.606596999999999830777142;
184 if ( (!strcmp(line,
"Triangles")) || (!strcmp(line,
"triangles")) || (!strcmp(line,
"TRIANGLES")) )
187 dat.getline (line, 99);
191 else if ( (!strcmp(line,
"Quadrilaterals")) || (!strcmp(line,
"quadrilaterals")) || (!strcmp(line,
"QUADRILATERALS")) )
194 dat.getline (line, 99);
200 dat.getline (line, 99);
203 In.numberoffacets = N_Faces;
204 In.facetlist =
new tetgenio::facet[In.numberoffacets];
205 In.facetmarkerlist =
new int[In.numberoffacets];
207 for(i=0;i<N_Faces; i++)
209 dat.getline (line, 99);
211 F = &In.facetlist[i];
213 F->numberofpolygons = 1;
214 F->polygonlist =
new tetgenio::polygon[F->numberofpolygons];
215 F->numberofholes = 0;
218 P = &F->polygonlist[0];
220 P->numberofvertices = N_FVert;
221 P->vertexlist =
new int[P->numberofvertices];
223 for(j=0;j<N_FVert;j++)
226 P->vertexlist[j] = k-1;
229 dat >> In.facetmarkerlist[i];
231 if(BDComp_Min > In.facetmarkerlist[i])
232 BDComp_Min=In.facetmarkerlist[i];
239 for(i=0;i<N_Faces; i++)
240 In.facetmarkerlist[i] -= BDComp_Min;
248 if ( (!strcmp(line,
"Tetrahedron")) || (!strcmp(line,
"tetrahedron")) || (!strcmp(line,
"TETRAHEDRON")) )
251 dat.getline (line, 99);
256 dat.getline (line, 99);
259 In.numberoftetrahedra = N_Cells;
260 In.numberofcorners = N_CVert;
261 In.numberoftetrahedronattributes = 1;
262 In.tetrahedronlist =
new int[N_Cells * 4];
263 In.tetrahedronattributelist =
new REAL[N_Cells];
264 In.tetrahedronvolumelist =
new REAL[N_Cells];
266 for(i=0; i<N_Cells; i++)
268 dat.getline (line, 99);
269 plist = &(In.tetrahedronlist[i * 4]);
271 for(j=0;j<N_CVert;j++)
278 dat >> In.tetrahedronattributelist[i];
292 void ReadMeditMesh(
char *SMESH, tetgenio &In)
294 int i, j, k, dimension, N_FVert, N_Faces, N_Vertices;
295 int BDComp_Min=10000000;
300 tetgenio::polygon *P;
302 std::ifstream dat(SMESH);
306 cerr <<
"cannot open '" << SMESH <<
"' for input" << endl;
315 if ( (!strcmp(line,
"Dimension")) || (!strcmp(line,
"dimension")) || (!strcmp(line,
"DIMENSION")))
317 dat.getline (line, 99);
322 dat.getline (line, 99);
327 cerr <<
"dimension: " << dimension << endl;
336 if ( (!strcmp(line,
"Vertices")) || (!strcmp(line,
"vertices")) || (!strcmp(line,
"VERTICES")) )
338 dat.getline (line, 99);
343 dat.getline (line, 99);
346 In.numberofpoints = N_Vertices;
347 In.pointlist =
new double[3*N_Vertices];
348 In.pointmtrlist =
new double[N_Vertices];
349 In.numberofpointmtrs = 1;
363 for(i=0;i<N_Vertices; i++)
365 dat.getline (line, 99);
366 dat >> In.pointlist[3*i] >> In.pointlist[3*i+1] >> In.pointlist[3*i+2];
372 In.pointmtrlist[i] = 10.;
384 if ( (!strcmp(line,
"Triangles")) || (!strcmp(line,
"triangles")) || (!strcmp(line,
"TRIANGLES")) )
387 dat.getline (line, 99);
391 else if ( (!strcmp(line,
"Quadrilaterals")) || (!strcmp(line,
"quadrilaterals")) || (!strcmp(line,
"QUADRILATERALS")) )
394 dat.getline (line, 99);
400 dat.getline (line, 99);
403 In.numberoffacets = N_Faces;
404 In.facetlist =
new tetgenio::facet[In.numberoffacets];
405 In.facetmarkerlist =
new int[In.numberoffacets];
407 for(i=0;i<N_Faces; i++)
409 dat.getline (line, 99);
411 F = &In.facetlist[i];
413 F->numberofpolygons = 1;
414 F->polygonlist =
new tetgenio::polygon[F->numberofpolygons];
415 F->numberofholes = 0;
417 P = &F->polygonlist[0];
419 P->numberofvertices = N_FVert;
420 P->vertexlist =
new int[P->numberofvertices];
422 for(j=0;j<N_FVert;j++)
425 P->vertexlist[j] = k-1;
428 dat >> In.facetmarkerlist[i];
430 if(BDComp_Min > In.facetmarkerlist[i])
431 BDComp_Min=In.facetmarkerlist[i];
447 for(i=0;i<N_Faces; i++)
448 In.facetmarkerlist[i] -= BDComp_Min;
459 void ReadMeditMesh_Adapt(
char *SMESH, tetgenio &In)
461 int i, j, k, m, dimension, N_FVert, N_Faces, N_Vertices;
462 int BDComp_Min=10000000, N_AddVert, count, VertList[4], Fcount;
467 tetgenio::polygon *P;
469 std::ifstream dat(SMESH);
473 cerr <<
"cannot open '" << SMESH <<
"' for input" << endl;
482 if ( (!strcmp(line,
"Dimension")) || (!strcmp(line,
"dimension")) || (!strcmp(line,
"DIMENSION")))
484 dat.getline (line, 99);
489 dat.getline (line, 99);
494 cerr <<
"dimension: " << dimension << endl;
503 if ( (!strcmp(line,
"Vertices")) || (!strcmp(line,
"vertices")) || (!strcmp(line,
"VERTICES")) )
505 dat.getline (line, 99);
510 dat.getline (line, 99);
514 In.numberofpoints = N_Vertices + N_AddVert;
515 In.pointlist =
new double[3*In.numberofpoints];
520 for(i=0;i<N_Vertices; i++)
522 dat.getline (line, 99);
523 dat >> In.pointlist[3*i] >> In.pointlist[3*i+1] >> In.pointlist[3*i+2];
537 if ( (!strcmp(line,
"Triangles")) || (!strcmp(line,
"triangles")) || (!strcmp(line,
"TRIANGLES")) )
540 dat.getline (line, 99);
544 else if ( (!strcmp(line,
"Quadrilaterals")) || (!strcmp(line,
"quadrilaterals")) || (!strcmp(line,
"QUADRILATERALS")) )
547 dat.getline (line, 99);
553 dat.getline (line, 99);
556 cout <<
"N_Faces " << N_Faces << endl;
557 In.numberoffacets = N_Faces + 2;
558 In.facetlist =
new tetgenio::facet[In.numberoffacets];
559 In.facetmarkerlist =
new int[In.numberoffacets];
563 for(i=0;i<N_Faces; i++)
565 dat.getline (line, 99);
567 F = &In.facetlist[i];
569 F->numberofpolygons = 1;
570 F->polygonlist =
new tetgenio::polygon[F->numberofpolygons];
571 F->numberofholes = 0;
573 P = &F->polygonlist[0];
577 if( (i==1479 || i==1517 || i==1518 || i==1695 || i==1702 || i==1740 ) && N_AddVert>0)
584 for(j=0;j<N_FVert;j++)
589 X_ += In.pointlist[3*m];
590 Y_ += In.pointlist[3*m + 1];
591 Z_ += In.pointlist[3*m + 2];
595 dat >> In.facetmarkerlist[i];
597 X_ /=(double)N_FVert;
598 Y_ /=(double)N_FVert;
599 Z_ /=(double)N_FVert;
603 m = N_Vertices + count;
604 In.pointlist[3*m] = X_;
605 In.pointlist[3*m+1] = Y_;
606 In.pointlist[3*m+2] = Z_;
611 P->numberofvertices = N_FVert;
612 P->vertexlist =
new int[P->numberofvertices];
614 if(i==1479 || i==1517)
616 P->vertexlist[0] = VertList[0];
617 P->vertexlist[1] = m;
618 P->vertexlist[2] = VertList[2];
622 P->vertexlist[0] = VertList[2];
623 P->vertexlist[1] = m;
624 P->vertexlist[2] = VertList[1];
628 P->vertexlist[0] = VertList[0];
629 P->vertexlist[1] = VertList[1];
630 P->vertexlist[2] = m;
633 cout<< m <<
" vert 1: " << P->vertexlist[0] <<
" vert 2: " <<P->vertexlist[1] <<
" vert 3: " <<P->vertexlist[2]<<endl;
671 P->numberofvertices = N_FVert;
672 P->vertexlist =
new int[P->numberofvertices];
674 for(j=0;j<N_FVert;j++)
677 P->vertexlist[j] = k-1;
680 dat >> In.facetmarkerlist[i];
686 if(BDComp_Min > In.facetmarkerlist[i])
687 BDComp_Min=In.facetmarkerlist[i];
696 F = &In.facetlist[N_Faces+Fcount];
698 F->numberofpolygons = 1;
699 F->polygonlist =
new tetgenio::polygon[F->numberofpolygons];
700 F->numberofholes = 0;
702 P = &F->polygonlist[0];
704 P->numberofvertices = 8;
705 P->vertexlist =
new int[P->numberofvertices];
706 P->vertexlist[0] = 729;
707 P->vertexlist[1] = N_Vertices;
708 P->vertexlist[2] = 728;
709 P->vertexlist[3] = N_Vertices + 1;
710 P->vertexlist[4] = 409;
711 P->vertexlist[5] = N_Vertices + 2;
712 P->vertexlist[6] = 727;
713 P->vertexlist[7] = N_Vertices + 4;
715 In.facetmarkerlist[N_Faces+Fcount] = In.facetmarkerlist[i-1];
718 F = &In.facetlist[N_Faces+Fcount];
720 F->numberofpolygons = 1;
721 F->polygonlist =
new tetgenio::polygon[F->numberofpolygons];
722 F->numberofholes = 0;
724 P = &F->polygonlist[0];
726 P->numberofvertices = 8;
727 P->vertexlist =
new int[P->numberofvertices];
728 P->vertexlist[0] = 727;
729 P->vertexlist[1] = N_Vertices + 4;
730 P->vertexlist[2] = 410;
731 P->vertexlist[3] = N_Vertices + 3;
732 P->vertexlist[4] = 724;
733 P->vertexlist[5] = N_Vertices + 5;
734 P->vertexlist[6] = 723;
735 P->vertexlist[7] = N_Vertices + 2;
739 cout<< m <<
" vert: " << P->vertexlist[0] <<
" vert: " <<P->vertexlist[1] <<
" vert: " <<P->vertexlist[2]<<
" vert: " << P->vertexlist[3] <<
" vert: " << P->vertexlist[4]<<endl;
742 In.facetmarkerlist[N_Faces+Fcount] = In.facetmarkerlist[i-1];
746 F = &In.facetlist[N_Faces+Fcount];
748 F->numberofpolygons = 1;
749 F->polygonlist =
new tetgenio::polygon[F->numberofpolygons];
750 F->numberofholes = 0;
752 P = &F->polygonlist[0];
754 P->numberofvertices = 4;
755 P->vertexlist =
new int[P->numberofvertices];
756 P->vertexlist[0] = N_Vertices + 3;
757 P->vertexlist[1] = N_Vertices + 5;
758 P->vertexlist[2] = N_Vertices + 2;
759 P->vertexlist[3] = 727;
762 cout<< m <<
" vert: " << P->vertexlist[0] <<
" vert: " <<P->vertexlist[1] <<
" vert: " <<P->vertexlist[2]<<
" vert: " << P->vertexlist[3] <<
" vert: " << P->vertexlist[4]<<endl;
765 In.facetmarkerlist[N_Faces+Fcount] = In.facetmarkerlist[i-1];
770 for(i=0;i<N_Faces + Fcount; i++)
771 In.facetmarkerlist[i] -= BDComp_Min;
780 void DeleteDomain(
TDomain *&Domain)
782 int i, j, k, N_Cells, N_RootCells;
783 int CurrVertex, N_Faces, N_Vertices, ID;
785 TBaseCell **CellTree, **SurfCellTree, *cell;
798 VertexDel =
new TVertex*[8*N_RootCells];
801 for(i=0;i<N_Cells;i++)
806 for(j=0;j<N_Faces;j++)
810 VertexDel[CurrVertex++] = cell->
GetVertex(j);
815 for(k=0;k<CurrVertex;k++)
822 VertexDel[CurrVertex++] = cell->
GetVertex(j);
827 for(k=0;k<CurrVertex;k++)
828 if(VertexDel[k]==cell->
GetVertex((j+1)%N_Vertices))
834 VertexDel[CurrVertex++] = cell->
GetVertex((j+1)%N_Vertices);
838 for(k=0;k<CurrVertex;k++)
839 if(VertexDel[k]==cell->
GetVertex((j+2)%N_Vertices))
845 VertexDel[CurrVertex++] = cell->
GetVertex((j+2)%N_Vertices);
850 for(k=0;k<CurrVertex;k++)
851 if(VertexDel[k]==cell->
GetVertex((j+4)%N_Vertices))
857 VertexDel[CurrVertex++] = cell->
GetVertex((j+4)%N_Vertices);
863 for(i=0;i<CurrVertex;i++)
866 OutPut(CurrVertex<<
" vertices were deleted"<<endl);
870 for(i=0;i<N_RootCells;i++)
873 OutPut(N_RootCells<<
" cells were deleted"<<endl);
883 void TetrameshCreate(
TDomain *&Domain)
885 int i, j, k, l, dimension, N_Vertices;
886 int N_FVert, N_Faces, *Facemarkerlist, *Facelist, N_RootCells;
887 int v1, v2, v3, v4, CellMarker, RefLevel=0, *Tetrahedrals, *PointNeighb, maxEpV, *Tetrahedrals_loc;
888 int a, b, c, Neib[2], Neighb_tmp, CurrNeib, len1, len2, len3, CurrComp, N_Points ;
889 int N_Cells, MaxLen, jj;
890 const int *EdgeVertex, *TmpFV, *TmpLen;
892 double X, Y, Z, DispX, DispY, DispZ;
893 double Xmin = 1e10, Xmax = -1e10, Ymin = 1e10, Ymax = -1e10;
894 double Zmin = 1e10, Zmax = -1e10, T[4]={0,0,0,0}, S[4]={0,0,0,0};
895 double StartX, StartY, StartZ, BoundX, BoundY, BoundZ;
897 char *MESH, line[100];
911 MPI_Comm_rank(Comm, &rank);
912 MPI_Comm_size(Comm, &size);
917 DeleteDomain(Domain);
922 std::ifstream dat(MESH);
926 cerr <<
"cannot open '" << MESH <<
"' for input" << endl;
936 if ( (!strcmp(line,
"Dimension")) || (!strcmp(line,
"dimension")) || (!strcmp(line,
"DIMENSION")))
938 dat.getline (line, 99);
943 dat.getline (line, 99);
948 cerr <<
"dimension: " << dimension << endl;
957 if ( (!strcmp(line,
"Vertices")) || (!strcmp(line,
"vertices")) || (!strcmp(line,
"VERTICES")) )
959 dat.getline (line, 99);
964 dat.getline (line, 99);
968 NewVertices =
new TVertex*[N_Vertices];
971 for(i=0;i<N_Vertices; i++)
973 dat.getline (line, 99);
979 DispX = 3.606596999999999830777142;
988 DispY = 12.29866318748098663604651;
996 DispY = 214.3263880000000028758222;
1003 DispX = 177.8944370000000105846993;
1010 NewVertices[i] =
new TVertex( (X - DispX), (Y - DispY), (Z- DispZ));
1024 if (X > Xmax) Xmax = X;
1025 if (X < Xmin) Xmin = X;
1026 if (Y > Ymax) Ymax = Y;
1027 if (Y < Ymin) Ymin = Y;
1028 if (Z > Zmax) Zmax = Z;
1029 if (Z < Zmin) Zmin = Z;
1038 BoundX = Xmax - Xmin;
1039 BoundY = Ymax - Ymin;
1040 BoundZ = Zmax - Zmin;
1043 Domain->SetBoundBox(StartX, StartY, StartZ, BoundX, BoundY, BoundZ);
1057 if ( (!strcmp(line,
"Triangles")) || (!strcmp(line,
"triangles")) || (!strcmp(line,
"TRIANGLES")) )
1060 dat.getline (line, 99);
1064 else if ( (!strcmp(line,
"Quadrilaterals")) || (!strcmp(line,
"quadrilaterals")) || (!strcmp(line,
"QUADRILATERALS")) )
1067 dat.getline (line, 99);
1073 dat.getline (line, 99);
1079 cerr <<
"Only Tria surfaces implemented N_FVert: " << N_FVert << endl;
1083 Facelist =
new int[N_FVert*N_Faces];
1084 Facemarkerlist =
new int[N_Faces];
1086 for(i=0;i<N_Faces; i++)
1088 dat.getline (line, 99);
1090 for(j=0;j<N_FVert;j++)
1093 Facelist[i*N_FVert + j] = k-1;
1096 dat >> Facemarkerlist[i];
1113 if ( (!strcmp(line,
"Tetrahedron")) || (!strcmp(line,
"tetrahedron")) || (!strcmp(line,
"TETRAHEDRON")) )
1115 dat.getline (line, 99);
1120 dat.getline (line, 99);
1125 Tetrahedrals =
new int[4*N_RootCells];
1127 for (i=0;i<N_RootCells;i++)
1129 dat.getline (line, 99);
1130 dat >> v1 >> v2 >> v3 >> v4 >> CellMarker;
1131 Tetrahedrals[4*i ] = v1 -1;
1132 Tetrahedrals[4*i + 1] = v2 -1;
1133 Tetrahedrals[4*i + 2] = v3 -1;
1134 Tetrahedrals[4*i + 3] = v4 -1;
1141 CellTree[i]->
SetVertex(0, NewVertices[Tetrahedrals[4*i ]]);
1142 CellTree[i]->
SetVertex(1, NewVertices[Tetrahedrals[4*i + 1]]);
1143 CellTree[i]->
SetVertex(2, NewVertices[Tetrahedrals[4*i + 2]]);
1144 CellTree[i]->
SetVertex(3, NewVertices[Tetrahedrals[4*i + 3]]);
1147 ((
TMacroCell *) CellTree[i])->SetSubGridID(0);
1163 PointNeighb =
new int[N_Vertices];
1167 cout<<
"Numberofpoints "<<N_Vertices<<endl;
1168 memset(PointNeighb, 0, N_Vertices*SizeOfInt);
1170 for (i=0;i<4*N_RootCells;i++)
1171 PointNeighb[Tetrahedrals[i]]++;
1174 for (i=0;i<N_Vertices;i++)
1175 if (PointNeighb[i] > maxEpV) maxEpV = PointNeighb[i];
1176 delete [] PointNeighb;
1181 cout<<
"maxEpV "<< maxEpV<<endl;
1183 PointNeighb =
new int[++maxEpV * N_Vertices];
1185 memset(PointNeighb, 0, maxEpV*N_Vertices*SizeOfInt);
1191 for(i=0;i<4*N_RootCells;i++)
1193 j = Tetrahedrals[i]*maxEpV;
1196 PointNeighb[j + PointNeighb[j]] = i / 4;
1204 cout<<
"Surface faces "<<N_Faces<<endl;
1206 for (i=0;i<N_Faces;i++)
1209 b = Facelist[3*i+1];
1210 c = Facelist[3*i+2];
1218 len1 = PointNeighb[a*maxEpV];
1219 len2 = PointNeighb[b*maxEpV];
1220 len3 = PointNeighb[c*maxEpV];
1223 for (j=1;j<=len1;j++)
1225 Neighb_tmp = PointNeighb[a*maxEpV + j];
1226 for (k=1;k<=len2;k++)
1228 if (Neighb_tmp == PointNeighb[b*maxEpV + k])
1230 for (l=1;l<=len3;l++)
1231 if (Neighb_tmp == PointNeighb[c*maxEpV + l])
1233 Neib[CurrNeib++] = Neighb_tmp;
1238 if (CurrNeib == 2)
break;
1250 CurrComp = Facemarkerlist[i] - 1;
1256 cout<<
"Not a scalp and skull layer: "<<CurrComp<<endl;
1262 NewVertices[a]->
GetY(), T[1], S[1]) ||
1264 NewVertices[b]->
GetY(), T[2], S[2]) ||
1266 NewVertices[c]->
GetY(), T[3], S[3]) )
1268 cerr<<
"Error: could not set parameter values"<<endl;
1269 OutPut(NewVertices[a]<<endl);
1270 OutPut(NewVertices[b]<<endl);
1271 OutPut(NewVertices[c]<<endl);
1296 cerr <<
"Error !!!!!!!! not enough or more neighbours!" << endl;
1298 Joint =
new TJointEqN(CellTree[Neib[0]], CellTree[Neib[1]]);
1305 if (Tetrahedrals[4*Neib[0]+j] == a)
break;
1309 if (Tetrahedrals[4*Neib[0]+k] == b)
break;
1313 if (Tetrahedrals[4*Neib[0]+l] == c)
break;
1315 l = l*100 + k*10 + j;
1321 case 210:
case 21:
case 102:
1322 case 120:
case 12:
case 201:
1325 case 310:
case 31:
case 103:
1326 case 130:
case 13:
case 301:
1329 case 321:
case 132:
case 213:
1330 case 231:
case 123:
case 312:
1333 case 230:
case 23:
case 302:
1334 case 320:
case 32:
case 203:
1339 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
1343 CellTree[Neib[0]]->
SetJoint(j, Joint);
1349 if (Tetrahedrals[4*Neib[1]+j] == a)
break;
1353 if (Tetrahedrals[4*Neib[1]+k] == b)
break;
1357 if (Tetrahedrals[4*Neib[1]+l] == c)
break;
1359 l = l*100 + k*10 + j;
1365 case 210:
case 21:
case 102:
1366 case 120:
case 12:
case 201:
1369 case 310:
case 31:
case 103:
1370 case 130:
case 13:
case 301:
1373 case 321:
case 132:
case 213:
1374 case 231:
case 123:
case 312:
1377 case 230:
case 23:
case 302:
1378 case 320:
case 32:
case 203:
1383 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
1386 CellTree[Neib[1]]->
SetJoint(j, Joint);
1389 if (Joint->
GetType() == InterfaceJoint3D ||
1390 Joint->
GetType() == IsoInterfaceJoint3D)
1396 if (Joint->
GetType() == JointEqN)
1406 for(i=0;i<N_Cells;i++)
1412 Tetrahedrals_loc = Tetrahedrals+4*i;
1415 for(jj=0;jj<N_Faces;jj++)
1418 N_Points = TmpLen[jj];
1422 cerr <<
"Only Tria faces are allowed!!! N_FVert: " << N_Points << endl;
1427 a = Tetrahedrals_loc[TmpFV[jj*MaxLen]];
1428 b = Tetrahedrals_loc[TmpFV[jj*MaxLen + 1]];
1429 c = Tetrahedrals_loc[TmpFV[jj*MaxLen + 2]];
1437 len1 = PointNeighb[a*maxEpV];
1438 len2 = PointNeighb[b*maxEpV];
1439 len3 = PointNeighb[c*maxEpV];
1442 for (j=1;j<=len1;j++)
1444 Neighb_tmp = PointNeighb[a*maxEpV + j];
1445 for (k=1;k<=len2;k++)
1447 if(Neighb_tmp == PointNeighb[b*maxEpV + k])
1449 for(l=1;l<=len3;l++)
1450 if(Neighb_tmp == PointNeighb[c*maxEpV + l])
1452 Neib[CurrNeib++] = Neighb_tmp;
1457 if (CurrNeib == 2)
break;
1462 cerr<<
"Face " << i <<
"No. CurrNeib " << CurrNeib <<
" Neib 1" << Neib[0] <<
" Neib 2" << Neib[1] <<endl;
1467 Joint =
new TJointEqN(CellTree[Neib[0]], CellTree[Neib[1]]);
1472 if (Tetrahedrals[4*Neib[0]+j] == a)
break;
1476 if (Tetrahedrals[4*Neib[0]+k] == b)
break;
1480 if (Tetrahedrals[4*Neib[0]+l] == c)
break;
1482 l = l*100 + k*10 + j;
1488 case 210:
case 21:
case 102:
1489 case 120:
case 12:
case 201:
1492 case 310:
case 31:
case 103:
1493 case 130:
case 13:
case 301:
1496 case 321:
case 132:
case 213:
1497 case 231:
case 123:
case 312:
1500 case 230:
case 23:
case 302:
1501 case 320:
case 32:
case 203:
1506 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
1510 CellTree[Neib[0]]->
SetJoint(j, Joint);
1515 if (Tetrahedrals[4*Neib[1]+j] == a)
break;
1519 if (Tetrahedrals[4*Neib[1]+k] == b)
break;
1523 if (Tetrahedrals[4*Neib[1]+l] == c)
break;
1525 l = l*100 + k*10 + j;
1531 case 210:
case 21:
case 102:
1532 case 120:
case 12:
case 201:
1535 case 310:
case 31:
case 103:
1536 case 130:
case 13:
case 301:
1539 case 321:
case 132:
case 213:
1540 case 231:
case 123:
case 312:
1543 case 230:
case 23:
case 302:
1544 case 320:
case 32:
case 203:
1549 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
1552 CellTree[Neib[1]]->
SetJoint(j, Joint);
1554 if (Joint->
GetType() == InterfaceJoint3D ||
1555 Joint->
GetType() == IsoInterfaceJoint3D)
1561 if (Joint->
GetType() == JointEqN)
1567 delete [] PointNeighb;
1580 void TetrameshGen(
TDomain *&Domain)
1585 int i, j, k, l, N_Coord, *N_FVerts, N_Faces, *Facets;
1586 int N, N_RootCells, N_Cells, CurrVertex, N_Vertices, ID, N_G, RefLevel=0;
1587 int CurrNeib, len1, len2, len3, maxEpV = 0, a, b, c, Neib[2], Neighb_tmp, CurrComp;
1588 int *Tetrahedrals, *PointNeighb, dimension;
1589 int *Facelist, *Facemarkerlist;
1591 double X, Y, Z, DispX, DispY, DispZ;
1592 double *Coordinates, N_x, N_y, N_z;
1594 double Xmin = 1e10, Xmax = -1e10, Ymin = 1e10, Ymax = -1e10;
1595 double Zmin = 1e10, Zmax = -1e10, T[4]={0,0,0,0}, S[4]={0,0,0,0};
1596 double StartX, StartY, StartZ, BoundX, BoundY, BoundZ;
1598 tetgenio In, Out, Out_New;
1602 TVertex **VertexDel, **NewVertices, **NewSurfVertices;
1611 char *SMESH, line[100];
1618 MPI_Comm_rank(Comm, &rank);
1619 MPI_Comm_size(Comm, &size);
1634 std::ostringstream opts;
1637 opts.seekp(std::ios::beg);
1662 ReadMeditMesh_Adapt(SMESH, In);
1669 tetrahedralize((
char*)opts.str().c_str(), &In, &Out);
1727 VertexDel =
new TVertex*[8*N_RootCells];
1730 for(i=0;i<N_Cells;i++)
1735 for(j=0;j<N_Faces;j++)
1739 VertexDel[CurrVertex++] = cell->
GetVertex(j);
1744 for(k=0;k<CurrVertex;k++)
1751 VertexDel[CurrVertex++] = cell->
GetVertex(j);
1756 for(k=0;k<CurrVertex;k++)
1757 if(VertexDel[k]==cell->
GetVertex((j+1)%N_Vertices))
1763 VertexDel[CurrVertex++] = cell->
GetVertex((j+1)%N_Vertices);
1767 for(k=0;k<CurrVertex;k++)
1768 if(VertexDel[k]==cell->
GetVertex((j+2)%N_Vertices))
1774 VertexDel[CurrVertex++] = cell->
GetVertex((j+2)%N_Vertices);
1779 for(k=0;k<CurrVertex;k++)
1780 if(VertexDel[k]==cell->
GetVertex((j+4)%N_Vertices))
1786 VertexDel[CurrVertex++] = cell->
GetVertex((j+4)%N_Vertices);
1792 for(i=0;i<CurrVertex;i++)
1793 delete VertexDel[i];
1794 delete [] VertexDel;
1795 OutPut(CurrVertex<<
" vertices were deleted"<<endl);
1799 for(i=0;i<N_RootCells;i++)
1802 OutPut(N_RootCells<<
" cells were deleted"<<endl);
1809 N_RootCells = Out.numberoftetrahedra;
1810 N_G = Out.numberofpoints;
1813 Coordinates = Out.pointlist;
1814 Tetrahedrals = Out.tetrahedronlist;
1820 MPI_Bcast(&N_RootCells, 1, MPI_INT, 0, Comm);
1821 MPI_Bcast(&N_G, 1, MPI_INT, 0, Comm);
1826 Coordinates =
new double [3*N_G];
1827 Tetrahedrals =
new int[4*N_RootCells];
1830 MPI_Bcast(Coordinates, 3*N_G, MPI_DOUBLE, 0, Comm);
1831 MPI_Bcast(Tetrahedrals, 4*N_RootCells, MPI_INT, 0, Comm);
1835 NewVertices =
new TVertex*[N_G];
1839 X = Coordinates[3*i];
1840 Y = Coordinates[3*i+1];
1841 Z = Coordinates[3*i+2];
1846 DispX = 3.606596999999999830777142;
1855 DispY = 12.29866318748098663604651;
1863 DispY = 214.3263880000000028758222;
1870 DispX = 177.8944370000000105846993;
1875 NewVertices[i] =
new TVertex( (X - DispX), (Y - DispY), (Z- DispZ));
1878 if (Coordinates[3*i] > Xmax) Xmax = Coordinates[3*i];
1879 if (Coordinates[3*i] < Xmin) Xmin = Coordinates[3*i];
1880 if (Coordinates[3*i+1] > Ymax) Ymax = Coordinates[3*i+1];
1881 if (Coordinates[3*i+1] < Ymin) Ymin = Coordinates[3*i+1];
1882 if (Coordinates[3*i+2] > Zmax) Zmax = Coordinates[3*i+2];
1883 if (Coordinates[3*i+2] < Zmin) Zmin = Coordinates[3*i+2];
1890 BoundX = Xmax - Xmin;
1891 BoundY = Ymax - Ymin;
1892 BoundZ = Zmax - Zmin;
1895 Domain->SetBoundBox(StartX, StartY, StartZ, BoundX, BoundY, BoundZ);
1906 for (i=0;i<N_RootCells;i++)
1911 CellTree[i]->
SetVertex(0, NewVertices[Tetrahedrals[4*i ]]);
1912 CellTree[i]->
SetVertex(1, NewVertices[Tetrahedrals[4*i + 1]]);
1913 CellTree[i]->
SetVertex(2, NewVertices[Tetrahedrals[4*i + 2]]);
1914 CellTree[i]->
SetVertex(3, NewVertices[Tetrahedrals[4*i + 3]]);
1917 ((
TMacroCell *) CellTree[i])->SetSubGridID(0);
1936 PointNeighb =
new int[N_G];
1940 cout<<
"numberofpoints "<<N_G<<endl;
1941 memset(PointNeighb, 0, N_G *SizeOfInt);
1943 for (i=0;i<4*N_RootCells;i++)
1944 PointNeighb[Tetrahedrals[i]]++;
1947 if (PointNeighb[i] > maxEpV) maxEpV = PointNeighb[i];
1948 delete [] PointNeighb;
1953 cout<<
"maxEpV "<< maxEpV<<endl;
1955 PointNeighb =
new int[++maxEpV * N_G];
1957 memset(PointNeighb, 0, maxEpV*N_G*SizeOfInt);
1964 for(i=0;i<4*N_RootCells;i++)
1966 j = Tetrahedrals[i]*maxEpV;
1969 PointNeighb[j + PointNeighb[j]] = i / 4;
1987 N_G = Out.numberoftrifaces;
1988 Facelist = Out.trifacelist;
1989 Facemarkerlist = Out.trifacemarkerlist;
1993 MPI_Bcast(&N_G, 1, MPI_INT, 0, Comm);
1997 Facelist =
new int [3*N_G];
1998 Facemarkerlist =
new int[N_G];
2002 MPI_Bcast(Facelist, 3*N_G, MPI_INT, 0, Comm);
2003 MPI_Bcast(Facemarkerlist, N_G, MPI_INT, 0, Comm);
2007 cout<<
"numberoftrifaces "<<N_G<<endl;
2012 b = Facelist[3*i+1];
2013 c = Facelist[3*i+2];
2021 len1 = PointNeighb[a*maxEpV];
2022 len2 = PointNeighb[b*maxEpV];
2023 len3 = PointNeighb[c*maxEpV];
2026 for (j=1;j<=len1;j++)
2028 Neighb_tmp = PointNeighb[a*maxEpV + j];
2029 for (k=1;k<=len2;k++)
2031 if (Neighb_tmp == PointNeighb[b*maxEpV + k])
2033 for (l=1;l<=len3;l++)
2034 if (Neighb_tmp == PointNeighb[c*maxEpV + l])
2036 Neib[CurrNeib++] = Neighb_tmp;
2041 if (CurrNeib == 2)
break;
2045 if (Facemarkerlist[i])
2048 CurrComp = Facemarkerlist[i] - 1;
2059 NewVertices[a]->
GetY(), T[1], S[1]) ||
2061 NewVertices[b]->
GetY(), T[2], S[2]) ||
2063 NewVertices[c]->
GetY(), T[3], S[3]) )
2065 cerr<<
"Error: could not set parameter values"<<endl;
2066 OutPut(NewVertices[a]<<endl);
2067 OutPut(NewVertices[b]<<endl);
2068 OutPut(NewVertices[c]<<endl);
2076 CellTree[Neib[0]], CellTree[Neib[1]] );
2079 CellTree[Neib[0]], CellTree[Neib[1]] );
2093 cerr <<
"Error !!!!!!!! not enough neighbours!" << endl;
2095 Joint =
new TJointEqN(CellTree[Neib[0]], CellTree[Neib[1]]);
2102 if (Tetrahedrals[4*Neib[0]+j] == a)
break;
2106 if (Tetrahedrals[4*Neib[0]+k] == b)
break;
2110 if (Tetrahedrals[4*Neib[0]+l] == c)
break;
2112 l = l*100 + k*10 + j;
2118 case 210:
case 21:
case 102:
2119 case 120:
case 12:
case 201:
2122 case 310:
case 31:
case 103:
2123 case 130:
case 13:
case 301:
2126 case 321:
case 132:
case 213:
2127 case 231:
case 123:
case 312:
2130 case 230:
case 23:
case 302:
2131 case 320:
case 32:
case 203:
2136 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
2139 CellTree[Neib[0]]->
SetJoint(j, Joint);
2145 if (Tetrahedrals[4*Neib[1]+j] == a)
break;
2149 if (Tetrahedrals[4*Neib[1]+k] == b)
break;
2153 if (Tetrahedrals[4*Neib[1]+l] == c)
break;
2155 l = l*100 + k*10 + j;
2161 case 210:
case 21:
case 102:
2162 case 120:
case 12:
case 201:
2165 case 310:
case 31:
case 103:
2166 case 130:
case 13:
case 301:
2169 case 321:
case 132:
case 213:
2170 case 231:
case 123:
case 312:
2173 case 230:
case 23:
case 302:
2174 case 320:
case 32:
case 203:
2179 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
2182 CellTree[Neib[1]]->
SetJoint(j, Joint);
2185 if (Joint->
GetType() == InterfaceJoint3D ||
2186 Joint->
GetType() == IsoInterfaceJoint3D)
2192 if (Joint->
GetType() == JointEqN)
2211 delete [] Tetrahedrals ;
2212 delete [] Coordinates;
2214 delete [] Facemarkerlist;
2218 delete [] PointNeighb;
2232 void TetraGen(
TDomain *&Domain)
2237 int i, j, k, l, N_Coord, *N_FVerts, N_Faces, *Facets;
2238 int N, N_RootCells, N_Cells, CurrVertex, N_Vertices, ID, N_G, RefLevel=0;
2239 int CurrNeib, len1, len2, len3, maxEpV = 0, a, b, c, Neib[2], Neighb_tmp, CurrComp;
2240 int *Tetrahedrals, *PointNeighb, dimension;
2241 int jj, N_Points, MaxLen, *Tetrahedrals_loc;
2242 const int *EdgeVertex, *TmpFV, *TmpLen;
2244 double *Coordinates, N_x, N_y, N_z;
2246 double Xmin = 1e10, Xmax = -1e10, Ymin = 1e10, Ymax = -1e10;
2247 double Zmin = 1e10, Zmax = -1e10, T[4]={0,0,0,0}, S[4]={0,0,0,0};
2248 double StartX, StartY, StartZ, BoundX, BoundY, BoundZ;
2254 TVertex **VertexDel, **NewVertices, **NewSurfVertices;
2264 char *SMESH, line[100];
2271 MPI_Comm_rank(Comm, &rank);
2272 MPI_Comm_size(Comm, &size);
2285 std::ostringstream opts;
2288 opts.seekp(std::ios::beg);
2305 cout<<
"test DeleteDomain " <<endl;
2309 ReadMeditMesh(SMESH, In);
2311 cout<<
"test DeleteDomain 2" <<endl;
2317 tetrahedralize((
char*)opts.str().c_str(), &In, &Out);
2326 DeleteDomain(Domain);
2334 N_RootCells = Out.numberoftetrahedra;
2335 N_G = Out.numberofpoints;
2338 Coordinates = Out.pointlist;
2339 Tetrahedrals = Out.tetrahedronlist;
2343 MPI_Bcast(&N_RootCells, 1, MPI_INT, 0, Comm);
2344 MPI_Bcast(&N_G, 1, MPI_INT, 0, Comm);
2349 Coordinates =
new double [3*N_G];
2350 Tetrahedrals =
new int[4*N_RootCells];
2353 MPI_Bcast(Coordinates, 3*N_G, MPI_DOUBLE, 0, Comm);
2354 MPI_Bcast(Tetrahedrals, 4*N_RootCells, MPI_INT, 0, Comm);
2358 NewVertices =
new TVertex*[N_G];
2362 NewVertices[i] =
new TVertex(Coordinates[3*i], Coordinates[3*i+1], Coordinates[3*i+2]);
2365 if (Coordinates[3*i] > Xmax) Xmax = Coordinates[3*i];
2366 if (Coordinates[3*i] < Xmin) Xmin = Coordinates[3*i];
2367 if (Coordinates[3*i+1] > Ymax) Ymax = Coordinates[3*i+1];
2368 if (Coordinates[3*i+1] < Ymin) Ymin = Coordinates[3*i+1];
2369 if (Coordinates[3*i+2] > Zmax) Zmax = Coordinates[3*i+2];
2370 if (Coordinates[3*i+2] < Zmin) Zmin = Coordinates[3*i+2];
2377 BoundX = Xmax - Xmin;
2378 BoundY = Ymax - Ymin;
2379 BoundZ = Zmax - Zmin;
2382 Domain->SetBoundBox(StartX, StartY, StartZ, BoundX, BoundY, BoundZ);
2393 for (i=0;i<N_RootCells;i++)
2398 CellTree[i]->
SetVertex(0, NewVertices[Tetrahedrals[4*i ]]);
2399 CellTree[i]->
SetVertex(1, NewVertices[Tetrahedrals[4*i + 1]]);
2400 CellTree[i]->
SetVertex(2, NewVertices[Tetrahedrals[4*i + 2]]);
2401 CellTree[i]->
SetVertex(3, NewVertices[Tetrahedrals[4*i + 3]]);
2404 ((
TMacroCell *) CellTree[i])->SetSubGridID(0);
2419 PointNeighb =
new int[N_G];
2423 cout<<
"numberofpoints "<<N_G<<endl;
2424 memset(PointNeighb, 0, N_G *SizeOfInt);
2426 for (i=0;i<4*N_RootCells;i++)
2427 PointNeighb[Tetrahedrals[i]]++;
2430 if (PointNeighb[i] > maxEpV) maxEpV = PointNeighb[i];
2431 delete [] PointNeighb;
2436 cout<<
"maxEpV "<< maxEpV<<endl;
2438 PointNeighb =
new int[++maxEpV * N_G];
2440 memset(PointNeighb, 0, maxEpV*N_G*SizeOfInt);
2447 for(i=0;i<4*N_RootCells;i++)
2449 j = Tetrahedrals[i]*maxEpV;
2452 PointNeighb[j + PointNeighb[j]] = i / 4;
2460 for (i=0;i<N_Cells;i++)
2466 Tetrahedrals_loc = Tetrahedrals+4*i;
2468 for(jj=0;jj<N_Faces;jj++)
2472 N_Points = TmpLen[jj];
2476 cerr <<
"Only Tria faces are allowed!!! N_FVert: " << N_Points << endl;
2482 a = Tetrahedrals_loc[TmpFV[jj*MaxLen]];
2483 b = Tetrahedrals_loc[TmpFV[jj*MaxLen + 1]];
2484 c = Tetrahedrals_loc[TmpFV[jj*MaxLen + 2]];
2492 len1 = PointNeighb[a*maxEpV];
2493 len2 = PointNeighb[b*maxEpV];
2494 len3 = PointNeighb[c*maxEpV];
2497 for (j=1;j<=len1;j++)
2499 Neighb_tmp = PointNeighb[a*maxEpV + j];
2500 for (k=1;k<=len2;k++)
2502 if (Neighb_tmp == PointNeighb[b*maxEpV + k])
2504 for (l=1;l<=len3;l++)
2505 if (Neighb_tmp == PointNeighb[c*maxEpV + l])
2507 Neib[CurrNeib++] = Neighb_tmp;
2512 if (CurrNeib == 2)
break;
2527 NewVertices[a]->
GetY(), T[1], S[1]) ||
2529 NewVertices[b]->
GetY(), T[2], S[2]) ||
2531 NewVertices[c]->
GetY(), T[3], S[3]) )
2533 cerr<<
"Error: could not set parameter values"<<endl;
2534 OutPut(NewVertices[a]<<endl);
2535 OutPut(NewVertices[b]<<endl);
2536 OutPut(NewVertices[c]<<endl);
2544 CellTree[Neib[0]], CellTree[Neib[1]] );
2547 CellTree[Neib[0]], CellTree[Neib[1]] );
2561 cerr <<
"Error !!!!!!!! not enough neighbours!" << endl;
2563 Joint =
new TJointEqN(CellTree[Neib[0]], CellTree[Neib[1]]);
2569 if (Tetrahedrals[4*Neib[0]+j] == a)
break;
2573 if (Tetrahedrals[4*Neib[0]+k] == b)
break;
2577 if (Tetrahedrals[4*Neib[0]+l] == c)
break;
2579 l = l*100 + k*10 + j;
2585 case 210:
case 21:
case 102:
2586 case 120:
case 12:
case 201:
2589 case 310:
case 31:
case 103:
2590 case 130:
case 13:
case 301:
2593 case 321:
case 132:
case 213:
2594 case 231:
case 123:
case 312:
2597 case 230:
case 23:
case 302:
2598 case 320:
case 32:
case 203:
2603 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
2606 CellTree[Neib[0]]->
SetJoint(j, Joint);
2612 if (Tetrahedrals[4*Neib[1]+j] == a)
break;
2616 if (Tetrahedrals[4*Neib[1]+k] == b)
break;
2620 if (Tetrahedrals[4*Neib[1]+l] == c)
break;
2622 l = l*100 + k*10 + j;
2628 case 210:
case 21:
case 102:
2629 case 120:
case 12:
case 201:
2632 case 310:
case 31:
case 103:
2633 case 130:
case 13:
case 301:
2636 case 321:
case 132:
case 213:
2637 case 231:
case 123:
case 312:
2640 case 230:
case 23:
case 302:
2641 case 320:
case 32:
case 203:
2646 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
2649 CellTree[Neib[1]]->
SetJoint(j, Joint);
2652 if (Joint->
GetType() == InterfaceJoint3D ||
2653 Joint->
GetType() == IsoInterfaceJoint3D)
2659 if (Joint->
GetType() == JointEqN)
2668 cout<<
"numberoftrifaces after "<<N_G<<endl;
2684 delete [] Tetrahedrals ;
2685 delete [] Coordinates;
2691 delete [] PointNeighb;
2705 void TetraGenWithInputCells(
TDomain *&Domain)
2710 int i, j, k, l, N_Coord, *N_FVerts, N_Faces, *Facets;
2711 int N, N_RootCells, N_Cells, CurrVertex, N_Vertices, ID, N_G, RefLevel=0;
2712 int CurrNeib, len1, len2, len3, maxEpV = 0, a, b, c, Neib[2], Neighb_tmp, CurrComp;
2713 int *Tetrahedrals, *PointNeighb, dimension;
2714 int jj, N_Points, MaxLen, *Tetrahedrals_loc;
2715 const int *EdgeVertex, *TmpFV, *TmpLen;
2716 double *TetRegionlist;
2718 double *Coordinates, N_x, N_y, N_z;
2720 double Xmin = 1e10, Xmax = -1e10, Ymin = 1e10, Ymax = -1e10;
2721 double Zmin = 1e10, Zmax = -1e10, T[4]={0,0,0,0}, S[4]={0,0,0,0};
2722 double StartX, StartY, StartZ, BoundX, BoundY, BoundZ;
2724 tetgenio In, Out, InAddPts;
2728 TVertex **VertexDel, **NewVertices, **NewSurfVertices;
2738 char *SMESH, *NODE, line[100];
2746 MPI_Comm_rank(Comm, &rank);
2747 MPI_Comm_size(Comm, &size);
2760 std::ostringstream opts;
2763 opts.seekp(std::ios::beg);
2792 ReadMeditMeshWithCells(SMESH, In);
2808 tetrahedralize((
char*)opts.str().c_str(), &In, &Out);
2809 cout<<
"11111111111111"<<endl;
2811 cout<<
"2222222222222"<<endl;
2821 DeleteDomain(Domain);
2828 N_RootCells = Out.numberoftetrahedra;
2829 N_G = Out.numberofpoints;
2832 Coordinates = Out.pointlist;
2833 Tetrahedrals = Out.tetrahedronlist;
2835 TetRegionlist = Out.tetrahedronattributelist;
2839 MPI_Bcast(&N_RootCells, 1, MPI_INT, 0, Comm);
2840 MPI_Bcast(&N_G, 1, MPI_INT, 0, Comm);
2845 Coordinates =
new double [3*N_G];
2846 Tetrahedrals =
new int[4*N_RootCells];
2847 TetRegionlist =
new double [N_RootCells];
2850 MPI_Bcast(Coordinates, 3*N_G, MPI_DOUBLE, 0, Comm);
2851 MPI_Bcast(Tetrahedrals, 4*N_RootCells, MPI_INT, 0, Comm);
2852 MPI_Bcast(TetRegionlist, N_RootCells, MPI_DOUBLE, 0, Comm);
2856 NewVertices =
new TVertex*[N_G];
2860 NewVertices[i] =
new TVertex(Coordinates[3*i], Coordinates[3*i+1], Coordinates[3*i+2]);
2863 if (Coordinates[3*i] > Xmax) Xmax = Coordinates[3*i];
2864 if (Coordinates[3*i] < Xmin) Xmin = Coordinates[3*i];
2865 if (Coordinates[3*i+1] > Ymax) Ymax = Coordinates[3*i+1];
2866 if (Coordinates[3*i+1] < Ymin) Ymin = Coordinates[3*i+1];
2867 if (Coordinates[3*i+2] > Zmax) Zmax = Coordinates[3*i+2];
2868 if (Coordinates[3*i+2] < Zmin) Zmin = Coordinates[3*i+2];
2875 BoundX = Xmax - Xmin;
2876 BoundY = Ymax - Ymin;
2877 BoundZ = Zmax - Zmin;
2880 Domain->SetBoundBox(StartX, StartY, StartZ, BoundX, BoundY, BoundZ);
2891 for (i=0;i<N_RootCells;i++)
2896 CellTree[i]->
SetVertex(0, NewVertices[Tetrahedrals[4*i ]]);
2897 CellTree[i]->
SetVertex(1, NewVertices[Tetrahedrals[4*i + 1]]);
2898 CellTree[i]->
SetVertex(2, NewVertices[Tetrahedrals[4*i + 2]]);
2899 CellTree[i]->
SetVertex(3, NewVertices[Tetrahedrals[4*i + 3]]);
2902 ((
TMacroCell *) CellTree[i])->SetSubGridID(0);
2920 PointNeighb =
new int[N_G];
2924 cout<<
"numberofpoints "<<N_G<<endl;
2925 memset(PointNeighb, 0, N_G *SizeOfInt);
2927 for (i=0;i<4*N_RootCells;i++)
2928 PointNeighb[Tetrahedrals[i]]++;
2931 if (PointNeighb[i] > maxEpV) maxEpV = PointNeighb[i];
2932 delete [] PointNeighb;
2937 cout<<
"maxEpV "<< maxEpV<<endl;
2939 PointNeighb =
new int[++maxEpV * N_G];
2941 memset(PointNeighb, 0, maxEpV*N_G*SizeOfInt);
2948 for(i=0;i<4*N_RootCells;i++)
2950 j = Tetrahedrals[i]*maxEpV;
2953 PointNeighb[j + PointNeighb[j]] = i / 4;
2961 for (i=0;i<N_Cells;i++)
2967 Tetrahedrals_loc = Tetrahedrals+4*i;
2969 for(jj=0;jj<N_Faces;jj++)
2973 N_Points = TmpLen[jj];
2977 cerr <<
"Only Tria faces are allowed!!! N_FVert: " << N_Points << endl;
2983 a = Tetrahedrals_loc[TmpFV[jj*MaxLen]];
2984 b = Tetrahedrals_loc[TmpFV[jj*MaxLen + 1]];
2985 c = Tetrahedrals_loc[TmpFV[jj*MaxLen + 2]];
2993 len1 = PointNeighb[a*maxEpV];
2994 len2 = PointNeighb[b*maxEpV];
2995 len3 = PointNeighb[c*maxEpV];
2998 for (j=1;j<=len1;j++)
3000 Neighb_tmp = PointNeighb[a*maxEpV + j];
3001 for (k=1;k<=len2;k++)
3003 if (Neighb_tmp == PointNeighb[b*maxEpV + k])
3005 for (l=1;l<=len3;l++)
3006 if (Neighb_tmp == PointNeighb[c*maxEpV + l])
3008 Neib[CurrNeib++] = Neighb_tmp;
3013 if (CurrNeib == 2)
break;
3028 NewVertices[a]->
GetY(), T[1], S[1]) ||
3030 NewVertices[b]->
GetY(), T[2], S[2]) ||
3032 NewVertices[c]->
GetY(), T[3], S[3]) )
3034 cerr<<
"Error: could not set parameter values"<<endl;
3035 OutPut(NewVertices[a]<<endl);
3036 OutPut(NewVertices[b]<<endl);
3037 OutPut(NewVertices[c]<<endl);
3045 CellTree[Neib[0]], CellTree[Neib[1]] );
3048 CellTree[Neib[0]], CellTree[Neib[1]] );
3062 cerr <<
"Error !!!!!!!! not enough neighbours!" << endl;
3064 Joint =
new TJointEqN(CellTree[Neib[0]], CellTree[Neib[1]]);
3070 if (Tetrahedrals[4*Neib[0]+j] == a)
break;
3074 if (Tetrahedrals[4*Neib[0]+k] == b)
break;
3078 if (Tetrahedrals[4*Neib[0]+l] == c)
break;
3080 l = l*100 + k*10 + j;
3086 case 210:
case 21:
case 102:
3087 case 120:
case 12:
case 201:
3090 case 310:
case 31:
case 103:
3091 case 130:
case 13:
case 301:
3094 case 321:
case 132:
case 213:
3095 case 231:
case 123:
case 312:
3098 case 230:
case 23:
case 302:
3099 case 320:
case 32:
case 203:
3104 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
3107 CellTree[Neib[0]]->
SetJoint(j, Joint);
3113 if (Tetrahedrals[4*Neib[1]+j] == a)
break;
3117 if (Tetrahedrals[4*Neib[1]+k] == b)
break;
3121 if (Tetrahedrals[4*Neib[1]+l] == c)
break;
3123 l = l*100 + k*10 + j;
3129 case 210:
case 21:
case 102:
3130 case 120:
case 12:
case 201:
3133 case 310:
case 31:
case 103:
3134 case 130:
case 13:
case 301:
3137 case 321:
case 132:
case 213:
3138 case 231:
case 123:
case 312:
3141 case 230:
case 23:
case 302:
3142 case 320:
case 32:
case 203:
3147 Error(
"Unable to set the face !!!!!!!!!!!!" << endl);
3150 CellTree[Neib[1]]->
SetJoint(j, Joint);
3153 if (Joint->
GetType() == InterfaceJoint3D ||
3154 Joint->
GetType() == IsoInterfaceJoint3D)
3160 if (Joint->
GetType() == JointEqN)
3169 cout<<
"numberoftrifaces after "<<N_G<<endl;
3185 delete [] Tetrahedrals ;
3186 delete [] Coordinates;
3187 delete [] TetRegionlist;
3192 delete [] PointNeighb;
void SetMapType()
Definition: Joint.C:107
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
double P0
Definition: Database.h:533
int GetFaceVertex(const int *&TmpFV, const int *&TmpLen, int &MaxLen)
Definition: ShapeDesc.h:124
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
TShapeDesc * GetShapeDesc() const
return shape descriptor of refinement descriptor
Definition: BaseCell.h:134
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
Definition: ShapeDesc.h:29
TJoint * GetJoint(int J_i)
return the pointer to face with number i
Definition: BaseCell.h:175
MPI_Comm Comm
Definition: Database.h:978
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
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