Go to the documentation of this file.
29 #include "triSurface.H"
67 Info <<
"Performing automatic refinement" <<
endl;
76 Info <<
"Finished with automatic refinement" <<
endl;
84 refinementCandidates.
append(i);
99 refinementCandidates.
append(i);
106 refinementCandidates.
clear();
108 refinementCandidates.
append(i);
115 refinementCandidates.
clear();
117 refinementCandidates.
append(i);
135 const boundBox& rootBox = octree_.rootBox();
149 octree_.findLeafContainingVertex(
points[corners[cornerI]]);
154 if( cornerInLeaf[cLabel] != -1 )
158 refineBox[cLabel] = 1;
162 cornerInLeaf[cLabel] = corners[cornerI];
168 # pragma omp parallel for if( refCandidates.size() > 1000 ) \
169 private(leavesInBox) shared(cornerInLeaf) \
170 reduction(+ : nMarked) schedule(dynamic, 20)
172 forAll(refCandidates, refI)
174 const label leafI = refCandidates[refI];
175 if( leaves[leafI]->level() >= maxRefLevel_ )
177 if( cornerInLeaf[leafI] == -1 )
182 const point c = leaves[leafI]->centre(rootBox);
183 const scalar r = 1.732 * leaves[leafI]->
size(rootBox);
188 octree_.findLeavesContainedInBox(bb, leavesInBox);
192 const label nei = leavesInBox[i];
199 if( cornerInLeaf[nei] == -1 )
206 refineBox[leafI] = 1;
213 Info << nMarked <<
" boxes marked by the corner criteria" <<
endl;
227 const boundBox& rootBox = octree_.rootBox();
242 const triSurf& surf = octree_.surface();
247 # pragma omp parallel for if( refCandidates.size() > 1000 ) \
248 private(patches, eGroups, helper) \
249 reduction(+ : nMarked) schedule(dynamic, 20)
251 forAll(refCandidates, refI)
253 const label leafI = refCandidates[refI];
254 if( !leaves[leafI]->hasContainedElements() )
256 if( leaves[leafI]->level() >= maxRefLevel_ )
261 const scalar
s = 1.733 * oc.
size(rootBox);
265 octree_.findTrianglesInBox(bb, helper);
268 patches.appendIfNotIn(surf[helper[i]].region());
272 octree_.findEdgesInBox(bb, helper);
284 for(
label patchJ=(patchI+1);patchJ<
patches.size();++patchJ)
298 for(
label egJ=egI+1;egJ<eGroups.
size();++egJ)
299 if( !eNeiGroups[eGroups[egI]].
found(eGroups[egJ]) )
309 Info <<
"Selecting leaf " << leafI
310 <<
" for auto-refinement" <<
endl;
314 refineBox[leafI] = 1;
319 Info << nMarked <<
" boxed marked by partitioning criteria" <<
endl;
335 const boundBox& rootBox = octree_.rootBox();
340 # pragma omp parallel for if( refCandidates.size() > 10000 ) \
341 private(containedTrias) \
342 reduction(+ : nMarked) schedule(dynamic, 100)
344 forAll(refCandidates, refI)
346 const label leafI = refCandidates[refI];
348 if( !octree_.hasContainedTriangles(leafI) )
352 if( oc.
level() >= maxRefLevel_ )
356 octree_.containedTriangles(leafI, containedTrias);
368 if( octree_.hasContainedEdges(leafI) )
370 octree_.containedEdges(leafI, containedTrias);
383 if( oc.
size(rootBox) > 0.2835 / (maxCurv + SMALL) )
385 refineBox[leafI] = 1;
391 Info << nMarked <<
" boxes marked by curvature criteria!" <<
endl;
405 const boundBox& rootBox = octree_.rootBox();
406 const triSurf& surf = octree_.surface();
411 # pragma omp parallel for if( refCandidates.size() > 1000 ) \
412 private(helper) reduction(+ : nMarked) schedule(dynamic, 20)
414 forAll(refCandidates, refI)
416 const label leafI = refCandidates[refI];
418 if( !octree_.hasContainedTriangles(leafI) )
422 if( oc.
level() >= maxRefLevel_ )
426 const scalar
s = 1.732 * oc.
size(rootBox);
432 octree_.findTrianglesInBox(bb, helper);
434 triaInRange.insert(helper[i]);
438 octree_.findEdgesInBox(bb, helper);
440 edgesInRange.
insert(helper[i]);
450 refineBox[leafI] = 1;
455 Info << nMarked <<
" boxed marked by proximity criteria" <<
endl;
493 octree_.exchangeRequestsWithNeighbourProcessors
501 receivedCoordinates.
append(refinedCubes[i]);
505 refCandidates.
clear();
506 forAll(receivedCoordinates, i)
510 for(
label scI=0;scI<8;++scI)
516 if( !oc || !oc->
isLeaf() )
523 refineBox.
setSize(octree_.numberOfLeaves());
surface(const surface &)
Disallow default bitwise copy construct.
const List< labelHashSet > & edgeGroupEdgeGroups() const
Edge group - edge groups addressing.
meshOctreeCube * findCubeForPosition(const meshOctreeCubeCoordinates &) const
return the pointer to the meshOctreeCube at the given position
label numberOfFaceGroups(const labelHashSet &containedElements, const point ¢re, const scalar range, const triSurf &surface)
find number of face groups within a given range
void append(const T &e)
Append an element at the end of the list.
bool proximityRefinement()
#define forAll(list, i)
Loop across all elements in list.
point centre(const boundBox &) const
return centre
bool refineBasedOnContainedPartitions(labelList &, const labelLongList &)
Template functions to aid in the implementation of demand driven data.
label cubeLabel() const
position of the cube in the list of leaves
void clear()
Clear the list, i.e. set next free to zero.
static bool & parRun()
Is this a parallel run?
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Size of the active part of the list.
bool refineBasedOnContainedCorners(labelList &, const labelLongList &)
refine boxes based on the number of contained surface corners
dimensioned< scalar > mag(const dimensioned< Type > &)
meshOctree & octree_
reference to meshOctree
void setSize(const label)
Reset size of List.
void refineSelectedBoxes(labelList &refineBox, const bool hexRefinement=false)
label numberOfLeaves() const
return leaves of the octree
bool curvatureRefinement()
refine DATA boxes based on curvature
direction maxRefLevel_
maximum allowed refinement level
void deleteDemandDrivenData(DataPtr &dataPtr)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
void loadDistribution(const direction usedType=0)
move octree cubes from one processor to another
scalar meanCurvatureAtTriangle(const label) const
bool isLeaf() const
check if the cube is a leaf
void appendIfNotIn(const T &e)
meshOctreeCubeCoordinates refineForPosition(const label) const
return the coordinates of child cube at the given position
const List< labelHashSet > & patchPatches() const
return patch-patches addressing
PtrList< coordinateSystem > coordinates(solidRegions.size())
void refineSelectedBoxes(labelList &, labelLongList &)
refine selected boxes
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))
label numberOfEdgeGroups(const labelHashSet &containedEdges, const point ¢re, const scalar range, const triSurf &surface)
find the number of edge groups within the given range
bool refineBasedOnCurvature(labelList &, const labelLongList &)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
scalar size(const boundBox &) const
return size
void setSize(const label)
Reset size of List.
direction level() const
return level
bool refineBasedOnProximityTests(labelList &, const labelLongList &)
void markAdditionalLayers(labelList &refineBox, const label nLayers=1) const
mark additional layers around the leaves selected for refinement
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
bool insert(const Key &key)
Insert a new entry.
scalar curvatureAtEdge(const label) const
const labelList & corners() const
return corner nodes
A bounding box defined in terms of the points at its extremities.
const dimensionedScalar c
Speed of light in a vacuum.
void size(const label)
Override size to be inconsistent with allocated storage.
vector point
Point is a vector.
const labelList & edgeGroups() const
void clear()
Clear the list, i.e. set next free to zero.
void automaticRefinement()
LongList< meshOctreeCube * > & leavesAccess()
return leaves
bool hexRefinement_
a flag for activating paired refinement