addPatchCellLayer.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-2024 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 "addPatchCellLayer.H"
27 #include "polyMesh.H"
28 #include "polyTopoChange.H"
29 #include "meshTools.H"
30 #include "polyTopoChangeMap.H"
31 #include "syncTools.H"
32 #include "globalIndex.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
39 }
40 
41 
42 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43 
44 Foam::label Foam::addPatchCellLayer::nbrFace
45 (
46  const labelListList& edgeFaces,
47  const label edgeI,
48  const label facei
49 )
50 {
51  const labelList& eFaces = edgeFaces[edgeI];
52 
53  if (eFaces.size() == 2)
54  {
55  return (eFaces[0] != facei ? eFaces[0] : eFaces[1]);
56  }
57  else
58  {
59  return -1;
60  }
61 }
62 
63 
64 void Foam::addPatchCellLayer::addVertex
65 (
66  const label pointi,
67  face& f,
68  label& fp
69 )
70 {
71  if (fp == 0)
72  {
73  f[fp++] = pointi;
74  }
75  else
76  {
77  if (f[fp-1] != pointi && f[0] != pointi)
78  {
79  f[fp++] = pointi;
80  }
81  }
82 }
83 
84 
85 bool Foam::addPatchCellLayer::sameEdgeNeighbour
86 (
87  const indirectPrimitivePatch& pp,
88  const labelListList& globalEdgeFaces,
89  const boolList& doneEdge,
90  const label thisGlobalFacei,
91  const label nbrGlobalFacei,
92  const label edgeI
93 ) const
94 {
95  const edge& e = pp.edges()[edgeI];
96 
97  return
98  !doneEdge[edgeI] // not yet handled
99  && (
100  addedPoints_[e[0]].size() // is extruded
101  || addedPoints_[e[1]].size()
102  )
103  && (
104  nbrFace(globalEdgeFaces, edgeI, thisGlobalFacei)
105  == nbrGlobalFacei // is to same neighbour
106  );
107 }
108 
109 
110 Foam::labelPair Foam::addPatchCellLayer::getEdgeString
111 (
112  const indirectPrimitivePatch& pp,
113  const labelListList& globalEdgeFaces,
114  const boolList& doneEdge,
115  const label patchFacei,
116  const label globalFacei
117 ) const
118 {
119  const labelList& fEdges = pp.faceEdges()[patchFacei];
120 
121  label startFp = -1;
122  label endFp = -1;
123 
124  // Get edge that hasn't been done yet but needs extrusion
125  forAll(fEdges, fp)
126  {
127  label edgeI = fEdges[fp];
128  const edge& e = pp.edges()[edgeI];
129 
130  if
131  (
132  !doneEdge[edgeI]
133  && ( addedPoints_[e[0]].size() || addedPoints_[e[1]].size() )
134  )
135  {
136  startFp = fp;
137  break;
138  }
139  }
140 
141  if (startFp != -1)
142  {
143  // We found an edge that needs extruding but hasn't been done yet.
144  // Now find the face on the other side
145  label nbrGlobalFacei = nbrFace
146  (
147  globalEdgeFaces,
148  fEdges[startFp],
149  globalFacei
150  );
151 
152  if (nbrGlobalFacei == -1)
153  {
154  // Proper boundary edge. Only extrude single edge.
155  endFp = startFp;
156  }
157  else
158  {
159  // Search back for edge
160  // - which hasn't been handled yet
161  // - with same neighbour
162  // - that needs extrusion
163  while (true)
164  {
165  label prevFp = fEdges.rcIndex(startFp);
166 
167  if
168  (
169  !sameEdgeNeighbour
170  (
171  pp,
172  globalEdgeFaces,
173  doneEdge,
174  globalFacei,
175  nbrGlobalFacei,
176  fEdges[prevFp]
177  )
178  )
179  {
180  break;
181  }
182  startFp = prevFp;
183  }
184 
185  // Search forward for end of string
186  endFp = startFp;
187  while (true)
188  {
189  label nextFp = fEdges.fcIndex(endFp);
190 
191  if
192  (
193  !sameEdgeNeighbour
194  (
195  pp,
196  globalEdgeFaces,
197  doneEdge,
198  globalFacei,
199  nbrGlobalFacei,
200  fEdges[nextFp]
201  )
202  )
203  {
204  break;
205  }
206  endFp = nextFp;
207  }
208  }
209  }
210 
211  return labelPair(startFp, endFp);
212 }
213 
214 
215 Foam::label Foam::addPatchCellLayer::addSideFace
216 (
217  const indirectPrimitivePatch& pp,
218  const labelListList& addedCells, // per pp face the new extruded cell
219  const face& newFace,
220  const label newPatchID,
221 
222  const label ownFacei, // pp face that provides owner
223  const label nbrFacei,
224  const label layerI, // layer
225  const label numEdgeFaces, // number of layers for edge
226  const labelList& meshFaces, // precalculated edgeFaces
227  polyTopoChange& meshMod
228 ) const
229 {
230  label masterFacei = -1;
231  label addedFacei = -1;
232 
233  // Is patch edge external edge of indirectPrimitivePatch?
234  if (nbrFacei == -1)
235  {
236  // External edge so external face.
237 
238  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
239 
240  // Loop over all faces connected to edge and see if we can find a face
241  // that is otherPatchID
242 
243  // Get my mesh face
244  label meshFacei = pp.addressing()[ownFacei];
245 
246  forAll(meshFaces, k)
247  {
248  label facei = meshFaces[k];
249 
250  if
251  (
252  (facei != meshFacei)
253  && (patches.whichPatch(facei) == newPatchID)
254  )
255  {
256  // Found the patch face. Use it to map from
257  masterFacei = facei;
258  break;
259  }
260  }
261 
262  // Determine if different number of layer on owner and neighbour side
263  // (relevant only for coupled faces). See section for internal edge
264  // below.
265 
266  label layerOwn;
267 
268  if (addedCells[ownFacei].size() < numEdgeFaces)
269  {
270  label offset = numEdgeFaces - addedCells[ownFacei].size();
271  if (layerI <= offset)
272  {
273  layerOwn = 0;
274  }
275  else
276  {
277  layerOwn = layerI - offset;
278  }
279  }
280  else
281  {
282  layerOwn = layerI;
283  }
284 
285  addedFacei = meshMod.addFace
286  (
287  newFace, // face
288  addedCells[ownFacei][layerOwn], // owner
289  -1, // neighbour
290  masterFacei, // master face
291  false, // flux flip
292  newPatchID // patch for face
293  );
294  }
295  else
296  {
297  // When adding side faces we need to modify neighbour and owners
298  // in region where layer mesh is stopped. Determine which side
299  // has max number of faces and make sure layers match closest to
300  // original pp if there are different number of layers.
301 
302  label layerNbr;
303  label layerOwn;
304 
305  if (addedCells[ownFacei].size() > addedCells[nbrFacei].size())
306  {
307  label offset =
308  addedCells[ownFacei].size() - addedCells[nbrFacei].size();
309 
310  layerOwn = layerI;
311 
312  if (layerI <= offset)
313  {
314  layerNbr = 0;
315  }
316  else
317  {
318  layerNbr = layerI - offset;
319  }
320  }
321  else if (addedCells[nbrFacei].size() > addedCells[ownFacei].size())
322  {
323  label offset =
324  addedCells[nbrFacei].size() - addedCells[ownFacei].size();
325 
326  layerNbr = layerI;
327 
328  if (layerI <= offset)
329  {
330  layerOwn = 0;
331  }
332  else
333  {
334  layerOwn = layerI - offset;
335  }
336  }
337  else
338  {
339  // Same number of layers on both sides.
340  layerNbr = layerI;
341  layerOwn = layerI;
342  }
343 
344  addedFacei = meshMod.addFace
345  (
346  newFace, // face
347  addedCells[ownFacei][layerOwn], // owner
348  addedCells[nbrFacei][layerNbr], // neighbour
349  -1, // master face
350  false, // flux flip
351  -1 // patch for face
352  );
353  }
354 
355  return addedFacei;
356 }
357 
358 
359 Foam::label Foam::addPatchCellLayer::findProcPatch
360 (
361  const polyMesh& mesh,
362  const label nbrProcID
363 )
364 {
365  const polyBoundaryMesh& patches = mesh.boundaryMesh();
366 
367  forAll(mesh.globalData().processorPatches(), i)
368  {
369  label patchi = mesh.globalData().processorPatches()[i];
370 
371  if
372  (
373  refCast<const processorPolyPatch>(patches[patchi]).neighbProcNo()
374  == nbrProcID
375  )
376  {
377  return patchi;
378  }
379  }
380  return -1;
381 }
382 
383 
384 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
385 
387 (
388  const polyMesh& mesh,
389  const bool addToMesh
390 )
391 :
392  mesh_(mesh),
393  addToMesh_(addToMesh),
394  addedPoints_(0),
395  pointZonesAddedPoints_(mesh.pointZones().size()),
396  cellZonesAddedCells_(mesh.cellZones().size()),
397  layerFaces_(0)
398 {}
399 
400 
401 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
402 
404 (
405  const polyMesh& mesh,
406  const labelListList& layerFaces
407 )
408 {
409  labelListList layerCells(layerFaces.size());
410 
411  forAll(layerFaces, patchFacei)
412  {
413  const labelList& faceLabels = layerFaces[patchFacei];
414 
415  if (faceLabels.size())
416  {
417  labelList& added = layerCells[patchFacei];
418  added.setSize(faceLabels.size()-1);
419 
420  for (label i = 0; i < faceLabels.size()-1; i++)
421  {
422  added[i] = mesh.faceNeighbour()[faceLabels[i]];
423  }
424  }
425  }
426  return layerCells;
427 }
428 
429 
431 {
432  return addedCells(mesh_, layerFaces_);
433 }
434 
435 
437 (
438  const polyMesh& mesh,
439  const globalIndex& globalFaces,
440  const indirectPrimitivePatch& pp
441 )
442 {
443  // Precalculate mesh edges for pp.edges.
444  const labelList meshEdges(pp.meshEdges(mesh.edges(), mesh.pointEdges()));
445 
446  // From mesh edge to global face labels. Non-empty sublists only for
447  // pp edges.
448  labelListList globalEdgeFaces(mesh.nEdges());
449 
450  const labelListList& edgeFaces = pp.edgeFaces();
451 
452  forAll(edgeFaces, edgeI)
453  {
454  label meshEdgeI = meshEdges[edgeI];
455 
456  const labelList& eFaces = edgeFaces[edgeI];
457 
458  // Store face and processor as unique tag.
459  labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
460  globalEFaces.setSize(eFaces.size());
461  forAll(eFaces, i)
462  {
463  globalEFaces[i] = globalFaces.toGlobal(pp.addressing()[eFaces[i]]);
464  }
465  }
466 
467  // Synchronise across coupled edges.
469  (
470  mesh,
471  globalEdgeFaces,
472  uniqueEqOp(),
473  labelList() // null value
474  );
475 
476  // Extract pp part
477  return labelListList(UIndirectList<labelList>(globalEdgeFaces, meshEdges));
478 }
479 
480 
482 (
483  const polyMesh& mesh,
484  const globalIndex& globalFaces,
485  const labelListList& globalEdgeFaces,
486  const indirectPrimitivePatch& pp,
487 
488  labelList& sidePatchID,
489  label& nPatches,
490  Map<label>& nbrProcToPatch,
491  Map<label>& patchToNbrProc
492 )
493 {
494  const polyBoundaryMesh& patches = mesh.boundaryMesh();
495 
496  // Precalculate mesh edges for pp.edges.
497  const labelList meshEdges(pp.meshEdges(mesh.edges(), mesh.pointEdges()));
498 
499  sidePatchID.setSize(pp.nEdges());
500  sidePatchID = -1;
501 
502  // These also get determined but not (yet) exported:
503  // - whether face is created from other face or edge
504  // - what zone&orientation face should have
505 
506  labelList masterFacei(pp.nEdges(), -1);
507 
508  nPatches = patches.size();
509 
510  forAll(globalEdgeFaces, edgeI)
511  {
512  const labelList& eGlobalFaces = globalEdgeFaces[edgeI];
513  if
514  (
515  eGlobalFaces.size() == 2
516  && pp.edgeFaces()[edgeI].size() == 1
517  )
518  {
519  // Locally but not globally a boundary edge. Hence a coupled
520  // edge. Find the patch to use if on different
521  // processors.
522 
523  label f0 = eGlobalFaces[0];
524  label f1 = eGlobalFaces[1];
525 
526  label otherProci = -1;
527  if (globalFaces.isLocal(f0) && !globalFaces.isLocal(f1))
528  {
529  otherProci = globalFaces.whichProcID(f1);
530  }
531  else if (!globalFaces.isLocal(f0) && globalFaces.isLocal(f1))
532  {
533  otherProci = globalFaces.whichProcID(f0);
534  }
535 
536 
537  if (otherProci != -1)
538  {
539  sidePatchID[edgeI] = findProcPatch(mesh, otherProci);
540  if (sidePatchID[edgeI] == -1)
541  {
542  // Cannot find a patch to processor. See if already
543  // marked for addition
544  if (nbrProcToPatch.found(otherProci))
545  {
546  sidePatchID[edgeI] = nbrProcToPatch[otherProci];
547  }
548  else
549  {
550  sidePatchID[edgeI] = nPatches;
551  nbrProcToPatch.insert(otherProci, nPatches);
552  patchToNbrProc.insert(nPatches, otherProci);
553  nPatches++;
554  }
555  }
556  }
557  }
558  }
559 
560 
561 
562  // Determine face properties for all other boundary edges
563  // ------------------------------------------------------
564 
565  const labelListList& edgeFaces = pp.edgeFaces();
566 
567  DynamicList<label> dynMeshEdgeFaces;
568 
569  forAll(edgeFaces, edgeI)
570  {
571  if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
572  {
573  // Proper, uncoupled patch edge.
574 
575  label myFacei = pp.addressing()[edgeFaces[edgeI][0]];
576 
577  // Pick up any boundary face on this edge and use its properties
578  label meshEdgeI = meshEdges[edgeI];
579  const labelList& meshFaces = mesh.edgeFaces
580  (
581  meshEdgeI,
582  dynMeshEdgeFaces
583  );
584 
585  forAll(meshFaces, k)
586  {
587  label facei = meshFaces[k];
588 
589  if (facei != myFacei && !mesh.isInternalFace(facei))
590  {
591  sidePatchID[edgeI] = mesh.boundaryMesh().whichPatch(facei);
592  masterFacei[edgeI] = facei;
593 
594  break;
595  }
596  }
597  }
598  }
599 
600 
601  // Now hopefully every boundary edge has a side patch. Check
602  if (debug)
603  {
604  forAll(edgeFaces, edgeI)
605  {
606  if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
607  {
608  const edge& e = pp.edges()[edgeI];
610  << "Have no sidePatchID for edge " << edgeI << " points "
611  << pp.points()[pp.meshPoints()[e[0]]]
612  << pp.points()[pp.meshPoints()[e[1]]]
613  << endl;
614  }
615  }
616  }
617 
618 
619  // Now we have sidepatch see if we have patchface or edge to map from
620  forAll(edgeFaces, edgeI)
621  {
622  if
623  (
624  edgeFaces[edgeI].size() == 1
625  && sidePatchID[edgeI] != -1
626  && masterFacei[edgeI] == -1
627  )
628  {
629  // 1. Do we have a boundary face to map from
630 
631  label myFacei = pp.addressing()[edgeFaces[edgeI][0]];
632 
633  // Pick up any boundary face on this edge and use its properties
634  label meshEdgeI = meshEdges[edgeI];
635  const labelList& meshFaces = mesh.edgeFaces
636  (
637  meshEdgeI,
638  dynMeshEdgeFaces
639  );
640 
641  forAll(meshFaces, k)
642  {
643  const label facei = meshFaces[k];
644 
645  if
646  (
647  facei != myFacei
648  && !mesh.isInternalFace(facei)
649  && patches.whichPatch(facei) == sidePatchID[edgeI]
650  )
651  {
652  sidePatchID[edgeI] = mesh.boundaryMesh().whichPatch(facei);
653  masterFacei[edgeI] = facei;
654  break;
655  }
656  }
657  }
658  }
659 }
660 
661 
663 (
664  const globalIndex& globalFaces,
665  const labelListList& globalEdgeFaces,
666  const scalarField& expansionRatio,
667  const indirectPrimitivePatch& pp,
668  const labelList& sidePatchID,
669  const labelList& exposedPatchID,
670  const labelList& nFaceLayers,
671  const labelList& nPointLayers,
672  const vectorField& firstLayerDisp,
673  const labelList& faceCellZones,
674  polyTopoChange& meshMod
675 )
676 {
677  if (debug)
678  {
679  Pout<< "addPatchCellLayer::setRefinement : Adding up to "
680  << gMax(nPointLayers)
681  << " layers of cells to indirectPrimitivePatch with "
682  << pp.nPoints() << " points" << endl;
683  }
684 
685  if
686  (
687  pp.nPoints() != firstLayerDisp.size()
688  || pp.nPoints() != nPointLayers.size()
689  || pp.size() != nFaceLayers.size()
690  )
691  {
693  << "Size of new points is not same as number of points used by"
694  << " the face subset" << endl
695  << " patch.nPoints:" << pp.nPoints()
696  << " displacement:" << firstLayerDisp.size()
697  << " nPointLayers:" << nPointLayers.size() << nl
698  << " patch.nFaces:" << pp.size()
699  << " nFaceLayers:" << nFaceLayers.size()
700  << abort(FatalError);
701  }
702 
703  forAll(nPointLayers, i)
704  {
705  if (nPointLayers[i] < 0)
706  {
708  << "Illegal number of layers " << nPointLayers[i]
709  << " at patch point " << i << abort(FatalError);
710  }
711  }
712  forAll(nFaceLayers, i)
713  {
714  if (nFaceLayers[i] < 0)
715  {
717  << "Illegal number of layers " << nFaceLayers[i]
718  << " at patch face " << i << abort(FatalError);
719  }
720  }
721 
722  forAll(globalEdgeFaces, edgeI)
723  {
724  if (globalEdgeFaces[edgeI].size() > 2)
725  {
726  const edge& e = pp.edges()[edgeI];
727 
728  if (nPointLayers[e[0]] > 0 || nPointLayers[e[1]] > 0)
729  {
731  << "Trying to extrude edge "
732  << e.line(pp.localPoints())
733  << " which is non-manifold (has "
734  << globalEdgeFaces[edgeI].size()
735  << " faces using it)"
736  << abort(FatalError);
737  }
738  }
739  }
740 
741 
742  const labelList& meshPoints = pp.meshPoints();
743 
744  // Some storage for edge-face-addressing.
746 
747  // Precalculate mesh edges for pp.edges.
748  const labelList meshEdges(pp.meshEdges(mesh_.edges(), mesh_.pointEdges()));
749 
750  if (debug)
751  {
752  // Check synchronisation
753  // ~~~~~~~~~~~~~~~~~~~~~
754 
755  {
756  labelList n(mesh_.nPoints(), 0);
757  UIndirectList<label>(n, meshPoints) = nPointLayers;
759 
760  // Non-synced
761  forAll(meshPoints, i)
762  {
763  label meshPointi = meshPoints[i];
764 
765  if (n[meshPointi] != nPointLayers[i])
766  {
768  << "At mesh point:" << meshPointi
769  << " coordinate:" << mesh_.points()[meshPointi]
770  << " specified nLayers:" << nPointLayers[i] << endl
771  << "On coupled point a different nLayers:"
772  << n[meshPointi] << " was specified."
773  << abort(FatalError);
774  }
775  }
776 
777 
778  // Check that nPointLayers equals the max layers of connected faces
779  // (or 0). Anything else makes no sense.
780  labelList nFromFace(mesh_.nPoints(), 0);
781  forAll(nFaceLayers, i)
782  {
783  const face& f = pp[i];
784 
785  forAll(f, fp)
786  {
787  label pointi = f[fp];
788 
789  nFromFace[pointi] = max(nFromFace[pointi], nFaceLayers[i]);
790  }
791  }
793  (
794  mesh_,
795  nFromFace,
796  maxEqOp<label>(),
797  label(0)
798  );
799 
800  forAll(nPointLayers, i)
801  {
802  label meshPointi = meshPoints[i];
803 
804  if
805  (
806  nPointLayers[i] > 0
807  && nPointLayers[i] != nFromFace[meshPointi]
808  )
809  {
811  << "At mesh point:" << meshPointi
812  << " coordinate:" << mesh_.points()[meshPointi]
813  << " specified nLayers:" << nPointLayers[i] << endl
814  << "but the max nLayers of surrounding faces is:"
815  << nFromFace[meshPointi]
816  << abort(FatalError);
817  }
818  }
819  }
820 
821  {
822  pointField d(mesh_.nPoints(), vector::max);
823  UIndirectList<point>(d, meshPoints) = firstLayerDisp;
825  (
826  mesh_,
827  d,
828  minEqOp<vector>(),
830  );
831 
832  forAll(meshPoints, i)
833  {
834  label meshPointi = meshPoints[i];
835 
836  if (mag(d[meshPointi] - firstLayerDisp[i]) > small)
837  {
839  << "At mesh point:" << meshPointi
840  << " coordinate:" << mesh_.points()[meshPointi]
841  << " specified displacement:" << firstLayerDisp[i]
842  << endl
843  << "On coupled point a different displacement:"
844  << d[meshPointi] << " was specified."
845  << abort(FatalError);
846  }
847  }
848  }
849 
850  // Check that edges of pp (so ones that become boundary faces)
851  // connect to only one boundary face. Guarantees uniqueness of
852  // patch that they go into so if this is a coupled patch both
853  // sides decide the same.
854  // ~~~~~~~~~~~~~~~~~~~~~~
855 
856  for (label edgeI = pp.nInternalEdges(); edgeI < pp.nEdges(); edgeI++)
857  {
858  const edge& e = pp.edges()[edgeI];
859 
860  if (nPointLayers[e[0]] > 0 || nPointLayers[e[1]] > 0)
861  {
862  // Edge is to become a face
863 
864  const labelList& eFaces = pp.edgeFaces()[edgeI];
865 
866  // First check: pp should be single connected.
867  if (eFaces.size() != 1)
868  {
870  << "boundary-edge-to-be-extruded:"
871  << pp.points()[meshPoints[e[0]]]
872  << pp.points()[meshPoints[e[1]]]
873  << " has more than two faces using it:" << eFaces
874  << abort(FatalError);
875  }
876 
877  label myFacei = pp.addressing()[eFaces[0]];
878 
879  label meshEdgeI = meshEdges[edgeI];
880 
881  // Mesh faces using edge
882  const labelList& meshFaces = mesh_.edgeFaces(meshEdgeI, ef);
883 
884  // Check that there is only one patchface using edge.
885  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
886 
887  label bFacei = -1;
888 
889  forAll(meshFaces, i)
890  {
891  label facei = meshFaces[i];
892 
893  if (facei != myFacei)
894  {
895  if (!mesh_.isInternalFace(facei))
896  {
897  if (bFacei == -1)
898  {
899  bFacei = facei;
900  }
901  else
902  {
904  << "boundary-edge-to-be-extruded:"
905  << pp.points()[meshPoints[e[0]]]
906  << pp.points()[meshPoints[e[1]]]
907  << " has more than two boundary faces"
908  << " using it:"
909  << bFacei << " fc:"
910  << mesh_.faceCentres()[bFacei]
911  << " patch:" << patches.whichPatch(bFacei)
912  << " and " << facei << " fc:"
913  << mesh_.faceCentres()[facei]
914  << " patch:" << patches.whichPatch(facei)
915  << abort(FatalError);
916  }
917  }
918  }
919  }
920  }
921  }
922  }
923 
924 
925  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
926 
927  // Precalculated patchID for each patch face
928  labelList patchID(pp.size());
929 
930  forAll(pp, patchFacei)
931  {
932  label meshFacei = pp.addressing()[patchFacei];
933 
934  patchID[patchFacei] = patches.whichPatch(meshFacei);
935  }
936 
937 
938  // From master point (in patch point label) to added points (in mesh point
939  // label)
940  addedPoints_.setSize(pp.nPoints());
941 
942  // Mark points that do not get extruded by setting size of addedPoints_ to 0
943  label nTruncated = 0;
944 
945  forAll(nPointLayers, patchPointi)
946  {
947  if (nPointLayers[patchPointi] > 0)
948  {
949  addedPoints_[patchPointi].setSize(nPointLayers[patchPointi]);
950  }
951  else
952  {
953  nTruncated++;
954  }
955  }
956 
957  if (debug)
958  {
959  Pout<< "Not adding points at " << nTruncated << " out of "
960  << pp.nPoints() << " points" << endl;
961  }
962 
963 
964  //
965  // Create new points
966  //
967 
968  // If creating new mesh: copy existing patch points
969  labelList copiedPatchPoints;
970  if (!addToMesh_)
971  {
972  copiedPatchPoints.setSize(firstLayerDisp.size());
973  forAll(firstLayerDisp, patchPointi)
974  {
975  if (addedPoints_[patchPointi].size())
976  {
977  const label meshPointi = meshPoints[patchPointi];
978 
979  copiedPatchPoints[patchPointi] = meshMod.addPoint
980  (
981  mesh_.points()[meshPointi], // point
982  -1, // master point
983  true // supports a cell
984  );
985 
986  forAll(mesh_.pointZones(), zonei)
987  {
988  if (mesh_.pointZones()[zonei].localIndex(meshPointi) != -1)
989  {
990  pointZonesAddedPoints_[zonei].insert
991  (
992  copiedPatchPoints[patchPointi]
993  );
994  }
995  }
996  }
997  }
998  }
999 
1000 
1001  // Create points for additional layers
1002  forAll(firstLayerDisp, patchPointi)
1003  {
1004  if (addedPoints_[patchPointi].size())
1005  {
1006  const label meshPointi = meshPoints[patchPointi];
1007 
1008  point pt = mesh_.points()[meshPointi];
1009  vector disp = firstLayerDisp[patchPointi];
1010 
1011  const labelList zones(mesh_.pointZones().whichZones(meshPointi));
1012 
1013  forAll(addedPoints_[patchPointi], i)
1014  {
1015  pt += disp;
1016 
1017  const label addedVertI = meshMod.addPoint
1018  (
1019  pt, // point
1020  (addToMesh_ ? meshPointi : -1), // master point
1021  true // supports a cell
1022  );
1023 
1024  addedPoints_[patchPointi][i] = addedVertI;
1025 
1026  forAll(zones, zonei)
1027  {
1028  pointZonesAddedPoints_[zonei].insert(addedVertI);
1029  }
1030 
1031  disp *= expansionRatio[patchPointi];
1032  }
1033  }
1034  }
1035 
1036 
1037  //
1038  // Add cells to all boundaryFaces
1039  //
1040 
1041  labelListList addedCells(pp.size());
1042 
1043  forAll(pp, patchFacei)
1044  {
1045  if (nFaceLayers[patchFacei] > 0)
1046  {
1047  addedCells[patchFacei].setSize(nFaceLayers[patchFacei]);
1048 
1049  const label meshFacei = pp.addressing()[patchFacei];
1050 
1051  const labelList ownZones
1052  (
1053  mesh_.cellZones().whichZones(mesh_.faceOwner()[meshFacei])
1054  );
1055 
1056  for (label i = 0; i < nFaceLayers[patchFacei]; i++)
1057  {
1058  // Note: add from cell (owner of patch face) or from face?
1059  // for now add from cell so we can map easily.
1060  addedCells[patchFacei][i] = meshMod.addCell
1061  (
1062  (addToMesh_ ? mesh_.faceOwner()[meshFacei] : -1)
1063  );
1064 
1065  forAll(ownZones, zonei)
1066  {
1067  cellZonesAddedCells_[ownZones[zonei]].insert
1068  (
1069  addedCells[patchFacei][i]
1070  );
1071  }
1072 
1073  if (faceCellZones.size() && faceCellZones[patchFacei] != -1)
1074  {
1075  cellZonesAddedCells_[faceCellZones[patchFacei]].insert
1076  (
1077  addedCells[patchFacei][i]
1078  );
1079  }
1080  }
1081  }
1082  }
1083 
1084 
1085  // Create faces on top of the original patch faces.
1086  // These faces are created from original patch faces outwards so in order
1087  // of increasing cell number. So orientation should be same as original
1088  // patch face for them to have owner<neighbour.
1089 
1090  layerFaces_.setSize(pp.size());
1091 
1092  forAll(pp.localFaces(), patchFacei)
1093  {
1094  label meshFacei = pp.addressing()[patchFacei];
1095 
1096  if (addedCells[patchFacei].size())
1097  {
1098  layerFaces_[patchFacei].setSize(addedCells[patchFacei].size() + 1);
1099 
1100  // Get duplicated vertices on the patch face.
1101  const face& f = pp.localFaces()[patchFacei];
1102 
1103  face newFace(f.size());
1104 
1105  forAll(addedCells[patchFacei], i)
1106  {
1107  forAll(f, fp)
1108  {
1109  if (addedPoints_[f[fp]].empty())
1110  {
1111  // Keep original point
1112  newFace[fp] =
1113  (
1114  addToMesh_
1115  ? meshPoints[f[fp]]
1116  : copiedPatchPoints[f[fp]]
1117  );
1118  }
1119  else
1120  {
1121  // Get new outside point
1122  label offset =
1123  addedPoints_[f[fp]].size()
1124  - addedCells[patchFacei].size();
1125  newFace[fp] = addedPoints_[f[fp]][i+offset];
1126  }
1127  }
1128 
1129 
1130  // Get new neighbour
1131  label nei;
1132  label patchi;
1133 
1134  if (i == addedCells[patchFacei].size()-1)
1135  {
1136  // Top layer so is patch face.
1137  nei = -1;
1138  patchi = patchID[patchFacei];
1139  }
1140  else
1141  {
1142  // Internal face between layer i and i+1
1143  nei = addedCells[patchFacei][i+1];
1144  patchi = -1;
1145  }
1146 
1147  layerFaces_[patchFacei][i+1] = meshMod.addFace
1148  (
1149  newFace, // face
1150  addedCells[patchFacei][i], // owner
1151  nei, // neighbour
1152  (addToMesh_ ? meshFacei : -1), // master face
1153  false, // flux flip
1154  patchi // patch for face
1155  );
1156  }
1157  }
1158  }
1159 
1160  //
1161  // Modify old patch faces to be on the inside
1162  //
1163 
1164  if (addToMesh_)
1165  {
1166  forAll(pp, patchFacei)
1167  {
1168  if (addedCells[patchFacei].size())
1169  {
1170  label meshFacei = pp.addressing()[patchFacei];
1171 
1172  layerFaces_[patchFacei][0] = meshFacei;
1173 
1174  meshMod.modifyFace
1175  (
1176  pp[patchFacei], // modified face
1177  meshFacei, // label of face
1178  mesh_.faceOwner()[meshFacei], // owner
1179  addedCells[patchFacei][0], // neighbour
1180  false, // face flip
1181  -1 // patch for face
1182  );
1183  }
1184  }
1185  }
1186  else
1187  {
1188  // If creating new mesh: reverse original faces and put them
1189  // in the exposed patch ID.
1190  forAll(pp, patchFacei)
1191  {
1192  if (nFaceLayers[patchFacei] > 0)
1193  {
1194  // Reverse and renumber old patch face.
1195  face f(pp.localFaces()[patchFacei].reverseFace());
1196  forAll(f, fp)
1197  {
1198  f[fp] = copiedPatchPoints[f[fp]];
1199  }
1200 
1201  layerFaces_[patchFacei][0] = meshMod.addFace
1202  (
1203  f, // modified face
1204  addedCells[patchFacei][0], // owner
1205  -1, // neighbour
1206  -1, // masterFace
1207  true, // face flip
1208  exposedPatchID[patchFacei] // patch for face
1209  );
1210  }
1211  }
1212  }
1213 
1214 
1215 
1216  //
1217  // Create 'side' faces, one per edge that is being extended.
1218  //
1219 
1220  const labelListList& faceEdges = pp.faceEdges();
1221  const faceList& localFaces = pp.localFaces();
1222  const edgeList& edges = pp.edges();
1223 
1224  // Get number of layers per edge. This is 0 if edge is not extruded;
1225  // max of connected faces otherwise.
1226  labelList edgeLayers(pp.nEdges());
1227 
1228  {
1229  // Use list over mesh.nEdges() since syncTools does not yet support
1230  // partial list synchronisation.
1231  labelList meshEdgeLayers(mesh_.nEdges(), -1);
1232 
1233  forAll(meshEdges, edgeI)
1234  {
1235  const edge& e = edges[edgeI];
1236 
1237  label meshEdgeI = meshEdges[edgeI];
1238 
1239  if ((nPointLayers[e[0]] == 0) && (nPointLayers[e[1]] == 0))
1240  {
1241  meshEdgeLayers[meshEdgeI] = 0;
1242  }
1243  else
1244  {
1245  const labelList& eFaces = pp.edgeFaces()[edgeI];
1246 
1247  forAll(eFaces, i)
1248  {
1249  meshEdgeLayers[meshEdgeI] = max
1250  (
1251  nFaceLayers[eFaces[i]],
1252  meshEdgeLayers[meshEdgeI]
1253  );
1254  }
1255  }
1256  }
1257 
1259  (
1260  mesh_,
1261  meshEdgeLayers,
1262  maxEqOp<label>(),
1263  label(0) // initial value
1264  );
1265 
1266  forAll(meshEdges, edgeI)
1267  {
1268  edgeLayers[edgeI] = meshEdgeLayers[meshEdges[edgeI]];
1269  }
1270  }
1271 
1272 
1273  // Mark off which edges have been extruded
1274  boolList doneEdge(pp.nEdges(), false);
1275 
1276 
1277  // Create faces. Per face walk connected edges and find string of edges
1278  // between the same two faces and extrude string into a single face.
1279  forAll(pp, patchFacei)
1280  {
1281  const labelList& fEdges = faceEdges[patchFacei];
1282 
1283  forAll(fEdges, fp)
1284  {
1285  // Get string of edges that needs to be extruded as a single face.
1286  // Returned as indices in fEdges.
1287  labelPair indexPair
1288  (
1289  getEdgeString
1290  (
1291  pp,
1292  globalEdgeFaces,
1293  doneEdge,
1294  patchFacei,
1295  globalFaces.toGlobal(pp.addressing()[patchFacei])
1296  )
1297  );
1298 
1299  // Pout<< "Found unextruded edges in edges:" << fEdges
1300  // << " start:" << indexPair[0]
1301  // << " end:" << indexPair[1]
1302  // << endl;
1303 
1304  const label startFp = indexPair[0];
1305  const label endFp = indexPair[1];
1306 
1307  if (startFp != -1)
1308  {
1309  // Extrude edges from indexPair[0] up to indexPair[1]
1310  // (note indexPair = indices of edges. There is one more vertex
1311  // than edges)
1312  const face& f = localFaces[patchFacei];
1313 
1314  labelList stringedVerts;
1315  if (endFp >= startFp)
1316  {
1317  stringedVerts.setSize(endFp-startFp+2);
1318  }
1319  else
1320  {
1321  stringedVerts.setSize(endFp+f.size()-startFp+2);
1322  }
1323 
1324  label fp = startFp;
1325 
1326  for (label i = 0; i < stringedVerts.size()-1; i++)
1327  {
1328  stringedVerts[i] = f[fp];
1329  doneEdge[fEdges[fp]] = true;
1330  fp = f.fcIndex(fp);
1331  }
1332  stringedVerts.last() = f[fp];
1333 
1334 
1335  // Now stringedVerts contains the vertices in order of face f.
1336  // This is consistent with the order if f becomes the owner cell
1337  // and nbrFacei the neighbour cell. Note that the cells get
1338  // added in order of pp so we can just use face ordering and
1339  // because we loop in incrementing order as well we will
1340  // always have nbrFacei > patchFacei.
1341 
1342  label startEdgeI = fEdges[startFp];
1343 
1344  label meshEdgeI = meshEdges[startEdgeI];
1345 
1346  label numEdgeSideFaces = edgeLayers[startEdgeI];
1347 
1348  for (label i = 0; i < numEdgeSideFaces; i++)
1349  {
1350  label vEnd = stringedVerts.last();
1351  label vStart = stringedVerts[0];
1352 
1353  // calculate number of points making up a face
1354  label newFp = 2*stringedVerts.size();
1355 
1356  if (i == 0)
1357  {
1358  // layer 0 gets all the truncation of neighbouring
1359  // faces with more layers.
1360  if (addedPoints_[vEnd].size())
1361  {
1362  newFp +=
1363  addedPoints_[vEnd].size() - numEdgeSideFaces;
1364  }
1365  if (addedPoints_[vStart].size())
1366  {
1367  newFp +=
1368  addedPoints_[vStart].size() - numEdgeSideFaces;
1369  }
1370  }
1371 
1372  face newFace(newFp);
1373 
1374  newFp = 0;
1375 
1376  // For layer 0 get pp points, for all other layers get
1377  // points of layer-1.
1378  if (i == 0)
1379  {
1380  forAll(stringedVerts, stringedI)
1381  {
1382  label v = stringedVerts[stringedI];
1383  addVertex
1384  (
1385  (
1386  addToMesh_
1387  ? meshPoints[v]
1388  : copiedPatchPoints[v]
1389  ),
1390  newFace,
1391  newFp
1392  );
1393  }
1394  }
1395  else
1396  {
1397  forAll(stringedVerts, stringedI)
1398  {
1399  label v = stringedVerts[stringedI];
1400  if (addedPoints_[v].size())
1401  {
1402  label offset =
1403  addedPoints_[v].size() - numEdgeSideFaces;
1404  addVertex
1405  (
1406  addedPoints_[v][i+offset-1],
1407  newFace,
1408  newFp
1409  );
1410  }
1411  else
1412  {
1413  addVertex
1414  (
1415  (
1416  addToMesh_
1417  ? meshPoints[v]
1418  : copiedPatchPoints[v]
1419  ),
1420  newFace,
1421  newFp
1422  );
1423  }
1424  }
1425  }
1426 
1427  // add points between stringed vertices (end)
1428  if (numEdgeSideFaces < addedPoints_[vEnd].size())
1429  {
1430  if (i == 0 && addedPoints_[vEnd].size())
1431  {
1432  label offset =
1433  addedPoints_[vEnd].size() - numEdgeSideFaces;
1434  for (label ioff = 0; ioff < offset; ioff++)
1435  {
1436  addVertex
1437  (
1438  addedPoints_[vEnd][ioff],
1439  newFace,
1440  newFp
1441  );
1442  }
1443  }
1444  }
1445 
1446  forAllReverse(stringedVerts, stringedI)
1447  {
1448  label v = stringedVerts[stringedI];
1449  if (addedPoints_[v].size())
1450  {
1451  label offset =
1452  addedPoints_[v].size() - numEdgeSideFaces;
1453  addVertex
1454  (
1455  addedPoints_[v][i+offset],
1456  newFace,
1457  newFp
1458  );
1459  }
1460  else
1461  {
1462  addVertex
1463  (
1464  (
1465  addToMesh_
1466  ? meshPoints[v]
1467  : copiedPatchPoints[v]
1468  ),
1469  newFace,
1470  newFp
1471  );
1472  }
1473  }
1474 
1475 
1476  // add points between stringed vertices (start)
1477  if (numEdgeSideFaces < addedPoints_[vStart].size())
1478  {
1479  if (i == 0 && addedPoints_[vStart].size())
1480  {
1481  label offset =
1482  addedPoints_[vStart].size() - numEdgeSideFaces;
1483  for (label ioff = offset-1; ioff >= 0; ioff--)
1484  {
1485  addVertex
1486  (
1487  addedPoints_[vStart][ioff],
1488  newFace,
1489  newFp
1490  );
1491  }
1492  }
1493  }
1494 
1495  if (newFp >= 3)
1496  {
1497  // Add face in between faces patchFacei and nbrFacei
1498  // (possibly -1 for external edges)
1499 
1500  newFace.setSize(newFp);
1501 
1502  if (debug)
1503  {
1504  labelHashSet verts(2*newFace.size());
1505  forAll(newFace, fp)
1506  {
1507  if (!verts.insert(newFace[fp]))
1508  {
1510  << "Duplicate vertex in face"
1511  << " to be added." << nl
1512  << "newFace:" << newFace << nl
1513  << "points:"
1515  (
1516  meshMod.points(),
1517  newFace
1518  ) << nl
1519  << "Layer:" << i
1520  << " out of:" << numEdgeSideFaces << nl
1521  << "ExtrudeEdge:" << meshEdgeI
1522  << " at:"
1523  << mesh_.edges()[meshEdgeI].line
1524  (
1525  mesh_.points()
1526  ) << nl
1527  << "string:" << stringedVerts
1528  << "stringpoints:"
1530  (
1531  pp.localPoints(),
1532  stringedVerts
1533  ) << nl
1534  << "stringNLayers:"
1536  (
1537  nPointLayers,
1538  stringedVerts
1539  ) << nl
1540  << abort(FatalError);
1541  }
1542  }
1543  }
1544 
1545  label nbrFacei = nbrFace
1546  (
1547  pp.edgeFaces(),
1548  startEdgeI,
1549  patchFacei
1550  );
1551 
1552  const labelList& meshFaces = mesh_.edgeFaces
1553  (
1554  meshEdgeI,
1555  ef
1556  );
1557 
1558  addSideFace
1559  (
1560  pp,
1561  addedCells,
1562 
1563  newFace, // vertices of new face
1564  sidePatchID[startEdgeI],// -1 or patch for face
1565 
1566  patchFacei,
1567  nbrFacei,
1568  i, // layer
1569  numEdgeSideFaces, // num layers
1570  meshFaces, // edgeFaces
1571  meshMod
1572  );
1573  }
1574  }
1575  }
1576  }
1577  }
1578 }
1579 
1580 
1582 (
1583  const polyTopoChangeMap& map,
1584  const labelList& faceMap, // new to old patch faces
1585  const labelList& pointMap // new to old patch points
1586 )
1587 {
1588  {
1589  labelListList newAddedPoints(pointMap.size());
1590 
1591  forAll(newAddedPoints, newPointi)
1592  {
1593  label oldPointi = pointMap[newPointi];
1594 
1595  const labelList& added = addedPoints_[oldPointi];
1596 
1597  labelList& newAdded = newAddedPoints[newPointi];
1598  newAdded.setSize(added.size());
1599  label newI = 0;
1600 
1601  forAll(added, i)
1602  {
1603  label newPointi = map.reversePointMap()[added[i]];
1604 
1605  if (newPointi >= 0)
1606  {
1607  newAdded[newI++] = newPointi;
1608  }
1609  }
1610  newAdded.setSize(newI);
1611  }
1612  addedPoints_.transfer(newAddedPoints);
1613  }
1614 
1615  {
1616  labelListList newLayerFaces(faceMap.size());
1617 
1618  forAll(newLayerFaces, newFacei)
1619  {
1620  label oldFacei = faceMap[newFacei];
1621 
1622  const labelList& added = layerFaces_[oldFacei];
1623 
1624  labelList& newAdded = newLayerFaces[newFacei];
1625  newAdded.setSize(added.size());
1626  label newI = 0;
1627 
1628  forAll(added, i)
1629  {
1630  label newFacei = map.reverseFaceMap()[added[i]];
1631 
1632  if (newFacei >= 0)
1633  {
1634  newAdded[newI++] = newFacei;
1635  }
1636  }
1637  newAdded.setSize(newI);
1638  }
1639  layerFaces_.transfer(newLayerFaces);
1640  }
1641 }
1642 
1643 
1645 {
1646  // Add the pointZones to the merged mesh
1647  mesh.pointZones().insert(pointZonesAddedPoints_);
1648 
1649  // Add the cellZones to the merged mesh
1650  mesh.cellZones().insert(cellZonesAddedCells_);
1651 }
1652 
1653 
1654 // ************************************************************************* //
label k
label n
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Definition: UList.H:446
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:109
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:138
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
void setSize(const label)
Reset size of List.
Definition: List.C:281
label nEdges() const
Return number of edges in patch.
label nPoints() const
Return number of points supporting patch faces.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
label nInternalEdges() const
Number of internal edges.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const Field< PointType > & points() const
Return reference to global points.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
const labelListList & edgeFaces() const
Return edge-face addressing.
const labelListList & faceEdges() const
Return face-edge addressing.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
A List with indirect addressing.
Definition: UIndirectList.H:60
label size() const
Return the number of elements in the list.
const List< label > & addressing() const
Return the list addressing.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Definition: UListI.H:58
T & last()
Return the last element of the list.
Definition: UListI.H:128
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
static const Form max
Definition: VectorSpace.H:120
void insert(const List< labelHashSet > &zonesIndices)
Insert given indices into zones.
Definition: ZoneList.C:341
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
static void calcSidePatch(const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &sidePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc)
Boundary edges get extruded into boundary faces. Determine patch.
void setRefinement(const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const labelList &sidePatchID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, const labelList &faceCellZones, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layers on top.
void updateZones(polyMesh &mesh)
Update the mesh zones.
void topoChange(const polyTopoChangeMap &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
addPatchCellLayer(const polyMesh &, const bool addToMesh=true)
Construct from mesh.
labelListList addedCells() const
Added cells given current mesh & layerfaces.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it. Uses.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:61
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:76
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:64
label whichProcID(const label i) const
Which processor does global come from? Binary search.
Definition: globalIndexI.H:123
label toGlobal(const label i) const
From local to global.
Definition: globalIndexI.H:82
bool isLocal(const label i) const
Is on local processor.
Definition: globalIndexI.H:95
Foam::polyBoundaryMesh.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
const pointZoneList & pointZones() const
Return point zones.
Definition: polyMesh.H:440
const cellZoneList & cellZones() const
Return cell zones.
Definition: polyMesh.H:452
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:404
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1345
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
const labelList & reverseFaceMap() const
Reverse face map.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
label addCell(const label masterCellID)
Add cell and return new cell index.
label addPoint(const point &, const label masterPointID, const bool inCell)
Add point and return new point index.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID)
Modify vertices or cell of face.
label addFace(const face &f, const label own, const label nei, const label masterFaceID, const bool flipFaceFlux, const label patchID)
Add face to cells and return new face index.
label nEdges() const
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const labelListList & edgeFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronise values on all mesh points.
static void syncEdgeList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronise values on all mesh edges.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
label patchi
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for OpenFOAM.
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
const doubleScalar e
Definition: doubleScalar.H:106
List< label > labelList
A List of labels.
Definition: labelList.H:56
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
errorManip< error > abort(error &err)
Definition: errorManip.H:131
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:57
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
error FatalError
void offset(label &lst, const label o)
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
static const char nl
Definition: Ostream.H:266
Type gMax(const FieldField< Field, Type > &f)
label newPointi
Definition: readKivaGrid.H:495
labelList f(nPoints)
label nPatches
Definition: readKivaGrid.H:396