42 const label gapLevelIncrement
45 allGeometry_(allGeometry),
46 surfaces_(surfacesDict.size()),
47 names_(surfacesDict.size()),
48 surfZones_(surfacesDict.size()),
49 regionOffset_(surfacesDict.size())
58 const word& geomName = allGeometry_.
names()[geomi];
60 if (surfacesDict.
found(geomName))
69 surfZones_.setSize(surfi);
89 const word& geomName = allGeometry_.
names()[geomi];
98 names_[surfi] = geomName;
99 surfaces_[surfi] = geomi;
102 globalMinLevel[surfi] = refLevel[0];
103 globalMaxLevel[surfi] = refLevel[1];
104 globalLevelIncr[surfi] =
dict.lookupOrDefault
112 globalMinLevel[surfi] < 0
113 || globalMaxLevel[surfi] < globalMinLevel[surfi]
114 || globalLevelIncr[surfi] < 0
120 ) <<
"Illegal level specification for surface "
122 <<
" : minLevel:" << globalMinLevel[surfi]
123 <<
" maxLevel:" << globalMaxLevel[surfi]
124 <<
" levelincrement:" << globalLevelIncr[surfi]
134 if (
dict.found(
"patchInfo"))
139 dict.subDict(
"patchInfo").clone()
142 dict.readIfPresent(
"perpendicularAngle", globalAngle[surfi]);
144 if (
dict.found(
"regions"))
161 regionMinLevel[surfi].insert(regioni, refLevel[0]);
162 regionMaxLevel[surfi].insert(regioni, refLevel[1]);
168 regionLevelIncr[surfi].insert(regioni, levelincr);
173 || refLevel[1] < refLevel[0]
180 ) <<
"Illegal level specification for surface "
181 << names_[surfi] <<
" region "
183 <<
" : minLevel:" << refLevel[0]
184 <<
" maxLevel:" << refLevel[1]
185 <<
" levelincrement:" << levelincr
189 if (regionDict.
found(
"perpendicularAngle"))
191 regionAngle[surfi].insert
194 regionDict.
lookup<scalar>(
"perpendicularAngle")
198 if (regionDict.
found(
"patchInfo"))
200 regionPatchInfo[surfi].insert
213 if (unmatchedKeys.
size() > 0)
218 ) <<
"Not all entries in refinementSurfaces dictionary were used."
219 <<
" The following entries were not used : "
231 nRegions += allGeometry_[surfaces_[surfi]].regions().
size();
242 perpendicularAngle_ = -great;
246 forAll(globalMinLevel, surfi)
253 label globalRegioni = regionOffset_[surfi] + i;
254 minLevel_[globalRegioni] = globalMinLevel[surfi];
255 maxLevel_[globalRegioni] = globalMaxLevel[surfi];
256 gapLevel_[globalRegioni] =
257 maxLevel_[globalRegioni]
258 + globalLevelIncr[surfi];
260 perpendicularAngle_[globalRegioni] = globalAngle[surfi];
261 if (globalPatchInfo.
set(surfi))
266 globalPatchInfo[surfi].
clone()
274 label globalRegioni = regionOffset_[surfi] + iter.key();
276 minLevel_[globalRegioni] = iter();
277 maxLevel_[globalRegioni] = regionMaxLevel[surfi][iter.key()];
278 gapLevel_[globalRegioni] =
279 maxLevel_[globalRegioni]
280 + regionLevelIncr[surfi][iter.key()];
284 label globalRegioni = regionOffset_[surfi] + iter.key();
286 perpendicularAngle_[globalRegioni] = regionAngle[surfi][iter.key()];
292 label globalRegioni = regionOffset_[surfi] + iter.key();
294 patchInfo_.set(globalRegioni, iter()().
clone());
314 allGeometry_(allGeometry),
317 surfZones_(surfZones),
318 regionOffset_(regionOffset),
322 perpendicularAngle_(perpendicularAngle),
323 patchInfo_(patchInfo.size())
340 const scalar level0EdgeLength,
341 const bool extendedRefinementSpan
377 minLevelField[i] = minLevel(surfi, region[i]);
387 if (extendedRefinementSpan)
390 shells.findHigherLevel
400 minLevelField[i] =
max(minLevelField[i], shellLevel[i]);
426 if (surfaces_.empty())
431 if (surfaces_.size() == 1)
446 geom.
getField(intersectionInfo, minLevelField);
447 bool haveLevelField =
457 intersectionInfo.
size(),
460 haveLevelField =
true;
465 forAll(intersectionInfo, i)
469 intersectionInfo[i].hit()
470 && minLevelField[i] > currentLevel[i]
474 surfaceLevel[i] = minLevelField[i];
497 geom.
getField(intersectionInfo, minLevelField);
501 forAll(intersectionInfo, i)
504 label minLocalLevel = -1;
506 if (intersectionInfo[i].hit())
509 if (minLevelField.
size())
511 minLocalLevel = minLevelField[i];
517 minLocalLevel = minLevel(surfi, 0);
522 label pointi = intersectionToPoint[i];
524 if (minLocalLevel > currentLevel[pointi])
527 surfaces[pointi] = surfi;
528 surfaceLevel[pointi] = minLocalLevel;
532 p0[missI] = start[pointi];
533 p1[missI] = end[pointi];
534 intersectionToPoint[missI] = pointi;
548 intersectionToPoint.
setSize(missI);
549 intersectionInfo.
setSize(missI);
569 if (surfaces_.empty())
592 n += hitinfo[pointi].
size();
605 surfinfo[
n] = pHits[i];
606 pointMap[
n] = pointi;
624 label region = globalRegion(surfi, surfRegion[i]);
625 label pointi = pointMap[i];
627 if (globalRegionLevel[region] > currentLevel[pointi])
631 surfaceNormal[pointi].
setSize(sz+1);
632 surfaceNormal[pointi][sz] = surfNormal[i];
634 surfaceLevel[pointi].
setSize(sz+1);
635 surfaceLevel[pointi][sz] = globalRegionLevel[region];
659 if (surfaces_.empty())
682 n += hitinfo[pointi].
size();
695 surfinfo[
n] = pHits[i];
696 pointMap[
n] = pointi;
711 label region = globalRegion(surfi, surfRegion[i]);
712 label pointi = pointMap[i];
714 if (globalRegionLevel[region] > currentLevel[pointi])
721 surfaceNormal[pointi].
setSize(sz+1);
722 surfaceNormal[pointi][sz] = surfNormal[i];
724 surfaceLevel[pointi].
setSize(sz+1);
725 surfaceLevel[pointi][sz] = globalRegionLevel[region];
761 forAll(surfacesToTest, testi)
763 label surfi = surfacesToTest[testi];
780 forAll(nearestInfo, pointi)
782 if (nearestInfo[pointi].hit())
784 hit1[pointi] = nearestInfo[pointi];
785 surface1[pointi] = surfi;
786 region1[pointi] = region[pointi];
787 nearest[pointi] = hit1[pointi].hitPoint();
805 if (hit1[pointi].hit())
807 nearest[pointi] = hit1[pointi].hitPoint();
812 nearest[pointi] = end[pointi];
816 forAll(surfacesToTest, testi)
818 label surfi = surfacesToTest[testi];
835 forAll(nearestInfo, pointi)
837 if (nearestInfo[pointi].hit())
839 hit2[pointi] = nearestInfo[pointi];
840 surface2[pointi] = surfi;
841 region2[pointi] = region[pointi];
842 nearest[pointi] = hit2[pointi].hitPoint();
852 if (hit1[pointi].hit() && !hit2[pointi].hit())
854 hit2[pointi] = hit1[pointi];
855 surface2[pointi] = surface1[pointi];
856 region2[pointi] = region1[pointi];
898 forAll(surfacesToTest, testi)
900 label surfi = surfacesToTest[testi];
904 geom.
findLine(start, nearest, nearestInfo);
908 forAll(nearestInfo, pointi)
910 if (nearestInfo[pointi].hit())
912 hit1[pointi] = nearestInfo[pointi];
913 surface1[pointi] = surfi;
914 region1[pointi] = region[pointi];
915 normal1[pointi] = normal[pointi];
916 nearest[pointi] = hit1[pointi].hitPoint();
935 if (hit1[pointi].hit())
937 nearest[pointi] = hit1[pointi].hitPoint();
942 nearest[pointi] = end[pointi];
946 forAll(surfacesToTest, testi)
948 label surfi = surfacesToTest[testi];
952 geom.
findLine(end, nearest, nearestInfo);
956 forAll(nearestInfo, pointi)
958 if (nearestInfo[pointi].hit())
960 hit2[pointi] = nearestInfo[pointi];
961 surface2[pointi] = surfi;
962 region2[pointi] = region[pointi];
963 normal2[pointi] = normal[pointi];
964 nearest[pointi] = hit2[pointi].hitPoint();
974 if (hit1[pointi].hit() && !hit2[pointi].hit())
976 hit2[pointi] = hit1[pointi];
977 surface2[pointi] = surface1[pointi];
978 region2[pointi] = region1[pointi];
979 normal2[pointi] = normal1[pointi];
1029 forAll(hitSurface, pointi)
1031 if (hitSurface[pointi] != -1)
1033 hitSurface[pointi] = surfacesToTest[hitSurface[pointi]];
1063 forAll(hitSurface, pointi)
1065 if (hitSurface[pointi] != -1)
1067 hitSurface[pointi] = surfacesToTest[hitSurface[pointi]];
1075 forAll(surfacesToTest, i)
1077 label surfi = surfacesToTest[i];
1092 allGeometry_[surfaces_[surfi]].getRegion(localHits, localRegion);
1096 hitRegion[localIndices[i]] = localRegion[i];
1127 forAll(hitSurface, pointi)
1129 if (hitSurface[pointi] != -1)
1131 hitSurface[pointi] = surfacesToTest[hitSurface[pointi]];
1141 forAll(surfacesToTest, i)
1143 label surfi = surfacesToTest[i];
1159 allGeometry_[surfaces_[surfi]].getRegion(localHits, localRegion);
1163 hitRegion[localIndices[i]] = localRegion[i];
1168 allGeometry_[surfaces_[surfi]].getNormal(localHits, localNormal);
1172 hitNormal[localIndices[i]] = localNormal[i];
1186 insideSurfaces = -1;
1190 label surfi = testSurfaces[i];
1195 surfZones_[surfi].zoneInside();
1204 <<
"Trying to use surface "
1206 <<
" which has non-geometric inside selection method "
1218 if (insideSurfaces[pointi] == -1)
1232 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,.
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)