46 const regIOobject& io,
50 const fileName fName(io.filePath(typeName, isGlobal));
55 <<
"Cannot find triSurfaceMesh starting from " 65 const regIOobject& io,
72 if (!fName.isAbsolute())
91 const regIOobject& io,
92 const dictionary& dict,
96 fileName dictFName, fName;
98 if (dict.readIfPresent(
"file", dictFName,
false,
false))
100 fName = relativeFilePath(io, dictFName, isGlobal);
105 <<
"Cannot find triSurfaceMesh at " << io.path()/dictFName
111 fName = io.filePath(typeName, isGlobal);
116 <<
"Cannot find triSurfaceMesh starting from " 125 bool Foam::triSurfaceMesh::addFaceToEdge
128 EdgeMap<label>& facesPerEdge
132 if (eFnd != facesPerEdge.end())
142 facesPerEdge.insert(e, 1);
148 bool Foam::triSurfaceMesh::isSurfaceClosed()
const 161 EdgeMap<label> facesPerEdge(100);
162 forAll(pointFaces, pointi)
164 const labelList& pFaces = pointFaces[pointi];
166 facesPerEdge.
clear();
178 label nextPointi = f[f.fcIndex(fp)];
180 if (nextPointi > pointi)
182 bool okFace = addFaceToEdge
184 edge(pointi, nextPointi),
194 label prevPointi = f[f.rcIndex(fp)];
196 if (prevPointi > pointi)
198 bool okFace = addFaceToEdge
200 edge(pointi, prevPointi),
306 checkFile(static_cast<const searchableSurface&>(*
this), dict,
true)
315 fName_ = relativeFilePath
317 static_cast<const searchableSurface&>(*
this),
323 scalar scaleFactor = 0;
327 if (dict.
readIfPresent(
"scale", scaleFactor) && scaleFactor > 0)
339 if (dict.
readIfPresent(
"minQuality", minQuality_) && minQuality_ > 0)
342 <<
" : ignoring triangles with quality < " 343 << minQuality_ <<
" for normals calculation." <<
endl;
404 checkFile(static_cast<const searchableSurface&>(*
this), dict, isGlobal)
413 fName_ = relativeFilePath
415 static_cast<const searchableSurface&>(*
this),
421 scalar scaleFactor = 0;
425 if (dict.
readIfPresent(
"scale", scaleFactor) && scaleFactor > 0)
437 if (dict.
readIfPresent(
"minQuality", minQuality_) && minQuality_ > 0)
440 <<
" : ignoring triangles with quality < " 441 << minQuality_ <<
" for normals calculation." <<
endl;
494 const point& fc = centres[facei];
497 const point& pt = pts[f[fp]];
519 return !indices.
empty();
534 if (edgeTree_.empty())
593 if (regions_.
empty())
598 regions_[regionI] =
patches()[regionI].name();
607 if (surfaceClosed_ == -1)
609 if (isSurfaceClosed())
619 return surfaceClosed_ == 1;
717 if (minQuality_ >= 0)
728 label facei = info[i].index();
729 normal[i] = s[facei].area(pts);
731 scalar qual = s[facei].tri(pts).quality();
733 if (qual < minQuality_)
736 const labelList& fFaces = faceFaces[facei];
740 label nbrI = fFaces[j];
741 scalar nbrQual = s[nbrI].tri(pts).quality();
745 normal[i] = s[nbrI].area(pts);
750 normal[i] /=
mag(normal[i]) + vSmall;
765 label facei = info[i].index();
770 normal[i] = s[facei].normal(pts);
795 const point& pt = points[pointi];
797 if (!
tree().bb().contains(pt))
800 volType[pointi] =
tree().shapes().getVolumeType(
tree(), pt);
805 volType[pointi] =
tree().getVolumeType(pt);
835 fldPtr.
ptr()->store();
845 if (foundObject<triSurfaceLabelField>(
"values"))
858 values[i] = fld[info[i].index()];
897 triSurface::write(fullPath);
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
List< labelList > labelListList
A List of labelList.
label nPoints() const
Return number of points supporting patch faces.
label maxTreeDepth() const
Return max tree depth of octree.
Field< label > labelField
Specialisation of Field<T> for label.
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
#define forAll(list, i)
Loop across all elements in list.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
A class for handling file names.
triSurfaceMesh(const IOobject &, const triSurface &)
Construct from triSurface.
void clearOut()
Clear storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void clearOut()
Clear storage.
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared). Any point.
T & operator[](const label)
Return element of UList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Field< PointType > & faceCentres() const
Return face centres for patch.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
triSurfaceRegionSearch(const triSurface &)
Construct from surface. Holds reference to surface!
virtual tmp< pointField > points() const
Get the points that define the surface.
T & ref() const
Return non-const reference or generate a fatal error.
virtual ~triSurfaceMesh()
Destructor.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual void setField(const labelList &values)
WIP. Store element-wise field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static scalar & perturbTol()
Get the perturbation tolerance.
fileName objectPath() const
Return complete path + object name.
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Holds data for octree to work on an edges subset.
label nInternalEdges() const
Number of internal edges.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
A bounding box defined in terms of the points at its extremities.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
const dimensionSet dimless
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
T * ptr()
Return object pointer for reuse.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Macros for easy insertion into run-time selection tables.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
virtual bool hasVolumeType() const
Whether supports volume type below. I.e. whether is closed.
virtual void movePoints(const pointField &)
Move points.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
objectRegistry(const Time &db, const label nIoObjects=128)
Construct the time objectRegistry given an initial estimate.
A list of faces which address into the list of points.
A List obtained as a section of another List.
const labelListList & faceFaces() const
Return face-face addressing.
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))
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool write=true) const
Write using given format, version and compression.
vectorField pointField
pointField is a vectorField.
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))
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &info) const
Calculate all intersections from start to end.
bool isAbsolute() const
Return true if file name is absolute.
void clear()
Clear the list, i.e. set size to zero.
static const word & geometryDir()
Return the geometry directory name.
virtual fileName filePath(const bool globalFile, const IOobject &, const word &typeName) const =0
Search for an object. globalFile : also check undecomposed case.
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
const fileName & local() const
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
streamFormat
Enumeration for the format of data in the stream.
const Field< PointType > & points() const
Return reference to global points.
static const word null
An empty word.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
List< label > labelList
A List of labels.
Triangle with additional region number.
const fileOperation & fileHandler()
Get current file handler.
searchableSurface(const IOobject &io)
compressionType
Enumeration for the format of data in the stream.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
label nEdges() const
Return number of edges in patch.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
word name(const complex &)
Return a string representation of a complex.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
void setSize(const label)
Reset size of List.
const geometricSurfacePatchList & patches() const
writeOption writeOpt() const
triSurface()
Construct null.
std::remove_reference< ::Foam::List< labelledTri > >::type::value_type FaceType
Non-pointer based hierarchical recursive searching.
string & expand(const bool allowEmpty=false)
Expand initial tildes and all occurrences of environment variables.
virtual label size() const
Range of local indices that can be returned.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void movePoints(const pointField &)
Move points.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
scalar tolerance() const
Return tolerance to use in searches.
void invertManyToMany(const label len, const UList< InList > &, List< OutList > &)
Invert many-to-many.
Standard boundBox + extra functionality for use in octree.
dimensioned< scalar > mag(const dimensioned< Type > &)
fileName path() const
Return directory path name (part before last /)
const boundBox & bounds() const
Return const reference to boundBox.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
A class for managing temporary objects.
Registry of regIOobjects.
const objectRegistry & db() const
Return the local objectRegistry.
friend class iterator
Declare friendship with the iterator.
Triangulated surface description with patch information.
readOption readOpt() const
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label size() const
Return the number of elements in the UList.
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
virtual const wordList & regions() const
Names of regions.
treeBoundBox extend(const scalar s) const
Return asymetrically extended bounding box, with guaranteed.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.