Go to the documentation of this file.
41 searchableSurfaceCollection,
70 subGeom_[surfI].findNearest
74 transform_[surfI].localPosition(
samples),
83 if (hitInfo[pointI].hit())
87 point globalPt = transform_[surfI].globalPosition
91 hitInfo[pointI].rawPoint(),
98 if (distSqr < minDistSqr[pointI])
100 minDistSqr[pointI] = distSqr;
101 nearestInfo[pointI].setPoint(globalPt);
102 nearestInfo[pointI].setHit();
103 nearestInfo[pointI].setIndex
105 hitInfo[pointI].index()
106 + indexOffset_[surfI]
108 nearestSurf[pointI] = surfI;
130 if (info[pointI].hit())
132 label index = info[pointI].index();
139 surfInfo.
setSize(subGeom_.size());
141 infoMap.
setSize(subGeom_.size());
145 surfInfo[surfI].setSize(nHits[surfI]);
146 infoMap[surfI].
setSize(nHits[surfI]);
152 if (info[pointI].hit())
154 label index = info[pointI].index();
159 label localI = nHits[surfI]++;
163 info[pointI].rawPoint(),
164 index-indexOffset_[surfI]
166 infoMap[surfI][localI] = pointI;
181 instance_(
dict.size()),
183 transform_(
dict.size()),
184 subGeom_(
dict.size()),
185 mergeSubRegions_(
dict.lookup(
"mergeSubRegions")),
186 indexOffset_(
dict.size()+1)
191 label startIndex = 0;
194 if (
dict.isDict(iter().keyword()))
196 instance_[surfI] = iter().keyword();
200 scale_[surfI] = subDict.
lookup(
"scale");
210 const word subGeomName(subDict.
lookup(
"surface"));
219 if (
s.size() !=
s.globalSize())
222 <<
"Cannot use a distributed surface in a collection."
228 indexOffset_[surfI] = startIndex;
229 startIndex += subGeom_[surfI].size();
231 Info<<
" instance : " << instance_[surfI] <<
endl;
232 Info<<
" surface : " <<
s.name() <<
endl;
233 Info<<
" scale : " << scale_[surfI] <<
endl;
234 Info<<
" coordsys : " << transform_[surfI] <<
endl;
239 indexOffset_[surfI] = startIndex;
241 instance_.setSize(surfI);
242 scale_.setSize(surfI);
243 transform_.setSize(surfI);
244 subGeom_.setSize(surfI);
245 indexOffset_.setSize(surfI+1);
252 const boundBox& surfBb = subGeom_[surfI].bounds();
255 const point surfBbMin = transform_[surfI].globalPosition
263 const point surfBbMax = transform_[surfI].globalPosition
272 bounds().
min() =
min(bounds().
min(), surfBbMin);
273 bounds().max() =
max(bounds().
max(), surfBbMax);
288 if (regions_.size() == 0)
290 regionOffset_.
setSize(subGeom_.size());
295 regionOffset_[surfI] = allRegions.size();
297 if (mergeSubRegions_)
304 const wordList& subRegions = subGeom_[surfI].regions();
308 allRegions.
append(instance_[surfI] +
"_" + subRegions[i]);
312 regions_.transfer(allRegions.
shrink());
320 return indexOffset_.last();
339 ctrs[coordI++] = transform_[surfI].globalPosition
360 centres.setSize(size());
361 radiusSqr.setSize(centres.size());
368 scalar maxScale =
cmptMax(scale_[surfI]);
372 subGeom_[surfI].boundingSpheres(subCentres, subRadiusSqr);
376 centres[coordI] = transform_[surfI].globalPosition
384 radiusSqr[coordI] = maxScale*subRadiusSqr[i];
399 nPoints += subGeom_[surfI].points()().size();
414 pts[
nPoints++] = transform_[surfI].globalPosition
470 transform_[surfI].localPosition
480 transform_[surfI].localPosition
487 subGeom_[surfI].findLine(e0, e1, hitInfo);
491 if (hitInfo[pointI].hit())
494 nearest[pointI] = transform_[surfI].globalPosition
498 hitInfo[pointI].rawPoint(),
502 info[pointI] = hitInfo[pointI];
503 info[pointI].rawPoint() = nearest[pointI];
504 info[pointI].setIndex
506 hitInfo[pointI].index()
507 + indexOffset_[surfI]
519 if (info[pointI].hit())
521 vector n(end[pointI] - start[pointI]);
522 scalar magN =
mag(
n);
528 scalar
s = ((info[pointI].rawPoint()-start[pointI])&
n);
533 <<
"point:" << info[pointI]
535 <<
" outside vector "
536 <<
" start:" << start[pointI]
537 <<
" end:" << end[pointI]
555 findLine(start, end, info);
568 findLine(start, end, nearestInfo);
573 if (nearestInfo[pointI].hit())
576 info[pointI][0] = nearestInfo[pointI];
580 info[pointI].
clear();
592 if (subGeom_.size() == 0)
594 else if (subGeom_.size() == 1)
596 if (mergeSubRegions_)
599 region = regionOffset_[0];
603 subGeom_[0].getRegion(info, region);
614 sortHits(info, surfInfo, infoMap);
621 if (mergeSubRegions_)
629 region[map[i]] = regionOffset_[surfI];
638 subGeom_[surfI].getRegion(surfInfo[surfI], surfRegion);
643 region[map[i]] = regionOffset_[surfI] + surfRegion[i];
657 if (subGeom_.size() == 0)
659 else if (subGeom_.size() == 1)
661 subGeom_[0].getNormal(info,
normal);
671 sortHits(info, surfInfo, infoMap);
679 subGeom_[surfI].getNormal(surfInfo[surfI], surfNormal);
682 surfNormal = transform_[surfI].globalVector(surfNormal);
687 normal[map[i]] = surfNormal[i];
701 <<
"Volume type not supported for collection."
709 const bool keepNonLocal,
729 subGeom_[surfI].distribute
744 subGeom_[surfI].setField
751 subGeom_[surfI].size(),
766 if (subGeom_.size() == 0)
768 else if (subGeom_.size() == 1)
770 subGeom_[0].getField(info, values);
780 sortHits(info, surfInfo, infoMap);
786 subGeom_[surfI].getField(surfInfo[surfI], surfValues);
788 if (surfValues.
size())
796 values[map[i]] = surfValues[i];
vectorField pointField
pointField is a vectorField.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
void sortHits(const List< pointIndexHit > &info, List< List< pointIndexHit > > &surfInfo, labelListList &infoMap) const
Sort hits into per-surface bins. Misses are rejected.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from string.
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
const point & max() const
Maximum describing the bounding box.
searchableSurfaceCollection(const searchableSurfaceCollection &)
Disallow default bitwise copy construct.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
A List obtained as a section of another List.
virtual ~searchableSurfaceCollection()
Destructor.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual void distribute(const List< treeBoundBox > &, const bool keepNonLocal, autoPtr< mapDistribute > &faceMap, autoPtr< mapDistribute > &pointMap)
Set bounds of surface. Bounds currently set as list of.
virtual const wordList & regions() const
Names of regions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
const objectRegistry & db() const
Return the local objectRegistry.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual label size() const
Range of local indices that can be returned.
scalarField samples(nIntervals, 0)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
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.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
void findNearest(const pointField &samples, scalarField &minDistSqr, List< pointIndexHit > &nearestInfo, labelList &nearestSurf) const
Find point nearest to sample. Updates minDistSqr. Sets nearestInfo.
label findLower(const ListType &, typename ListType::const_reference, const label start, const BinaryOp &bop)
Find last element < given value in sorted list and return index,.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
const point & min() const
Minimum describing the bounding box.
PtrList< coordinateSystem > coordinates(solidRegions.size())
A list of keyword definitions, which are a keyword followed by any number of values (e....
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
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))
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
PointIndexHit< point > pointIndexHit
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
A bounding box defined in terms of the points at its extremities.
Various functions to operate on Lists.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
void size(const label)
Override size to be inconsistent with allocated storage.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual void setField(const labelList &values)
WIP. Store element-wise field.
word name(const complex &)
Return a string representation of a complex.
A normal distribution model.