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 -------------------------------------------------------------------------------
11 License
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"
34 #include "indirectPrimitivePatch.H"
35 #include "dummyTransform.H"
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 defineTypeNameAndDebug(localPointRegion, 0);
43 
44 // Reduction class to get minimum value over face.
46 {
47 public:
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.
69 bool 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
109 void 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 
250 void 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 {
470  const polyBoundaryMesh& patches = mesh.boundaryMesh();
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.
550  indirectPrimitivePatch allPatch
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 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1069
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
Foam::List::resize
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:139
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:63
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
mapPolyMesh.H
globalIndex.H
Foam::labelPairList
List< labelPair > labelPairList
List of labelPairs.
Definition: labelPair.H:64
Foam::syncTools::syncBoundaryFaceList
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.
Definition: syncToolsTemplates.C:998
localPointRegion.H
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:138
dummyTransform.H
Dummy transform to be used with syncTools.
Foam::Map< label >
Foam::boolList
List< bool > boolList
A List of bools.
Definition: List.H:65
Foam::List::append
void append(const T &val)
Append an element at the end of the list.
Definition: ListI.H:175
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:444
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::dummyTransform
Definition: dummyTransform.H:47
polyMesh.H
syncTools.H
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::syncTools::syncPointList
static void syncPointList(const polyMesh &mesh, List< T > &pointValues, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
Definition: syncToolsTemplates.C:721
Foam::primitiveMesh::nPoints
label nPoints() const noexcept
Number of mesh points.
Definition: primitiveMeshI.H:37
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::labelPair
Pair< label > labelPair
A pair of labels.
Definition: Pair.H:54
Foam::localPointRegion::localPointRegion
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
Definition: localPointRegion.C:462
Foam::primitiveMesh::nCells
label nCells() const noexcept
Number of mesh cells.
Definition: primitiveMeshI.H:96
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::List::setSize
void setSize(const label n)
Alias for resize()
Definition: List.H:222
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1107
Foam::List::transfer
void transfer(List< T > &list)
Definition: List.C:456
Foam::IndirectList
A List with indirect addressing.
Definition: IndirectList.H:56
Foam::primitiveMesh::nBoundaryFaces
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Definition: primitiveMeshI.H:84
Foam::polyBoundaryMesh::whichPatch
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Definition: polyBoundaryMesh.C:812
indirectPrimitivePatch.H
newPointi
label newPointi
Definition: readKivaGrid.H:496
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::localPointRegion::findDuplicateFaces
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
Definition: localPointRegion.C:544
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::mapPolyMesh::reverseFaceMap
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:501
Foam::IOobject::name
const word & name() const noexcept
Return name.
Definition: IOobjectI.H:65
Foam::localPointRegion::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: localPointRegion.C:684
Foam::primitiveMesh::isInternalFace
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
Definition: primitiveMeshI.H:103
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1094
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::nl
constexpr char nl
Definition: Ostream.H:404
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
f
labelList f(nPoints)
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
Foam::mapPolyMesh::reversePointMap
const labelList & reversePointMap() const
Reverse point map.
Definition: mapPolyMesh.H:469
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const noexcept
Number of internal faces.
Definition: primitiveMeshI.H:78
Foam::List< bool >
Foam::primitiveMesh::faceCentres
const vectorField & faceCentres() const
Definition: primitiveMeshFaceCentresAndAreas.C:77
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::primitiveMesh::nFaces
label nFaces() const noexcept
Number of mesh faces.
Definition: primitiveMeshI.H:90
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
coupled
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatch.C:330
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::minEqOpFace::operator()
void operator()(face &x, const face &y) const
Definition: localPointRegion.C:49
pFaces
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
Foam::polyMesh::faceNeighbour
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1113
Foam::minEqOpFace
Definition: localPointRegion.C:45
Foam::localPointRegion::findDuplicateFacePairs
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Definition: localPointRegion.C:625
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78