35 const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90;
44 const PtrList<dictionary>& surfaceDicts,
45 const refinementSurfaces& refineSurfaces,
47 const polyBoundaryMesh& boundaryMesh
51 labelList globalSurfLayers(surfaceDicts.size());
53 List<Map<label> > regionSurfLayers(surfaceDicts.size());
55 const labelList& surfaceIndices = refineSurfaces.surfaces();
57 forAll(surfaceDicts, surfI)
59 const dictionary& dict = surfaceDicts[surfI];
61 globalSurfLayers[surfI] = readLabel(dict.lookup(
"surfaceLayers"));
63 if (dict.found(
"regions"))
67 PtrList<dictionary> regionDicts(dict.lookup(
"regions"));
70 refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
74 const dictionary& regionDict = regionDicts[dictI];
76 const word
regionName(regionDict.lookup(
"name"));
80 label nLayers = readLabel(regionDict.lookup(
"surfaceLayers"));
83 <<
" surface layers:" << nLayers <<
nl;
85 regionSurfLayers[surfI].insert(regionI, nLayers);
93 labelList nLayers(boundaryMesh.size(), 0);
95 forAll(surfaceIndices, surfI)
98 refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
100 forAll(regionNames, regionI)
102 const word&
regionName = regionNames[regionI];
104 label global = refineSurfaces.globalRegion(surfI, regionI);
106 label patchI = globalToPatch[global];
109 nLayers[patchI] = globalSurfLayers[surfI];
113 regionSurfLayers[surfI].
find(regionI);
115 if (iter != regionSurfLayers[surfI].end())
117 nLayers[patchI] = iter();
121 if (nLayers[patchI] < 0)
125 "layerParameters::readNumLayers(..)"
126 ) <<
"Illegal number of layers " << nLayers[patchI]
128 << refineSurfaces.names()[surfI]
129 <<
" region " << regionName <<
endl
141 Foam::layerParameters::layerParameters
165 relativeSizes_(
false),
181 nGrow_(readLabel(dict.
lookup(
"nGrow"))),
182 nSmoothSurfaceNormals_
184 readLabel(dict.
lookup(
"nSmoothSurfaceNormals"))
186 nSmoothNormals_(readLabel(dict.
lookup(
"nSmoothNormals"))),
187 nSmoothThickness_(readLabel(dict.
lookup(
"nSmoothThickness"))),
188 maxFaceThicknessRatio_
201 maxThicknessToMedialRatio_
205 minMedianAxisAngleCos_
210 nBufferCellsNoExtrude_
212 readLabel(dict.
lookup(
"nBufferCellsNoExtrude"))
214 nSnap_(readLabel(dict.
lookup(
"nSnap"))),
215 nLayerIter_(readLabel(dict.
lookup(
"nLayerIter"))),
216 nRelaxedIter_(labelMax)
218 if (dict.
found(
"nRelaxedIter"))
220 dict.
lookup(
"nRelaxedIter") >> nRelaxedIter_;
223 if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
226 <<
"Layer iterations should be >= 0." <<
endl
227 <<
"nLayerIter:" << nLayerIter_
228 <<
" nRelaxedIter:" << nRelaxedIter_
235 Foam::layerParameters::layerParameters
241 numLayers_(boundaryMesh.
size(), 0),
247 relativeSizes_(dict.
lookup(
"relativeSizes")),
263 nGrow_(readLabel(dict.
lookup(
"nGrow"))),
264 nSmoothSurfaceNormals_
266 readLabel(dict.
lookup(
"nSmoothSurfaceNormals"))
268 nSmoothNormals_(readLabel(dict.
lookup(
"nSmoothNormals"))),
269 nSmoothThickness_(readLabel(dict.
lookup(
"nSmoothThickness"))),
270 maxFaceThicknessRatio_
283 maxThicknessToMedialRatio_
287 minMedianAxisAngleCos_
292 nBufferCellsNoExtrude_
294 readLabel(dict.
lookup(
"nBufferCellsNoExtrude"))
296 nSnap_(readLabel(dict.
lookup(
"nRelaxIter"))),
297 nLayerIter_(readLabel(dict.
lookup(
"nLayerIter"))),
298 nRelaxedIter_(labelMax)
300 if (dict.
found(
"nRelaxedIter"))
302 dict.
lookup(
"nRelaxedIter") >> nRelaxedIter_;
304 if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
307 <<
"Layer iterations should be >= 0." <<
endl
308 <<
"nLayerIter:" << nLayerIter_
309 <<
" nRelaxedIter:" << nRelaxedIter_
316 forAll(boundaryMesh, patchI)
318 const word& patchName = boundaryMesh[patchI].
name();
320 if (layersDict.
found(patchName))
325 readLabel(layerDict.
lookup(
"nSurfaceLayers"));
330 expansionRatio_[patchI]
334 "finalLayerThickness",
335 finalLayerThickness_[patchI]
340 minThickness_[patchI]
353 bool hasMatch =
false;
354 forAll(boundaryMesh, patchI)
356 if (re.
match(boundaryMesh[patchI].
name()))
364 IOWarningIn(
"layerParameters::layerParameters(..)", layersDict)
365 <<
"Wildcard layer specification for " << wildCards[i]
366 <<
" does not match any patch." <<
endl;
374 if (boundaryMesh.
findPatchID(nonWildCards[i]) == -1)
376 IOWarningIn(
"layerParameters::layerParameters(..)", layersDict)
377 <<
"Layer specification for " << nonWildCards[i]
378 <<
" does not match any patch." <<
endl;