41 const label gapLevelIncrement
44 allGeometry_(allGeometry),
45 surfaces_(surfacesDict.size()),
46 names_(surfacesDict.size()),
47 surfZones_(surfacesDict.size()),
48 regionOffset_(surfacesDict.size())
57 const word& geomName = allGeometry_.
names()[geomi];
59 if (surfacesDict.
found(geomName))
68 surfZones_.setSize(surfi);
88 const word& geomName = allGeometry_.
names()[geomi];
97 names_[surfi] = geomName;
98 surfaces_[surfi] = geomi;
101 globalMinLevel[surfi] = refLevel[0];
102 globalMaxLevel[surfi] = refLevel[1];
103 globalLevelIncr[surfi] =
dict.lookupOrDefault
111 globalMinLevel[surfi] < 0
112 || globalMaxLevel[surfi] < globalMinLevel[surfi]
113 || globalLevelIncr[surfi] < 0
119 ) <<
"Illegal level specification for surface "
121 <<
" : minLevel:" << globalMinLevel[surfi]
122 <<
" maxLevel:" << globalMaxLevel[surfi]
123 <<
" levelincrement:" << globalLevelIncr[surfi]
133 if (
dict.found(
"patchInfo"))
138 dict.subDict(
"patchInfo").clone()
141 dict.readIfPresent(
"perpendicularAngle", globalAngle[surfi]);
143 if (
dict.found(
"regions"))
160 regionMinLevel[surfi].insert(regioni, refLevel[0]);
161 regionMaxLevel[surfi].insert(regioni, refLevel[1]);
167 regionLevelIncr[surfi].insert(regioni, levelincr);
172 || refLevel[1] < refLevel[0]
179 ) <<
"Illegal level specification for surface "
180 << names_[surfi] <<
" region "
182 <<
" : minLevel:" << refLevel[0]
183 <<
" maxLevel:" << refLevel[1]
184 <<
" levelincrement:" << levelincr
188 if (regionDict.
found(
"perpendicularAngle"))
190 regionAngle[surfi].insert
193 regionDict.
lookup<scalar>(
"perpendicularAngle")
197 if (regionDict.
found(
"patchInfo"))
199 regionPatchInfo[surfi].insert
212 if (unmatchedKeys.
size() > 0)
217 ) <<
"Not all entries in refinementSurfaces dictionary were used."
218 <<
" The following entries were not used : "
230 nRegions += allGeometry_[surfaces_[surfi]].regions().
size();
241 perpendicularAngle_ = -great;
245 forAll(globalMinLevel, surfi)
252 label globalRegioni = regionOffset_[surfi] + i;
253 minLevel_[globalRegioni] = globalMinLevel[surfi];
254 maxLevel_[globalRegioni] = globalMaxLevel[surfi];
255 gapLevel_[globalRegioni] =
256 maxLevel_[globalRegioni]
257 + globalLevelIncr[surfi];
259 perpendicularAngle_[globalRegioni] = globalAngle[surfi];
260 if (globalPatchInfo.
set(surfi))
265 globalPatchInfo[surfi].
clone()
273 label globalRegioni = regionOffset_[surfi] + iter.key();
275 minLevel_[globalRegioni] = iter();
276 maxLevel_[globalRegioni] = regionMaxLevel[surfi][iter.key()];
277 gapLevel_[globalRegioni] =
278 maxLevel_[globalRegioni]
279 + regionLevelIncr[surfi][iter.key()];
283 label globalRegioni = regionOffset_[surfi] + iter.key();
285 perpendicularAngle_[globalRegioni] = regionAngle[surfi][iter.key()];
291 label globalRegioni = regionOffset_[surfi] + iter.key();
293 patchInfo_.set(globalRegioni, iter()().
clone());
313 allGeometry_(allGeometry),
316 surfZones_(surfZones),
317 regionOffset_(regionOffset),
321 perpendicularAngle_(perpendicularAngle),
322 patchInfo_(patchInfo.size())
339 const scalar level0EdgeLength,
340 const bool extendedRefinementSpan
376 minLevelField[i] = minLevel(surfi, region[i]);
386 if (extendedRefinementSpan)
389 shells.findHigherLevel
399 minLevelField[i] =
max(minLevelField[i], shellLevel[i]);
425 if (surfaces_.empty())
430 if (surfaces_.size() == 1)
445 geom.
getField(intersectionInfo, minLevelField);
446 bool haveLevelField =
456 intersectionInfo.
size(),
459 haveLevelField =
true;
464 forAll(intersectionInfo, i)
468 intersectionInfo[i].hit()
469 && minLevelField[i] > currentLevel[i]
473 surfaceLevel[i] = minLevelField[i];
496 geom.
getField(intersectionInfo, minLevelField);
500 forAll(intersectionInfo, i)
503 label minLocalLevel = -1;
505 if (intersectionInfo[i].hit())
508 if (minLevelField.
size())
510 minLocalLevel = minLevelField[i];
516 minLocalLevel = minLevel(surfi, 0);
521 label pointi = intersectionToPoint[i];
523 if (minLocalLevel > currentLevel[pointi])
526 surfaces[pointi] = surfi;
527 surfaceLevel[pointi] = minLocalLevel;
531 p0[missI] = start[pointi];
532 p1[missI] = end[pointi];
533 intersectionToPoint[missI] = pointi;
547 intersectionToPoint.
setSize(missI);
548 intersectionInfo.
setSize(missI);
568 if (surfaces_.empty())
591 n += hitinfo[pointi].
size();
604 surfinfo[
n] = pHits[i];
605 pointMap[
n] = pointi;
623 label region = globalRegion(surfi, surfRegion[i]);
624 label pointi = pointMap[i];
626 if (globalRegionLevel[region] > currentLevel[pointi])
630 surfaceNormal[pointi].
setSize(sz+1);
631 surfaceNormal[pointi][sz] = surfNormal[i];
633 surfaceLevel[pointi].
setSize(sz+1);
634 surfaceLevel[pointi][sz] = globalRegionLevel[region];
658 if (surfaces_.empty())
681 n += hitinfo[pointi].
size();
694 surfinfo[
n] = pHits[i];
695 pointMap[
n] = pointi;
710 label region = globalRegion(surfi, surfRegion[i]);
711 label pointi = pointMap[i];
713 if (globalRegionLevel[region] > currentLevel[pointi])
720 surfaceNormal[pointi].
setSize(sz+1);
721 surfaceNormal[pointi][sz] = surfNormal[i];
723 surfaceLevel[pointi].
setSize(sz+1);
724 surfaceLevel[pointi][sz] = globalRegionLevel[region];
760 forAll(surfacesToTest, testi)
762 label surfi = surfacesToTest[testi];
779 forAll(nearestInfo, pointi)
781 if (nearestInfo[pointi].hit())
783 hit1[pointi] = nearestInfo[pointi];
784 surface1[pointi] = surfi;
785 region1[pointi] = region[pointi];
786 nearest[pointi] = hit1[pointi].hitPoint();
804 if (hit1[pointi].hit())
806 nearest[pointi] = hit1[pointi].hitPoint();
811 nearest[pointi] = end[pointi];
815 forAll(surfacesToTest, testi)
817 label surfi = surfacesToTest[testi];
834 forAll(nearestInfo, pointi)
836 if (nearestInfo[pointi].hit())
838 hit2[pointi] = nearestInfo[pointi];
839 surface2[pointi] = surfi;
840 region2[pointi] = region[pointi];
841 nearest[pointi] = hit2[pointi].hitPoint();
851 if (hit1[pointi].hit() && !hit2[pointi].hit())
853 hit2[pointi] = hit1[pointi];
854 surface2[pointi] = surface1[pointi];
855 region2[pointi] = region1[pointi];
897 forAll(surfacesToTest, testi)
899 label surfi = surfacesToTest[testi];
903 geom.
findLine(start, nearest, nearestInfo);
907 forAll(nearestInfo, pointi)
909 if (nearestInfo[pointi].hit())
911 hit1[pointi] = nearestInfo[pointi];
912 surface1[pointi] = surfi;
913 region1[pointi] = region[pointi];
914 normal1[pointi] = normal[pointi];
915 nearest[pointi] = hit1[pointi].hitPoint();
934 if (hit1[pointi].hit())
936 nearest[pointi] = hit1[pointi].hitPoint();
941 nearest[pointi] = end[pointi];
945 forAll(surfacesToTest, testi)
947 label surfi = surfacesToTest[testi];
951 geom.
findLine(end, nearest, nearestInfo);
955 forAll(nearestInfo, pointi)
957 if (nearestInfo[pointi].hit())
959 hit2[pointi] = nearestInfo[pointi];
960 surface2[pointi] = surfi;
961 region2[pointi] = region[pointi];
962 normal2[pointi] = normal[pointi];
963 nearest[pointi] = hit2[pointi].hitPoint();
973 if (hit1[pointi].hit() && !hit2[pointi].hit())
975 hit2[pointi] = hit1[pointi];
976 surface2[pointi] = surface1[pointi];
977 region2[pointi] = region1[pointi];
978 normal2[pointi] = normal1[pointi];
1028 forAll(hitSurface, pointi)
1030 if (hitSurface[pointi] != -1)
1032 hitSurface[pointi] = surfacesToTest[hitSurface[pointi]];
1062 forAll(hitSurface, pointi)
1064 if (hitSurface[pointi] != -1)
1066 hitSurface[pointi] = surfacesToTest[hitSurface[pointi]];
1074 forAll(surfacesToTest, i)
1076 label surfi = surfacesToTest[i];
1091 allGeometry_[surfaces_[surfi]].getRegion(localHits, localRegion);
1095 hitRegion[localIndices[i]] = localRegion[i];
1126 forAll(hitSurface, pointi)
1128 if (hitSurface[pointi] != -1)
1130 hitSurface[pointi] = surfacesToTest[hitSurface[pointi]];
1140 forAll(surfacesToTest, i)
1142 label surfi = surfacesToTest[i];
1158 allGeometry_[surfaces_[surfi]].getRegion(localHits, localRegion);
1162 hitRegion[localIndices[i]] = localRegion[i];
1167 allGeometry_[surfaces_[surfi]].getNormal(localHits, localNormal);
1171 hitNormal[localIndices[i]] = localNormal[i];
1185 insideSurfaces = -1;
1189 label surfi = testSurfaces[i];
1194 surfZones_[surfi].zoneInside();
1203 <<
"Trying to use surface "
1205 <<
" which has non-geometric inside selection method "
1217 if (insideSurfaces[pointi] == -1)
1231 insideSurfaces[pointi] = surfi;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A HashTable with keys but without contents.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
label size() const
Return number of elements in table.
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
A List with indirect addressing.
label size() const
Return the number of elements in the UPtrList.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keyword definitions, which are a keyword followed by any number of values (e....
autoPtr< dictionary > clone() const
Construct and return clone.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
wordList toc() const
Return the table of contents.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
A keyword and a list of tokens is an 'entry'.
const keyType & keyword() const
Return keyword.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
Encapsulates queries for volume refinement ('refine all cells within shell').
void findAllHigherIntersections(const pointField &start, const pointField &end, const labelList ¤tLevel, const labelList &globalRegionLevel, List< vectorList > &surfaceNormal, labelListList &surfaceLevel) const
Find all intersections of edge. Unsorted order.
void findNearest(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest point on surfaces.
refinementSurfaces(const searchableSurfaces &allGeometry, const dictionary &, const label gapLevelIncrement)
Construct from surfaces and dictionary.
const PtrList< dictionary > & patchInfo() const
From global region number to patch type.
void findInside(const labelList &surfacesToTest, const pointField &pt, labelList &insideSurfaces) const
Detect if a point is 'inside' (closed) surfaces.
void findNearestRegion(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &hitSurface, labelList &hitRegion) const
Find nearest point on surfaces. Return surface and region on.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Used for debugging only: find intersection of edge.
void findHigherIntersection(const pointField &start, const pointField &end, const labelList ¤tLevel, labelList &surfaces, labelList &surfaceLevel) const
Find intersection of edge. Return -1 or first surface.
void setMinLevelFields(const refinementRegions &shells, const scalar level0EdgeLength, const bool extendedRefinementSpan)
Calculate the refinement level for every element.
void findNearestIntersection(const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList ®ion1, labelList &surface2, List< pointIndexHit > &hit2, labelList ®ion2) const
Find intersection nearest to the endpoints. surface1,2 are.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const =0
From a set of points and indices get the region.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Find first intersection on segment from start to end.
virtual void getVolumeType(const pointField &, List< volumeType > &) const =0
Determine type (inside/outside) for point. unknown if.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
virtual bool hasVolumeType() const =0
Whether supports volume type below.
virtual void getField(const List< pointIndexHit > &, labelList &values) const
WIP. From a set of hits (points and.
virtual const wordList & regions() const =0
Names of regions.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const =0
Get all intersections in order from start to end.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Return any intersection on segment from start to end.
virtual label globalSize() const
Range of global indices that can be returned.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const =0
Get bounding spheres (centre and radius squared), one per element.
static void findAnyIntersection(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &)
Find any intersection. Return hit point information and.
static void findNearest(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &)
Find nearest. Return -1 (and a miss()) or surface and nearest.
Container for searchableSurfaces.
const wordList & names() const
Contains information about location on a triSurface.
areaSelectionAlgo
Types of selection of area.
static const NamedEnum< areaSelectionAlgo, 4 > areaSelectionAlgoNames
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
surfacesMesh setField(triSurfaceToAgglom)
const Foam::wordList regionNames(args.optionFound("allRegions") ? runTime .controlDict().subDict("regionSolvers").toc() :wordList(1, args.optionFound("region") ? args.optionRead< word >("region") :polyMesh::defaultRegion))
scalarField samples(nIntervals, 0)