Go to the documentation of this file.
54 globalThicknessRatio_(1.0),
55 globalMaxThicknessFirstLayer_(VGREAT),
57 thicknessRatioForPatch_(),
58 maxThicknessForPatch_(),
59 discontinuousLayersForPatch_(),
67 newVerticesForSplitEdge_(),
87 "void refineBoundaryLayers::avoidRefinement()"
101 "void refineBoundaryLayers::activate2DMode()"
114 "void refineBoundaryLayers::setGlobalNumberOfLayers(const label)"
122 "void refineBoundaryLayers::setGlobalNumberOfLayers(const label)"
123 ) <<
"The specified global number of boundary layers is less than 2"
138 "void refineBoundaryLayers::setGlobalThicknessRatio(const scalar)"
142 if( thicknessRatio < 1.0 )
146 "void refineBoundaryLayers::setGlobalThicknessRatio(const scalar)"
147 ) <<
"The specified global thickness ratio is less than 1.0" <<
endl;
157 const scalar maxThickness
164 "void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
169 if( maxThickness <= 0.0 )
173 "void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
175 ) <<
"The specified global maximum thickness of the first"
176 <<
" boundary layer is negative!!" <<
endl;
181 globalMaxThicknessFirstLayer_ = maxThickness;
186 const word& patchName,
194 "void refineBoundaryLayers::setNumberOfLayersForPatch"
195 "(const word&, const label)"
203 "void refineBoundaryLayers::setNumberOfLayersForPatch"
204 "(const word&, const label)"
205 ) <<
"The specified number of boundary layers for patch " << patchName
206 <<
" is less than 2... boundary layers disabled for this patch!" <<
endl;
209 const labelList matchedIDs = mesh_.findPatches(patchName);
211 forAll(matchedIDs, matchI)
213 numLayersForPatch_[mesh_.getPatchName(matchedIDs[matchI])] = nLayers;
219 const word& patchName,
220 const scalar thicknessRatio
227 "void refineBoundaryLayers::setThicknessRatioForPatch"
228 "(const word&, const scalar)"
232 if( thicknessRatio < 1.0 )
236 "void refineBoundaryLayers::setThicknessRatioForPatch"
237 "(const word&, const scalar)"
238 ) <<
"The specified thickness ratio for patch " << patchName
239 <<
" is less than 1.0" <<
endl;
244 const labelList matchedIDs = mesh_.findPatches(patchName);
246 forAll(matchedIDs, matchI)
248 const word pName = mesh_.getPatchName(matchedIDs[matchI]);
249 thicknessRatioForPatch_[pName] = thicknessRatio;
255 const word& patchName,
256 const scalar maxThickness
263 "void refineBoundaryLayers::setMaxThicknessOfFirstLayerForPatch"
264 "(const word&, const scalar)"
268 if( maxThickness <= 0.0 )
272 "void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
273 "(const word&, const scalar)"
274 ) <<
"The specified maximum thickness of the first boundary layer "
275 <<
"for patch " << patchName <<
" is negative!!" <<
endl;
280 const labelList matchedIDs = mesh_.findPatches(patchName);
282 forAll(matchedIDs, matchI)
284 const word pName = mesh_.getPatchName(matchedIDs[matchI]);
285 maxThicknessForPatch_[pName] = maxThickness;
295 "void refineBoundaryLayers::setInteruptForPatch(const word&)"
301 forAll(matchedIDs, matchI)
314 "void refineBoundaryLayers::setCellSubset(const word)"
328 bool refinePatch(
false);
341 Info <<
"Starting refining boundary layers" <<
endl;
347 "void refineBoundaryLayers::refineLayers()"
348 ) <<
"Boundary layers are already refined! "
349 <<
"Stopping refinement" <<
endl;
358 "void refineBoundaryLayers::refineLayers()"
359 ) <<
"Boundary layers do not exist in the mesh! Cannot refine" <<
endl;
372 Info <<
"Finished refining boundary layers" <<
endl;
387 forAll(pointInLayer, pointI)
388 if( pointInLayer[pointI] )
389 layerPoints.
append(pointI);
411 if( meshDict.
isDict(
"boundaryLayers") )
416 if( bndLayers.
found(
"nLayers") )
421 if( bndLayers.
found(
"thicknessRatio") )
427 if( bndLayers.
found(
"maxFirstLayerThickness") )
429 const scalar maxFirstThickness =
436 if( bndLayers.
found(
"excludedPatches") )
449 if( bndLayers.
isDict(
"patchBoundaryLayers") )
452 bndLayers.
subDict(
"patchBoundaryLayers");
459 if( patchBndLayers.
isDict(pName) )
464 if( patchDict.
found(
"nLayers") )
466 const label nLayers =
471 if( patchDict.
found(
"thicknessRatio") )
477 if( patchDict.
found(
"maxFirstLayerThickness") )
479 const scalar maxFirstThickness =
482 patchDict.
lookup(
"maxFirstLayerThickness")
490 if( patchDict.
found(
"allowDiscontinuity") )
492 const bool allowDiscontinuity =
495 if( allowDiscontinuity )
501 Warning <<
"Cannot refine layer for patch "
scalar globalThicknessRatio_
global thickness ratio
void refineLayers()
performs refinement based on the given settings
void generateNewFaces()
map split edges onto a cell
void setGlobalThicknessRatio(const scalar thicknessRatio)
set the global thickness ratio (default is 1)
void append(const T &e)
Append an element at the end of the list.
void pointsInBndLayer(labelLongList &)
provide the list of points in the boundary layer
A class for handling words, derived from string.
const meshSurfaceEngine & surfaceEngine() const
Return reference to meshSurfaceEngine.
bool is2DMesh_
a flag whether a 2D mesh generation is active or not
meshSurfaceEngine * msePtr_
pointer to mesh surface engine
#define forAll(list, i)
Loop across all elements in list.
labelList findPatches(const word &patchName) const
return a list of patch indices corresponding to the given
Template functions to aid in the implementation of demand driven data.
void clear()
Clear the list, i.e. set next free to zero.
std::map< word, label > numLayersForPatch_
number of boundary layers for user-selected patches
refineBoundaryLayers(const refineBoundaryLayers &)
Disallow bitwise copy construct.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
void generateNewVertices()
generate new points on edges, faces and in cells
void setMaxThicknessOfFirstLayerForPatch(const word &patchName, const scalar maxThickness)
set the maximum thickness of the first layer for a patch
void setGlobalNumberOfLayers(const label nLayers)
set the global number of boundary layers
Ostream & endl(Ostream &os)
Add newline and flush stream.
const pointFieldPMG & points() const
access to points
void activateSpecialMode()
std::set< word > discontinuousLayersForPatch_
allow discontinuous layers for patch
label pointSubsetIndex(const word &) const
bool isDict(const word &) const
Check if entry is a sub-dictionary.
void deleteDemandDrivenData(DataPtr &dataPtr)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
bool done_
check whether the refinement is already executed
#define forAllRow(graph, rowI, index)
word getPatchName(const label patchID) const
return the name of a patch given its ID
wordList patchNames(nPatches)
void setNumberOfLayersForPatch(const word &patchName, const label nLayers)
label size() const
return the number of used elements
A list of keyword definitions, which are a keyword followed by any number of values (e....
label globalNumLayers_
global number of boundary layers
void addPointToSubset(const label, const label)
void setThicknessRatioForPatch(const word &patchName, const scalar thicknessRatio)
void setCellSubset(const word subsetName="layerCells")
set the flag to store the boundary layer cells in a subset
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool analyseLayers()
analyse layers to check their topology
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
void setGlobalMaxThicknessOfFirstLayer(const scalar maxThickness)
set the maximum thickness of the first boundary layer
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void generateNewCells()
generate new cells and add them to the mesh
label readLabel(Istream &is)
void setInteruptForPatch(const word &patchName)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
wordList toc() const
Return the table of contents.
void activate2DMode()
activate 2D layer refinement
static void readSettings(const dictionary &, refineBoundaryLayers &)
read the settings from dictionary
void avoidRefinement()
set no refinement flag
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
polyMeshGen & mesh_
Reference to the mesh.
label addPointSubset(const word &)
point subsets
VRWGraph newVerticesForSplitEdge_
new vertices for on edges which shall be refined