meshRefinement.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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 "meshRefinement.H"
27 #include "volMesh.H"
28 #include "volFields.H"
29 #include "surfaceMesh.H"
30 #include "syncTools.H"
31 #include "Time.H"
32 #include "refinementSurfaces.H"
33 #include "refinementFeatures.H"
34 #include "decompositionMethod.H"
35 #include "regionSplit.H"
36 #include "fvMeshDistribute.H"
37 #include "indirectPrimitivePatch.H"
38 #include "polyTopoChange.H"
39 #include "removeCells.H"
40 #include "mapDistributePolyMesh.H"
41 #include "localPointRegion.H"
42 #include "pointMesh.H"
43 #include "pointFields.H"
44 #include "slipPointPatchFields.H"
48 #include "processorPointPatch.H"
49 #include "globalIndex.H"
50 #include "meshTools.H"
51 #include "OFstream.H"
52 #include "geomDecomp.H"
53 #include "Random.H"
54 #include "searchableSurfaces.H"
55 #include "treeBoundBox.H"
57 #include "fvMeshTools.H"
58 #include "motionSmoother.H"
59 #include "faceSet.H"
60 
61 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65  defineTypeNameAndDebug(meshRefinement, 0);
66 
67  template<>
68  const char* Foam::NamedEnum
69  <
71  5
72  >::names[] =
73  {
74  "mesh",
75  //"scalarLevels",
76  "intersections",
77  "featureSeeds",
78  "attraction",
79  "layerInfo"
80  };
81 
82  template<>
83  const char* Foam::NamedEnum
84  <
86  1
87  >::names[] =
88  {
89  "layerInfo"
90  };
91 
92  template<>
93  const char* Foam::NamedEnum
94  <
96  4
97  >::names[] =
98  {
99  "mesh",
100  "scalarLevels",
101  "layerSets",
102  "layerFields"
103  };
104 
105 }
106 
109 
112 
115 
116 
118 
120 
121 
122 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
123 
125 (
126  labelList& neiLevel,
127  pointField& neiCc
128 ) const
129 {
130  const labelList& cellLevel = meshCutter_.cellLevel();
131  const pointField& cellCentres = mesh_.cellCentres();
132 
133  label nBoundaryFaces = mesh_.nFaces() - mesh_.nInternalFaces();
134 
135  if (neiLevel.size() != nBoundaryFaces || neiCc.size() != nBoundaryFaces)
136  {
138  << nBoundaryFaces << " neiLevel:" << neiLevel.size()
139  << abort(FatalError);
140  }
141 
142  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
143 
144  labelHashSet addedPatchIDSet(meshedPatches());
145 
146  forAll(patches, patchI)
147  {
148  const polyPatch& pp = patches[patchI];
149 
150  const labelUList& faceCells = pp.faceCells();
151  const vectorField::subField faceCentres = pp.faceCentres();
152  const vectorField::subField faceAreas = pp.faceAreas();
153 
154  label bFaceI = pp.start()-mesh_.nInternalFaces();
155 
156  if (pp.coupled())
157  {
158  forAll(faceCells, i)
159  {
160  neiLevel[bFaceI] = cellLevel[faceCells[i]];
161  neiCc[bFaceI] = cellCentres[faceCells[i]];
162  bFaceI++;
163  }
164  }
165  else if (addedPatchIDSet.found(patchI))
166  {
167  // Face was introduced from cell-cell intersection. Try to
168  // reconstruct other side cell(centre). Three possibilities:
169  // - cells same size.
170  // - preserved cell smaller. Not handled.
171  // - preserved cell larger.
172  forAll(faceCells, i)
173  {
174  // Extrapolate the face centre.
175  vector fn = faceAreas[i];
176  fn /= mag(fn)+VSMALL;
177 
178  label own = faceCells[i];
179  label ownLevel = cellLevel[own];
180  label faceLevel = meshCutter_.faceLevel(pp.start()+i);
181  if (faceLevel < 0)
182  {
183  // Due to e.g. face merging no longer a consistent
184  // refinementlevel of face. Assume same as cell
185  faceLevel = ownLevel;
186  }
187 
188  // Normal distance from face centre to cell centre
189  scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
190  if (faceLevel > ownLevel)
191  {
192  // Other cell more refined. Adjust normal distance
193  d *= 0.5;
194  }
195  neiLevel[bFaceI] = faceLevel;
196  // Calculate other cell centre by extrapolation
197  neiCc[bFaceI] = faceCentres[i] + d*fn;
198  bFaceI++;
199  }
200  }
201  else
202  {
203  forAll(faceCells, i)
204  {
205  neiLevel[bFaceI] = cellLevel[faceCells[i]];
206  neiCc[bFaceI] = faceCentres[i];
207  bFaceI++;
208  }
209  }
210  }
211 
212  // Swap coupled boundaries. Apply separation to cc since is coordinate.
213  syncTools::swapBoundaryFacePositions(mesh_, neiCc);
214  syncTools::swapBoundaryFaceList(mesh_, neiLevel);
215 }
216 
217 
219 (
220  const pointField& neiCc,
221  const labelList& neiLevel,
222  const labelList& testFaces,
223  pointField& start,
224  pointField& end,
225  labelList& minLevel
226 ) const
227 {
228  const labelList& cellLevel = meshCutter_.cellLevel();
229  const pointField& cellCentres = mesh_.cellCentres();
230 
231  start.setSize(testFaces.size());
232  end.setSize(testFaces.size());
233  minLevel.setSize(testFaces.size());
234 
235  forAll(testFaces, i)
236  {
237  label faceI = testFaces[i];
238  label own = mesh_.faceOwner()[faceI];
239 
240  if (mesh_.isInternalFace(faceI))
241  {
242  label nei = mesh_.faceNeighbour()[faceI];
243 
244  start[i] = cellCentres[own];
245  end[i] = cellCentres[nei];
246  minLevel[i] = min(cellLevel[own], cellLevel[nei]);
247  }
248  else
249  {
250  label bFaceI = faceI - mesh_.nInternalFaces();
251 
252  start[i] = cellCentres[own];
253  end[i] = neiCc[bFaceI];
254  minLevel[i] = min(cellLevel[own], neiLevel[bFaceI]);
255  }
256  }
257 
258  // Extend segments a bit
259  {
260  const vectorField smallVec(ROOTSMALL*(end-start));
261  start -= smallVec;
262  end += smallVec;
263  }
264 }
265 
266 
267 // Find intersections of edges (given by their two endpoints) with surfaces.
268 // Returns first intersection if there are more than one.
270 {
271  const pointField& cellCentres = mesh_.cellCentres();
272 
273  // Stats on edges to test. Count proc faces only once.
275 
276  {
277  label nMasterFaces = 0;
278  forAll(isMasterFace, faceI)
279  {
280  if (isMasterFace.get(faceI) == 1)
281  {
282  nMasterFaces++;
283  }
284  }
285  reduce(nMasterFaces, sumOp<label>());
286 
287  label nChangedFaces = 0;
288  forAll(changedFaces, i)
289  {
290  if (isMasterFace.get(changedFaces[i]) == 1)
291  {
292  nChangedFaces++;
293  }
294  }
295  reduce(nChangedFaces, sumOp<label>());
296 
297  Info<< "Edge intersection testing:" << nl
298  << " Number of edges : " << nMasterFaces << nl
299  << " Number of edges to retest : " << nChangedFaces
300  << endl;
301  }
302 
303 
304  // Get boundary face centre and level. Coupled aware.
305  labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
307  calcNeighbourData(neiLevel, neiCc);
308 
309  // Collect segments we want to test for
310  pointField start(changedFaces.size());
311  pointField end(changedFaces.size());
312 
313  forAll(changedFaces, i)
314  {
315  label faceI = changedFaces[i];
316  label own = mesh_.faceOwner()[faceI];
317 
318  start[i] = cellCentres[own];
319  if (mesh_.isInternalFace(faceI))
320  {
321  end[i] = cellCentres[mesh_.faceNeighbour()[faceI]];
322  }
323  else
324  {
325  end[i] = neiCc[faceI-mesh_.nInternalFaces()];
326  }
327  }
328 
329  // Extend segments a bit
330  {
331  const vectorField smallVec(ROOTSMALL*(end-start));
332  start -= smallVec;
333  end += smallVec;
334  }
335 
336 
337  // Do tests in one go
338  labelList surfaceHit;
339  {
340  labelList surfaceLevel;
342  (
343  shells_,
344  start,
345  end,
346  labelList(start.size(), -1), // accept any intersection
347  surfaceHit,
348  surfaceLevel
349  );
350  }
351 
352  // Keep just surface hit
353  forAll(surfaceHit, i)
354  {
355  surfaceIndex_[changedFaces[i]] = surfaceHit[i];
356  }
357 
358  // Make sure both sides have same information. This should be
359  // case in general since same vectors but just to make sure.
361 
362  label nHits = countHits();
363  label nTotHits = returnReduce(nHits, sumOp<label>());
364 
365  Info<< " Number of intersected edges : " << nTotHits << endl;
366 
367  // Set files to same time as mesh
369 }
370 
371 
373 (
374  const string& msg,
375  const polyMesh& mesh,
376  const List<scalar>& fld
377 )
378 {
379  if (fld.size() != mesh.nPoints())
380  {
382  << msg << endl
383  << "fld size:" << fld.size() << " mesh points:" << mesh.nPoints()
384  << abort(FatalError);
385  }
386 
387  Pout<< "Checking field " << msg << endl;
388  scalarField minFld(fld);
390  (
391  mesh,
392  minFld,
393  minEqOp<scalar>(),
394  GREAT
395  );
396  scalarField maxFld(fld);
398  (
399  mesh,
400  maxFld,
401  maxEqOp<scalar>(),
402  -GREAT
403  );
404  forAll(minFld, pointI)
405  {
406  const scalar& minVal = minFld[pointI];
407  const scalar& maxVal = maxFld[pointI];
408  if (mag(minVal-maxVal) > SMALL)
409  {
410  Pout<< msg << " at:" << mesh.points()[pointI] << nl
411  << " minFld:" << minVal << nl
412  << " maxFld:" << maxVal << nl
413  << endl;
414  }
415  }
416 }
417 
418 
420 (
421  const string& msg,
422  const polyMesh& mesh,
423  const List<point>& fld
424 )
425 {
426  if (fld.size() != mesh.nPoints())
427  {
429  << msg << endl
430  << "fld size:" << fld.size() << " mesh points:" << mesh.nPoints()
431  << abort(FatalError);
432  }
433 
434  Pout<< "Checking field " << msg << endl;
435  pointField minFld(fld);
437  (
438  mesh,
439  minFld,
441  point(GREAT, GREAT, GREAT)
442  );
443  pointField maxFld(fld);
445  (
446  mesh,
447  maxFld,
450  );
451  forAll(minFld, pointI)
452  {
453  const point& minVal = minFld[pointI];
454  const point& maxVal = maxFld[pointI];
455  if (mag(minVal-maxVal) > SMALL)
456  {
457  Pout<< msg << " at:" << mesh.points()[pointI] << nl
458  << " minFld:" << minVal << nl
459  << " maxFld:" << maxVal << nl
460  << endl;
461  }
462  }
463 }
464 
465 
467 {
468  Pout<< "meshRefinement::checkData() : Checking refinement structure."
469  << endl;
470  meshCutter_.checkMesh();
471 
472  Pout<< "meshRefinement::checkData() : Checking refinement levels."
473  << endl;
474  meshCutter_.checkRefinementLevels(1, labelList(0));
475 
476 
477  label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
478 
479  Pout<< "meshRefinement::checkData() : Checking synchronization."
480  << endl;
481 
482  // Check face centres
483  {
484  // Boundary face centres
485  pointField::subList boundaryFc
486  (
487  mesh_.faceCentres(),
488  nBnd,
489  mesh_.nInternalFaces()
490  );
491 
492  // Get neighbouring face centres
493  pointField neiBoundaryFc(boundaryFc);
495  (
496  mesh_,
497  neiBoundaryFc,
498  eqOp<point>()
499  );
500 
501  // Compare
502  testSyncBoundaryFaceList
503  (
504  mergeDistance_,
505  "testing faceCentres : ",
506  boundaryFc,
507  neiBoundaryFc
508  );
509  }
510  // Check meshRefinement
511  {
512  // Get boundary face centre and level. Coupled aware.
513  labelList neiLevel(nBnd);
514  pointField neiCc(nBnd);
515  calcNeighbourData(neiLevel, neiCc);
516 
517  // Collect segments we want to test for
518  pointField start(mesh_.nFaces());
519  pointField end(mesh_.nFaces());
520 
521  forAll(start, faceI)
522  {
523  start[faceI] = mesh_.cellCentres()[mesh_.faceOwner()[faceI]];
524 
525  if (mesh_.isInternalFace(faceI))
526  {
527  end[faceI] = mesh_.cellCentres()[mesh_.faceNeighbour()[faceI]];
528  }
529  else
530  {
531  end[faceI] = neiCc[faceI-mesh_.nInternalFaces()];
532  }
533  }
534 
535  // Extend segments a bit
536  {
537  const vectorField smallVec(ROOTSMALL*(end-start));
538  start -= smallVec;
539  end += smallVec;
540  }
541 
542 
543  // Do tests in one go
544  labelList surfaceHit;
545  {
546  labelList surfaceLevel;
547  surfaces_.findHigherIntersection
548  (
549  shells_,
550  start,
551  end,
552  labelList(start.size(), -1), // accept any intersection
553  surfaceHit,
554  surfaceLevel
555  );
556  }
557  // Get the coupled hit
558  labelList neiHit
559  (
561  (
562  surfaceHit,
563  nBnd,
564  mesh_.nInternalFaces()
565  )
566  );
567  syncTools::swapBoundaryFaceList(mesh_, neiHit);
568 
569  // Check
570  forAll(surfaceHit, faceI)
571  {
572  if (surfaceIndex_[faceI] != surfaceHit[faceI])
573  {
574  if (mesh_.isInternalFace(faceI))
575  {
577  << "Internal face:" << faceI
578  << " fc:" << mesh_.faceCentres()[faceI]
579  << " cached surfaceIndex_:" << surfaceIndex_[faceI]
580  << " current:" << surfaceHit[faceI]
581  << " ownCc:"
582  << mesh_.cellCentres()[mesh_.faceOwner()[faceI]]
583  << " neiCc:"
584  << mesh_.cellCentres()[mesh_.faceNeighbour()[faceI]]
585  << endl;
586  }
587  else if
588  (
589  surfaceIndex_[faceI]
590  != neiHit[faceI-mesh_.nInternalFaces()]
591  )
592  {
594  << "Boundary face:" << faceI
595  << " fc:" << mesh_.faceCentres()[faceI]
596  << " cached surfaceIndex_:" << surfaceIndex_[faceI]
597  << " current:" << surfaceHit[faceI]
598  << " ownCc:"
599  << mesh_.cellCentres()[mesh_.faceOwner()[faceI]]
600  << " neiCc:"
601  << neiCc[faceI-mesh_.nInternalFaces()]
602  << " end:" << end[faceI]
603  << " ownLevel:"
604  << meshCutter_.cellLevel()[mesh_.faceOwner()[faceI]]
605  << " faceLevel:"
606  << meshCutter_.faceLevel(faceI)
607  << endl;
608  }
609  }
610  }
611  }
612  {
613  labelList::subList boundarySurface
614  (
615  surfaceIndex_,
616  mesh_.nFaces()-mesh_.nInternalFaces(),
617  mesh_.nInternalFaces()
618  );
619 
620  labelList neiBoundarySurface(boundarySurface);
622  (
623  mesh_,
624  neiBoundarySurface
625  );
626 
627  // Compare
628  testSyncBoundaryFaceList
629  (
630  0, // tolerance
631  "testing surfaceIndex() : ",
632  boundarySurface,
633  neiBoundarySurface
634  );
635  }
636 
637 
638  // Find duplicate faces
639  Pout<< "meshRefinement::checkData() : Counting duplicate faces."
640  << endl;
641 
642  labelList duplicateFace
643  (
645  (
646  mesh_,
647  identity(mesh_.nFaces()-mesh_.nInternalFaces())
648  + mesh_.nInternalFaces()
649  )
650  );
651 
652  // Count
653  {
654  label nDup = 0;
655 
656  forAll(duplicateFace, i)
657  {
658  if (duplicateFace[i] != -1)
659  {
660  nDup++;
661  }
662  }
663  nDup /= 2; // will have counted both faces of duplicate
664  Pout<< "meshRefinement::checkData() : Found " << nDup
665  << " duplicate pairs of faces." << endl;
666  }
667 }
668 
669 
671 {
672  meshCutter_.setInstance(inst);
673  surfaceIndex_.instance() = inst;
674 }
675 
676 
677 // Remove cells. Put exposedFaces (output of getExposedFaces(cellsToRemove))
678 // into exposedPatchIDs.
680 (
681  const labelList& cellsToRemove,
682  const labelList& exposedFaces,
683  const labelList& exposedPatchIDs,
684  removeCells& cellRemover
685 )
686 {
687  polyTopoChange meshMod(mesh_);
688 
689  // Arbitrary: put exposed faces into last patch.
690  cellRemover.setRefinement
691  (
692  cellsToRemove,
693  exposedFaces,
694  exposedPatchIDs,
695  meshMod
696  );
697 
698  // Change the mesh (no inflation)
699  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
700 
701  // Update fields
702  mesh_.updateMesh(map);
703 
704  // Move mesh (since morphing might not do this)
705  if (map().hasMotionPoints())
706  {
707  mesh_.movePoints(map().preMotionPoints());
708  }
709  else
710  {
711  // Delete mesh volumes. No other way to do this?
712  mesh_.clearOut();
713  }
714 
715  // Reset the instance for if in overwrite mode
716  mesh_.setInstance(timeName());
717  setInstance(mesh_.facesInstance());
718 
719  // Update local mesh data
720  cellRemover.updateMesh(map);
721 
722  // Update intersections. Recalculate intersections for exposed faces.
723  labelList newExposedFaces = renumber
724  (
725  map().reverseFaceMap(),
726  exposedFaces
727  );
728 
729  //Pout<< "removeCells : updating intersections for "
730  // << newExposedFaces.size() << " newly exposed faces." << endl;
731 
732  updateMesh(map, newExposedFaces);
733 
734  return map;
735 }
736 
737 
738 // Split faces
740 (
741  const labelList& splitFaces,
742  const labelPairList& splits,
743  //const List<Pair<point> >& splitPoints,
744  polyTopoChange& meshMod
745 ) const
746 {
747  forAll(splitFaces, i)
748  {
749  label faceI = splitFaces[i];
750  const face& f = mesh_.faces()[faceI];
751 
752  // Split as start and end index in face
753  const labelPair& split = splits[i];
754 
755  label nVerts = split[1]-split[0];
756  if (nVerts < 0)
757  {
758  nVerts += f.size();
759  }
760  nVerts += 1;
761 
762 
763  // Split into f0, f1
764  face f0(nVerts);
765 
766  label fp = split[0];
767  forAll(f0, i)
768  {
769  f0[i] = f[fp];
770  fp = f.fcIndex(fp);
771  }
772 
773  face f1(f.size()-f0.size()+2);
774  fp = split[1];
775  forAll(f1, i)
776  {
777  f1[i] = f[fp];
778  fp = f.fcIndex(fp);
779  }
780 
781 
782  // Determine face properties
783  label own = mesh_.faceOwner()[faceI];
784  label nei = -1;
785  label patchI = -1;
786  if (faceI >= mesh_.nInternalFaces())
787  {
788  patchI = mesh_.boundaryMesh().whichPatch(faceI);
789  }
790  else
791  {
792  nei = mesh_.faceNeighbour()[faceI];
793  }
794 
795  label zoneI = mesh_.faceZones().whichZone(faceI);
796  bool zoneFlip = false;
797  if (zoneI != -1)
798  {
799  const faceZone& fz = mesh_.faceZones()[zoneI];
800  zoneFlip = fz.flipMap()[fz.whichFace(faceI)];
801  }
802 
803 
804  //Pout<< "face:" << faceI << " verts:" << f
805  // << " split into f0:" << f0
806  // << " f1:" << f1 << endl;
807 
808  // Change/add faces
809  meshMod.modifyFace
810  (
811  f0, // modified face
812  faceI, // label of face
813  own, // owner
814  nei, // neighbour
815  false, // face flip
816  patchI, // patch for face
817  zoneI, // zone for face
818  zoneFlip // face flip in zone
819  );
820  meshMod.addFace
821  (
822  f1, // modified face
823  own, // owner
824  nei, // neighbour
825  -1, // master point
826  -1, // master edge
827  faceI, // master face
828  false, // face flip
829  patchI, // patch for face
830  zoneI, // zone for face
831  zoneFlip // face flip in zone
832  );
833 
834 
836  //meshMod.modifyPoint
837  //(
838  // f[split[0]],
839  // splitPoints[i][0],
840  // -1,
841  // true
842  //);
843  //meshMod.modifyPoint
844  //(
845  // f[split[1]],
846  // splitPoints[i][1],
847  // -1,
848  // true
849  //);
850  }
851 }
852 
853 
855 (
856  const labelList& splitFaces,
857  const labelPairList& splits,
858  const dictionary& motionDict,
859 
860  labelList& duplicateFace,
861  List<labelPair>& baffles
862 )
863 {
864  label nSplit = returnReduce(splitFaces.size(), sumOp<label>());
865  Info<< nl
866  << "Splitting " << nSplit
867  << " faces across diagonals" << "." << nl << endl;
868 
869  // To undo: store original faces
870  faceList originalFaces(UIndirectList<face>(mesh_.faces(), splitFaces));
871  labelPairList facePairs(splitFaces.size(), labelPair(-1, -1));
872 
873 
874  {
875  polyTopoChange meshMod(mesh_);
876  meshMod.setCapacity
877  (
878  meshMod.points().size(),
879  meshMod.faces().size()+splitFaces.size(),
880  mesh_.nCells()
881  );
882 
883  // Insert the mesh changes
884  doSplitFaces(splitFaces, splits, meshMod);
885 
886  // Change the mesh (no inflation)
887  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
888 
889  // Update fields
890  mesh_.updateMesh(map);
891 
892  // Move mesh (since morphing might not do this)
893  if (map().hasMotionPoints())
894  {
895  mesh_.movePoints(map().preMotionPoints());
896  }
897 
898  // Reset the instance for if in overwrite mode
899  mesh_.setInstance(timeName());
900  setInstance(mesh_.facesInstance());
901 
902 
903  // Update local mesh data
904  // ~~~~~~~~~~~~~~~~~~~~~~
905 
906  forAll(originalFaces, i)
907  {
908  inplaceRenumber(map().reversePointMap(), originalFaces[i]);
909  }
910 
911  {
912  Map<label> splitFaceToIndex(2*splitFaces.size());
913  forAll(splitFaces, i)
914  {
915  splitFaceToIndex.insert(splitFaces[i], i);
916  }
917 
918  forAll(map().faceMap(), faceI)
919  {
920  label oldFaceI = map().faceMap()[faceI];
921  Map<label>::iterator oldFaceFnd = splitFaceToIndex.find
922  (
923  oldFaceI
924  );
925  if (oldFaceFnd != splitFaceToIndex.end())
926  {
927  labelPair& twoFaces = facePairs[oldFaceFnd()];
928  if (twoFaces[0] == -1)
929  {
930  twoFaces[0] = faceI;
931  }
932  else if (twoFaces[1] == -1)
933  {
934  twoFaces[1] = faceI;
935  }
936  else
937  {
939  << "problem: twoFaces:" << twoFaces
940  << exit(FatalError);
941  }
942  }
943  }
944  }
945 
946 
947  // Update baffle data
948  // ~~~~~~~~~~~~~~~~~~
949 
950  if (duplicateFace.size())
951  {
953  (
954  map().faceMap(),
955  label(-1),
956  duplicateFace
957  );
958  }
959 
960  const labelList& oldToNewFaces = map().reverseFaceMap();
961  forAll(baffles, i)
962  {
963  labelPair& baffle = baffles[i];
964  baffle.first() = oldToNewFaces[baffle.first()];
965  baffle.second() = oldToNewFaces[baffle.second()];
966 
967  if (baffle.first() == -1 || baffle.second() == -1)
968  {
970  << "Removed baffle : faces:" << baffle
971  << exit(FatalError);
972  }
973  }
974 
975 
976  // Update insersections
977  // ~~~~~~~~~~~~~~~~~~~~
978 
979  {
980  DynamicList<label> changedFaces(facePairs.size());
981  forAll(facePairs, i)
982  {
983  changedFaces.append(facePairs[i].first());
984  changedFaces.append(facePairs[i].second());
985  }
986 
987  // Update intersections on changed faces
988  updateMesh(map, growFaceCellFace(changedFaces));
989  }
990  }
991 
992 
993 
994  // Undo loop
995  // ~~~~~~~~~
996  // Maintains two bits of information:
997  // facePairs : two faces originating from the same face
998  // originalFaces : original face in current vertices
999 
1000 
1001  for (label iteration = 0; iteration < 100; iteration++)
1002  {
1003  Info<< nl
1004  << "Undo iteration " << iteration << nl
1005  << "----------------" << endl;
1006 
1007 
1008  // Check mesh for errors
1009  // ~~~~~~~~~~~~~~~~~~~~~
1010 
1011  faceSet errorFaces
1012  (
1013  mesh_,
1014  "errorFaces",
1015  mesh_.nFaces()-mesh_.nInternalFaces()
1016  );
1017  bool hasErrors = motionSmoother::checkMesh
1018  (
1019  false, // report
1020  mesh_,
1021  motionDict,
1022  errorFaces
1023  );
1024  if (!hasErrors)
1025  {
1026  break;
1027  }
1028 
1029  // Extend faces
1030  {
1031  const labelList grownFaces(growFaceCellFace(errorFaces));
1032  errorFaces.clear();
1033  errorFaces.insert(grownFaces);
1034  }
1035 
1036 
1037  // Merge face pairs
1038  // ~~~~~~~~~~~~~~~~
1039  // (if one of the faces is in the errorFaces set)
1040 
1041  polyTopoChange meshMod(mesh_);
1042 
1043  // Indices (in facePairs) of merged faces
1044  labelHashSet mergedIndices(facePairs.size());
1045  forAll(facePairs, index)
1046  {
1047  const labelPair& twoFaces = facePairs[index];
1048 
1049  if
1050  (
1051  errorFaces.found(twoFaces.first())
1052  || errorFaces.found(twoFaces.second())
1053  )
1054  {
1055  const face& originalFace = originalFaces[index];
1056 
1057 
1058  // Determine face properties
1059  label own = mesh_.faceOwner()[twoFaces[0]];
1060  label nei = -1;
1061  label patchI = -1;
1062  if (twoFaces[0] >= mesh_.nInternalFaces())
1063  {
1064  patchI = mesh_.boundaryMesh().whichPatch(twoFaces[0]);
1065  }
1066  else
1067  {
1068  nei = mesh_.faceNeighbour()[twoFaces[0]];
1069  }
1070 
1071  label zoneI = mesh_.faceZones().whichZone(twoFaces[0]);
1072  bool zoneFlip = false;
1073  if (zoneI != -1)
1074  {
1075  const faceZone& fz = mesh_.faceZones()[zoneI];
1076  zoneFlip = fz.flipMap()[fz.whichFace(twoFaces[0])];
1077  }
1078 
1079  // Modify first face
1080  meshMod.modifyFace
1081  (
1082  originalFace, // modified face
1083  twoFaces[0], // label of face
1084  own, // owner
1085  nei, // neighbour
1086  false, // face flip
1087  patchI, // patch for face
1088  zoneI, // zone for face
1089  zoneFlip // face flip in zone
1090  );
1091  // Merge second face into first
1092  meshMod.removeFace(twoFaces[1], twoFaces[0]);
1093 
1094  mergedIndices.insert(index);
1095  }
1096  }
1097 
1098  label n = returnReduce(mergedIndices.size(), sumOp<label>());
1099 
1100  Info<< "Detected " << n
1101  << " split faces that will be restored to their original faces."
1102  << nl << endl;
1103 
1104  if (n == 0)
1105  {
1106  // Nothing to be restored
1107  break;
1108  }
1109 
1110  nSplit -= n;
1111 
1112 
1113  // Change the mesh (no inflation)
1114  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
1115 
1116  // Update fields
1117  mesh_.updateMesh(map);
1118 
1119  // Move mesh (since morphing might not do this)
1120  if (map().hasMotionPoints())
1121  {
1122  mesh_.movePoints(map().preMotionPoints());
1123  }
1124 
1125  // Reset the instance for if in overwrite mode
1126  mesh_.setInstance(timeName());
1127  setInstance(mesh_.facesInstance());
1128 
1129 
1130  // Update local mesh data
1131  // ~~~~~~~~~~~~~~~~~~~~~~
1132 
1133  {
1134  const labelList& oldToNewFaces = map().reverseFaceMap();
1135  const labelList& oldToNewPoints = map().reversePointMap();
1136 
1137  // Compact out merged faces
1138  DynamicList<label> changedFaces(mergedIndices.size());
1139 
1140  label newIndex = 0;
1141  forAll(facePairs, index)
1142  {
1143  const labelPair& oldSplit = facePairs[index];
1144  label new0 = oldToNewFaces[oldSplit[0]];
1145  label new1 = oldToNewFaces[oldSplit[1]];
1146 
1147  if (!mergedIndices.found(index))
1148  {
1149  // Faces still split
1150  if (new0 < 0 || new1 < 0)
1151  {
1153  << "Problem: oldFaces:" << oldSplit
1154  << " newFaces:" << labelPair(new0, new1)
1155  << exit(FatalError);
1156  }
1157 
1158  facePairs[newIndex] = labelPair(new0, new1);
1159  originalFaces[newIndex] = renumber
1160  (
1161  oldToNewPoints,
1162  originalFaces[index]
1163  );
1164  newIndex++;
1165  }
1166  else
1167  {
1168  // Merged face. Only new0 kept.
1169  if (new0 < 0 || new1 == -1)
1170  {
1172  << "Problem: oldFaces:" << oldSplit
1173  << " newFace:" << labelPair(new0, new1)
1174  << exit(FatalError);
1175  }
1176  changedFaces.append(new0);
1177  }
1178  }
1179 
1180  facePairs.setSize(newIndex);
1181  originalFaces.setSize(newIndex);
1182 
1183 
1184  // Update intersections
1185  updateMesh(map, growFaceCellFace(changedFaces));
1186  }
1187 
1188  // Update baffle data
1189  // ~~~~~~~~~~~~~~~~~~
1190  {
1191  if (duplicateFace.size())
1192  {
1194  (
1195  map().faceMap(),
1196  label(-1),
1197  duplicateFace
1198  );
1199  }
1200 
1201  const labelList& reverseFaceMap = map().reverseFaceMap();
1202  forAll(baffles, i)
1203  {
1204  labelPair& baffle = baffles[i];
1205  baffle.first() = reverseFaceMap[baffle.first()];
1206  baffle.second() = reverseFaceMap[baffle.second()];
1207 
1208  if (baffle.first() == -1 || baffle.second() == -1)
1209  {
1211  << "Removed baffle : faces:" << baffle
1212  << exit(FatalError);
1213  }
1214  }
1215  }
1216 
1217  }
1218 
1219  return nSplit;
1220 }
1221 
1222 
1223 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
1224 
1225 // Construct from components
1228  fvMesh& mesh,
1229  const scalar mergeDistance,
1230  const bool overwrite,
1231  const refinementSurfaces& surfaces,
1232  const refinementFeatures& features,
1233  const shellSurfaces& shells,
1234  const shellSurfaces& limitShells
1235 )
1236 :
1237  mesh_(mesh),
1238  mergeDistance_(mergeDistance),
1239  overwrite_(overwrite),
1240  oldInstance_(mesh.pointsInstance()),
1241  surfaces_(surfaces),
1242  features_(features),
1243  shells_(shells),
1244  limitShells_(limitShells),
1245  meshCutter_
1246  (
1247  mesh,
1248  false // do not try to read history.
1249  ),
1250  surfaceIndex_
1251  (
1252  IOobject
1253  (
1254  "surfaceIndex",
1255  mesh_.facesInstance(),
1257  mesh_,
1260  false
1261  ),
1262  labelList(mesh_.nFaces(), -1)
1263  ),
1264  userFaceData_(0)
1265 {
1266  // recalculate intersections for all faces
1267  updateIntersections(identity(mesh_.nFaces()));
1268 }
1269 
1270 
1271 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
1272 
1274 {
1275  // Stats on edges to test. Count proc faces only once.
1276  PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_));
1277 
1278  label nHits = 0;
1279 
1280  forAll(surfaceIndex_, faceI)
1281  {
1282  if (surfaceIndex_[faceI] >= 0 && isMasterFace.get(faceI) == 1)
1283  {
1284  nHits++;
1285  }
1286  }
1287  return nHits;
1288 }
1289 
1290 
1293  const bool keepZoneFaces,
1294  const bool keepBaffles,
1295  const scalarField& cellWeights,
1296  decompositionMethod& decomposer,
1297  fvMeshDistribute& distributor
1298 )
1299 {
1301 
1302  if (Pstream::parRun())
1303  {
1304  //if (debug_)
1305  //{
1306  // const_cast<Time&>(mesh_.time())++;
1307  //}
1308 
1309  // Wanted distribution
1311 
1312 
1313  // Faces where owner and neighbour are not 'connected' so can
1314  // go to different processors.
1315  boolList blockedFace;
1316  label nUnblocked = 0;
1317 
1318  // Faces that move as block onto single processor
1319  PtrList<labelList> specifiedProcessorFaces;
1320  labelList specifiedProcessor;
1321 
1322  // Pairs of baffles
1323  List<labelPair> couples;
1324 
1325  // Constraints from decomposeParDict
1326  decomposer.setConstraints
1327  (
1328  mesh_,
1329  blockedFace,
1330  specifiedProcessorFaces,
1331  specifiedProcessor,
1332  couples
1333  );
1334 
1335 
1336  if (keepZoneFaces || keepBaffles)
1337  {
1338  if (keepZoneFaces)
1339  {
1340  // Determine decomposition to keep/move surface zones
1341  // on one processor. The reason is that snapping will make these
1342  // into baffles, move and convert them back so if they were
1343  // proc boundaries after baffling&moving the points might be no
1344  // longer synchronised so recoupling will fail. To prevent this
1345  // keep owner&neighbour of such a surface zone on the same
1346  // processor.
1347 
1348  const faceZoneMesh& fZones = mesh_.faceZones();
1349  const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
1350 
1351  // Get faces whose owner and neighbour should stay together,
1352  // i.e. they are not 'blocked'.
1353 
1354  forAll(fZones, zoneI)
1355  {
1356  const faceZone& fZone = fZones[zoneI];
1357 
1358  forAll(fZone, i)
1359  {
1360  label faceI = fZone[i];
1361  if (blockedFace[faceI])
1362  {
1363  if
1364  (
1365  mesh_.isInternalFace(faceI)
1366  || pbm[pbm.whichPatch(faceI)].coupled()
1367  )
1368  {
1369  blockedFace[faceI] = false;
1370  nUnblocked++;
1371  }
1372  }
1373  }
1374  }
1375 
1376 
1377  // If the faceZones are not synchronised the blockedFace
1378  // might not be synchronised. If you are sure the faceZones
1379  // are synchronised remove below check.
1381  (
1382  mesh_,
1383  blockedFace,
1384  andEqOp<bool>() // combine operator
1385  );
1386  }
1387  reduce(nUnblocked, sumOp<label>());
1388 
1389  if (keepZoneFaces)
1390  {
1391  Info<< "Found " << nUnblocked
1392  << " zoned faces to keep together." << endl;
1393  }
1394 
1395 
1396  // Extend un-blockedFaces with any cyclics
1397  {
1398  boolList separatedCoupledFace(mesh_.nFaces(), false);
1399  selectSeparatedCoupledFaces(separatedCoupledFace);
1400 
1401  label nSeparated = 0;
1402  forAll(separatedCoupledFace, faceI)
1403  {
1404  if (separatedCoupledFace[faceI])
1405  {
1406  if (blockedFace[faceI])
1407  {
1408  blockedFace[faceI] = false;
1409  nSeparated++;
1410  }
1411  }
1412  }
1413  reduce(nSeparated, sumOp<label>());
1414  Info<< "Found " << nSeparated
1415  << " separated coupled faces to keep together." << endl;
1416 
1417  nUnblocked += nSeparated;
1418  }
1419 
1420 
1421  if (keepBaffles)
1422  {
1423  label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
1424 
1425  labelList coupledFace(mesh_.nFaces(), -1);
1426  {
1427  // Get boundary baffles that need to stay together
1428  List<labelPair> allCouples
1429  (
1431  );
1432 
1433  // Merge with any couples from
1434  // decompositionMethod::setConstraints
1435  forAll(couples, i)
1436  {
1437  const labelPair& baffle = couples[i];
1438  coupledFace[baffle.first()] = baffle.second();
1439  coupledFace[baffle.second()] = baffle.first();
1440  }
1441  forAll(allCouples, i)
1442  {
1443  const labelPair& baffle = allCouples[i];
1444  coupledFace[baffle.first()] = baffle.second();
1445  coupledFace[baffle.second()] = baffle.first();
1446  }
1447  }
1448 
1449  couples.setSize(nBnd);
1450  label nCpl = 0;
1451  forAll(coupledFace, faceI)
1452  {
1453  if (coupledFace[faceI] != -1 && faceI < coupledFace[faceI])
1454  {
1455  couples[nCpl++] = labelPair(faceI, coupledFace[faceI]);
1456  }
1457  }
1458  couples.setSize(nCpl);
1459  }
1460  label nCouples = returnReduce(couples.size(), sumOp<label>());
1461 
1462  if (keepBaffles)
1463  {
1464  Info<< "Found " << nCouples << " baffles to keep together."
1465  << endl;
1466  }
1467  }
1468 
1469 
1470  // Make sure blockedFace not set on couples
1471  forAll(couples, i)
1472  {
1473  const labelPair& baffle = couples[i];
1474  blockedFace[baffle.first()] = false;
1475  blockedFace[baffle.second()] = false;
1476  }
1477 
1478  distribution = decomposer.decompose
1479  (
1480  mesh_,
1481  cellWeights,
1482  blockedFace,
1483  specifiedProcessorFaces,
1484  specifiedProcessor,
1485  couples // explicit connections
1486  );
1487 
1488  if (debug)
1489  {
1490  labelList nProcCells(distributor.countCells(distribution));
1491  Pout<< "Wanted distribution:" << nProcCells << endl;
1492 
1494  Pstream::listCombineScatter(nProcCells);
1495 
1496  Pout<< "Wanted resulting decomposition:" << endl;
1497  forAll(nProcCells, procI)
1498  {
1499  Pout<< " " << procI << '\t' << nProcCells[procI] << endl;
1500  }
1501  Pout<< endl;
1502 
1503 
1504  if (keepZoneFaces)
1505  {
1506  const faceZoneMesh& fZones = mesh_.faceZones();
1507  const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
1508 
1509  // Check that faceZone faces are indeed internal
1510  forAll(fZones, zoneI)
1511  {
1512  const faceZone& fZone = fZones[zoneI];
1513 
1514  forAll(fZone, i)
1515  {
1516  label faceI = fZone[i];
1517  label patchI = pbm.whichPatch(faceI);
1518 
1519  if (patchI >= 0 && pbm[patchI].coupled())
1520  {
1522  << "Face at " << mesh_.faceCentres()[faceI]
1523  << " on zone " << fZone.name()
1524  << " is on coupled patch " << pbm[patchI].name()
1525  << endl;
1526  }
1527  }
1528  }
1529  }
1530  }
1531 
1532  // Do actual sending/receiving of mesh
1533  map = distributor.distribute(distribution);
1534 
1535  // Update numbering of meshRefiner
1536  distribute(map);
1537 
1538  // Set correct instance (for if overwrite)
1539  mesh_.setInstance(timeName());
1540  setInstance(mesh_.facesInstance());
1541  }
1542 
1543  return map;
1544 }
1545 
1546 
1547 // Helper function to get intersected faces
1549 {
1550  label nBoundaryFaces = 0;
1551 
1552  forAll(surfaceIndex_, faceI)
1553  {
1554  if (surfaceIndex_[faceI] != -1)
1555  {
1556  nBoundaryFaces++;
1557  }
1558  }
1559 
1560  labelList surfaceFaces(nBoundaryFaces);
1561  nBoundaryFaces = 0;
1562 
1563  forAll(surfaceIndex_, faceI)
1564  {
1565  if (surfaceIndex_[faceI] != -1)
1566  {
1567  surfaceFaces[nBoundaryFaces++] = faceI;
1568  }
1569  }
1570  return surfaceFaces;
1571 }
1572 
1573 
1574 // Helper function to get points used by faces
1576 {
1577  const faceList& faces = mesh_.faces();
1578 
1579  // Mark all points on faces that will become baffles
1580  PackedBoolList isBoundaryPoint(mesh_.nPoints());
1581  label nBoundaryPoints = 0;
1582 
1583  forAll(surfaceIndex_, faceI)
1584  {
1585  if (surfaceIndex_[faceI] != -1)
1586  {
1587  const face& f = faces[faceI];
1588 
1589  forAll(f, fp)
1590  {
1591  if (isBoundaryPoint.set(f[fp], 1u))
1592  {
1593  nBoundaryPoints++;
1594  }
1595  }
1596  }
1597  }
1598 
1600  //labelList adaptPatchIDs(meshedPatches());
1601  //forAll(adaptPatchIDs, i)
1602  //{
1603  // label patchI = adaptPatchIDs[i];
1604  //
1605  // if (patchI != -1)
1606  // {
1607  // const polyPatch& pp = mesh_.boundaryMesh()[patchI];
1608  //
1609  // label faceI = pp.start();
1610  //
1611  // forAll(pp, i)
1612  // {
1613  // const face& f = faces[faceI];
1614  //
1615  // forAll(f, fp)
1616  // {
1617  // if (isBoundaryPoint.set(f[fp], 1u))
1618  // nBoundaryPoints++;
1619  // }
1620  // }
1621  // faceI++;
1622  // }
1623  // }
1624  //}
1625 
1626 
1627  // Pack
1628  labelList boundaryPoints(nBoundaryPoints);
1629  nBoundaryPoints = 0;
1630  forAll(isBoundaryPoint, pointI)
1631  {
1632  if (isBoundaryPoint.get(pointI) == 1u)
1633  {
1634  boundaryPoints[nBoundaryPoints++] = pointI;
1635  }
1636  }
1637 
1638  return boundaryPoints;
1639 }
1640 
1641 
1642 //- Create patch from set of patches
1645  const polyMesh& mesh,
1646  const labelList& patchIDs
1647 )
1648 {
1650 
1651  // Count faces.
1652  label nFaces = 0;
1653 
1654  forAll(patchIDs, i)
1655  {
1656  const polyPatch& pp = patches[patchIDs[i]];
1657 
1658  nFaces += pp.size();
1659  }
1660 
1661  // Collect faces.
1662  labelList addressing(nFaces);
1663  nFaces = 0;
1664 
1665  forAll(patchIDs, i)
1666  {
1667  const polyPatch& pp = patches[patchIDs[i]];
1668 
1669  label meshFaceI = pp.start();
1670 
1671  forAll(pp, i)
1672  {
1673  addressing[nFaces++] = meshFaceI++;
1674  }
1675  }
1676 
1678  (
1680  (
1681  IndirectList<face>(mesh.faces(), addressing),
1682  mesh.points()
1683  )
1684  );
1685 }
1686 
1687 
1688 // Construct pointVectorField with correct boundary conditions
1691  const pointMesh& pMesh,
1692  const labelList& adaptPatchIDs
1693 )
1694 {
1695  const polyMesh& mesh = pMesh();
1696 
1697  // Construct displacement field.
1698  const pointBoundaryMesh& pointPatches = pMesh.boundary();
1699 
1700  wordList patchFieldTypes
1701  (
1702  pointPatches.size(),
1703  slipPointPatchVectorField::typeName
1704  );
1705 
1706  forAll(adaptPatchIDs, i)
1707  {
1708  patchFieldTypes[adaptPatchIDs[i]] =
1709  fixedValuePointPatchVectorField::typeName;
1710  }
1711 
1712  forAll(pointPatches, patchI)
1713  {
1714  if (isA<processorPointPatch>(pointPatches[patchI]))
1715  {
1716  patchFieldTypes[patchI] = calculatedPointPatchVectorField::typeName;
1717  }
1718  else if (isA<cyclicPointPatch>(pointPatches[patchI]))
1719  {
1720  patchFieldTypes[patchI] = cyclicSlipPointPatchVectorField::typeName;
1721  }
1722  }
1723 
1724  // Note: time().timeName() instead of meshRefinement::timeName() since
1725  // postprocessable field.
1727  (
1728  new pointVectorField
1729  (
1730  IOobject
1731  (
1732  "pointDisplacement",
1733  mesh.time().timeName(),
1734  mesh,
1737  ),
1738  pMesh,
1739  dimensionedVector("displacement", dimLength, vector::zero),
1740  patchFieldTypes
1741  )
1742  );
1743  return tfld;
1744 }
1745 
1746 
1748 {
1749  const faceZoneMesh& fZones = mesh.faceZones();
1750 
1751  // Check any zones are present anywhere and in same order
1752 
1753  {
1754  List<wordList> zoneNames(Pstream::nProcs());
1755  zoneNames[Pstream::myProcNo()] = fZones.names();
1756  Pstream::gatherList(zoneNames);
1757  Pstream::scatterList(zoneNames);
1758  // All have same data now. Check.
1759  forAll(zoneNames, procI)
1760  {
1761  if (procI != Pstream::myProcNo())
1762  {
1763  if (zoneNames[procI] != zoneNames[Pstream::myProcNo()])
1764  {
1766  << "faceZones are not synchronised on processors." << nl
1767  << "Processor " << procI << " has faceZones "
1768  << zoneNames[procI] << nl
1769  << "Processor " << Pstream::myProcNo()
1770  << " has faceZones "
1771  << zoneNames[Pstream::myProcNo()] << nl
1772  << exit(FatalError);
1773  }
1774  }
1775  }
1776  }
1777 
1778  // Check that coupled faces are present on both sides.
1779 
1780  labelList faceToZone(mesh.nFaces()-mesh.nInternalFaces(), -1);
1781 
1782  forAll(fZones, zoneI)
1783  {
1784  const faceZone& fZone = fZones[zoneI];
1785 
1786  forAll(fZone, i)
1787  {
1788  label bFaceI = fZone[i]-mesh.nInternalFaces();
1789 
1790  if (bFaceI >= 0)
1791  {
1792  if (faceToZone[bFaceI] == -1)
1793  {
1794  faceToZone[bFaceI] = zoneI;
1795  }
1796  else if (faceToZone[bFaceI] == zoneI)
1797  {
1799  << "Face " << fZone[i] << " in zone "
1800  << fZone.name()
1801  << " is twice in zone!"
1802  << abort(FatalError);
1803  }
1804  else
1805  {
1807  << "Face " << fZone[i] << " in zone "
1808  << fZone.name()
1809  << " is also in zone "
1810  << fZones[faceToZone[bFaceI]].name()
1811  << abort(FatalError);
1812  }
1813  }
1814  }
1815  }
1816 
1817  labelList neiFaceToZone(faceToZone);
1818  syncTools::swapBoundaryFaceList(mesh, neiFaceToZone);
1819 
1820  forAll(faceToZone, i)
1821  {
1822  if (faceToZone[i] != neiFaceToZone[i])
1823  {
1825  << "Face " << mesh.nInternalFaces()+i
1826  << " is in zone " << faceToZone[i]
1827  << ", its coupled face is in zone " << neiFaceToZone[i]
1828  << abort(FatalError);
1829  }
1830  }
1831 }
1832 
1833 
1836  const polyMesh& mesh,
1837  const PackedBoolList& isMasterEdge,
1838  const labelList& meshPoints,
1839  const edgeList& edges,
1840  scalarField& edgeWeights,
1841  scalarField& invSumWeight
1842 )
1843 {
1844  const pointField& pts = mesh.points();
1845 
1846  // Calculate edgeWeights and inverse sum of edge weights
1847  edgeWeights.setSize(isMasterEdge.size());
1848  invSumWeight.setSize(meshPoints.size());
1849 
1850  forAll(edges, edgeI)
1851  {
1852  const edge& e = edges[edgeI];
1853  scalar eMag = max
1854  (
1855  SMALL,
1856  mag
1857  (
1858  pts[meshPoints[e[1]]]
1859  - pts[meshPoints[e[0]]]
1860  )
1861  );
1862  edgeWeights[edgeI] = 1.0/eMag;
1863  }
1864 
1865  // Sum per point all edge weights
1866  weightedSum
1867  (
1868  mesh,
1869  isMasterEdge,
1870  meshPoints,
1871  edges,
1872  edgeWeights,
1873  scalarField(meshPoints.size(), 1.0), // data
1874  invSumWeight
1875  );
1876 
1877  // Inplace invert
1878  forAll(invSumWeight, pointI)
1879  {
1880  scalar w = invSumWeight[pointI];
1881 
1882  if (w > 0.0)
1883  {
1884  invSumWeight[pointI] = 1.0/w;
1885  }
1886  }
1887 }
1888 
1889 
1892  fvMesh& mesh,
1893  const label insertPatchI,
1894  const word& patchName,
1895  const dictionary& patchDict
1896 )
1897 {
1898  // Clear local fields and e.g. polyMesh parallelInfo.
1899  mesh.clearOut();
1900 
1901  polyBoundaryMesh& polyPatches =
1902  const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
1903  fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
1904 
1905  label patchI = polyPatches.size();
1906 
1907  // Add polyPatch at the end
1908  polyPatches.setSize(patchI+1);
1909  polyPatches.set
1910  (
1911  patchI,
1913  (
1914  patchName,
1915  patchDict,
1916  insertPatchI,
1917  polyPatches
1918  )
1919  );
1920  fvPatches.setSize(patchI+1);
1921  fvPatches.set
1922  (
1923  patchI,
1924  fvPatch::New
1925  (
1926  polyPatches[patchI], // point to newly added polyPatch
1927  mesh.boundary()
1928  )
1929  );
1930 
1931  addPatchFields<volScalarField>
1932  (
1933  mesh,
1935  );
1936  addPatchFields<volVectorField>
1937  (
1938  mesh,
1940  );
1941  addPatchFields<volSphericalTensorField>
1942  (
1943  mesh,
1945  );
1946  addPatchFields<volSymmTensorField>
1947  (
1948  mesh,
1950  );
1951  addPatchFields<volTensorField>
1952  (
1953  mesh,
1955  );
1956 
1957  // Surface fields
1958 
1959  addPatchFields<surfaceScalarField>
1960  (
1961  mesh,
1963  );
1964  addPatchFields<surfaceVectorField>
1965  (
1966  mesh,
1968  );
1969  addPatchFields<surfaceSphericalTensorField>
1970  (
1971  mesh,
1973  );
1974  addPatchFields<surfaceSymmTensorField>
1975  (
1976  mesh,
1978  );
1979  addPatchFields<surfaceTensorField>
1980  (
1981  mesh,
1983  );
1984  return patchI;
1985 }
1986 
1987 
1988 // Adds patch if not yet there. Returns patchID.
1991  fvMesh& mesh,
1992  const word& patchName,
1993  const dictionary& patchInfo
1994 )
1995 {
1996  polyBoundaryMesh& polyPatches =
1997  const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
1998  fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
1999 
2000  const label patchI = polyPatches.findPatchID(patchName);
2001  if (patchI != -1)
2002  {
2003  // Already there
2004  return patchI;
2005  }
2006 
2007 
2008  label insertPatchI = polyPatches.size();
2009  label startFaceI = mesh.nFaces();
2010 
2011  forAll(polyPatches, patchI)
2012  {
2013  const polyPatch& pp = polyPatches[patchI];
2014 
2015  if (isA<processorPolyPatch>(pp))
2016  {
2017  insertPatchI = patchI;
2018  startFaceI = pp.start();
2019  break;
2020  }
2021  }
2022 
2023  dictionary patchDict(patchInfo);
2024  patchDict.set("nFaces", 0);
2025  patchDict.set("startFace", startFaceI);
2026 
2027  // Below is all quite a hack. Feel free to change once there is a better
2028  // mechanism to insert and reorder patches.
2029 
2030  label addedPatchI = appendPatch(mesh, insertPatchI, patchName, patchDict);
2031 
2032 
2033  // Create reordering list
2034  // patches before insert position stay as is
2035  labelList oldToNew(addedPatchI+1);
2036  for (label i = 0; i < insertPatchI; i++)
2037  {
2038  oldToNew[i] = i;
2039  }
2040  // patches after insert position move one up
2041  for (label i = insertPatchI; i < addedPatchI; i++)
2042  {
2043  oldToNew[i] = i+1;
2044  }
2045  // appended patch gets moved to insert position
2046  oldToNew[addedPatchI] = insertPatchI;
2047 
2048  // Shuffle into place
2049  polyPatches.reorder(oldToNew, true);
2050  fvPatches.reorder(oldToNew);
2051 
2052  reorderPatchFields<volScalarField>(mesh, oldToNew);
2053  reorderPatchFields<volVectorField>(mesh, oldToNew);
2054  reorderPatchFields<volSphericalTensorField>(mesh, oldToNew);
2055  reorderPatchFields<volSymmTensorField>(mesh, oldToNew);
2056  reorderPatchFields<volTensorField>(mesh, oldToNew);
2057  reorderPatchFields<surfaceScalarField>(mesh, oldToNew);
2058  reorderPatchFields<surfaceVectorField>(mesh, oldToNew);
2059  reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew);
2060  reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew);
2061  reorderPatchFields<surfaceTensorField>(mesh, oldToNew);
2062 
2063  return insertPatchI;
2064 }
2065 
2066 
2069  const word& name,
2070  const dictionary& patchInfo
2071 )
2072 {
2073  label meshedI = findIndex(meshedPatches_, name);
2074 
2075  if (meshedI != -1)
2076  {
2077  // Already there. Get corresponding polypatch
2078  return mesh_.boundaryMesh().findPatchID(name);
2079  }
2080  else
2081  {
2082  // Add patch
2083  label patchI = addPatch(mesh_, name, patchInfo);
2084 
2085 // dictionary patchDict(patchInfo);
2086 // patchDict.set("nFaces", 0);
2087 // patchDict.set("startFace", 0);
2088 // autoPtr<polyPatch> ppPtr
2089 // (
2090 // polyPatch::New
2091 // (
2092 // name,
2093 // patchDict,
2094 // 0,
2095 // mesh_.boundaryMesh()
2096 // )
2097 // );
2098 // label patchI = fvMeshTools::addPatch
2099 // (
2100 // mesh_,
2101 // ppPtr(),
2102 // dictionary(), // optional field values
2103 // calculatedFvPatchField<scalar>::typeName,
2104 // true
2105 // );
2106 
2107  // Store
2108  meshedPatches_.append(name);
2109 
2110  // Clear patch based addressing
2111  faceToCoupledPatch_.clear();
2112 
2113  return patchI;
2114  }
2115 }
2116 
2117 
2119 {
2120  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
2121 
2122  DynamicList<label> patchIDs(meshedPatches_.size());
2123  forAll(meshedPatches_, i)
2124  {
2125  label patchI = patches.findPatchID(meshedPatches_[i]);
2126 
2127  if (patchI == -1)
2128  {
2130  << "Problem : did not find patch " << meshedPatches_[i]
2131  << endl << "Valid patches are " << patches.names()
2132  << abort(FatalError);
2133  }
2134  if (!polyPatch::constraintType(patches[patchI].type()))
2135  {
2136  patchIDs.append(patchI);
2137  }
2138  }
2139 
2140  return patchIDs;
2141 }
2142 
2143 
2146  const word& fzName,
2147  const word& masterPatch,
2148  const word& slavePatch,
2149  const surfaceZonesInfo::faceZoneType& fzType
2150 )
2151 {
2153  (
2154  fzName, //name
2155  labelList(0), //addressing
2156  boolList(0), //flipmap
2157  mesh_
2158  );
2159 
2160  faceZoneToMasterPatch_.insert(fzName, masterPatch);
2161  faceZoneToSlavePatch_.insert(fzName, slavePatch);
2162  faceZoneToType_.insert(fzName, fzType);
2163 
2164  return zoneI;
2165 }
2166 
2167 
2170  const word& fzName,
2171  label& masterPatchID,
2172  label& slavePatchID,
2174 ) const
2175 {
2176  const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
2177 
2178  if (!faceZoneToMasterPatch_.found(fzName))
2179  {
2180  return false;
2181  }
2182  else
2183  {
2184  const word& masterName = faceZoneToMasterPatch_[fzName];
2185  masterPatchID = pbm.findPatchID(masterName);
2186 
2187  const word& slaveName = faceZoneToSlavePatch_[fzName];
2188  slavePatchID = pbm.findPatchID(slaveName);
2189 
2190  fzType = faceZoneToType_[fzName];
2191 
2192  return true;
2193  }
2194 }
2195 
2196 
2198 {
2199  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
2200 
2201  forAll(patches, patchI)
2202  {
2203  // Check all coupled. Avoid using .coupled() so we also pick up AMI.
2204  if (isA<coupledPolyPatch>(patches[patchI]))
2205  {
2206  const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
2207  (
2208  patches[patchI]
2209  );
2210 
2211  if (cpp.separated() || !cpp.parallel())
2212  {
2213  forAll(cpp, i)
2214  {
2215  selected[cpp.start()+i] = true;
2216  }
2217  }
2218  }
2219  }
2220 }
2221 
2222 
2225  const polyMesh& mesh,
2226  const labelList& cellToRegion,
2227  const vector& perturbVec,
2228  const point& p
2229 )
2230 {
2231  label regionI = -1;
2232 
2233  // Force calculation of base points (needs to be synchronised)
2234  (void)mesh.tetBasePtIs();
2235 
2236  label cellI = mesh.findCell(p);
2237  //if (cellI != -1)
2238  //{
2239  // Pout<< "findRegion : Found point:" << p << " in cell " << cellI
2240  // << " at:" << mesh.cellCentres()[cellI] << endl;
2241  //}
2242  //else
2243  //{
2244  // Pout<< "findRegion : Found point:" << p << " in cell " << cellI
2245  // << endl;
2246  //}
2247 
2248  if (cellI != -1)
2249  {
2250  regionI = cellToRegion[cellI];
2251  }
2252  reduce(regionI, maxOp<label>());
2253 
2254  if (regionI == -1)
2255  {
2256  // See if we can perturb a bit
2257  cellI = mesh.findCell(p+perturbVec);
2258  if (cellI != -1)
2259  {
2260  regionI = cellToRegion[cellI];
2261  }
2262  reduce(regionI, maxOp<label>());
2263  }
2264  return regionI;
2265 }
2266 //XXXXXXXX
2267 //Foam::labelList Foam::meshRefinement::findRegion
2268 //(
2269 // const polyMesh& mesh,
2270 // const labelList& cellToRegion,
2271 // const vector& perturbVec,
2272 // const pointField& pts
2273 //)
2274 //{
2275 // labelList regions(pts.size(), -1);
2276 //
2277 // forAll(pts, i)
2278 // {
2279 // label cellI = mesh.findCell(pts[i]);
2280 // if (cellI != -1)
2281 // {
2282 // regions[i] = cellToRegion[cellI];
2283 // }
2284 // reduce(regions[i], maxOp<label>());
2285 //
2286 // if (regions[i] == -1)
2287 // {
2288 // // See if we can perturb a bit
2289 // cellI = mesh.findCell(pts[i]+perturbVec);
2290 // if (cellI != -1)
2291 // {
2292 // regions[i] = cellToRegion[cellI];
2293 // }
2294 // reduce(regions[i], maxOp<label>());
2295 // }
2296 // }
2297 //
2298 // forAll(regions, i)
2299 // {
2300 // if (regions[i] == -1)
2301 // {
2302 // FatalErrorInFunction
2303 // << "Point " << pts[i]
2304 // << " is not inside the mesh." << nl
2305 // << "Bounding box of the mesh:" << mesh.bounds()
2306 // //<< "All points " << pts
2307 // //<< " with corresponding regions " << regions
2308 // << exit(FatalError);
2309 // }
2310 // }
2311 //
2312 // return regions;
2313 //}
2314 //XXXXXXXX
2315 
2316 
2317 // Modify cellRegion to be consistent with locationsInMesh.
2318 // - all regions not in locationsInMesh are set to -1
2319 // - check that all regions inside locationsOutsideMesh are set to -1
2322  const polyMesh& mesh,
2323  const vector& perturbVec,
2324  const pointField& locationsInMesh,
2325  const pointField& locationsOutsideMesh,
2326  const label nRegions,
2327  labelList& cellRegion
2328 )
2329 {
2330  PackedBoolList insideCell(mesh.nCells());
2331 
2332 
2333  // Mark all cells reachable from locationsInMesh
2334  labelList insideRegions(locationsInMesh.size());
2335  forAll(insideRegions, i)
2336  {
2337  // Find the region containing the point
2338  label regionI = findRegion
2339  (
2340  mesh,
2341  cellRegion,
2342  perturbVec,
2343  locationsInMesh[i]
2344  );
2345 
2346  insideRegions[i] = regionI;
2347 
2348  // Mark all cells in the region as being inside
2349  forAll(cellRegion, cellI)
2350  {
2351  if (cellRegion[cellI] == regionI)
2352  {
2353  insideCell[cellI] = true;
2354  }
2355  }
2356  }
2357 
2358 
2359 
2360  // Check that all the locations outside the
2361  // mesh do not conflict with those inside
2362  forAll(locationsOutsideMesh, i)
2363  {
2364  // Find the region containing the point
2365  label regionI = findRegion
2366  (
2367  mesh,
2368  cellRegion,
2369  perturbVec,
2370  locationsOutsideMesh[i]
2371  );
2372 
2373  if (regionI != -1)
2374  {
2375  // Do a quick check for locationsOutsideMesh overlapping with
2376  // inside ones.
2377  label index = findIndex(insideRegions, regionI);
2378  if (index != -1)
2379  {
2381  << "Location in mesh " << locationsInMesh[index]
2382  << " is inside same mesh region " << regionI
2383  << " as location outside mesh "
2384  << locationsOutsideMesh[i]
2385  << exit(FatalError);
2386  }
2387  }
2388  }
2389 
2390 
2391  // Now update cellRegion to -1 for unreachable cells
2392  forAll(insideCell, cellI)
2393  {
2394  if (!insideCell[cellI])
2395  {
2396  cellRegion[cellI] = -1;
2397  }
2398  }
2399 }
2400 
2401 
2404  const labelList& globalToMasterPatch,
2405  const labelList& globalToSlavePatch,
2406  const pointField& locationsInMesh,
2407  const pointField& locationsOutsideMesh
2408 )
2409 {
2410  // Force calculation of face decomposition (used in findCell)
2411  (void)mesh_.tetBasePtIs();
2412 
2413  // Determine connected regions. regionSplit is the labelList with the
2414  // region per cell.
2415 
2416  boolList blockedFace(mesh_.nFaces(), false);
2417  selectSeparatedCoupledFaces(blockedFace);
2418 
2419  regionSplit cellRegion(mesh_, blockedFace);
2420 
2421  findRegions
2422  (
2423  mesh_,
2424  mergeDistance_*vector(1,1,1), // perturbVec
2425  locationsInMesh,
2426  locationsOutsideMesh,
2427  cellRegion.nRegions(),
2428  cellRegion
2429  );
2430 
2431  // Subset
2432  // ~~~~~~
2433 
2434  // Get cells to remove
2435  DynamicList<label> cellsToRemove(mesh_.nCells());
2436  forAll(cellRegion, cellI)
2437  {
2438  if (cellRegion[cellI] == -1)
2439  {
2440  cellsToRemove.append(cellI);
2441  }
2442  }
2443  cellsToRemove.shrink();
2444 
2445  label nTotCellsToRemove = returnReduce
2446  (
2447  cellsToRemove.size(),
2448  sumOp<label>()
2449  );
2450 
2451 
2452  autoPtr<mapPolyMesh> mapPtr;
2453  if (nTotCellsToRemove > 0)
2454  {
2455  label nCellsToKeep =
2456  mesh_.globalData().nTotalCells()
2457  - nTotCellsToRemove;
2458 
2459  Info<< "Keeping all cells containing points " << locationsInMesh << endl
2460  << "Selected for keeping : "
2461  << nCellsToKeep
2462  << " cells." << endl;
2463 
2464 
2465  // Remove cells
2466  removeCells cellRemover(mesh_);
2467 
2468  labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove));
2469  labelList exposedPatch;
2470 
2471  label nExposedFaces = returnReduce(exposedFaces.size(), sumOp<label>());
2472  if (nExposedFaces)
2473  {
2474  // FatalErrorInFunction
2475  // << "Removing non-reachable cells should only expose"
2476  // << " boundary faces" << nl
2477  // << "ExposedFaces:" << exposedFaces << abort(FatalError);
2478 
2479  // Patch for exposed faces for lack of anything sensible.
2480  label defaultPatch = 0;
2481  if (globalToMasterPatch.size())
2482  {
2483  defaultPatch = globalToMasterPatch[0];
2484  }
2485 
2487  << "Removing non-reachable cells exposes "
2488  << nExposedFaces << " internal or coupled faces." << endl
2489  << " These get put into patch " << defaultPatch << endl;
2490  exposedPatch.setSize(exposedFaces.size(), defaultPatch);
2491  }
2492 
2493  mapPtr = doRemoveCells
2494  (
2495  cellsToRemove,
2496  exposedFaces,
2497  exposedPatch,
2498  cellRemover
2499  );
2500  }
2501  return mapPtr;
2502 }
2503 
2504 
2506 {
2507  // mesh_ already distributed; distribute my member data
2508 
2509  // surfaceQueries_ ok.
2510 
2511  // refinement
2512  meshCutter_.distribute(map);
2513 
2514  // surfaceIndex is face data.
2515  map.distributeFaceData(surfaceIndex_);
2516 
2517  // faceToPatch (baffles that were on coupled faces) is not maintained
2518  // (since baffling also disconnects points)
2519  faceToCoupledPatch_.clear();
2520 
2521  // maintainedFaces are indices of faces.
2522  forAll(userFaceData_, i)
2523  {
2524  map.distributeFaceData(userFaceData_[i].second());
2525  }
2526 
2527  // Redistribute surface and any fields on it.
2528  {
2529  Random rndGen(653213);
2530 
2531  // Get local mesh bounding box. Single box for now.
2533  treeBoundBox& bb = meshBb[0];
2534  bb = treeBoundBox(mesh_.points());
2535  bb = bb.extend(rndGen, 1e-4);
2536 
2537  // Distribute all geometry (so refinementSurfaces and shellSurfaces)
2538  searchableSurfaces& geometry =
2539  const_cast<searchableSurfaces&>(surfaces_.geometry());
2540 
2541  forAll(geometry, i)
2542  {
2544  autoPtr<mapDistribute> pointMap;
2545  geometry[i].distribute
2546  (
2547  meshBb,
2548  false, // do not keep outside triangles
2549  faceMap,
2550  pointMap
2551  );
2552 
2553  if (faceMap.valid())
2554  {
2555  // (ab)use the instance() to signal current modification time
2556  geometry[i].instance() = geometry[i].time().timeName();
2557  }
2558 
2559  faceMap.clear();
2560  pointMap.clear();
2561  }
2562  }
2563 }
2564 
2565 
2566 // Update local data for a mesh change
2569  const mapPolyMesh& map,
2570  const labelList& changedFaces
2571 )
2572 {
2573  Map<label> dummyMap(0);
2574 
2575  updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
2576 }
2577 
2578 
2581  const labelList& pointsToStore,
2582  const labelList& facesToStore,
2583  const labelList& cellsToStore
2584 )
2585 {
2586  // For now only meshCutter has storable/retrievable data.
2587  meshCutter_.storeData
2588  (
2589  pointsToStore,
2590  facesToStore,
2591  cellsToStore
2592  );
2593 }
2594 
2595 
2598  const mapPolyMesh& map,
2599  const labelList& changedFaces,
2600  const Map<label>& pointsToRestore,
2601  const Map<label>& facesToRestore,
2602  const Map<label>& cellsToRestore
2603 )
2604 {
2605  // For now only meshCutter has storable/retrievable data.
2606 
2607  // Update numbering of cells/vertices.
2608  meshCutter_.updateMesh
2609  (
2610  map,
2611  pointsToRestore,
2612  facesToRestore,
2613  cellsToRestore
2614  );
2615 
2616  // Update surfaceIndex
2617  updateList(map.faceMap(), label(-1), surfaceIndex_);
2618 
2619  // Update faceToCoupledPatch_
2620  {
2621  Map<label> newFaceToPatch(faceToCoupledPatch_.size());
2622  forAllConstIter(Map<label>, faceToCoupledPatch_, iter)
2623  {
2624  label newFaceI = map.reverseFaceMap()[iter.key()];
2625 
2626  if (newFaceI >= 0)
2627  {
2628  newFaceToPatch.insert(newFaceI, iter());
2629  }
2630  }
2631  faceToCoupledPatch_.transfer(newFaceToPatch);
2632  }
2633 
2634 
2635  // Update cached intersection information
2636  updateIntersections(changedFaces);
2637 
2638  // Update maintained faces
2639  forAll(userFaceData_, i)
2640  {
2641  labelList& data = userFaceData_[i].second();
2642 
2643  if (userFaceData_[i].first() == KEEPALL)
2644  {
2645  // extend list with face-from-face data
2646  updateList(map.faceMap(), label(-1), data);
2647  }
2648  else if (userFaceData_[i].first() == MASTERONLY)
2649  {
2650  // keep master only
2651  labelList newFaceData(map.faceMap().size(), -1);
2652 
2653  forAll(newFaceData, faceI)
2654  {
2655  label oldFaceI = map.faceMap()[faceI];
2656 
2657  if (oldFaceI >= 0 && map.reverseFaceMap()[oldFaceI] == faceI)
2658  {
2659  newFaceData[faceI] = data[oldFaceI];
2660  }
2661  }
2662  data.transfer(newFaceData);
2663  }
2664  else
2665  {
2666  // remove any face that has been refined i.e. referenced more than
2667  // once.
2668 
2669  // 1. Determine all old faces that get referenced more than once.
2670  // These get marked with -1 in reverseFaceMap
2671  labelList reverseFaceMap(map.reverseFaceMap());
2672 
2673  forAll(map.faceMap(), faceI)
2674  {
2675  label oldFaceI = map.faceMap()[faceI];
2676 
2677  if (oldFaceI >= 0)
2678  {
2679  if (reverseFaceMap[oldFaceI] != faceI)
2680  {
2681  // faceI is slave face. Mark old face.
2682  reverseFaceMap[oldFaceI] = -1;
2683  }
2684  }
2685  }
2686 
2687  // 2. Map only faces with intact reverseFaceMap
2688  labelList newFaceData(map.faceMap().size(), -1);
2689  forAll(newFaceData, faceI)
2690  {
2691  label oldFaceI = map.faceMap()[faceI];
2692 
2693  if (oldFaceI >= 0)
2694  {
2695  if (reverseFaceMap[oldFaceI] == faceI)
2696  {
2697  newFaceData[faceI] = data[oldFaceI];
2698  }
2699  }
2700  }
2701  data.transfer(newFaceData);
2702  }
2703  }
2704 }
2705 
2706 
2708 {
2709  bool writeOk =
2710  mesh_.write()
2711  && meshCutter_.write()
2712  && surfaceIndex_.write();
2713 
2714 
2715  // Make sure that any distributed surfaces (so ones which probably have
2716  // been changed) get written as well.
2717  // Note: should ideally have some 'modified' flag to say whether it
2718  // has been changed or not.
2719  searchableSurfaces& geometry =
2720  const_cast<searchableSurfaces&>(surfaces_.geometry());
2721 
2722  forAll(geometry, i)
2723  {
2724  searchableSurface& s = geometry[i];
2725 
2726  // Check if instance() of surface is not constant or system.
2727  // Is good hint that surface is distributed.
2728  if
2729  (
2730  s.instance() != s.time().system()
2731  && s.instance() != s.time().caseSystem()
2732  && s.instance() != s.time().constant()
2733  && s.instance() != s.time().caseConstant()
2734  )
2735  {
2736  // Make sure it gets written to current time, not constant.
2737  s.instance() = s.time().timeName();
2738  writeOk = writeOk && s.write();
2739  }
2740  }
2741 
2742  return writeOk;
2743 }
2744 
2745 
2748  const polyMesh& mesh,
2749  const labelList& meshPoints
2750 )
2751 {
2752  const globalIndex globalPoints(meshPoints.size());
2753 
2754  labelList myPoints(meshPoints.size());
2755  forAll(meshPoints, pointI)
2756  {
2757  myPoints[pointI] = globalPoints.toGlobal(pointI);
2758  }
2759 
2761  (
2762  mesh,
2763  meshPoints,
2764  myPoints,
2765  minEqOp<label>(),
2766  labelMax
2767  );
2768 
2769 
2770  PackedBoolList isPatchMasterPoint(meshPoints.size());
2771  forAll(meshPoints, pointI)
2772  {
2773  if (myPoints[pointI] == globalPoints.toGlobal(pointI))
2774  {
2775  isPatchMasterPoint[pointI] = true;
2776  }
2777  }
2778 
2779  return isPatchMasterPoint;
2780 }
2781 
2782 
2785  const polyMesh& mesh,
2786  const labelList& meshEdges
2787 )
2788 {
2789  const globalIndex globalEdges(meshEdges.size());
2790 
2791  labelList myEdges(meshEdges.size());
2792  forAll(meshEdges, edgeI)
2793  {
2794  myEdges[edgeI] = globalEdges.toGlobal(edgeI);
2795  }
2796 
2798  (
2799  mesh,
2800  meshEdges,
2801  myEdges,
2802  minEqOp<label>(),
2803  labelMax
2804  );
2805 
2806 
2807  PackedBoolList isMasterEdge(meshEdges.size());
2808  forAll(meshEdges, edgeI)
2809  {
2810  if (myEdges[edgeI] == globalEdges.toGlobal(edgeI))
2811  {
2812  isMasterEdge[edgeI] = true;
2813  }
2814  }
2815 
2816  return isMasterEdge;
2817 }
2818 
2819 
2820 void Foam::meshRefinement::printMeshInfo(const bool debug, const string& msg)
2821 const
2822 {
2823  const globalMeshData& pData = mesh_.globalData();
2824 
2825  if (debug)
2826  {
2827  Pout<< msg.c_str()
2828  << " : cells(local):" << mesh_.nCells()
2829  << " faces(local):" << mesh_.nFaces()
2830  << " points(local):" << mesh_.nPoints()
2831  << endl;
2832  }
2833 
2834  {
2835  PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_));
2836  label nMasterFaces = 0;
2837  forAll(isMasterFace, i)
2838  {
2839  if (isMasterFace[i])
2840  {
2841  nMasterFaces++;
2842  }
2843  }
2844 
2845  PackedBoolList isMeshMasterPoint(syncTools::getMasterPoints(mesh_));
2846  label nMasterPoints = 0;
2847  forAll(isMeshMasterPoint, i)
2848  {
2849  if (isMeshMasterPoint[i])
2850  {
2851  nMasterPoints++;
2852  }
2853  }
2854 
2855  Info<< msg.c_str()
2856  << " : cells:" << pData.nTotalCells()
2857  << " faces:" << returnReduce(nMasterFaces, sumOp<label>())
2858  << " points:" << returnReduce(nMasterPoints, sumOp<label>())
2859  << endl;
2860  }
2861 
2862 
2863  //if (debug)
2864  {
2865  const labelList& cellLevel = meshCutter_.cellLevel();
2866 
2867  labelList nCells(gMax(cellLevel)+1, 0);
2868 
2869  forAll(cellLevel, cellI)
2870  {
2871  nCells[cellLevel[cellI]]++;
2872  }
2873 
2876 
2877  Info<< "Cells per refinement level:" << endl;
2878  forAll(nCells, levelI)
2879  {
2880  Info<< " " << levelI << '\t' << nCells[levelI]
2881  << endl;
2882  }
2883  }
2884 }
2885 
2886 
2887 //- Return either time().constant() or oldInstance
2889 {
2890  if (overwrite_ && mesh_.time().timeIndex() == 0)
2891  {
2892  return oldInstance_;
2893  }
2894  else
2895  {
2896  return mesh_.time().timeName();
2897  }
2898 }
2899 
2900 
2902 {
2903  // Note: use time().timeName(), not meshRefinement::timeName()
2904  // so as to dump the fields to 0, not to constant.
2905  {
2906  volScalarField volRefLevel
2907  (
2908  IOobject
2909  (
2910  "cellLevel",
2911  mesh_.time().timeName(),
2912  mesh_,
2915  false
2916  ),
2917  mesh_,
2918  dimensionedScalar("zero", dimless, 0),
2919  zeroGradientFvPatchScalarField::typeName
2920  );
2921 
2922  const labelList& cellLevel = meshCutter_.cellLevel();
2923 
2924  forAll(volRefLevel, cellI)
2925  {
2926  volRefLevel[cellI] = cellLevel[cellI];
2927  }
2928 
2929  volRefLevel.write();
2930  }
2931 
2932  // Dump pointLevel
2933  {
2934  const pointMesh& pMesh = pointMesh::New(mesh_);
2935 
2936  pointScalarField pointRefLevel
2937  (
2938  IOobject
2939  (
2940  "pointLevel",
2941  mesh_.time().timeName(),
2942  mesh_,
2945  false
2946  ),
2947  pMesh,
2948  dimensionedScalar("zero", dimless, 0)
2949  );
2950 
2951  const labelList& pointLevel = meshCutter_.pointLevel();
2952 
2953  forAll(pointRefLevel, pointI)
2954  {
2955  pointRefLevel[pointI] = pointLevel[pointI];
2956  }
2957 
2958  pointRefLevel.write();
2959  }
2960 }
2961 
2962 
2964 {
2965  {
2966  const pointField& cellCentres = mesh_.cellCentres();
2967 
2968  OFstream str(prefix + "_edges.obj");
2969  label vertI = 0;
2970  Pout<< "meshRefinement::dumpIntersections :"
2971  << " Writing cellcentre-cellcentre intersections to file "
2972  << str.name() << endl;
2973 
2974 
2975  // Redo all intersections
2976  // ~~~~~~~~~~~~~~~~~~~~~~
2977 
2978  // Get boundary face centre and level. Coupled aware.
2979  labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
2980  pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
2981  calcNeighbourData(neiLevel, neiCc);
2982 
2983  labelList intersectionFaces(intersectedFaces());
2984 
2985  // Collect segments we want to test for
2986  pointField start(intersectionFaces.size());
2987  pointField end(intersectionFaces.size());
2988 
2989  forAll(intersectionFaces, i)
2990  {
2991  label faceI = intersectionFaces[i];
2992  start[i] = cellCentres[mesh_.faceOwner()[faceI]];
2993 
2994  if (mesh_.isInternalFace(faceI))
2995  {
2996  end[i] = cellCentres[mesh_.faceNeighbour()[faceI]];
2997  }
2998  else
2999  {
3000  end[i] = neiCc[faceI-mesh_.nInternalFaces()];
3001  }
3002  }
3003 
3004  // Extend segments a bit
3005  {
3006  const vectorField smallVec(ROOTSMALL*(end-start));
3007  start -= smallVec;
3008  end += smallVec;
3009  }
3010 
3011 
3012  // Do tests in one go
3013  labelList surfaceHit;
3014  List<pointIndexHit> surfaceHitInfo;
3015  surfaces_.findAnyIntersection
3016  (
3017  start,
3018  end,
3019  surfaceHit,
3020  surfaceHitInfo
3021  );
3022 
3023  forAll(intersectionFaces, i)
3024  {
3025  if (surfaceHit[i] != -1)
3026  {
3027  meshTools::writeOBJ(str, start[i]);
3028  vertI++;
3029  meshTools::writeOBJ(str, surfaceHitInfo[i].hitPoint());
3030  vertI++;
3031  meshTools::writeOBJ(str, end[i]);
3032  vertI++;
3033  str << "l " << vertI-2 << ' ' << vertI-1 << nl
3034  << "l " << vertI-1 << ' ' << vertI << nl;
3035  }
3036  }
3037  }
3038 
3039  Pout<< endl;
3040 }
3041 
3042 
3045  const debugType debugFlags,
3046  const writeType writeFlags,
3047  const fileName& prefix
3048 ) const
3049 {
3050  if (writeFlags & WRITEMESH)
3051  {
3052  write();
3053  }
3054  if (writeFlags & WRITELEVELS)
3055  {
3056  dumpRefinementLevel();
3057  }
3058  if (debugFlags & OBJINTERSECTIONS && prefix.size())
3059  {
3060  dumpIntersections(prefix);
3061  }
3062 }
3063 
3064 
3066 {
3067  return writeLevel_;
3068 }
3069 
3070 
3072 {
3073  writeLevel_ = flags;
3074 }
3075 
3076 
3078 {
3079  return outputLevel_;
3080 }
3081 
3082 
3084 {
3085  outputLevel_ = flags;
3086 }
3087 
3088 
3089 // ************************************************************************* //
processorPointPatch.H
Foam::meshRefinement::writeLevel_
static writeType writeLevel_
Control of writing level.
Definition: meshRefinement.H:152
volFields.H
Foam::fvMeshDistribute::countCells
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
Definition: fvMeshDistribute.C:1589
Foam::Random
Simple random number generator.
Definition: Random.H:49
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::maxOp
Definition: ops.H:172
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
meshTools.H
Foam::distribution
Accumulating histogram of values. Specified bin resolution automatic generation of bins.
Definition: distribution.H:51
geomDecomp.H
Foam::PackedBoolList
A bit-packed bool list.
Definition: PackedBoolList.H:63
Foam::pointMesh::boundary
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: pointMesh.H:106
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
Foam::syncTools::getMasterFaces
static PackedBoolList getMasterFaces(const polyMesh &)
Get per face whether it is uncoupled or a master of a.
Definition: syncTools.C:153
Foam::globalPoints
Calculates points shared by more than two processor patches or cyclic patches.
Definition: globalPoints.H:100
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
Foam::surfaceZonesInfo::faceZoneType
faceZoneType
What to do with faceZone faces.
Definition: surfaceZonesInfo.H:73
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:90
Foam::meshRefinement::dumpIntersections
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
Definition: meshRefinement.C:2963
Foam::polyBoundaryMesh::findPatchID
label findPatchID(const word &patchName) const
Find patch index given a name.
Definition: polyBoundaryMesh.C:678
Foam::meshRefinement::findRegions
static void findRegions(const polyMesh &, const vector &perturbVec, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const label nRegions, labelList &cellRegion)
Definition: meshRefinement.C:2321
Foam::Vector< scalar >::zero
static const Vector zero
Definition: Vector.H:80
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::meshRefinement::calcCellCellRays
void calcCellCellRays(const pointField &neiCc, const labelList &neiLevel, const labelList &testFaces, pointField &start, pointField &end, labelList &minLevel) const
Calculate rays from cell-centre to cell-centre and corresponding.
Definition: meshRefinement.C:219
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:86
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::meshRefinement::findRegion
static label findRegion(const polyMesh &, const labelList &cellRegion, const vector &perturbVec, const point &p)
Find region point is in. Uses optional perturbation to re-test.
Definition: meshRefinement.C:2224
cyclicSlipPointPatchFields.H
Foam::IOobject::AUTO_WRITE
@ AUTO_WRITE
Definition: IOobject.H:117
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::meshRefinement::intersectedPoints
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
Definition: meshRefinement.C:1575
Foam::findIndex
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
Foam::meshRefinement::IOoutputType
IOoutputType
Enumeration for what to output.
Definition: meshRefinement.H:111
Foam::removeCells
Given list of cells to remove insert all the topology changes.
Definition: removeCells.H:59
Foam::polyTopoChange::changeMesh
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
Definition: polyTopoChange.C:3039
Foam::DynamicList< label >
calculatedPointPatchFields.H
Foam::polyTopoChange::points
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
Definition: polyTopoChange.H:421
Foam::meshTools::writeOBJ
void writeOBJ(Ostream &os, const point &pt)
Write obj representation of point.
Definition: meshTools.C:203
Foam::polyMesh::tetBasePtIs
const labelList & tetBasePtIs() const
Return the tetBasePtIs.
Definition: polyMesh.C:818
Foam::Pstream::scatterList
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
Definition: gatherScatterList.C:205
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
volMesh.H
globalIndex.H
Foam::labelMax
static const label labelMax
Definition: label.H:62
Foam::UPstream::nProcs
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Definition: UPstream.H:387
Foam::PackedBoolList::set
void set(const PackedList< 1 > &)
Set specified bits.
Definition: PackedBoolList.C:169
Foam::polyTopoChange::addFace
label addFace(const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Add face to cells. Return new face label.
Definition: polyTopoChange.C:2805
Foam::treeBoundBox
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:75
Foam::meshRefinement::writeLevel
static writeType writeLevel()
Get/set write level.
Definition: meshRefinement.C:3065
Foam::meshRefinement::intersectedFaces
labelList intersectedFaces() const
Get faces with intersection.
Definition: meshRefinement.C:1548
Foam::polyPatch::coupled
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:322
Foam::polyTopoChange::modifyFace
void modifyFace(const face &f, const label faceI, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Modify vertices or cell of face.
Definition: polyTopoChange.C:2869
Foam::meshRefinement::printMeshInfo
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
Definition: meshRefinement.C:2820
Foam::meshRefinement::addFaceZone
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
Definition: meshRefinement.C:2145
Foam::polyMesh::meshSubDir
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:309
motionSmoother.H
polyTopoChange.H
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
localPointRegion.H
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:97
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
Foam::meshRefinement::countHits
label countHits() const
Count number of intersections (local)
Definition: meshRefinement.C:1273
Foam::fvPatch::New
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
Definition: fvPatchNew.C:33
Foam::maxEqOp
Definition: ops.H:77
Foam::globalMeshData::nTotalCells
label nTotalCells() const
Return total number of cells in decomposed mesh.
Definition: globalMeshData.H:394
Foam::Pair::first
const Type & first() const
Return first.
Definition: Pair.H:87
Foam::refinementSurfaces::findHigherIntersection
void findHigherIntersection(const shellSurfaces &shells, const pointField &start, const pointField &end, const labelList &currentLevel, labelList &surfaces, labelList &surfaceLevel) const
Find intersection of edge. Return -1 or first surface.
Definition: refinementSurfaces.C:723
Foam::meshRefinement::IOdebugType
IOdebugType
Enumeration for what to debug.
Definition: meshRefinement.H:90
Foam::polyMesh::facesInstance
const fileName & facesInstance() const
Return the current instance directory for faces.
Definition: polyMesh.C:778
Foam::removeCells::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: removeCells.H:115
Foam::Map< label >
Foam::meshRefinement::IOoutputTypeNames
static const NamedEnum< IOoutputType, 1 > IOoutputTypeNames
Definition: meshRefinement.H:115
Foam::meshRefinement::appendPatch
static label appendPatch(fvMesh &, const label insertPatchI, const word &, const dictionary &)
Helper:append patch to end of mesh.
Definition: meshRefinement.C:1891
Foam::meshRefinement::splitFacesUndo
label splitFacesUndo(const labelList &splitFaces, const labelPairList &splits, const dictionary &motionDict, labelList &duplicateFace, List< labelPair > &baffles)
Split faces along diagonal. Maintain mesh quality. Return.
Definition: meshRefinement.C:855
Foam::faceSet
A list of face labels.
Definition: faceSet.H:48
Foam::maxMagSqrEqOp
Definition: ops.H:80
Foam::meshRefinement::IOwriteTypeNames
static const NamedEnum< IOwriteType, 4 > IOwriteTypeNames
Definition: meshRefinement.H:129
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::coupledPolyPatch
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
Definition: coupledPolyPatch.H:51
decompositionMethod.H
Foam::polyBoundaryMesh::reorder
void reorder(const labelUList &, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
Definition: polyBoundaryMesh.C:1100
removeCells.H
refinementFeatures.H
Foam::meshRefinement::calculateEdgeWeights
static void calculateEdgeWeights(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
Definition: meshRefinement.C:1835
Foam::meshRefinement::IOwriteType
IOwriteType
Enumeration for what to write.
Definition: meshRefinement.H:122
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::HashSet< label, Hash< label > >
syncTools.H
Foam::meshRefinement::addPatch
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
Definition: meshRefinement.C:1990
Foam::meshRefinement::doSplitFaces
void doSplitFaces(const labelList &splitFaces, const labelPairList &splits, polyTopoChange &meshMod) const
Split faces into two.
Definition: meshRefinement.C:740
meshBb
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::meshRefinement::updateList
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
Definition: meshRefinementTemplates.C:35
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New
static const pointMesh & New(const polyMesh &mesh)
Definition: MeshObject.C:44
Foam::meshRefinement::IOdebugTypeNames
static const NamedEnum< IOdebugType, 5 > IOdebugTypeNames
Definition: meshRefinement.H:99
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
OFstream.H
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const
Return face zone mesh.
Definition: polyMesh.H:463
Foam::polyTopoChange::setCapacity
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh.
Definition: polyTopoChange.C:2498
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:52
Foam::meshRefinement::surfaces_
const refinementSurfaces & surfaces_
All surface-intersection interaction.
Definition: meshRefinement.H:173
Foam::meshRefinement::doRemoveCells
autoPtr< mapPolyMesh > doRemoveCells(const labelList &cellsToRemove, const labelList &exposedFaces, const labelList &exposedPatchIDs, removeCells &cellRemover)
Remove cells. Put exposedFaces into exposedPatchIDs.
Definition: meshRefinement.C:680
Foam::SubField
Pre-declare related SubField type.
Definition: Field.H:61
Foam::renumber
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:32
Foam::inplaceRenumber
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
Definition: ListOpsTemplates.C:57
Foam::coupledPolyPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: coupledPolyPatch.H:288
Foam::primitiveMesh::nCells
label nCells() const
Definition: primitiveMeshI.H:64
Foam::polyMesh::pointsInstance
const fileName & pointsInstance() const
Return the current instance directory for points.
Definition: polyMesh.C:772
searchableSurfaces.H
mapDistributePolyMesh.H
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::coupledPolyPatch::separated
virtual bool separated() const
Are the planes separated.
Definition: coupledPolyPatch.H:276
Foam::primitiveMesh::nPoints
label nPoints() const
Definition: primitiveMeshI.H:35
Foam::meshRefinement::splitMeshRegions
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const pointField &locationsInMesh, const pointField &locationsOutsideMesh)
Split mesh. Keep part containing point. Return empty map if.
Definition: meshRefinement.C:2403
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:43
Foam::shellSurfaces
Encapsulates queries for volume refinement ('refine all cells within shell').
Definition: shellSurfaces.H:52
Foam::PtrList::set
bool set(const label) const
Is element set.
Foam::meshRefinement::surfaceIndex_
labelIOList surfaceIndex_
Per cc-cc vector the index of the surface hit.
Definition: meshRefinement.H:188
Foam::meshRefinement::timeName
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
Definition: meshRefinement.C:2888
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::polyTopoChange::faces
const DynamicList< face > & faces() const
Definition: polyTopoChange.H:426
Foam::meshRefinement::checkCoupledFaceZones
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
Definition: meshRefinement.C:1747
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:64
Foam::treeBoundBox::extend
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
Definition: treeBoundBoxI.H:317
treeBoundBox.H
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
refinementSurfaces.H
Foam::minEqOp
Definition: ops.H:78
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:66
Foam::meshRefinement::meshedPatches
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
Definition: meshRefinement.C:2118
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1017
faceSet.H
regionSplit.H
Foam::IndirectList
A List with indirect addressing.
Definition: IndirectList.H:102
Foam::ZoneMesh< faceZone, polyMesh >
f1
scalar f1
Definition: createFields.H:28
Foam::Pair::second
const Type & second() const
Return second.
Definition: Pair.H:99
Foam::polyBoundaryMesh::whichPatch
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Definition: polyBoundaryMesh.C:703
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobject.H:273
Foam::regionSplit
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Definition: regionSplit.H:119
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::regionSplit::nRegions
label nRegions() const
Return total number of regions.
Definition: regionSplit.H:201
slipPointPatchFields.H
Foam::DynamicList::shrink
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Definition: DynamicListI.H:258
Foam::polyPatch::constraintType
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: polyPatch.C:270
Foam::meshRefinement::distribute
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
Definition: meshRefinement.C:2505
Foam::removeCells::setRefinement
void setRefinement(const labelList &cellsToRemove, const labelList &facesToExpose, const labelList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
Definition: removeCells.C:189
Foam::identity
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
Foam::polyTopoChange::removeFace
void removeFace(const label, const label)
Remove/merge face.
Definition: polyTopoChange.C:2914
Foam::PtrList::reorder
void reorder(const labelUList &)
Reorders elements. Ordering does not have to be done in.
Definition: PtrList.C:208
Foam::decompositionMethod::setConstraints
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections)
Helper: extract constraints:
Definition: decompositionMethod.C:1421
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::HashTable::size
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const
Definition: primitiveMeshI.H:52
surfaceMesh.H
Foam::globalMeshData
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Definition: globalMeshData.H:106
Foam::polyPatch::New
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
Definition: polyPatchNew.C:32
Foam::meshRefinement::makePatch
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
Definition: meshRefinement.C:1644
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
fld
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
meshRefinement.H
Foam::plusEqOp
Definition: ops.H:71
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::decompositionMethod
Abstract base class for decomposition.
Definition: decompositionMethod.H:48
Foam::localPointRegion::findDuplicateFaces
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
Definition: localPointRegion.C:541
Foam::eqOp
Definition: ops.H:70
Foam::HashTable::found
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:109
Foam::meshRefinement::calcNeighbourData
void calcNeighbourData(labelList &neiLevel, pointField &neiCc) const
Calculate coupled boundary end vector and refinement level.
Definition: meshRefinement.C:125
Foam::mapDistributePolyMesh::distributeFaceData
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
Definition: mapDistributePolyMesh.H:243
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::calculatedFvPatchField
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Definition: calculatedFvPatchField.H:65
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
Foam::meshRefinement::mesh_
fvMesh & mesh_
Reference to mesh.
Definition: meshRefinement.H:161
Foam::faceZone::whichFace
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
Definition: faceZone.C:314
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::polyPatch::faceCells
const labelUList & faceCells() const
Return face-cell addressing.
Definition: polyPatch.C:340
Foam::zone::name
const word & name() const
Return name.
Definition: zone.H:150
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
Foam::PackedList::get
unsigned int get(const label) const
Get value at index I.
Definition: PackedListI.H:964
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
Foam::meshRefinement::updateMesh
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
Definition: meshRefinement.C:2568
Foam::syncTools::syncBoundaryFacePositions
static void syncBoundaryFacePositions(const polyMesh &mesh, UList< point > &l, const CombineOp &cop)
Synchronize locations on boundary faces only.
Definition: syncTools.H:363
Foam::boolList
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:312
Foam::meshRefinement::getMasterEdges
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
Definition: meshRefinement.C:2784
Foam::meshRefinement::balance
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
Definition: meshRefinement.C:1292
fixedValuePointPatchFields.H
Random.H
Foam::meshRefinement::meshRefinement
meshRefinement(const meshRefinement &)
Disallow default bitwise copy construct.
Foam::ZoneMesh::names
wordList names() const
Return a list of zone names.
Definition: ZoneMesh.C:263
Foam::DynamicList::append
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::OFstream
Output to file stream.
Definition: OFstream.H:81
Foam::meshRefinement::setInstance
void setInstance(const fileName &)
Set instance of all local IOobjects.
Definition: meshRefinement.C:670
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:405
Foam::pointBoundaryMesh
Foam::pointBoundaryMesh.
Definition: pointBoundaryMesh.H:52
Foam::mapPolyMesh::reverseFaceMap
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:497
Foam::meshRefinement::selectSeparatedCoupledFaces
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
Definition: meshRefinement.C:2197
Foam::Pstream::listCombineGather
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Definition: combineGatherScatter.C:282
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::polyMesh::findCell
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
Definition: polyMesh.C:1411
Foam::decompositionMethod::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
Definition: decompositionMethod.H:126
Foam::primitiveMesh::cellCentres
const vectorField & cellCentres() const
Definition: primitiveMeshCellCentresAndVols.C:211
Foam::syncTools::swapBoundaryFaceList
static void swapBoundaryFaceList(const polyMesh &mesh, UList< T > &l)
Swap coupled boundary face values.
Definition: syncTools.H:430
Foam::meshRefinement::getMasterPoints
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
Definition: meshRefinement.C:2747
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1004
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::Pstream::gatherList
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
Definition: gatherScatterList.C:49
Foam::syncTools::syncEdgeList
static void syncEdgeList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh edges.
Definition: syncToolsTemplates.C:1141
Foam::primitiveMesh::nFaces
label nFaces() const
Definition: primitiveMeshI.H:58
fvMeshDistribute.H
Foam::sumOp
Definition: ops.H:162
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
Foam::Pout
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
Foam::polyPatch::faceCentres
const vectorField::subField faceCentres() const
Return face centres.
Definition: polyPatch.C:308
Foam::HashTable::clear
void clear()
Clear all entries from table.
Definition: HashTable.C:473
fvMeshTools.H
Foam::refinementFeatures
Encapsulates queries for features.
Definition: refinementFeatures.H:51
f
labelList f(nPoints)
Foam::motionSmootherAlgo::checkMesh
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
Definition: motionSmootherAlgoCheck.C:415
Foam::Vector< scalar >
Foam::meshRefinement::writeType
writeType
Definition: meshRefinement.H:130
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::primitiveMesh::isInternalFace
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Definition: primitiveMeshI.H:70
Foam::polyPatch::faceAreas
const vectorField::subField faceAreas() const
Return face normals.
Definition: polyPatch.C:314
Foam::searchableSurfaces
Container for searchableSurfaces.
Definition: searchableSurfaces.H:53
Foam::meshRefinement::checkData
void checkData()
Debugging: check that all faces still obey start()>end()
Definition: meshRefinement.C:466
Foam::dictionary::transfer
void transfer(dictionary &)
Transfer the contents of the argument and annul the argument.
Definition: dictionary.C:1059
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
Foam::meshRefinement::write
bool write() const
Write mesh and all data.
Definition: meshRefinement.C:2707
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::PtrList::setSize
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:142
Foam::syncTools::getMasterPoints
static PackedBoolList getMasterPoints(const polyMesh &)
Get per point whether it is uncoupled or a master of a.
Definition: syncTools.C:65
Foam::meshRefinement::addMeshedPatch
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
Definition: meshRefinement.C:2068
Foam::meshRefinement::storeData
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
Definition: meshRefinement.C:2580
Foam::fvMeshDistribute::distribute
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
Definition: fvMeshDistribute.C:1613
Foam::mapPolyMesh::faceMap
const labelList & faceMap() const
Old face map.
Definition: mapPolyMesh.H:406
Foam::meshRefinement::testSyncPointList
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
Definition: meshRefinement.C:373
Foam::meshRefinement::outputLevel
static outputType outputLevel()
Get/set output level.
Definition: meshRefinement.C:3077
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::autoPtr::clear
void clear()
Delete object (if the pointer is valid) and set pointer to NULL.
Definition: autoPtrI.H:126
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::UIndirectList
A List with indirect addressing.
Definition: fvMatrix.H:106
patches
patches[0]
Definition: createSingleCellMesh.H:36
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::meshRefinement::updateIntersections
void updateIntersections(const labelList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
Definition: meshRefinement.C:269
Foam::minMagSqrEqOp
Definition: ops.H:79
Foam::OFstream::name
const fileName & name() const
Return the name of the stream.
Definition: OFstream.H:118
Foam::PackedList::size
label size() const
Number of entries.
Definition: PackedListI.H:714
Foam::syncTools::syncFaceList
static void syncFaceList(const polyMesh &mesh, UList< T > &l, const CombineOp &cop)
Synchronize values on all mesh faces.
Definition: syncTools.H:381
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::meshRefinement::outputType
outputType
Definition: meshRefinement.H:116
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:57
Foam::Pstream::listCombineScatter
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Definition: combineGatherScatter.C:417
Foam::point
vector point
Point is a vector.
Definition: point.H:41
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::meshRefinement::shells_
const shellSurfaces & shells_
All shell-refinement interaction.
Definition: meshRefinement.H:179
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::refinementSurfaces
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
Definition: refinementSurfaces.H:60
Foam::meshRefinement::outputLevel_
static outputType outputLevel_
Control of output/log level.
Definition: meshRefinement.H:155
Foam::faceZone::flipMap
const boolList & flipMap() const
Return face flip map.
Definition: faceZone.H:249
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
zeroGradientFvPatchFields.H
Foam::removeCells::getExposedFaces
labelList getExposedFaces(const labelList &cellsToRemove) const
Get labels of exposed faces.
Definition: removeCells.C:73
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::meshRefinement::makeDisplacementField
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
Definition: meshRefinement.C:1690
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
Foam::fvMeshDistribute
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Definition: fvMeshDistribute.H:70
Foam::labelPair
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
rndGen
cachedRandom rndGen(label(0), -1)
pointFields.H
write
Tcoeff write()
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:562
pointMesh.H
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::polyMesh::faceNeighbour
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1023
Foam::syncTools::syncPointList
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
Definition: syncToolsTemplates.C:984
Foam::meshRefinement::getFaceZoneInfo
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
Definition: meshRefinement.C:2169
Foam::localPointRegion::findDuplicateFacePairs
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Definition: localPointRegion.C:620
Foam::NamedEnum
Initialise the NamedEnum HashTable from the static list of names.
Definition: NamedEnum.H:52
Foam::fvMesh::clearOut
void clearOut()
Clear all geometry and addressing.
Definition: fvMesh.C:231
Foam::globalIndex::toGlobal
label toGlobal(const label i) const
From local to global.
Definition: globalIndexI.H:82
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
Foam::andEqOp
Definition: ops.H:81
Foam::dictionary::set
void set(entry *)
Assign a new entry, overwrite any existing entry.
Definition: dictionary.C:856
Foam::meshRefinement::dumpRefinementLevel
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
Definition: meshRefinement.C:2901
Foam::meshRefinement::debugType
debugType
Definition: meshRefinement.H:100
Foam::surfaceZonesInfo::addFaceZone
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
Definition: surfaceZonesInfo.C:452