localPointRegion.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "localPointRegion.H"
27 #include "syncTools.H"
28 #include "polyMesh.H"
29 #include "mapPolyMesh.H"
30 #include "globalIndex.H"
31 #include "indirectPrimitivePatch.H"
32 #include "dummyTransform.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 defineTypeNameAndDebug(localPointRegion, 0);
40 
41 // Reduction class to get minimum value over face.
43 {
44 public:
45 
46  void operator()(face& x, const face& y) const
47  {
48  if (x.size())
49  {
50  label j = 0;
51  forAll(x, i)
52  {
53  x[i] = min(x[i], y[j]);
54 
55  j = y.rcIndex(j);
56  }
57  }
58  }
59 };
60 
61 }
62 
63 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
64 
65 // Are two lists identical either in forward or in reverse order.
66 bool Foam::localPointRegion::isDuplicate
67 (
68  const face& f0,
69  const face& f1,
70  const bool forward
71 )
72 {
73  label fp1 = findIndex(f1, f0[0]);
74 
75  if (fp1 == -1)
76  {
77  return false;
78  }
79 
80  forAll(f0, fp0)
81  {
82  if (f0[fp0] != f1[fp1])
83  {
84  return false;
85  }
86 
87  if (forward)
88  {
89  fp1 = f1.fcIndex(fp1);
90  }
91  else
92  {
93  fp1 = f1.rcIndex(fp1);
94  }
95  }
96  return true;
97 }
98 
99 
100 // Count regions per point
101 void Foam::localPointRegion::countPointRegions
102 (
103  const polyMesh& mesh,
104  const boolList& candidatePoint,
105  const Map<label>& candidateFace,
106  faceList& minRegion
107 )
108 {
109  // Almost all will have only one so only
110  // populate Map if more than one.
111  labelList minPointRegion(mesh.nPoints(), -1);
112  // From global point to local (multi-region) point numbering
113  meshPointMap_.resize(candidateFace.size()/100);
114  // From local (multi-region) point to regions
115  DynamicList<labelList> pointRegions(meshPointMap_.size());
116 
117  // From faces with any duplicated point on it to local face
118  meshFaceMap_.resize(meshPointMap_.size());
119 
120  forAllConstIter(Map<label>, candidateFace, iter)
121  {
122  label faceI = iter.key();
123 
124  if (!mesh.isInternalFace(faceI))
125  {
126  const face& f = mesh.faces()[faceI];
127 
128  if (minRegion[faceI].empty())
129  {
130  FatalErrorIn("localPointRegion::countPointRegions(..)")
131  << "Face from candidateFace without minRegion set." << endl
132  << "Face:" << faceI << " fc:" << mesh.faceCentres()[faceI]
133  << " verts:" << f << abort(FatalError);
134  }
135 
136  forAll(f, fp)
137  {
138  label pointI = f[fp];
139 
140  // Even points which were not candidates for splitting might
141  // be on multiple baffles that are being split so check.
142 
143  if (candidatePoint[pointI])
144  {
145  label region = minRegion[faceI][fp];
146 
147  if (minPointRegion[pointI] == -1)
148  {
149  minPointRegion[pointI] = region;
150  }
151  else if (minPointRegion[pointI] != region)
152  {
153  // Multiple regions for this point. Add.
154  Map<label>::iterator iter = meshPointMap_.find(pointI);
155  if (iter != meshPointMap_.end())
156  {
157  labelList& regions = pointRegions[iter()];
158  if (findIndex(regions, region) == -1)
159  {
160  label sz = regions.size();
161  regions.setSize(sz+1);
162  regions[sz] = region;
163  }
164  }
165  else
166  {
167  label localPointI = meshPointMap_.size();
168  meshPointMap_.insert(pointI, localPointI);
169  labelList regions(2);
170  regions[0] = minPointRegion[pointI];
171  regions[1] = region;
172  pointRegions.append(regions);
173  }
174 
175  label meshFaceMapI = meshFaceMap_.size();
176  meshFaceMap_.insert(faceI, meshFaceMapI);
177  }
178  }
179  }
180  }
181  }
182  minPointRegion.clear();
183 
184  // Add internal faces that use any duplicated point. Can only have one
185  // region!
186  forAllConstIter(Map<label>, candidateFace, iter)
187  {
188  label faceI = iter.key();
189 
190  if (mesh.isInternalFace(faceI))
191  {
192  const face& f = mesh.faces()[faceI];
193 
194  forAll(f, fp)
195  {
196  // Note: candidatePoint test not really necessary but
197  // speeds up rejection.
198  if (candidatePoint[f[fp]] && meshPointMap_.found(f[fp]))
199  {
200  label meshFaceMapI = meshFaceMap_.size();
201  meshFaceMap_.insert(faceI, meshFaceMapI);
202  }
203  }
204  }
205  }
206 
207 
208  // Transfer to member data
209  pointRegions.shrink();
210  pointRegions_.setSize(pointRegions.size());
211  forAll(pointRegions, i)
212  {
213  pointRegions_[i].transfer(pointRegions[i]);
214  }
215 
216  // Compact minRegion
217  faceRegions_.setSize(meshFaceMap_.size());
218  forAllConstIter(Map<label>, meshFaceMap_, iter)
219  {
220  faceRegions_[iter()].labelList::transfer(minRegion[iter.key()]);
221 
223  //{
224  // label faceI = iter.key();
225  // const face& f = mesh.faces()[faceI];
226  // Pout<< "Face:" << faceI << " fc:" << mesh.faceCentres()[faceI]
227  // << " verts:" << f << endl;
228  // forAll(f, fp)
229  // {
230  // Pout<< " " << f[fp] << " min:" << faceRegions_[iter()][fp]
231  // << endl;
232  // }
233  // Pout<< endl;
234  //}
235  }
236 
237  // Compact region numbering
238  // ? TBD.
239 }
240 
241 
242 void Foam::localPointRegion::calcPointRegions
243 (
244  const polyMesh& mesh,
245  boolList& candidatePoint
246 )
247 {
248  label nBnd = mesh.nFaces()-mesh.nInternalFaces();
249  const labelList& faceOwner = mesh.faceOwner();
250  const labelList& faceNeighbour = mesh.faceNeighbour();
251 
252 
254  (
255  mesh,
256  candidatePoint,
257  orEqOp<bool>(),
258  false // nullValue
259  );
260 
261 
262  // Mark any face/boundaryFace/cell with a point on a candidate point.
263  // - candidateFace does not necessary have to be a baffle!
264  // - candidateFace is synchronised (since candidatePoint is)
265  Map<label> candidateFace(2*nBnd);
266  label candidateFaceI = 0;
267 
268  Map<label> candidateCell(nBnd);
269  label candidateCellI = 0;
270 
271  forAll(mesh.faces(), faceI)
272  {
273  const face& f = mesh.faces()[faceI];
274 
275  forAll(f, fp)
276  {
277  if (candidatePoint[f[fp]])
278  {
279  // Mark face
280  if (candidateFace.insert(faceI, candidateFaceI))
281  {
282  candidateFaceI++;
283  }
284 
285  // Mark cells
286  if (candidateCell.insert(faceOwner[faceI], candidateCellI))
287  {
288  candidateCellI++;
289  }
290 
291  if (mesh.isInternalFace(faceI))
292  {
293  label nei = faceNeighbour[faceI];
294  if (candidateCell.insert(nei, candidateCellI))
295  {
296  candidateCellI++;
297  }
298  }
299 
300  break;
301  }
302  }
303  }
304 
305 
306 
307  // Get global indices for cells
308  globalIndex globalCells(mesh.nCells());
309 
310 
311  // Determine for every candidate face per point the minimum region
312  // (global cell) it is connected to. (candidateFaces are the
313  // only ones using a
314  // candidate point so the only ones that can be affected)
315  faceList minRegion(mesh.nFaces());
316  forAllConstIter(Map<label>, candidateFace, iter)
317  {
318  label faceI = iter.key();
319  const face& f = mesh.faces()[faceI];
320 
321  if (mesh.isInternalFace(faceI))
322  {
323  label globOwn = globalCells.toGlobal(faceOwner[faceI]);
324  label globNei = globalCells.toGlobal(faceNeighbour[faceI]);
325  minRegion[faceI].setSize(f.size(), min(globOwn, globNei));
326  }
327  else
328  {
329  label globOwn = globalCells.toGlobal(faceOwner[faceI]);
330  minRegion[faceI].setSize(f.size(), globOwn);
331  }
332  }
333 
334  // Now minimize over all faces that are connected through internal
335  // faces or through cells. This loop iterates over the max number of
336  // cells connected to a point (=8 for hex mesh)
337 
338  while (true)
339  {
340  // Transport minimum from face across cell
341  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
342 
343  Map<label> minPointValue(100);
344  label nChanged = 0;
345  forAllConstIter(Map<label>, candidateCell, iter)
346  {
347  minPointValue.clear();
348 
349  label cellI = iter.key();
350  const cell& cFaces = mesh.cells()[cellI];
351 
352  // Determine minimum per point
353  forAll(cFaces, cFaceI)
354  {
355  label faceI = cFaces[cFaceI];
356 
357  if (minRegion[faceI].size())
358  {
359  const face& f = mesh.faces()[faceI];
360 
361  forAll(f, fp)
362  {
363  label pointI = f[fp];
364  Map<label>::iterator iter = minPointValue.find(pointI);
365 
366  if (iter == minPointValue.end())
367  {
368  minPointValue.insert(pointI, minRegion[faceI][fp]);
369  }
370  else
371  {
372  label currentMin = iter();
373  iter() = min(currentMin, minRegion[faceI][fp]);
374  }
375  }
376  }
377  }
378 
379  // Set face minimum from point minimum
380  forAll(cFaces, cFaceI)
381  {
382  label faceI = cFaces[cFaceI];
383 
384  if (minRegion[faceI].size())
385  {
386  const face& f = mesh.faces()[faceI];
387 
388  forAll(f, fp)
389  {
390  label minVal = minPointValue[f[fp]];
391 
392  if (minVal != minRegion[faceI][fp])
393  {
394  minRegion[faceI][fp] = minVal;
395  nChanged++;
396  }
397  }
398  }
399  }
400  }
401 
402  //Pout<< "nChanged:" << nChanged << endl;
403 
404  if (returnReduce(nChanged, sumOp<label>()) == 0)
405  {
406  break;
407  }
408 
409 
410  // Transport minimum across coupled faces
411  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412 
413  SubList<face> l
414  (
415  minRegion,
416  mesh.nFaces()-mesh.nInternalFaces(),
417  mesh.nInternalFaces()
418  );
420  (
421  mesh,
422  l,
423  minEqOpFace(),
424  Foam::dummyTransform() // dummy transformation
425  );
426  }
427 
428 
429  // Count regions per point
430  countPointRegions(mesh, candidatePoint, candidateFace, minRegion);
431  minRegion.clear();
432 
433 
435  //forAllConstIter(Map<label>, meshPointMap_, iter)
436  //{
437  // Pout<< "point:" << iter.key()
438  // << " coord:" << mesh.points()[iter.key()]
439  // << " regions:" << pointRegions_[iter()] << endl;
440  //}
441 }
442 
443 
444 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
445 
447 :
448  //nRegions_(0),
449  meshPointMap_(0),
450  pointRegions_(0),
451  meshFaceMap_(0),
452  faceRegions_(0)
453 {
454  const polyBoundaryMesh& patches = mesh.boundaryMesh();
455 
456  // Get any point on the outside which is on a non-coupled boundary
457  boolList candidatePoint(mesh.nPoints(), false);
458 
459  forAll(patches, patchI)
460  {
461  if (!patches[patchI].coupled())
462  {
463  const polyPatch& pp = patches[patchI];
464 
465  forAll(pp.meshPoints(), i)
466  {
467  candidatePoint[pp.meshPoints()[i]] = true;
468  }
469  }
470  }
471 
472  calcPointRegions(mesh, candidatePoint);
473 }
474 
475 
477 (
478  const polyMesh& mesh,
479  const labelList& candidatePoints
480 )
481 :
482  //nRegions_(0),
483  meshPointMap_(0),
484  pointRegions_(0),
485  meshFaceMap_(0),
486  faceRegions_(0)
487 {
488  boolList candidatePoint(mesh.nPoints(), false);
489 
490  forAll(candidatePoints, i)
491  {
492  candidatePoint[candidatePoints[i]] = true;
493  }
494 
495  calcPointRegions(mesh, candidatePoint);
496 }
497 
498 
499 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
500 
501 // Return a list (in allPatch indices) with either -1 or the face label
502 // of the face that uses the same vertices.
504 (
505  const primitiveMesh& mesh,
506  const labelList& boundaryFaces
507 )
508 {
509  // Addressing engine for all boundary faces.
510  indirectPrimitivePatch allPatch
511  (
512  IndirectList<face>(mesh.faces(), boundaryFaces),
513  mesh.points()
514  );
515 
516  labelList duplicateFace(allPatch.size(), -1);
517  label nDuplicateFaces = 0;
518 
519  // Find all duplicate faces.
520  forAll(allPatch, bFaceI)
521  {
522  const face& f = allPatch.localFaces()[bFaceI];
523 
524  // Get faces connected to f[0].
525  // Check whether share all points with f.
526  const labelList& pFaces = allPatch.pointFaces()[f[0]];
527 
528  forAll(pFaces, i)
529  {
530  label otherFaceI = pFaces[i];
531 
532  if (otherFaceI > bFaceI)
533  {
534  const face& otherF = allPatch.localFaces()[otherFaceI];
535 
536  if (isDuplicate(f, otherF, true))
537  {
539  (
540  "findDuplicateFaces(const primitiveMesh&"
541  ", const labelList&)"
542  ) << "Face:" << bFaceI + mesh.nInternalFaces()
543  << " has local points:" << f
544  << " which are in same order as face:"
545  << otherFaceI + mesh.nInternalFaces()
546  << " with local points:" << otherF
547  << abort(FatalError);
548  }
549  else if (isDuplicate(f, otherF, false))
550  {
551  label meshFace0 = bFaceI + mesh.nInternalFaces();
552  label meshFace1 = otherFaceI + mesh.nInternalFaces();
553 
554  if
555  (
556  duplicateFace[bFaceI] != -1
557  || duplicateFace[otherFaceI] != -1
558  )
559  {
561  (
562  "findDuplicateFaces(const primitiveMesh&"
563  ", const labelList&)"
564  ) << "One of two duplicate faces already marked"
565  << " as duplicate." << nl
566  << "This means that three or more faces share"
567  << " the same points and this is illegal." << nl
568  << "Face:" << meshFace0
569  << " with local points:" << f
570  << " which are in same order as face:"
571  << meshFace1
572  << " with local points:" << otherF
573  << abort(FatalError);
574  }
575 
576  duplicateFace[bFaceI] = otherFaceI;
577  duplicateFace[otherFaceI] = bFaceI;
578  nDuplicateFaces++;
579  }
580  }
581  }
582  }
583 
584  return duplicateFace;
585 }
586 
587 
589 (
590  const polyMesh& mesh
591 )
592 {
593  const polyBoundaryMesh& patches = mesh.boundaryMesh();
594 
595  // Faces to test: all boundary faces
596  labelList testFaces
597  (
598  identity(mesh.nFaces()-mesh.nInternalFaces())
599  + mesh.nInternalFaces()
600  );
601 
602  // Find correspondencing baffle face (or -1)
603  const labelList duplicateFace(findDuplicateFaces(mesh, testFaces));
604 
605  // Convert into list of coupled face pairs (mesh face labels).
606  DynamicList<labelPair> baffles(testFaces.size());
607 
608  forAll(duplicateFace, i)
609  {
610  label otherFaceI = duplicateFace[i];
611 
612  if (otherFaceI != -1 && i < otherFaceI)
613  {
614  label meshFace0 = testFaces[i];
615  label patch0 = patches.whichPatch(meshFace0);
616  label meshFace1 = testFaces[otherFaceI];
617  label patch1 = patches.whichPatch(meshFace1);
618 
619  // Check for illegal topology. Should normally not happen!
620  if
621  (
622  (patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
623  || (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
624  )
625  {
627  (
628  "localPointRegion::findDuplicateFacePairs(const polyMesh&)"
629  ) << "One of two duplicate faces is on"
630  << " processorPolyPatch."
631  << "This is not allowed." << nl
632  << "Face:" << meshFace0
633  << " is on patch:" << patches[patch0].name()
634  << nl
635  << "Face:" << meshFace1
636  << " is on patch:" << patches[patch1].name()
637  << abort(FatalError);
638  }
639 
640  baffles.append(labelPair(meshFace0, meshFace1));
641  }
642  }
643  return baffles.shrink();
644 }
645 
646 
648 {
649  {
650  Map<label> newMap(meshFaceMap_.size());
651 
652  forAllConstIter(Map<label>, meshFaceMap_, iter)
653  {
654  label newFaceI = map.reverseFaceMap()[iter.key()];
655 
656  if (newFaceI >= 0)
657  {
658  newMap.insert(newFaceI, iter());
659  }
660  }
661  meshFaceMap_.transfer(newMap);
662  }
663  {
664  Map<label> newMap(meshPointMap_.size());
665 
666  forAllConstIter(Map<label>, meshPointMap_, iter)
667  {
668  label newPointI = map.reversePointMap()[iter.key()];
669 
670  if (newPointI >= 0)
671  {
672  newMap.insert(newPointI, iter());
673  }
674  }
675 
676  meshPointMap_.transfer(newMap);
677  }
678 }
679 
680 
681 // ************************************************************************* //
A List with indirect addressing.
Definition: IndirectList.H:102
virtual const pointField & points() const =0
Return mesh points.
label nFaces() const
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:497
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
labelList f(nPoints)
void operator()(face &x, const face &y) const
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
const labelList & reversePointMap() const
Reverse point map.
Definition: mapPolyMesh.H:465
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
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
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Definition: UListI.H:58
label nCells() const
const cellList & cells() const
static void syncBoundaryFaceList(const polyMesh &, UList< T > &, const CombineOp &cop, const TransformOp &top)
Synchronize values on boundary faces only.
virtual const faceList & faces() const =0
Return faces.
Namespace for OpenFOAM.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
patches[0]
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
void clear()
Clear the list, i.e. set size to zero.
Definition: List.C:379
static const char nl
Definition: Ostream.H:260
void setSize(const label)
Reset size of List.
Definition: List.C:318
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void clear()
Clear all entries from table.
Definition: HashTable.C:473
Foam::polyBoundaryMesh.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
#define forAll(list, i)
Definition: UList.H:421
void resize(const label)
Alter the addressed list size.
Definition: DynamicListI.H:222
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
errorManip< error > abort(error &err)
Definition: errorManip.H:131
const word & name() const
Return name.
Definition: IOobject.H:260
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1073
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
A list of faces which address into the list of points.
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
label nInternalFaces() const
void resize(const label)
Alias for setSize(const label)
Definition: ListI.H:50
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
error FatalError
scalar y
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Definition: HashTable.C:518
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
Definition: HashTable.H:106
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Dummy transform to be used with syncTools.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
Definition: UListI.H:65
A List obtained as a section of another List.
Definition: SubList.H:53
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:97
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1060
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Definition: HashTable.C:139
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
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1079
label nPoints() const
defineTypeNameAndDebug(combustionModel, 0)
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const