snappyHexMesh.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-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright 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  Application
25  snappyHexMesh
26 
27  Description
28  Automatic split hex mesher. Refines and snaps to surface.
29 
30  \*---------------------------------------------------------------------------*/
31 
32 #include "argList.H"
33 #include "Time.H"
34 #include "fvMesh.H"
35 #include "autoRefineDriver.H"
36 #include "autoSnapDriver.H"
37 #include "autoLayerDriver.H"
38 #include "searchableSurfaces.H"
39 #include "refinementSurfaces.H"
40 #include "refinementFeatures.H"
41 #include "shellSurfaces.H"
42 #include "decompositionMethod.H"
43 #include "noDecomp.H"
44 #include "fvMeshDistribute.H"
45 #include "wallPolyPatch.H"
46 #include "refinementParameters.H"
47 #include "snapParameters.H"
48 #include "layerParameters.H"
49 #include "vtkSetWriter.H"
50 #include "faceSet.H"
51 #include "motionSmoother.H"
52 #include "polyTopoChange.H"
53 #include "cellModeller.H"
54 #include "uindirectPrimitivePatch.H"
55 #include "surfZoneIdentifierList.H"
56 #include "UnsortedMeshedSurface.H"
57 #include "MeshedSurface.H"
58 #include "globalIndex.H"
59 #include "IOmanip.H"
60 #include "decompositionModel.H"
61 #include "fvMeshTools.H"
62 
63 using namespace Foam;
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 // Convert size (as fraction of defaultCellSize) to refinement level
69 (
70  const scalar level0Coeff, // ratio of hex cell size v.s. defaultCellSize
71  const scalar sizeCoeff
72  )
73 {
74  return round(::log(level0Coeff/sizeCoeff)/::log(2));
75 }
76 
77 
79 (
80  const searchableSurfaces& allGeometry,
81  const dictionary& surfacesDict,
82  const dictionary& shapeControlDict,
83  const label gapLevelIncrement,
84  const scalar level0Coeff
85  )
86 {
87  autoPtr<refinementSurfaces> surfacePtr;
88 
89  // Count number of surfaces.
90  label surfI = 0;
91  forAll(allGeometry.names(), geomI)
92  {
93  const word& geomName = allGeometry.names()[geomI];
94 
95  if (surfacesDict.found(geomName))
96  {
97  surfI++;
98  }
99  }
100 
101  labelList surfaces(surfI);
102  wordList names(surfI);
103  PtrList<surfaceZonesInfo> surfZones(surfI);
104 
105  labelList regionOffset(surfI);
106 
107  labelList globalMinLevel(surfI, 0);
108  labelList globalMaxLevel(surfI, 0);
109  labelList globalLevelIncr(surfI, 0);
110  PtrList<dictionary> globalPatchInfo(surfI);
111  List<Map<label> > regionMinLevel(surfI);
112  List<Map<label> > regionMaxLevel(surfI);
113  List<Map<label> > regionLevelIncr(surfI);
114  List<Map<scalar> > regionAngle(surfI);
115  List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
116 
117  HashSet<word> unmatchedKeys(surfacesDict.toc());
118 
119  surfI = 0;
120  forAll(allGeometry.names(), geomI)
121  {
122  const word& geomName = allGeometry.names()[geomI];
123 
124  const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
125 
126  if (ePtr)
127  {
128  const dictionary& shapeDict = ePtr->dict();
129  unmatchedKeys.erase(ePtr->keyword());
130 
131  names[surfI] = geomName;
132  surfaces[surfI] = geomI;
133 
134  const searchableSurface& surface = allGeometry[geomI];
135 
136  // Find the index in shapeControlDict
137  // Invert surfaceCellSize to get the refinementLevel
138 
139  const word scsFuncName =
140  shapeDict.lookup("surfaceCellSizeFunction");
141  const dictionary& scsDict =
142  shapeDict.subDict(scsFuncName + "Coeffs");
143 
144  const scalar surfaceCellSize =
145  readScalar(scsDict.lookup("surfaceCellSizeCoeff"));
146 
147  const label refLevel = sizeCoeffToRefinement
148  (
149  level0Coeff,
150  surfaceCellSize
151  );
152 
153  globalMinLevel[surfI] = refLevel;
154  globalMaxLevel[surfI] = refLevel;
155  globalLevelIncr[surfI] = gapLevelIncrement;
156 
157  // Surface zones
158  surfZones.set(surfI, new surfaceZonesInfo(surface, shapeDict));
159 
160 
161  // Global perpendicular angle
162  if (shapeDict.found("patchInfo"))
163  {
164  globalPatchInfo.set
165  (
166  surfI,
167  shapeDict.subDict("patchInfo").clone()
168  );
169  }
170 
171 
172  // Per region override of patchInfo
173 
174  if (shapeDict.found("regions"))
175  {
176  const dictionary& regionsDict = shapeDict.subDict("regions");
177  const wordList& regionNames =
178  allGeometry[surfaces[surfI]].regions();
179 
180  forAll(regionNames, regionI)
181  {
182  Info << "patchInfo regionName is "<< regionNames[regionI]<< endl;
183  if (regionsDict.found(regionNames[regionI]))
184  {
185  // Get the dictionary for region
186  const dictionary& regionDict = regionsDict.subDict
187  (
188  regionNames[regionI]
189  );
190 
191  if (regionDict.found("patchInfo"))
192  {
193  regionPatchInfo[surfI].insert
194  (
195  regionI,
196  regionDict.subDict("patchInfo").clone()
197  );
198  }
199  }
200  }
201  }
202 
203  // Per region override of cellSize
204  if (shapeDict.found("regions"))
205  {
206  const dictionary& shapeControlRegionsDict =
207  shapeDict.subDict("regions");
208  const wordList& regionNames =
209  allGeometry[surfaces[surfI]].regions();
210 
211  forAll(regionNames, regionI)
212  {
213  Info << "cellSize regionName is "<< regionNames[regionI]<< endl;
214  if (shapeControlRegionsDict.found(regionNames[regionI]))
215  {
216  const dictionary& shapeControlRegionDict =
217  shapeControlRegionsDict.subDict
218  (
219  regionNames[regionI]
220  );
221 
222  const word scsFuncName =
223  shapeControlRegionDict.lookup
224  (
225  "surfaceCellSizeFunction"
226  );
227  const dictionary& scsDict =
228  shapeControlRegionDict.subDict
229  (
230  scsFuncName + "Coeffs"
231  );
232 
233  const scalar surfaceCellSize =
234  readScalar
235  (
236  scsDict.lookup("surfaceCellSizeCoeff")
237  );
238 
239  const label refLevel = sizeCoeffToRefinement
240  (
241  level0Coeff,
242  surfaceCellSize
243  );
244 
245  regionMinLevel[surfI].insert(regionI, refLevel);
246  regionMaxLevel[surfI].insert(regionI, refLevel);
247  regionLevelIncr[surfI].insert(regionI, 0);
248  }
249  }
250  }
251 
252  surfI++;
253  }
254  }
255 
256  // Calculate local to global region offset
257  label nRegions = 0;
258 
259  forAll(surfaces, surfI)
260  {
261  regionOffset[surfI] = nRegions;
262  nRegions += allGeometry[surfaces[surfI]].regions().size();
263  }
264 
265  // Rework surface specific information into information per global region
266  labelList minLevel(nRegions, 0);
267  labelList maxLevel(nRegions, 0);
268  labelList gapLevel(nRegions, -1);
269  PtrList<dictionary> patchInfo(nRegions);
270 
271  forAll(globalMinLevel, surfI)
272  {
273  label nRegions = allGeometry[surfaces[surfI]].regions().size();
274 
275  // Initialise to global (i.e. per surface)
276  for (label i = 0; i < nRegions; i++)
277  {
278  label globalRegionI = regionOffset[surfI] + i;
279  minLevel[globalRegionI] = globalMinLevel[surfI];
280  maxLevel[globalRegionI] = globalMaxLevel[surfI];
281  gapLevel[globalRegionI] =
282  maxLevel[globalRegionI]
283  + globalLevelIncr[surfI];
284 
285  if (globalPatchInfo.set(surfI))
286  {
287  patchInfo.set
288  (
289  globalRegionI,
290  globalPatchInfo[surfI].clone()
291  );
292  }
293  }
294 
295  // Overwrite with region specific information
296  forAllConstIter(Map<label>, regionMinLevel[surfI], iter)
297  {
298  label globalRegionI = regionOffset[surfI] + iter.key();
299 
300  minLevel[globalRegionI] = iter();
301  maxLevel[globalRegionI] = regionMaxLevel[surfI][iter.key()];
302  gapLevel[globalRegionI] =
303  maxLevel[globalRegionI]
304  + regionLevelIncr[surfI][iter.key()];
305  }
306 
307  const Map<autoPtr<dictionary> >& localInfo = regionPatchInfo[surfI];
308  forAllConstIter(Map<autoPtr<dictionary> >, localInfo, iter)
309  {
310  label globalRegionI = regionOffset[surfI] + iter.key();
311  patchInfo.set(globalRegionI, iter()().clone());
312  }
313  }
314 
315  surfacePtr.set
316  (
318  (
319  allGeometry,
320  surfaces,
321  names,
322  surfZones,
323  regionOffset,
324  minLevel,
325  maxLevel,
326  gapLevel,
327  scalarField(nRegions, -GREAT), //perpendicularAngle,
328  patchInfo
329  )
330  );
331 
332 
333  const refinementSurfaces& rf = surfacePtr();
334 
335  // Determine maximum region name length
336  label maxLen = 0;
337  forAll(rf.surfaces(), surfI)
338  {
339  label geomI = rf.surfaces()[surfI];
340  const wordList& regionNames = allGeometry.regionNames()[geomI];
341  forAll(regionNames, regionI)
342  {
343  maxLen = Foam::max(maxLen, label(regionNames[regionI].size()));
344  }
345  }
346 
347 
348  Info<< setw(maxLen) << "Region"
349  << setw(10) << "Min Level"
350  << setw(10) << "Max Level"
351  << setw(10) << "Gap Level" << nl
352  << setw(maxLen) << "------"
353  << setw(10) << "---------"
354  << setw(10) << "---------"
355  << setw(10) << "---------" << endl;
356 
357  forAll(rf.surfaces(), surfI)
358  {
359  label geomI = rf.surfaces()[surfI];
360 
361  Info<< rf.names()[surfI] << ':' << nl;
362 
363  const wordList& regionNames = allGeometry.regionNames()[geomI];
364 
365  forAll(regionNames, regionI)
366  {
367  label globalI = rf.globalRegion(surfI, regionI);
368 
369  Info<< setw(maxLen) << regionNames[regionI]
370  << setw(10) << rf.minLevel()[globalI]
371  << setw(10) << rf.maxLevel()[globalI]
372  << setw(10) << rf.gapLevel()[globalI] << endl;
373  }
374  }
375 
376 
377  return surfacePtr;
378 }
379 
380 
381  void extractSurface
382 (
383  const polyMesh& mesh,
384  const Time& runTime,
385  const labelHashSet& includePatches,
386  const fileName& outFileName
387  )
388 {
390 
391  // Collect sizes. Hash on names to handle local-only patches (e.g.
392  // processor patches)
393  HashTable<label> patchSize(1000);
394  label nFaces = 0;
395  forAllConstIter(labelHashSet, includePatches, iter)
396  {
397  const polyPatch& pp = bMesh[iter.key()];
398  patchSize.insert(pp.name(), pp.size());
399  nFaces += pp.size();
400  }
402 
403 
404  // Allocate zone/patch for all patches
405  HashTable<label> compactZoneID(1000);
406  forAllConstIter(HashTable<label>, patchSize, iter)
407  {
408  label sz = compactZoneID.size();
409  compactZoneID.insert(iter.key(), sz);
410  }
411  Pstream::mapCombineScatter(compactZoneID);
412 
413 
414  // Rework HashTable into labelList just for speed of conversion
415  labelList patchToCompactZone(bMesh.size(), -1);
416  forAllConstIter(HashTable<label>, compactZoneID, iter)
417  {
418  label patchI = bMesh.findPatchID(iter.key());
419  if (patchI != -1)
420  {
421  patchToCompactZone[patchI] = iter();
422  }
423  }
424 
425  // Collect faces on zones
426  DynamicList<label> faceLabels(nFaces);
427  DynamicList<label> compactZones(nFaces);
428  forAllConstIter(labelHashSet, includePatches, iter)
429  {
430  const polyPatch& pp = bMesh[iter.key()];
431  forAll(pp, i)
432  {
433  faceLabels.append(pp.start()+i);
434  compactZones.append(patchToCompactZone[pp.index()]);
435  }
436  }
437 
438  // Addressing engine for all faces
439  uindirectPrimitivePatch allBoundary
440  (
441  UIndirectList<face>(mesh.faces(), faceLabels),
442  mesh.points()
443  );
444 
445 
446  // Find correspondence to master points
447  labelList pointToGlobal;
448  labelList uniqueMeshPoints;
450  (
451  allBoundary.meshPoints(),
452  allBoundary.meshPointMap(),
453  pointToGlobal,
454  uniqueMeshPoints
455  );
456 
457  // Gather all unique points on master
458  List<pointField> gatheredPoints(Pstream::nProcs());
459  gatheredPoints[Pstream::myProcNo()] = pointField
460  (
461  mesh.points(),
462  uniqueMeshPoints
463  );
464  Pstream::gatherList(gatheredPoints);
465 
466  // Gather all faces
467  List<faceList> gatheredFaces(Pstream::nProcs());
468  gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces();
469  forAll(gatheredFaces[Pstream::myProcNo()], i)
470  {
471  inplaceRenumber(pointToGlobal, gatheredFaces[Pstream::myProcNo()][i]);
472  }
473  Pstream::gatherList(gatheredFaces);
474 
475  // Gather all ZoneIDs
476  List<labelList> gatheredZones(Pstream::nProcs());
477  gatheredZones[Pstream::myProcNo()] = compactZones.xfer();
478  Pstream::gatherList(gatheredZones);
479 
480  // On master combine all points, faces, zones
481  if (Pstream::master())
482  {
483  pointField allPoints = ListListOps::combine<pointField>
484  (
485  gatheredPoints,
487  );
488  gatheredPoints.clear();
489 
490  faceList allFaces = ListListOps::combine<faceList>
491  (
492  gatheredFaces,
494  );
495  gatheredFaces.clear();
496 
497  labelList allZones = ListListOps::combine<labelList>
498  (
499  gatheredZones,
501  );
502  gatheredZones.clear();
503 
504 
505  // Zones
506  surfZoneIdentifierList surfZones(compactZoneID.size());
507  forAllConstIter(HashTable<label>, compactZoneID, iter)
508  {
509  surfZones[iter()] = surfZoneIdentifier(iter.key(), iter());
510  Info<< "surfZone " << iter() << " : " << surfZones[iter()].name()
511  << endl;
512  }
513 
514  UnsortedMeshedSurface<face> unsortedFace
515  (
517  xferMove(allFaces),
518  xferMove(allZones),
519  xferMove(surfZones)
520  );
521 
522 
523  MeshedSurface<face> sortedFace(unsortedFace);
524 
525  fileName globalCasePath
526  (
527  runTime.processorCase()
528  ? runTime.path()/".."/outFileName
529  : runTime.path()/outFileName
530  );
531 
532  Info<< "Writing merged surface to " << globalCasePath << endl;
533 
534  sortedFace.write(globalCasePath);
535  }
536 }
537 
538 
539 // Check writing tolerance before doing any serious work
540 scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol)
541 {
542  const boundBox& meshBb = mesh.bounds();
543  scalar mergeDist = mergeTol * meshBb.mag();
544 
545  Info<< nl
546  << "Overall mesh bounding box : " << meshBb << nl
547  << "Relative tolerance : " << mergeTol << nl
548  << "Absolute matching distance : " << mergeDist << nl
549  << endl;
550 
551  // check writing tolerance
553  {
554  const scalar writeTol = std::pow
555  (
556  scalar(10.0),
557  -scalar(IOstream::defaultPrecision())
558  );
559 
560  if (mergeTol < writeTol)
561  {
563  << "Your current settings specify ASCII writing with "
564  << IOstream::defaultPrecision() << " digits precision." << nl
565  << "Your merging tolerance (" << mergeTol
566  << ") is finer than this." << nl
567  << "Change to binary writeFormat, "
568  << "or increase the writePrecision" << endl
569  << "or adjust the merge tolerance (mergeTol)."
570  << exit(FatalError);
571  }
572  }
573 
574  return mergeDist;
575 }
576 
577 
578 // Write mesh and additional information
579  void writeMesh
580 (
581  const string& msg,
582  const meshRefinement& meshRefiner,
583  const meshRefinement::debugType debugLevel,
584  const meshRefinement::writeType writeLevel
585  )
586 {
587  const fvMesh& mesh = meshRefiner.mesh();
588 
589  meshRefiner.printMeshInfo(debugLevel, msg);
590  Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
591 
592  //label flag = meshRefinement::MESH;
593  //if (writeLevel)
594  //{
595  // flag |= meshRefinement::SCALARLEVELS;
596  //}
597  //if (debug & meshRefinement::OBJINTERSECTIONS)
598  //{
599  // flag |= meshRefinement::OBJINTERSECTIONS;
600  //}
601  meshRefiner.write
602  (
603  debugLevel,
605  mesh.time().path()/meshRefiner.timeName()
606  );
607  Info<< "Wrote mesh in = "
608  << mesh.time().cpuTimeIncrement() << " s." << endl;
609 }
610 
611 
612 int main(int argc, char *argv[])
613 {
614 #include "addOverwriteOption.H"
616  (
617  "checkGeometry",
618  "check all surface geometry for quality"
619  );
621  (
622  "surfaceSimplify",
623  "boundBox",
624  "simplify the surface using snappyHexMesh starting from a boundBox"
625  );
627  (
628  "patches",
629  "(patch0 .. patchN)",
630  "only triangulate selected patches (wildcards supported)"
631  );
633  (
634  "outFile",
635  "fileName",
636  "name of the file to save the simplified surface to"
637  );
638 #include "addDictOption.H"
639 
640 #include "setRootCase.H"
641 #include "createTime.H"
642  runTime.functionObjects().off();
643 
644  const bool overwrite = args.optionFound("overwrite");
645  const bool checkGeometry = args.optionFound("checkGeometry");
646  const bool surfaceSimplify = args.optionFound("surfaceSimplify");
647 
649 
650  // if (surfaceSimplify)
651  // {
652  // IOdictionary foamyHexMeshDict
653  // (
654  // IOobject
655  // (
656  // "foamyHexMeshDict",
657  // runTime.system(),
658  // runTime,
659  // IOobject::MUST_READ_IF_MODIFIED,
660  // IOobject::NO_WRITE
661  // )
662  // );
663  //
664  // const dictionary& motionDict =
665  // foamyHexMeshDict.subDict("motionControl");
666  //
667  // const scalar defaultCellSize =
668  // readScalar(motionDict.lookup("defaultCellSize"));
669  //
670  // Info<< "Constructing single cell mesh from boundBox" << nl << endl;
671  //
672  // boundBox bb(args.optionRead<boundBox>("surfaceSimplify"));
673  //
674  // labelList owner(6, label(0));
675  // labelList neighbour(0);
676  //
677  // const cellModel& hexa = *(cellModeller::lookup("hex"));
678  // faceList faces = hexa.modelFaces();
679  //
680  // meshPtr.set
681  // (
682  // new fvMesh
683  // (
684  // IOobject
685  // (
686  // fvMesh::defaultRegion,
687  // runTime.timeName(),
688  // runTime,
689  // IOobject::NO_READ
690  // ),
691  // xferMove<Field<vector> >(bb.points()()),
692  // faces.xfer(),
693  // owner.xfer(),
694  // neighbour.xfer()
695  // )
696  // );
697  //
698  // List<polyPatch*> patches(1);
699  //
700  // patches[0] = new wallPolyPatch
701  // (
702  // "boundary",
703  // 6,
704  // 0,
705  // 0,
706  // meshPtr().boundaryMesh(),
707  // wallPolyPatch::typeName
708  // );
709  //
710  // meshPtr().addFvPatches(patches);
711  //
712  // const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0);
713  // const label initialRefLevels =
714  // ::log(initialCellSize/defaultCellSize)/::log(2);
715  //
716  // Info<< "Default cell size = " << defaultCellSize << endl;
717  // Info<< "Initial cell size = " << initialCellSize << endl;
718  //
719  // Info<< "Initial refinement levels = " << initialRefLevels << endl;
720  //
721  // Info<< "Mesh starting size = " << meshPtr().nCells() << endl;
722  //
723  // // meshCutter must be destroyed before writing the mesh otherwise it
724  // // writes the cellLevel/pointLevel files
725  // {
726  // hexRef8 meshCutter(meshPtr(), false);
727  //
728  // for (label refineI = 0; refineI < initialRefLevels; ++refineI)
729  // {
730  // // Mesh changing engine.
731  // polyTopoChange meshMod(meshPtr(), true);
732  //
733  // // Play refinement commands into mesh changer.
734  // meshCutter.setRefinement
735  // (
736  // identity(meshPtr().nCells()),
737  // meshMod
738  // );
739  //
740  // // Create mesh (no inflation), return map from old to new mesh
741  // autoPtr<mapPolyMesh> map =
742  // meshMod.changeMesh(meshPtr(), false);
743  //
744  // // Update fields
745  // meshPtr().updateMesh(map);
746  //
747  // // Delete mesh volumes.
748  // meshPtr().clearOut();
749  //
750  // Info<< "Refinement Iteration " << refineI + 1
751  // << ", Mesh size = " << meshPtr().nCells() << endl;
752  // }
753  // }
754  //
755  // Info<< "Mesh end size = " << meshPtr().nCells() << endl;
756  //
757  // Info<< "Create mesh" << endl;
758  // meshPtr().write();
759  // }
760  // else
761  {
762  Foam::Info
763  << "Create mesh for time = "
764  << runTime.timeName() << Foam::nl << Foam::endl;
765 
766  meshPtr.set
767  (
768  new fvMesh
769  (
771  (
773  runTime.timeName(),
774  runTime,
776  )
777  )
778  );
779  }
780 
781  fvMesh& mesh = meshPtr();
782 
783  Info<< "Read mesh in = "
784  << runTime.cpuTimeIncrement() << " s" << endl;
785 
786  // Check patches and faceZones are synchronised
789 
790 
791  // Read meshing dictionary
792  const word dictName("snappyHexMeshDict");
794  const IOdictionary meshDict(dictIO);
795 
796 
797  // all surface geometry
798  const dictionary& geometryDict = meshDict.subDict("geometry");
799 
800  // refinement parameters
801  const dictionary& refineDict = meshDict.subDict("castellatedMeshControls");
802 
803  // mesh motion and mesh quality parameters
804  const dictionary& motionDict = meshDict.subDict("meshQualityControls");
805 
806  // snap-to-surface parameters
807  const dictionary& snapDict = meshDict.subDict("snapControls");
808 
809  // layer addition parameters
810  const dictionary& layerDict = meshDict.subDict("addLayersControls");
811 
812  // absolute merge distance
813  const scalar mergeDist = getMergeDistance
814  (
815  mesh,
816  readScalar(meshDict.lookup("mergeTolerance"))
817  );
818 
819  const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false));
820 
821 
822  // Read decomposePar dictionary
823  dictionary decomposeDict;
824  {
825  if (Pstream::parRun())
826  {
827  fileName decompDictFile;
828  if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
829  {
830  if (isDir(decompDictFile))
831  {
832  decompDictFile = decompDictFile/"decomposeParDict";
833  }
834  }
835 
836  decomposeDict = IOdictionary
837  (
839  (
840  IOobject
841  (
842  "decomposeParDict",
843  runTime.system(),
844  mesh,
847  ),
848  decompDictFile
849  )
850  );
851  }
852  else
853  {
854  decomposeDict.add("method", "none");
855  decomposeDict.add("numberOfSubdomains", 1);
856  }
857  }
858 
859 
860  // Debug
861  // ~~~~~
862 
863  // Set debug level
865  (
866  meshDict.lookupOrDefault<label>
867  (
868  "debug",
869  0
870  )
871  );
872  {
873  wordList flags;
874  if (meshDict.readIfPresent("debugFlags", flags))
875  {
876  debugLevel = meshRefinement::debugType
877  (
879  (
881  flags
882  )
883  );
884  }
885  }
886  if (debugLevel > 0)
887  {
888  meshRefinement::debug = debugLevel;
889  autoRefineDriver::debug = debugLevel;
890  autoSnapDriver::debug = debugLevel;
891  autoLayerDriver::debug = debugLevel;
892  }
893 
894  // Set file writing level
895  {
896  wordList flags;
897  if (meshDict.readIfPresent("writeFlags", flags))
898  {
900  (
902  (
904  (
906  flags
907  )
908  )
909  );
910  }
911  }
912 
913  // Set output level
914  {
915  wordList flags;
916  if (meshDict.readIfPresent("outputFlags", flags))
917  {
919  (
921  (
923  (
925  flags
926  )
927  )
928  );
929  }
930  }
931 
932 
933  // Read geometry
934  // ~~~~~~~~~~~~~
935  //Info << "Read geo is OKOKOKOK!" << endl;
936  searchableSurfaces allGeometry
937  (
938  IOobject
939  (
940  "abc", // dummy name
941  mesh.time().constant(), // instance
942  //mesh.time().findInstance("triSurface", word::null),// instance
943  "triSurface", // local
944  mesh.time(), // registry
947  ),
948  geometryDict,
949  meshDict.lookupOrDefault("singleRegionName", true)
950  );
951 
952 
953  // Read refinement surfaces
954  // ~~~~~~~~~~~~~~~~~~~~~~~~
955  //Info << " Read refinement surfaces is OKOKK! " << endl;
956  autoPtr<refinementSurfaces> surfacesPtr;
957 
958  Info<< "Reading refinement surfaces." << endl;
959 
960  if (surfaceSimplify)
961  {
962  IOdictionary foamyHexMeshDict
963  (
964  IOobject
965  (
966  "foamyHexMeshDict",
967  runTime.system(),
968  runTime,
971  )
972  );
973 
974  const dictionary& conformationDict =
975  foamyHexMeshDict.subDict("surfaceConformation").subDict
976  (
977  "geometryToConformTo"
978  );
979 
980  const dictionary& motionDict =
981  foamyHexMeshDict.subDict("motionControl");
982 
983  const dictionary& shapeControlDict =
984  motionDict.subDict("shapeControlFunctions");
985 
986  // Calculate current ratio of hex cells v.s. wanted cell size
987  const scalar defaultCellSize =
988  readScalar(motionDict.lookup("defaultCellSize"));
989 
990  const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0);
991 
992  //Info<< "Wanted cell size = " << defaultCellSize << endl;
993  //Info<< "Current cell size = " << initialCellSize << endl;
994  //Info<< "Fraction = " << initialCellSize/defaultCellSize
995  // << endl;
996 
997  surfacesPtr =
999  (
1000  allGeometry,
1001  conformationDict,
1002  shapeControlDict,
1003  refineDict.lookupOrDefault("gapLevelIncrement", 0),
1004  initialCellSize/defaultCellSize
1005  );
1006  }
1007  else
1008  {
1009  surfacesPtr.set
1010  (
1011  new refinementSurfaces
1012  (
1013  allGeometry,
1014  refineDict.subDict("refinementSurfaces"),
1015  refineDict.lookupOrDefault("gapLevelIncrement", 0)
1016  )
1017  );
1018 
1019  Info<< "Read refinement surfaces in = "
1020  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1021  }
1022 
1023  refinementSurfaces& surfaces = surfacesPtr();
1024 
1025 
1026  // Checking only?
1027 
1028  if (checkGeometry)
1029  {
1030  // Extract patchInfo
1031  List<wordList> patchTypes(allGeometry.size());
1032 
1033  const PtrList<dictionary>& patchInfo = surfaces.patchInfo();
1034  const labelList& surfaceGeometry = surfaces.surfaces();
1035  forAll(surfaceGeometry, surfI)
1036  {
1037  label geomI = surfaceGeometry[surfI];
1038  const wordList& regNames = allGeometry.regionNames()[geomI];
1039 
1040  patchTypes[geomI].setSize(regNames.size());
1041  forAll(regNames, regionI)
1042  {
1043 
1044 
1045  label globalRegionI = surfaces.globalRegion(surfI, regionI);
1046 
1047  if (patchInfo.set(globalRegionI))
1048  {
1049  patchTypes[geomI][regionI] =
1050  word(patchInfo[globalRegionI].lookup("type"));
1051  }
1052  else
1053  {
1054  patchTypes[geomI][regionI] = wallPolyPatch::typeName;
1055  }
1056  }
1057  }
1058 
1059  // Write some stats
1060  allGeometry.writeStats(patchTypes, Info);
1061  // Check topology
1062  allGeometry.checkTopology(true);
1063  // Check geometry
1064  allGeometry.checkGeometry
1065  (
1066  100.0, // max size ratio
1067  1e-9, // intersection tolerance
1069  0.01, // min triangle quality
1070  true
1071  );
1072 
1073  return 0;
1074  }
1075 
1076 
1077 
1078  // Read refinement shells
1079  // ~~~~~~~~~~~~~~~~~~~~~~
1080 
1081  Info<< "Reading refinement shells." << endl;
1082  shellSurfaces shells
1083  (
1084  allGeometry,
1085  refineDict.subDict("refinementRegions")
1086  );
1087  Info<< "Read refinement shells in = "
1088  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1089 
1090 
1091  Info<< "Setting refinement level of surface to be consistent"
1092  << " with shells." << endl;
1093  surfaces.setMinLevelFields(shells);
1094  Info<< "Checked shell refinement in = "
1095  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1096 
1097 
1098  // Optionally read limit shells
1099  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1100 
1101  const dictionary limitDict(refineDict.subOrEmptyDict("limitRegions"));
1102 
1103  if (!limitDict.empty())
1104  {
1105  Info<< "Reading limit shells." << endl;
1106  }
1107 
1108  shellSurfaces limitShells(allGeometry, limitDict);
1109 
1110  if (!limitDict.empty())
1111  {
1112  Info<< "Read refinement shells in = "
1113  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1114  }
1115 
1116 
1117 
1118  // Read feature meshes
1119  // ~~~~~~~~~~~~~~~~~~~
1120 
1121  Info<< "Reading features." << endl;
1122  refinementFeatures features
1123  (
1124  mesh,
1125  refineDict.lookup("features")
1126  );
1127  Info<< "Read features in = "
1128  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1129 
1130 
1131 
1132  // Refinement engine
1133  // ~~~~~~~~~~~~~~~~~
1134 
1135  Info<< nl
1136  << "Determining initial surface intersections" << nl
1137  << "-----------------------------------------" << nl
1138  << endl;
1139 
1140  // Main refinement engine
1141  meshRefinement meshRefiner
1142  (
1143  mesh,
1144  mergeDist, // tolerance used in sorting coordinates
1145  overwrite, // overwrite mesh files?
1146  surfaces, // for surface intersection refinement
1147  features, // for feature edges/point based refinement
1148  shells, // for volume (inside/outside) refinement
1149  limitShells // limit of volume refinement
1150  );
1151  Info<< "Calculated surface intersections in = "
1152  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1153 
1154  // Some stats
1155  meshRefiner.printMeshInfo(debugLevel, "Initial mesh");
1156 
1157  meshRefiner.write
1158  (
1161  mesh.time().path()/meshRefiner.timeName()
1162  );
1163 
1164 
1165  // Refinement parameters
1166  const refinementParameters refineParams(refineDict);
1167 
1168  // Snap parameters
1169  const snapParameters snapParams(snapDict);
1170 
1171 
1172 
1173  // Add all the cellZones and faceZones
1174  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1175 
1176  // 1. cellZones relating to surface (faceZones added later)
1177 
1178  const labelList namedSurfaces
1179  (
1181  );
1182 
1184  (
1185  surfaces.surfZones(),
1186  namedSurfaces,
1187  mesh
1188  );
1189 
1190 
1191  // 2. cellZones relating to locations
1192 
1193  refineParams.addCellZonesToMesh(mesh);
1194 
1195 
1196 
1197  // Add all the surface regions as patches
1198  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1199 
1200  //- Global surface region to patch (non faceZone surface) or patches
1201  // (faceZone surfaces)
1202  labelList globalToMasterPatch;
1203  labelList globalToSlavePatch;
1204 
1205 
1206  {
1207  Info<< nl
1208  << "Adding patches for surface regions" << nl
1209  << "----------------------------------" << nl
1210  << endl;
1211 
1212  // From global region number to mesh patch.
1213  globalToMasterPatch.setSize(surfaces.nRegions(), -1);
1214  globalToSlavePatch.setSize(surfaces.nRegions(), -1);
1215 
1216  Info<< setf(ios_base::left)
1217  << setw(6) << "Patch"
1218  << setw(20) << "Type"
1219  << setw(30) << "Region" << nl
1220  << setw(6) << "-----"
1221  << setw(20) << "----"
1222  << setw(30) << "------" << endl;
1223 
1224  const labelList& surfaceGeometry = surfaces.surfaces();
1225  const PtrList<dictionary>& surfacePatchInfo = surfaces.patchInfo();
1226  const polyBoundaryMesh& pbm = mesh.boundaryMesh();
1227 
1228  forAll(surfaceGeometry, surfI)
1229  {
1230  label geomI = surfaceGeometry[surfI];
1231 
1232  //const wordList& regNames = allGeometry.regionNames()[geomI];
1233  wordList regNames = allGeometry.regionNames()[geomI];
1234  // const wordList& regNames = allGeometry.regionNames()[geomI].substr(0,allGeometry.regionNames()[geomI].find(".stl"));
1235  //const wordList& regNames = allGeometry.regionNames()[geomI].substr(0,allGeometry.regionNames()[geomI].find(".stl"));
1236 
1237  Info<< surfaces.names()[surfI] << ':' << nl << nl;
1238 
1239  const word& fzName = surfaces.surfZones()[surfI].faceZoneName();
1240 
1241  if (fzName.empty())
1242  {
1243  // Info << "fzName is empty!!" << endl;
1244  // 'Normal' surface
1245  forAll(regNames, i)
1246  {
1247  std::string tmps=regNames[i];
1248  regNames[i]=tmps.substr(0,tmps.find(".stl"));
1249 
1250  label globalRegionI = surfaces.globalRegion(surfI, i);
1251 
1252  label patchI;
1253 
1254  if (surfacePatchInfo.set(globalRegionI))
1255  {
1256  patchI = meshRefiner.addMeshedPatch
1257  (
1258  regNames[i],
1259  surfacePatchInfo[globalRegionI]
1260  );
1261  }
1262  else
1263  {
1264  dictionary patchInfo;
1265  patchInfo.set("type", wallPolyPatch::typeName);
1266 
1267  patchI = meshRefiner.addMeshedPatch
1268  (
1269  regNames[i],
1270  patchInfo
1271  );
1272  }
1273 
1274  // Info<< setf(ios_base::left)
1275  // << setw(6) << patchI
1276  // << setw(20) << pbm[patchI].type()
1277  // << setw(30) << regNames[i] << nl;
1278 
1279  globalToMasterPatch[globalRegionI] = patchI;
1280  globalToSlavePatch[globalRegionI] = patchI;
1281  }
1282  }
1283  else
1284  {
1285  // Info << "fzName is not empty!! use zoned surface!!" << endl;
1286  // Zoned surface
1287  forAll(regNames, i)
1288  {
1289  label globalRegionI = surfaces.globalRegion(surfI, i);
1290 
1291  // Add master side patch
1292  {
1293  label patchI;
1294 
1295  if (surfacePatchInfo.set(globalRegionI))
1296  {
1297  patchI = meshRefiner.addMeshedPatch
1298  (
1299  regNames[i],
1300  surfacePatchInfo[globalRegionI]
1301  );
1302  }
1303  else
1304  {
1305  dictionary patchInfo;
1306  patchInfo.set("type", wallPolyPatch::typeName);
1307 
1308  patchI = meshRefiner.addMeshedPatch
1309  (
1310  regNames[i],
1311  patchInfo
1312  );
1313  }
1314 
1315  // Info<< setf(ios_base::left)
1316  // << setw(6) << patchI
1317  // << setw(20) << pbm[patchI].type()
1318  // << setw(30) << regNames[i] << nl;
1319 
1320  globalToMasterPatch[globalRegionI] = patchI;
1321  }
1322  // Add slave side patch
1323  {
1324  const word slaveName = regNames[i] + "_slave";
1325  label patchI;
1326 
1327  if (surfacePatchInfo.set(globalRegionI))
1328  {
1329  patchI = meshRefiner.addMeshedPatch
1330  (
1331  slaveName,
1332  surfacePatchInfo[globalRegionI]
1333  );
1334  }
1335  else
1336  {
1337  dictionary patchInfo;
1338  patchInfo.set("type", wallPolyPatch::typeName);
1339 
1340  patchI = meshRefiner.addMeshedPatch
1341  (
1342  slaveName,
1343  patchInfo
1344  );
1345  }
1346 
1347  // Info<< setf(ios_base::left)
1348  // << setw(6) << patchI
1349  // << setw(20) << pbm[patchI].type()
1350  // << setw(30) << slaveName << nl;
1351 
1352  globalToSlavePatch[globalRegionI] = patchI;
1353  }
1354  }
1355 
1356  // For now: have single faceZone per surface. Use first
1357  // region in surface for patch for zoneing
1358  if (regNames.size())
1359  {
1360  Info << "regNames.size() is not ==0" << endl;
1361  label globalRegionI = surfaces.globalRegion(surfI, 0);
1362 
1363  meshRefiner.addFaceZone
1364  (
1365  fzName,
1366  pbm[globalToMasterPatch[globalRegionI]].name(),
1367  pbm[globalToSlavePatch[globalRegionI]].name(),
1368  surfaces.surfZones()[surfI].faceType()
1369  );
1370  }
1371  }
1372 
1373  Info<< nl;
1374  }
1375  Info<< "Added patches in = "
1376  << mesh.time().cpuTimeIncrement() << " s" << nl << endl;
1377  }
1378 
1379 
1380 
1381  // Add all information for all the remaining faceZones
1382  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1383 
1384  HashTable<Pair<word> > faceZoneToPatches;
1385  forAll(mesh.faceZones(), zoneI)
1386  {
1387  const word& fzName = mesh.faceZones()[zoneI].name();
1388 
1389  label mpI, spI;
1391  bool hasInfo = meshRefiner.getFaceZoneInfo(fzName, mpI, spI, fzType);
1392 
1393  if (!hasInfo)
1394  {
1395  // faceZone does not originate from a surface but presumably
1396  // from a cellZone pair instead
1397  string::size_type i = fzName.find("_to_");
1398  if (i != string::npos)
1399  {
1400  word cz0 = fzName.substr(0, i);
1401  word cz1 = fzName.substr(i+4, fzName.size()-i+4);
1402  word slaveName(cz1 + "_to_" + cz0);
1403  faceZoneToPatches.insert(fzName, Pair<word>(fzName, slaveName));
1404  }
1405  else
1406  {
1407  // Add as fzName + fzName_slave
1408  const word slaveName = fzName + "_slave";
1409  faceZoneToPatches.insert(fzName, Pair<word>(fzName, slaveName));
1410  }
1411  }
1412  }
1413 
1414  if (faceZoneToPatches.size())
1415  {
1417  (
1418  meshRefiner,
1419  refineParams,
1420  faceZoneToPatches
1421  );
1422  }
1423 
1424 
1425 
1426  // Re-do intersections on meshed boundaries since they use an extrapolated
1427  // other side
1428  {
1429  const labelList adaptPatchIDs(meshRefiner.meshedPatches());
1430 
1431  const polyBoundaryMesh& pbm = mesh.boundaryMesh();
1432 
1433  label nFaces = 0;
1434  forAll(adaptPatchIDs, i)
1435  {
1436  nFaces += pbm[adaptPatchIDs[i]].size();
1437  }
1438 
1439  labelList faceLabels(nFaces);
1440  nFaces = 0;
1441  forAll(adaptPatchIDs, i)
1442  {
1443  const polyPatch& pp = pbm[adaptPatchIDs[i]];
1444  forAll(pp, i)
1445  {
1446  faceLabels[nFaces++] = pp.start()+i;
1447  }
1448  }
1449  meshRefiner.updateIntersections(faceLabels);
1450  }
1451 
1452 
1453 
1454  // Parallel
1455  // ~~~~~~~~
1456 
1457  // Construct decomposition engine. Note: cannot use decompositionModel
1458  // MeshObject since we're clearing out the mesh inside the mesh generation.
1459  autoPtr<decompositionMethod> decomposerPtr
1460  (
1462  (
1463  decomposeDict
1464  )
1465  );
1466  decompositionMethod& decomposer = decomposerPtr();
1467 
1468  if (Pstream::parRun() && !decomposer.parallelAware())
1469  {
1471  << "You have selected decomposition method "
1472  << decomposer.typeName
1473  << " which is not parallel aware." << endl
1474  << "Please select one that is (hierarchical, ptscotch)"
1475  << exit(FatalError);
1476  }
1477 
1478  // Mesh distribution engine (uses tolerance to reconstruct meshes)
1479  fvMeshDistribute distributor(mesh, mergeDist);
1480 
1481 
1482 
1483 
1484 
1485  // Now do the real work -refinement -snapping -layers
1486  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1487 
1488  const Switch wantRefine(meshDict.lookup("castellatedMesh"));
1489  const Switch wantSnap(meshDict.lookup("snap"));
1490  const Switch wantLayers(meshDict.lookup("addLayers"));
1491 
1492  const Switch mergePatchFaces
1493  (
1494  meshDict.lookupOrDefault("mergePatchFaces", true)
1495  );
1496 
1497  if (!mergePatchFaces)
1498  {
1499  Info<< "Not merging patch-faces of cell to preserve"
1500  << " (split)hex cell shape."
1501  << nl << endl;
1502  }
1503 
1504 
1505  if (wantRefine)
1506  {
1507  cpuTime timer;
1508 
1509  autoRefineDriver refineDriver
1510  (
1511  meshRefiner,
1512  decomposer,
1513  distributor,
1514  globalToMasterPatch,
1515  globalToSlavePatch
1516  );
1517 
1518 
1519  if (!overwrite && !debugLevel)
1520  {
1521  const_cast<Time&>(mesh.time())++;
1522  }
1523 
1524 
1525  refineDriver.doRefine
1526  (
1527  refineDict,
1528  refineParams,
1529  snapParams,
1530  refineParams.handleSnapProblems(),
1531  mergePatchFaces, // merge co-planar faces
1532  motionDict
1533  );
1534 
1535  // Remove zero sized patches originating from faceZones
1536  if (!keepPatches && !wantSnap && !wantLayers)
1537  {
1539  }
1540 
1541  writeMesh
1542  (
1543  "Refined mesh",
1544  meshRefiner,
1545  debugLevel,
1547  );
1548 
1549  Info<< "Mesh refined in = "
1550  << timer.cpuTimeIncrement() << " s." << endl;
1551  }
1552 
1553  if (wantSnap)
1554  {
1555  cpuTime timer;
1556 
1557  autoSnapDriver snapDriver
1558  (
1559  meshRefiner,
1560  globalToMasterPatch,
1561  globalToSlavePatch
1562  );
1563 
1564  if (!overwrite && !debugLevel)
1565  {
1566  const_cast<Time&>(mesh.time())++;
1567  }
1568 
1569  // Use the resolveFeatureAngle from the refinement parameters
1570  scalar curvature = refineParams.curvature();
1571  scalar planarAngle = refineParams.planarAngle();
1572 
1573  snapDriver.doSnap
1574  (
1575  snapDict,
1576  motionDict,
1578  curvature,
1579  planarAngle,
1580  snapParams
1581  );
1582 
1583  // Remove zero sized patches originating from faceZones
1584  if (!keepPatches && !wantLayers)
1585  {
1587  }
1588 
1589  writeMesh
1590  (
1591  "Snapped mesh",
1592  meshRefiner,
1593  debugLevel,
1595  );
1596 
1597  Info<< "Mesh snapped in = "
1598  << timer.cpuTimeIncrement() << " s." << endl;
1599  }
1600 
1601  if (wantLayers)
1602  {
1603  cpuTime timer;
1604 
1605  // Layer addition parameters
1606  const layerParameters layerParams(layerDict, mesh.boundaryMesh());
1607 
1608  autoLayerDriver layerDriver
1609  (
1610  meshRefiner,
1611  globalToMasterPatch,
1612  globalToSlavePatch
1613  );
1614 
1615  // Use the maxLocalCells from the refinement parameters
1616  bool preBalance = returnReduce
1617  (
1618  (mesh.nCells() >= refineParams.maxLocalCells()),
1619  orOp<bool>()
1620  );
1621 
1622 
1623  if (!overwrite && !debugLevel)
1624  {
1625  const_cast<Time&>(mesh.time())++;
1626  }
1627 
1628  layerDriver.doLayers
1629  (
1630  layerDict,
1631  motionDict,
1632  layerParams,
1634  preBalance,
1635  decomposer,
1636  distributor
1637  );
1638 
1639  // Remove zero sized patches originating from faceZones
1640  if (!keepPatches)
1641  {
1643  }
1644 
1645  writeMesh
1646  (
1647  "Layer mesh",
1648  meshRefiner,
1649  debugLevel,
1651  );
1652 
1653  Info<< "Layers added in = "
1654  << timer.cpuTimeIncrement() << " s." << endl;
1655  }
1656 
1657 
1658 
1659  {
1660  // Check final mesh
1661  Info<< "Checking final mesh ..." << endl;
1662  faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
1663  motionSmoother::checkMesh(false, mesh, motionDict, wrongFaces);
1664  const label nErrors = returnReduce
1665  (
1666  wrongFaces.size(),
1667  sumOp<label>()
1668  );
1669 
1670  if (nErrors > 0)
1671  {
1672  Info<< "Finished meshing with " << nErrors << " illegal faces"
1673  << " (concave, zero area or negative cell pyramid volume)"
1674  << endl;
1675  wrongFaces.write();
1676  }
1677  else
1678  {
1679  Info<< "Finished meshing without any errors" << endl;
1680  }
1681  }
1682 
1683 
1684  if (surfaceSimplify)
1685  {
1687 
1688  labelHashSet includePatches(bMesh.size());
1689 
1690  if (args.optionFound("patches"))
1691  {
1692  includePatches = bMesh.patchSet
1693  (
1694  wordReList(args.optionLookup("patches")())
1695  );
1696  }
1697  else
1698  {
1699  forAll(bMesh, patchI)
1700  {
1701  const polyPatch& patch = bMesh[patchI];
1702 
1703  if (!isA<processorPolyPatch>(patch))
1704  {
1705  includePatches.insert(patchI);
1706  }
1707  }
1708  }
1709 
1710  fileName outFileName
1711  (
1713  (
1714  "outFile",
1715  "constant/triSurface/simplifiedSurface.stl"
1716  )
1717  );
1718 
1720  (
1721  mesh,
1722  runTime,
1723  includePatches,
1724  outFileName
1725  );
1726 
1727  pointIOField cellCentres
1728  (
1729  IOobject
1730  (
1731  "internalCellCentres",
1732  runTime.timeName(),
1733  mesh,
1736  ),
1737  mesh.cellCentres()
1738  );
1739 
1740  cellCentres.write();
1741  }
1742 
1743 
1744  Info<< "Finished meshing in = "
1745  << runTime.elapsedCpuTime() << " s." << endl;
1746 
1747  Info<< "End\n" << endl;
1748 
1749  return 0;
1750 }
1751 
1752 
1753 // ************************************************************************* //
Foam::Pstream::mapCombineGather
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
Definition: combineGatherScatter.C:535
shellSurfaces.H
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:65
Foam::cpuTime
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTime.H:52
Foam::setf
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
Definition: IOmanip.H:164
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
extractSurface
void extractSurface(const polyMesh &mesh, const Time &runTime, const labelHashSet &includePatches, const fileName &outFileName)
Definition: snappyHexMesh.C:382
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::DynamicList::xfer
Xfer< List< T > > xfer()
Transfer contents to the Xfer container as a plain List.
Definition: DynamicListI.H:301
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::autoLayerDriver::doLayers
void doLayers(const dictionary &shrinkDict, const dictionary &motionDict, const layerParameters &layerParams, const bool mergePatchFaces, const bool preBalance, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add layers according to the dictionary settings.
Definition: autoLayerDriver.C:4263
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::refinementSurfaces::maxLevel
const labelList & maxLevel() const
From global region number to refinement level.
Definition: refinementSurfaces.H:186
Foam::meshRefinement::WRITEMESH
@ WRITEMESH
Definition: meshRefinement.H:132
Foam::surfaceZonesInfo::faceZoneType
faceZoneType
What to do with faceZone faces.
Definition: surfaceZonesInfo.H:73
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::autoRefineDriver::addFaceZones
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word > > &faceZoneToPatches)
Helper: add faceZones and patches.
Definition: autoRefineDriver.C:1762
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::IOField< vector >
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::entry::keyword
const keyType & keyword() const
Return keyword.
Definition: entry.H:120
Foam::IOobject::AUTO_WRITE
@ AUTO_WRITE
Definition: IOobject.H:117
Foam::argList::addOption
static void addOption(const word &opt, const string &param="", const string &usage="")
Add to an option to validOptions with usage information.
Definition: argList.C:108
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:306
Foam::cpuTime::cpuTimeIncrement
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
Definition: cpuTime.C:74
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
noDecomp.H
Foam::DynamicList< label >
Foam::dictionary::readIfPresent
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Definition: dictionaryTemplates.C:94
Foam::decompositionMethod::New
static autoPtr< decompositionMethod > New(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
Definition: decompositionMethod.C:179
Foam::refinementSurfaces::surfaces
const labelList & surfaces() const
Definition: refinementSurfaces.H:157
Foam::refinementParameters::planarAngle
scalar planarAngle() const
Angle when two intersections are considered to be planar.
Definition: refinementParameters.H:154
Foam::Time::writeFormat
IOstream::streamFormat writeFormat() const
Default write format.
Definition: Time.H:303
addOverwriteOption.H
globalIndex.H
Foam::UPstream::nProcs
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Definition: UPstream.H:387
Foam::meshRefinement::writeLevel
static writeType writeLevel()
Get/set write level.
Definition: meshRefinement.C:3065
Foam::fvMeshTools::removeEmptyPatches
static labelList removeEmptyPatches(fvMesh &, const bool validBoundary)
Remove zero sized patches. All but processor patches are.
Definition: fvMeshTools.C:359
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::searchableSurfaces::checkTopology
label checkTopology(const bool report) const
All topological checks. Return number of failed checks.
Definition: searchableSurfaces.C:817
polyTopoChange.H
motionSmoother.H
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::decompositionModel::selectIO
static IOobject selectIO(const IOobject &, const fileName &)
Helper: return IOobject with optionally absolute path provided.
Definition: decompositionModel.C:143
Foam::wordReList
List< wordRe > wordReList
A List of wordRe (word or regular expression)
Definition: wordReList.H:50
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
wallPolyPatch.H
Foam::argList::addBoolOption
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Definition: argList.C:98
Foam::accessOp
Definition: ListListOps.H:98
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Definition: dictionaryTemplates.C:33
Foam::Time::functionObjects
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:435
Foam::HashTable::insert
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
Foam::checkGeometry
label checkGeometry(const polyMesh &mesh, const bool allGeometry, const autoPtr< surfaceWriter > &)
Definition: checkGeometry.C:478
Foam::Map< label >
Foam::meshRefinement::IOoutputTypeNames
static const NamedEnum< IOoutputType, 1 > IOoutputTypeNames
Definition: meshRefinement.H:115
Foam::regIOobject::write
virtual bool write() const
Write using setting from DB.
Definition: regIOobjectWrite.C:126
Foam::faceSet
A list of face labels.
Definition: faceSet.H:48
Foam::surfaceZonesInfo::getNamedSurfaces
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
Definition: surfaceZonesInfo.C:205
Foam::autoRefineDriver
Definition: autoRefineDriver.H:56
Foam::vtkSetWriter
Definition: vtkSetWriter.H:48
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
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::searchableSurfaces::writeStats
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
Definition: searchableSurfaces.C:867
decompositionMethod.H
refinementFeatures.H
Foam::HashSet
A HashTable with keys but without contents.
Definition: HashSet.H:59
Foam::meshRefinement::mesh
const fvMesh & mesh() const
Reference to mesh.
Definition: meshRefinement.H:817
meshBb
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
Foam::refinementSurfaces::gapLevel
const labelList & gapLevel() const
From global region number to small gap refinement level.
Definition: refinementSurfaces.H:192
setSystemMeshDictionaryIO.H
Foam::help::mergePatchFaces
faceList mergePatchFaces(const List< DynList< label > > &pfcs, const pointField &polyPoints)
Definition: helperFunctionsGeometryQueriesI.H:232
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::surfZoneIdentifier
An identifier for a surface zone on a meshed surface.
Definition: surfZoneIdentifier.H:60
Foam::meshRefinement::IOdebugTypeNames
static const NamedEnum< IOdebugType, 5 > IOdebugTypeNames
Definition: meshRefinement.H:99
patchTypes
wordList patchTypes(nPatches)
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const
Return face zone mesh.
Definition: polyMesh.H:463
addDictOption.H
Foam::HashTable::set
bool set(const Key &, const T &newElmt, bool protect)
Assign a new hashedEntry to a possibly already existing key.
Foam::globalMeshData::mergePoints
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
Definition: globalMeshData.C:2374
Foam::inplaceRenumber
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
Definition: ListOpsTemplates.C:57
UnsortedMeshedSurface.H
Foam::primitiveMesh::nCells
label nCells() const
Definition: primitiveMeshI.H:64
Foam::IOobject::MUST_READ_IF_MODIFIED
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:109
dictName
const word dictName("particleTrackDict")
Foam::MeshedSurface::write
static void write(const fileName &, const MeshedSurface< Face > &)
Write to file.
searchableSurfaces.H
Foam::snapParameters
Simple container to keep together snap specific information.
Definition: snapParameters.H:50
Foam::decompositionMethod::parallelAware
virtual bool parallelAware() const =0
Is method parallel aware (i.e. does it synchronize domains across.
Foam::refinementSurfaces::surfZones
const PtrList< surfaceZonesInfo > & surfZones() const
Definition: refinementSurfaces.H:168
Foam::polyBoundaryMesh::checkParallelSync
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
Definition: polyBoundaryMesh.C:859
Foam::IOstream::ASCII
@ ASCII
Definition: IOstream.H:88
Foam::meshRefinement::OBJINTERSECTIONS
@ OBJINTERSECTIONS
Definition: meshRefinement.H:104
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::timeName
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
Definition: meshRefinement.C:2888
cellModeller.H
Foam::refinementSurfaces::names
const wordList & names() const
Names of surfaces.
Definition: refinementSurfaces.H:163
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::dictionary::found
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:304
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::meshRefinement::checkCoupledFaceZones
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
Definition: meshRefinement.C:1747
Foam::TimePaths::system
const word & system() const
Return system name.
Definition: TimePaths.H:120
Foam::refinementParameters::maxLocalCells
label maxLocalCells() const
Per processor max number of cells.
Definition: refinementParameters.H:136
Foam::functionObjectList::off
virtual void off()
Switch the function objects off.
Definition: functionObjectList.C:178
Foam::orOp
Definition: ops.H:178
Foam::UnsortedMeshedSurface
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
Definition: MeshedSurface.H:74
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
sizeCoeffToRefinement
label sizeCoeffToRefinement(const scalar level0Coeff, const scalar sizeCoeff)
Definition: snappyHexMesh.C:69
argList.H
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
faceSet.H
Foam::autoPtr::set
void set(T *)
Set pointer to that given.
Definition: autoPtrI.H:99
Foam::refinementSurfaces::minLevel
const labelList & minLevel() const
From global region number to refinement level.
Definition: refinementSurfaces.H:180
createRefinementSurfaces
autoPtr< refinementSurfaces > createRefinementSurfaces(const searchableSurfaces &allGeometry, const dictionary &surfacesDict, const dictionary &shapeControlDict, const label gapLevelIncrement, const scalar level0Coeff)
Definition: snappyHexMesh.C:79
IOmanip.H
Istream and Ostream manipulators taking arguments.
Foam::refinementParameters
Simple container to keep together refinement specific information.
Definition: refinementParameters.H:55
Foam::HashTable< nil, word, string::hash >::erase
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
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
size_type
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:73
Foam::refinementParameters::curvature
scalar curvature() const
Curvature.
Definition: refinementParameters.H:148
Foam::surfaceZonesInfo
Definition: surfaceZonesInfo.H:57
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::layerParameters
Simple container to keep together layer specific information.
Definition: layerParameters.H:55
Foam::cpuTime::elapsedCpuTime
double elapsedCpuTime() const
Return CPU time (in seconds) from the start.
Definition: cpuTime.C:67
Foam::argList::optionLookupOrDefault
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
Definition: argListI.H:237
meshPtr
static fvMesh * meshPtr
Definition: globalFoam.H:52
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::meshRefinement::readFlags
static int readFlags(const Enum &namedEnum, const wordList &)
Helper: convert wordList into bit pattern using provided.
Definition: meshRefinementTemplates.C:261
Foam::refinementSurfaces::globalRegion
label globalRegion(const label surfI, const label regionI) const
From surface and region on surface to global region.
Definition: refinementSurfaces.H:230
Foam::log
dimensionedScalar log(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:253
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::plusEqOp
Definition: ops.H:71
Foam::decompositionMethod
Abstract base class for decomposition.
Definition: decompositionMethod.H:48
Foam::writer
Base class for graphics format writing. Entry points are.
Definition: writer.H:78
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::isDir
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
Definition: POSIX.C:615
Foam::setw
Omanip< int > setw(const int i)
Definition: IOmanip.H:199
getMergeDistance
scalar getMergeDistance(const polyMesh &mesh, const scalar mergeTol)
Definition: snappyHexMesh.C:540
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
Foam::entry::dict
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:312
Foam::searchableSurfaces::regionNames
const List< wordList > & regionNames() const
Definition: searchableSurfaces.H:126
Foam::refinementParameters::handleSnapProblems
bool handleSnapProblems() const
Definition: refinementParameters.H:203
Foam::DynamicList::append
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Foam::refinementSurfaces::patchInfo
const PtrList< dictionary > & patchInfo() const
From global region number to patch type.
Definition: refinementSurfaces.H:221
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:405
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:399
autoSnapDriver.H
Foam::HashTable< label >
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::polyMesh::bounds
const boundBox & bounds() const
Return mesh bounding box.
Definition: polyMesh.H:427
Foam::autoLayerDriver
All to do with adding layers.
Definition: autoLayerDriver.H:56
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
setRootCase.H
Foam::primitiveMesh::cellCentres
const vectorField & cellCentres() const
Definition: primitiveMeshCellCentresAndVols.C:211
vtkSetWriter.H
Foam::dictionary::lookupEntryPtr
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
Definition: dictionary.C:343
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::autoSnapDriver
All to do with snapping to surface.
Definition: autoSnapDriver.H:56
Foam::xferMove
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
Foam::primitiveMesh::nFaces
label nFaces() const
Definition: primitiveMeshI.H:58
fvMeshDistribute.H
Foam::sumOp
Definition: ops.H:162
Foam::Pair< word >
Foam::Time::path
fileName path() const
Return path.
Definition: Time.H:281
Foam::Pstream::mapCombineScatter
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Definition: combineGatherScatter.C:636
Foam::readScalar
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
Foam::IOstream::defaultPrecision
static unsigned int defaultPrecision()
Return the default precision.
Definition: IOstream.H:461
fvMeshTools.H
Foam::refinementFeatures
Encapsulates queries for features.
Definition: refinementFeatures.H:51
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
layerParameters.H
refinementParameters.H
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::searchableSurfaces
Container for searchableSurfaces.
Definition: searchableSurfaces.H:53
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePaths.H:130
Foam::refinementSurfaces::nRegions
label nRegions() const
Definition: refinementSurfaces.H:247
Foam::timer
Implements a timeout mechanism via sigalarm.
Definition: timer.H:81
Foam::autoRefineDriver::doRefine
void doRefine(const dictionary &refineDict, const refinementParameters &refineParams, const snapParameters &snapParams, const bool prepareForSnapping, const bool mergePatchFaces, const dictionary &motionDict)
Do all the refinement.
Definition: autoRefineDriver.C:1887
Foam::meshRefinement
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Definition: meshRefinement.H:82
Foam::dictionary::clone
autoPtr< dictionary > clone() const
Construct and return clone.
Definition: dictionary.C:215
Foam::dictionary::subOrEmptyDict
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
Definition: dictionary.C:666
Foam::meshRefinement::write
bool write() const
Write mesh and all data.
Definition: meshRefinement.C:2707
Foam::List::clear
void clear()
Clear the list, i.e. set size to zero.
Definition: List.C:379
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::surface
Definition: surface.H:55
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
createTime.H
Foam::meshRefinement::addMeshedPatch
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
Definition: meshRefinement.C:2068
snapParameters.H
Foam::argList::optionFound
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
Foam::refinementSurfaces::setMinLevelFields
void setMinLevelFields(const shellSurfaces &shells)
Calculate minLevelFields.
Definition: refinementSurfaces.C:594
Foam::meshRefinement::outputLevel
static outputType outputLevel()
Get/set output level.
Definition: meshRefinement.C:3077
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::PrimitivePatch::localFaces
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
Definition: PrimitivePatchTemplate.C:372
Foam::UIndirectList
A List with indirect addressing.
Definition: fvMatrix.H:106
main
int main(int argc, char *argv[])
Definition: snappyHexMesh.C:612
decompositionModel.H
Foam::DelaunayMeshTools::allPoints
tmp< pointField > allPoints(const Triangulation &t)
Extract all points in vertex-index order.
Foam::meshRefinement::updateIntersections
void updateIntersections(const labelList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
Definition: meshRefinement.C:269
Foam::dictionary::toc
wordList toc() const
Return the table of contents.
Definition: dictionary.C:697
Foam::searchableSurfaces::names
const wordList & names() const
Definition: searchableSurfaces.H:117
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::meshRefinement::outputType
outputType
Definition: meshRefinement.H:116
autoRefineDriver.H
Foam::polyMesh::globalData
const globalMeshData & globalData() const
Return parallel info.
Definition: polyMesh.C:1143
Foam::PrimitivePatch::meshPointMap
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
Definition: PrimitivePatchTemplate.C:412
Foam::autoSnapDriver::doSnap
void doSnap(const dictionary &snapDict, const dictionary &motionDict, const bool mergePatchFaces, const scalar featureCos, const scalar planarAngle, const snapParameters &snapParams)
Definition: autoSnapDriver.C:2528
autoLayerDriver.H
Foam::refinementParameters::addCellZonesToMesh
labelList addCellZonesToMesh(polyMesh &) const
Add cellZones to mesh. Return indices of cellZones (or -1)
Definition: refinementParameters.C:152
Foam::TimePaths::processorCase
bool processorCase() const
Return true if this is a processor case.
Definition: TimePaths.H:90
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatchTemplate.C:392
Foam::dictionary::subDict
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:631
Foam::MeshedSurface< face >
args
Foam::argList args(argc, argv)
Foam::refinementSurfaces
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
Definition: refinementSurfaces.H:60
Foam::searchableSurfaces::checkGeometry
label checkGeometry(const scalar maxRatio, const scalar tolerance, const autoPtr< writer< scalar > > &setWriter, const scalar minQuality, const bool report) const
All geometric checks. Return number of failed checks.
Definition: searchableSurfaces.C:837
Foam::argList::optionReadIfPresent
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:198
Foam::patchIdentifier::name
const word & name() const
Return name.
Definition: patchIdentifier.H:109
Foam::fvMeshDistribute
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Definition: fvMeshDistribute.H:70
Foam::patchIdentifier::index
label index() const
Return the index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:133
dictIO
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
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::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
Foam::argList::optionLookup
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
Definition: argListI.H:114
MeshedSurface.H
writeMesh
void writeMesh(const string &msg, const meshRefinement &meshRefiner, const meshRefinement::debugType debugLevel, const meshRefinement::writeType writeLevel)
Definition: snappyHexMesh.C:580
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress
Foam::surfaceZonesInfo::addCellZonesToMesh
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
Definition: surfaceZonesInfo.C:400
Foam::dictionary::set
void set(entry *)
Assign a new entry, overwrite any existing entry.
Definition: dictionary.C:856
Foam::meshRefinement::debugType
debugType
Definition: meshRefinement.H:100
surfZoneIdentifierList.H