44 NamedEnum<shellSurfaces::refineMode, 3>::
60 void Foam::shellSurfaces::setAndCheckLevels
66 if (modes_[shellI] != DISTANCE && distLevels.size() != 1)
70 "shellSurfaces::shellSurfaces" 71 "(const searchableSurfaces&, const dictionary&)" 72 ) <<
"For refinement mode " 73 << refineModeNames_[modes_[shellI]]
74 <<
" specify only one distance+level." 75 <<
" (its distance gets discarded)" 79 distances_[shellI].setSize(distLevels.size());
80 levels_[shellI].setSize(distLevels.size());
84 distances_[shellI][j] = distLevels[j].first();
85 levels_[shellI][j] = distLevels[j].second();
92 (distances_[shellI][j] <= distances_[shellI][j-1])
93 || (levels_[shellI][j] > levels_[shellI][j-1])
98 "shellSurfaces::shellSurfaces" 99 "(const searchableSurfaces&, const dictionary&)" 100 ) <<
"For refinement mode " 101 << refineModeNames_[modes_[shellI]]
102 <<
" : Refinement should be specified in order" 103 <<
" of increasing distance" 104 <<
" (and decreasing refinement level)." <<
endl 105 <<
"Distance:" << distances_[shellI][j]
106 <<
" refinementLevel:" << levels_[shellI][j]
114 if (modes_[shellI] == DISTANCE)
116 Info<<
"Refinement level according to distance to " 118 forAll(levels_[shellI], j)
120 Info<<
" level " << levels_[shellI][j]
121 <<
" for all cells within " << distances_[shellI][j]
122 <<
" metre." <<
endl;
127 if (!allGeometry_[shells_[shellI]].hasVolumeType())
131 "shellSurfaces::shellSurfaces" 132 "(const searchableSurfaces&" 133 ", const PtrList<dictionary>&)" 134 ) <<
"Shell " << shell.
name()
135 <<
" does not support testing for " 136 << refineModeNames_[modes_[shellI]] <<
endl 137 <<
"Probably it is not closed." 141 if (modes_[shellI] == INSIDE)
143 Info<<
"Refinement level " << levels_[shellI][0]
144 <<
" for all cells inside " << shell.
name() <<
endl;
148 Info<<
"Refinement level " << levels_[shellI][0]
149 <<
" for all cells outside " << shell.
name() <<
endl;
158 void Foam::shellSurfaces::orient()
163 bool hasSurface =
false;
169 if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
173 if (shell.triSurface::size())
179 boundBox shellBb(points[0], points[0]);
183 const point& pt = points[i];
196 const point outsidePt = overallBb.
max() + overallBb.
span();
204 if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
208 refCast<const triSurfaceMesh>(
s)
228 Info<<
"shellSurfaces : Flipped orientation of surface " 230 <<
" so point " << outsidePt <<
" is outside." <<
endl;
239 void Foam::shellSurfaces::findHigherLevel
246 const labelList& levels = levels_[shellI];
248 if (modes_[shellI] == DISTANCE)
261 label candidateI = 0;
267 if (levels[levelI] > maxLevel[pointI])
269 candidates[candidateI] = pt[pointI];
270 candidateMap[candidateI] = pointI;
271 candidateDistSqr[candidateI] =
sqr(distances[levelI]);
277 candidates.setSize(candidateI);
278 candidateMap.setSize(candidateI);
279 candidateDistSqr.setSize(candidateI);
283 allGeometry_[shells_[shellI]].findNearest
291 forAll(nearInfo, candidateI)
293 if (nearInfo[candidateI].hit())
299 mag(nearInfo[candidateI].hitPoint()-candidates[candidateI])
302 label pointI = candidateMap[candidateI];
305 maxLevel[pointI] = levels[minDistI+1];
318 label candidateI = 0;
322 if (levels[0] > maxLevel[pointI])
324 candidates[candidateI] = pt[pointI];
325 candidateMap[candidateI] = pointI;
329 candidates.
setSize(candidateI);
330 candidateMap.setSize(candidateI);
334 allGeometry_[shells_[shellI]].getVolumeType(candidates, volType);
338 label pointI = candidateMap[i];
343 modes_[shellI] == INSIDE
347 modes_[shellI] == OUTSIDE
352 maxLevel[pointI] = levels[0];
367 allGeometry_(allGeometry)
375 const word& geomName = allGeometry_.names()[geomI];
377 if (shellsDict.
found(geomName))
385 shells_.setSize(shellI);
386 modes_.setSize(shellI);
387 distances_.setSize(shellI);
388 levels_.setSize(shellI);
393 forAll(allGeometry_.names(), geomI)
395 const word& geomName = allGeometry_.names()[geomI];
404 shells_[shellI] = geomI;
405 modes_[shellI] = refineModeNames_.read(dict.
lookup(
"mode"));
408 setAndCheckLevels(shellI, dict.
lookup(
"levels"));
414 if (unmatchedKeys.size() > 0)
418 "shellSurfaces::shellSurfaces(..)",
420 ) <<
"Not all entries in refinementRegions dictionary were used." 421 <<
" The following entries were not used : " 422 << unmatchedKeys.sortedToc()
438 label overallMax = 0;
441 overallMax =
max(overallMax,
max(levels_[shellI]));
447 void Foam::shellSurfaces::findHigherLevel
459 findHigherLevel(pt, shellI, maxLevel);
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const pointField & points
A 2-tuple for storing two objects of different types.
const point & min() const
Minimum describing the bounding box.
static const boundBox invertedBox
A very large inverted boundBox: min/max == +/- VGREAT.
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 maxLevel() const
Highest shell level.
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
vector span() const
The bounding box span (from minimum to maximum)
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool orient(triSurface &, const point &, const bool orientOutside)
Flip faces such that normals are consistent with point:
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define IOWarningIn(functionName, ios)
Report an IO warning using Foam::Warning.
const keyType & keyword() const
Return keyword.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
wordList toc() const
Return the table of contents.
bool erase(T *p)
Remove the specified element from the list and delete it.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual tmp< pointField > points() const
Get the points that define the surface.
const point & max() const
Maximum describing the bounding box.
label findLower(const ListType &, typename ListType::const_reference, const label stary, const BinaryOp &bop)
Find last element < given value in sorted list and return index,.
const word & name() const
Return name.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A bounding box defined in terms of the points at its extremities.
A keyword and a list of tokens is an 'entry'.
shellSurfaces(const searchableSurfaces &allGeometry, const dictionary &shellsDict)
Construct from geometry and dictionary.
#define forAllReverse(list, i)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
A HashTable with keys but without contents.
Container for searchableSurfaces.
const wordList & names() const
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
IOoject and searching on triSurface.