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