checkPatch.H
Go to the documentation of this file.
1  if (bci != 0)
2  {
3  label bcIndex = bcIDs[bci];
4  label regionIndex = 0;
5 
6  // Decompose moving faces into piston and valves using the idface array
7  if (bci == 1)
8  {
9  if (kivaVersion == kiva3v)
10  {
11  regionIndex = max
12  (
13  max(idface[quadFace[0]], idface[quadFace[1]]),
14  max(idface[quadFace[2]], idface[quadFace[3]])
15  );
16 
17  if (regionIndex > 0)
18  {
19  bcIndex = VALVE;
20  regionIndex--;
21  }
22  }
23  }
24 
25  // Decompose fixed wall faces into cylinder-head and liner using
26  // the fv array and split of the y=0 faces as a symmetry plane
27  if (bci == 2)
28  {
29  if
30  (
31  fv[quadFace[0]] == 6
32  || fv[quadFace[1]] == 6
33  || fv[quadFace[2]] == 6
34  || fv[quadFace[3]] == 6
35  )
36  {
37  bcIndex = CYLINDERHEAD;
38  }
39 
40  if
41  (
42  mag(points[quadFace[0]].y()) < SMALL
43  && mag(points[quadFace[1]].y()) < SMALL
44  && mag(points[quadFace[2]].y()) < SMALL
45  && mag(points[quadFace[3]].y()) < SMALL
46  )
47  {
48  bcIndex = SYMMETRYPLANE;
49  }
50  }
51 
52  // Make the back part of the periodic boundary the second region
53  // of the front part
54  if (bci == 6)
55  {
56  bcIndex = WEDGE;
57  regionIndex = 1;
58  }
59 
60  if (regionIndex >= pFaces[bcIndex].size())
61  {
62  pFaces[bcIndex].setSize(regionIndex + 1);
63  }
64 
65  quadFace[0] = pointMap[quadFace[0]];
66  quadFace[1] = pointMap[quadFace[1]];
67  quadFace[2] = pointMap[quadFace[2]];
68  quadFace[3] = pointMap[quadFace[3]];
69 
70  label ti = 0;
71  forAll(quadFace, i)
72  {
73  if (quadFace[i] != quadFace[(i+1)%4])
74  {
75  triFace[(ti++)%3] = quadFace[i];
76  }
77  }
78 
79  if (ti == 4)
80  {
81  pFaces[bcIndex][regionIndex].append(quadFace);
82  }
83  else if (ti == 3)
84  {
85  pFaces[bcIndex][regionIndex].append(triFace);
86  }
87  // else the face has collapsed to an edge or point
88  }
89  else
90  {
92  << "bc not defined for active cell = " << i
93  << exit(FatalError);
94  }
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
labelList idface(nPoints)
scalar y
const pointField & points
labelList fv(nPoints)
face triFace(3)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints,-1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){pointMap[i]=i;}for(label i=0;i< nPoints;i++){if(f[i] > 0.0){hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei){if(edges[ei].mag(points)< SMALL){label start=pointMap[edges[ei].start()];while(start!=pointMap[start]){start=pointMap[start];}label end=pointMap[edges[ei].end()];while(end!=pointMap[end]){end=pointMap[end];}label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;}}cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){cellShape &cs=cellShapes[celli];forAll(cs, i){cs[i]=pointMap[cs[i]];}cs.collapse();}label bcIDs[11]={-1, 0, 2, 4,-1, 5,-1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&symmetryPolyPatch::typeName,&wedgePolyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&symmetryPolyPatch::typeName,&oldCyclicPolyPatch::typeName};enum patchTypeNames{PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={"piston","valve","liner","cylinderHead","axis","wedge","inflow","outflow","presin","presout","symmetryPlane","cyclic"};List< SLList< face > > pFaces[nBCs]
Definition: readKivaGrid.H:235
face quadFace(4)
dimensioned< scalar > mag(const dimensioned< Type > &)