localPointRegion.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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  {
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  << "Face:" << bFacei + mesh.nInternalFaces()
540  << " has local points:" << f
541  << " which are in same order as face:"
542  << otherFacei + mesh.nInternalFaces()
543  << " with local points:" << otherF
544  << abort(FatalError);
545  }
546  else if (isDuplicate(f, otherF, false))
547  {
548  label meshFace0 = bFacei + mesh.nInternalFaces();
549  label meshFace1 = otherFacei + mesh.nInternalFaces();
550 
551  if
552  (
553  duplicateFace[bFacei] != -1
554  || duplicateFace[otherFacei] != -1
555  )
556  {
558  << "One of two duplicate faces already marked"
559  << " as duplicate." << nl
560  << "This means that three or more faces share"
561  << " the same points and this is illegal." << nl
562  << "Face:" << meshFace0
563  << " with local points:" << f
564  << " which are in same order as face:"
565  << meshFace1
566  << " with local points:" << otherF
567  << abort(FatalError);
568  }
569 
570  duplicateFace[bFacei] = otherFacei;
571  duplicateFace[otherFacei] = bFacei;
572  nDuplicateFaces++;
573  }
574  }
575  }
576  }
577 
578  return duplicateFace;
579 }
580 
581 
583 (
584  const polyMesh& mesh
585 )
586 {
587  const polyBoundaryMesh& patches = mesh.boundaryMesh();
588 
589  // Faces to test: all boundary faces
590  labelList testFaces
591  (
592  identity(mesh.nFaces()-mesh.nInternalFaces())
593  + mesh.nInternalFaces()
594  );
595 
596  // Find correspondencing baffle face (or -1)
597  const labelList duplicateFace(findDuplicateFaces(mesh, testFaces));
598 
599  // Convert into list of coupled face pairs (mesh face labels).
600  DynamicList<labelPair> baffles(testFaces.size());
601 
602  forAll(duplicateFace, i)
603  {
604  label otherFacei = duplicateFace[i];
605 
606  if (otherFacei != -1 && i < otherFacei)
607  {
608  label meshFace0 = testFaces[i];
609  label patch0 = patches.whichPatch(meshFace0);
610  label meshFace1 = testFaces[otherFacei];
611  label patch1 = patches.whichPatch(meshFace1);
612 
613  // Check for illegal topology. Should normally not happen!
614  if
615  (
616  (patch0 != -1 && isA<processorPolyPatch>(patches[patch0]))
617  || (patch1 != -1 && isA<processorPolyPatch>(patches[patch1]))
618  )
619  {
621  << "One of two duplicate faces is on"
622  << " processorPolyPatch."
623  << "This is not allowed." << nl
624  << "Face:" << meshFace0
625  << " is on patch:" << patches[patch0].name()
626  << nl
627  << "Face:" << meshFace1
628  << " is on patch:" << patches[patch1].name()
629  << abort(FatalError);
630  }
631 
632  baffles.append(labelPair(meshFace0, meshFace1));
633  }
634  }
635  return baffles.shrink();
636 }
637 
638 
640 {
641  {
642  Map<label> newMap(meshFaceMap_.size());
643 
644  forAllConstIter(Map<label>, meshFaceMap_, iter)
645  {
646  label newFacei = map.reverseFaceMap()[iter.key()];
647 
648  if (newFacei >= 0)
649  {
650  newMap.insert(newFacei, iter());
651  }
652  }
653  meshFaceMap_.transfer(newMap);
654  }
655  {
656  Map<label> newMap(meshPointMap_.size());
657 
658  forAllConstIter(Map<label>, meshPointMap_, iter)
659  {
660  label newPointi = map.reversePointMap()[iter.key()];
661 
662  if (newPointi >= 0)
663  {
664  newMap.insert(newPointi, iter());
665  }
666  }
667 
668  meshPointMap_.transfer(newMap);
669  }
670 }
671 
672 
673 // ************************************************************************* //
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:424
static void syncBoundaryFaceList(const polyMesh &, UList< T > &, const CombineOp &cop, const TransformOp &top, const bool parRun=Pstream::parRun())
Synchronize values on boundary faces only.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
const labelList & reversePointMap() const
Reverse point map.
Definition: mapPolyMesh.H:463
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
const word & name() const
Return name.
Definition: IOobject.H:297
void resize(const label)
Alter the addressed list size.
Definition: DynamicListI.H:204
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
Definition: HashTable.H:110
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
label nInternalFaces() const
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
Definition: UListI.H:65
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1047
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
label nFaces() const
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Definition: UListI.H:58
label nCells() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
virtual const pointField & points() const =0
Return mesh points.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
const cellList & cells() const
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Definition: HashTable.C:513
patches[0]
void resize(const label)
Alias for setSize(const label)
Definition: ListI.H:137
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Dummy transform to be used with syncTools.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Definition: HashTable.C:142
scalar y
A list of faces which address into the list of points.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
A List obtained as a section of another List.
Definition: SubList.H:53
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:124
void clear()
Clear all entries from table.
Definition: HashTable.C:468
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:184
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1041
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1028
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::polyBoundaryMesh.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
static const char nl
Definition: Ostream.H:265
defineTypeNameAndDebug(combustionModel, 0)
labelList f(nPoints)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
Definition: List.C:281
label patchi
label newPointi
Definition: readKivaGrid.H:501
void operator()(face &x, const face &y) const
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
virtual const faceList & faces() const =0
Return faces.
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
label nPoints() const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
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
A List with indirect addressing.
Definition: IndirectList.H:102
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:495
Namespace for OpenFOAM.