Go to the documentation of this file.
32 #include "PatchTools.H"
113 <<
"Cannot find triSurfaceMesh starting from "
127 if (eFnd != facesPerEdge.end())
161 facesPerEdge.
clear();
173 label nextPointI =
f[
f.fcIndex(fp)];
175 if (nextPointI > pointI)
179 edge(pointI, nextPointI),
189 label prevPointI =
f[
f.rcIndex(fp)];
191 if (prevPointI > pointI)
195 edge(pointI, prevPointI),
345 scalar scaleFactor = 0;
364 <<
" : ignoring triangles with quality < "
365 << minQuality_ <<
" for normals calculation." <<
endl;
412 radiusSqr.setSize(size());
420 const point& fc = centres[faceI];
423 const point& pt = pts[
f[fp]];
445 return !indices.empty();
457 label event = getEvent();
473 if (edgeTree_.empty())
505 bb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
506 bb.
max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
538 if (regions_.empty())
543 regions_[regionI] =
patches()[regionI].name();
553 if (surfaceClosed_ == -1)
555 if (isSurfaceClosed())
565 return surfaceClosed_ == 1;
642 region[i] = triSurface::operator[](info[i].index()).region();
663 if (minQuality_ >= 0)
674 label faceI = info[i].index();
675 normal[i] =
s[faceI].normal(pts);
677 scalar qual =
s[faceI].tri(pts).quality();
679 if (qual < minQuality_)
682 const labelList& fFaces = faceFaces[faceI];
686 label nbrI = fFaces[j];
687 scalar nbrQual =
s[nbrI].tri(pts).quality();
691 normal[i] =
s[nbrI].normal(pts);
711 label faceI = info[i].index();
716 normal[i] =
s[faceI].normal(pts);
731 if (foundObject<triSurfaceLabelField>(
"values"))
735 lookupObject<triSurfaceLabelField>
740 fld.field() = values;
764 fldPtr.
ptr()->store();
775 if (foundObject<triSurfaceLabelField>(
"values"))
788 values[i] =
fld[info[i].index()];
810 if (!tree().bb().contains(pt))
817 outsideVolType_ = tree().shapes().getVolumeType(tree(), pt);
819 volType[pointI] = outsideVolType_;
824 volType[pointI] = tree().shapes().getVolumeType(tree(), pt);
830 volType[pointI] = tree().getVolumeType(pt);
852 && instance != runTime.
system()
858 const_cast<triSurfaceMesh&
>(*this).searchableSurface::instance() =
vectorField pointField
pointField is a vectorField.
Simple random number generator.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const boundBox & bounds() const
Return const reference to boundBox.
const labelListList & pointFaces() const
Return point-face addressing.
fileName filePath() const
Return complete path + object name if the file exists.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const Field< point > & points() const
Return reference to global points.
void clearOut()
Clear all data.
A class for handling file names.
const point & max() const
Maximum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, const labelList ®ionIndices, List< pointIndexHit > &info) const
Find the nearest point on the surface out of the regions.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
T * ptr()
Return object pointer for reuse.
A List obtained as a section of another List.
compressionType
Enumeration for the format of data in the stream.
Standard boundBox + extra functionality for use in octree.
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
const Time & time() const
Return time.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
fileName path() const
Return directory path name (part before last /)
void clearOut()
Clear storage.
fileName caseSystem() const
Return system name for the case.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
IOoject and searching on triSurface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void invertManyToMany(const label len, const UList< InList > &, List< OutList > &)
Invert many-to-many.
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &info) const
Calculate all intersections from start to end.
dimensioned< scalar > mag(const dimensioned< Type > &)
const fileName & instance() const
writeOption writeOpt() const
const Time & time() const
Return time.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
static word meshSubDir
Return the mesh sub-directory name (usually "triSurface")
static scalar & perturbTol()
Get the perturbation tolerance.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual void movePoints(const pointField &)
Move points.
const objectRegistry & db() const
Return the local objectRegistry.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
virtual void movePoints(const pointField &)
Move points.
Registry of regIOobjects.
fileName objectPath() const
Return complete path + object name.
scalarField samples(nIntervals, 0)
void findBox(const label nodeI, const treeBoundBox &searchBox, labelHashSet &elements) const
Find all elements intersecting box.
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.
Field< label > labelField
Specialisation of Field<T> for label.
const word & system() const
Return system name.
Triangulated surface description with patch information.
readOption readOpt() const
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
label eventNo() const
Event number at last update.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
Non-pointer based hierarchical recursive searching.
Holds data for octree to work on an edges subset.
const word & name() const
Return name.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
virtual const wordList & regions() const
Names of regions.
const point & min() const
Minimum describing the bounding box.
triSurfaceMesh(const triSurfaceMesh &)
Disallow default bitwise copy construct.
PtrList< coordinateSystem > coordinates(solidRegions.size())
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared). Any point.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
void clearOut()
Clear storage.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
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){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
const double e
Elementary charge.
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))
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
virtual void setField(const labelList &values)
WIP. Store element-wise field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label size() const
Return the number of elements in the UList.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static const fileName & checkFile(const fileName &fName, const fileName &objectName)
Check file existence.
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...
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual ~triSurfaceMesh()
Destructor.
virtual void scalePoints(const scalar &)
Scale points. A non-positive factor is ignored.
void clear()
Clear all entries from table.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
fileName caseConstant() const
Return constant name for the case.
static bool addFaceToEdge(const edge &, EdgeMap< label > &)
Helper function for isSurfaceClosed.
const word & constant() const
Return constant name.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write using given format, version and compression.
const Field< PointType > & faceCentres() const
Return face centres for patch.
const dimensionedScalar e
Elementary charge.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Triangle with additional region number.
bool isSurfaceClosed() const
Check whether surface is closed without calculating any permanent.
A bounding box defined in terms of the points at its extremities.
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
void size(const label)
Override size to be inconsistent with allocated storage.
vector point
Point is a vector.
void write(const fileName &, const word &ext, const bool sort) const
Generic write routine. Chooses writer based on extension.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
defineTypeNameAndDebug(combustionModel, 0)
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual bool hasVolumeType() const
Whether supports volume type below. I.e. whether is closed.
const fileName & local() const
dimensioned< scalar > magSqr(const dimensioned< Type > &)
cachedRandom rndGen(label(0), -1)
word name(const complex &)
Return a string representation of a complex.
A normal distribution model.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A list of faces which address into the list of points.
streamFormat
Enumeration for the format of data in the stream.