Go to the documentation of this file.
56 WarningIn(
"void meshOctreeCreator::setRootCubeSizeAndRefParameters()")
57 <<
"meshDict is not available" <<
endl;
73 scalar size = rootBox.
max().
x() - rootBox.
min().
x();
74 if( (rootBox.
max().
y() - rootBox.
min().
y()) > size )
75 size = rootBox.
max().
y() - rootBox.
min().
y();
76 if( (rootBox.
max().
z() - rootBox.
min().
z()) > size )
77 size = rootBox.
max().
z() - rootBox.
min().
z();
79 size += 0.5 * maxSize;
89 if( lSize < (maxSize * (1.0-SMALL)) )
93 rootBox.
max() =
c +
point(bbSize, bbSize, bbSize);
94 rootBox.
min() =
c -
point(bbSize, bbSize, bbSize);
101 }
while( !finished );
111 Info <<
"Root box " << rootBox <<
endl;
112 Info <<
"Requested cell size corresponds to octree level "
136 const scalar lSize = maxSize /
Foam::pow(2, addLevel);
146 }
while( !finished );
148 boundaryRefLevel_ += addLevel;
153 label l = boundaryRefLevel_;
155 boundaryRefLevel_ = l;
158 Info <<
"Requested boundary cell size corresponds to octree level "
161 scalar thickness(0.0);
174 std::make_pair(boundaryRefLevel_, thickness);
202 forAll(matchedIDs, matchI)
204 refPatches[counter] =
218 forAll(refPatches, patchI)
220 const label regionI = refPatches[patchI].patchInSurface(
surface);
225 scalar cs = refPatches[patchI].cellSize();
233 const scalar lSize = maxSize /
Foam::pow(2, addLevel);
243 }
while( !finished );
250 std::pair<direction, scalar> pp(level, 0.0);
253 if(
surface[triI].region() == regionI )
291 forAll(refPatches, patchI)
293 const word subsetName = refPatches[patchI].patchName();
295 const label subsetID =
surface.facetSubsetIndex(subsetName);
298 Warning <<
"Surface subset " << subsetName
299 <<
" does not exist" <<
endl;
303 scalar cs = refPatches[patchI].cellSize();
311 const scalar lSize = maxSize /
Foam::pow(2, addLevel);
321 }
while( !finished );
327 surface.facetsInSubset(subsetID, subsetFaces);
330 const std::pair<direction, scalar> pp(level, 0.0);
344 std::map<word, label> patchToIndex;
346 patchToIndex[
surface.patches()[patchI].
name()] = patchI;
349 std::map<word, label> setToIndex;
351 surface.facetSubsetIndices(setIDs);
353 setToIndex[
surface.facetSubsetName(setIDs[i])] = setIDs[i];
358 if( !
dict.isDict(entries[dictI]) )
361 const word& pName = entries[dictI];
366 if( patchDict.
found(
"additionalRefinementLevels") )
371 patchDict.
lookup(
"additionalRefinementLevels")
374 else if( patchDict.
found(
"cellSize") )
383 const scalar lSize = maxSize /
Foam::pow(2, nLevel);
393 }
while( !finished );
396 scalar refinementThickness(0.0);
397 if( patchDict.
found(
"refinementThickness") )
399 refinementThickness =
407 std::pair<direction, scalar> rp(level, refinementThickness);
409 forAll(matchedPatches, matchI)
412 const label patchI = matchedPatches[matchI];
416 if(
surface[triI].region() == patchI )
422 if( setToIndex.find(pName) != setToIndex.end() )
425 const label subsetId = setToIndex[pName];
428 surface.facetsInSubset(subsetId, facetsInSubset);
432 const label triI = facetsInSubset[i];
451 Info <<
"Setting root cube size and refinement parameters" <<
endl;
455 Info <<
"Refining boundary" <<
endl;
467 Info <<
"Performing automatic refinement" <<
endl;
500 const label nTrianglesInLeaf
506 const boundBox& rootBox = octree_.rootBox();
518 # pragma omp parallel reduction(+ : nMarked)
528 # pragma omp for schedule(dynamic, 20)
535 octree_.containedTriangles(leafI, ct);
537 if( (oc.
level() < maxLevel) && (ct.
size() > nTrianglesInLeaf) )
void refineBoxesIntersectingSurfaces()
surface(const surface &)
Disallow default bitwise copy construct.
scalar & searchRangeAccess()
return search range
A class for handling words, derived from string.
const point & max() const
Maximum describing the bounding box.
scalar scalingFactor_
Scaling factor.
#define forAll(list, i)
Loop across all elements in list.
void refineCube(const triSurf &, const boundBox &, meshOctreeSlot *slotPtr=NULL)
subdivide the octree cube
boundBox & rootBoxAccess()
return rootBox
void setRootCubeSizeAndRefParameters()
set the boundBox such that maxCellSize is achieved
static bool & parRun()
Is this a parallel run?
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void refineInsideAndUnknownBoxes()
List< meshOctreeSlot > & dataSlotsAccess()
return octree slots
dimensioned< scalar > mag(const dimensioned< Type > &)
bool isDict(const word &) const
Check if entry is a sub-dictionary.
void refineBoxes(const direction refLevel, const direction cubeType)
refine boxes of the given flag to the given size
void createInsideOutsideInformation()
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
meshOctree & octree_
Reference to meshOctree.
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.
void refineBoxesNearDataBoxes(const label nLayers=1)
refine boxes near DATA boxes to get a nice smooth surface
void createOctreeWithRefinedBoundary(const direction maxLevel, const label nTrianglesInLeaf=15)
wordList patchNames(nPatches)
void createOctreeBoxes()
create octree boxes
const point & min() const
Minimum describing the bounding box.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
bool & isRootInitialisedAccess()
return isRootInitialised_
A list of keyword definitions, which are a keyword followed by any number of values (e....
direction globalRefLevel_
ref level to achieve max cell size
const word & name() const
Return the name.
void loadDistribution(const bool distributeUsed=false)
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))
List< DynList< std::pair< direction, scalar > > > surfRefLevel_
this list contains ref level for each surface triangle
void setSize(const label)
Reset size of List.
const IOdictionary * meshDictPtr_
Dictionary containing information necessary to perform refinement.
direction level() const
return level
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void activateHexRefinement()
activate hex refinement
void refineBoxesIntersectingEdgeMeshes()
label readLabel(Istream &is)
A bounding box defined in terms of the points at its extremities.
const dimensionedScalar c
Speed of light in a vacuum.
void refineBoxesContainedInObjects()
refine boxes contained inside the objects for refinement
#define WarningIn(functionName)
Report a warning using Foam::Warning.
void size(const label)
Override size to be inconsistent with allocated storage.
vector point
Point is a vector.
const triSurf & surface() const
return a reference to the surface
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool hexRefinement_
hex refinement flag
void automaticRefinement()
void createListOfLeaves()
create leaves
LongList< meshOctreeCube * > & leavesAccess()
return leaves