46 const regIOobject& io,
53 ? io.globalFilePath(typeName)
54 : io.localFilePath(typeName)
59 <<
"Cannot find triSurfaceMesh starting from " 69 const regIOobject& io,
76 if (!fName.isAbsolute())
95 const regIOobject& io,
96 const dictionary& dict,
100 fileName dictFName, fName;
102 if (dict.readIfPresent(
"file", dictFName,
false,
false))
104 fName = relativeFilePath(io, dictFName, isGlobal);
109 <<
"Cannot find triSurfaceMesh at " << io.path()/dictFName
118 ? io.globalFilePath(typeName)
119 : io.localFilePath(typeName)
125 <<
"Cannot find triSurfaceMesh starting from " 134 bool Foam::triSurfaceMesh::addFaceToEdge
137 EdgeMap<label>& facesPerEdge
141 if (eFnd != facesPerEdge.end())
151 facesPerEdge.insert(e, 1);
157 bool Foam::triSurfaceMesh::isSurfaceClosed()
const 170 EdgeMap<label> facesPerEdge(100);
171 forAll(pointFaces, pointi)
173 const labelList& pFaces = pointFaces[pointi];
175 facesPerEdge.
clear();
187 label nextPointi = f[f.fcIndex(fp)];
189 if (nextPointi > pointi)
191 bool okFace = addFaceToEdge
193 edge(pointi, nextPointi),
203 label prevPointi = f[f.rcIndex(fp)];
205 if (prevPointi > pointi)
207 bool okFace = addFaceToEdge
209 edge(pointi, prevPointi),
315 checkFile(static_cast<const searchableSurface&>(*
this), dict,
true)
324 fName_ = relativeFilePath
326 static_cast<const searchableSurface&>(*
this),
332 scalar scaleFactor = 0;
336 if (dict.
readIfPresent(
"scale", scaleFactor) && scaleFactor > 0)
348 if (dict.
readIfPresent(
"minQuality", minQuality_) && minQuality_ > 0)
351 <<
" : ignoring triangles with quality < " 352 << minQuality_ <<
" for normals calculation." <<
endl;
413 checkFile(static_cast<const searchableSurface&>(*
this), dict, isGlobal)
422 fName_ = relativeFilePath
424 static_cast<const searchableSurface&>(*
this),
430 scalar scaleFactor = 0;
434 if (dict.
readIfPresent(
"scale", scaleFactor) && scaleFactor > 0)
446 if (dict.
readIfPresent(
"minQuality", minQuality_) && minQuality_ > 0)
449 <<
" : ignoring triangles with quality < " 450 << minQuality_ <<
" for normals calculation." <<
endl;
503 const point& fc = centres[facei];
506 const point& pt = pts[f[fp]];
528 return !indices.
empty();
543 if (edgeTree_.empty())
602 if (regions_.
empty())
607 regions_[regionI] =
patches()[regionI].name();
616 if (surfaceClosed_ == -1)
618 if (isSurfaceClosed())
628 return surfaceClosed_ == 1;
726 if (minQuality_ >= 0)
737 label facei = info[i].index();
738 normal[i] = s[facei].area(pts);
740 scalar qual = s[facei].tri(pts).quality();
742 if (qual < minQuality_)
745 const labelList& fFaces = faceFaces[facei];
749 label nbrI = fFaces[j];
750 scalar nbrQual = s[nbrI].tri(pts).quality();
754 normal[i] = s[nbrI].area(pts);
759 normal[i] /=
mag(normal[i]) + vSmall;
774 label facei = info[i].index();
779 normal[i] = s[facei].normal(pts);
804 const point& pt = points[pointi];
806 if (!
tree().bb().contains(pt))
809 volType[pointi] =
tree().shapes().getVolumeType(
tree(), pt);
814 volType[pointi] =
tree().getVolumeType(pt);
844 fldPtr.
ptr()->store();
854 if (foundObject<triSurfaceLabelField>(
"values"))
867 values[i] = fld[info[i].index()];
906 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)
intWM_LABEL_SIZE_t 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...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
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.
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.
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.
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.
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName) const =0
Search for an object. checkGlobal : also check undecomposed case.
Triangle with additional region number.
const fileOperation & fileHandler()
Get current file handler.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
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
const fileName & instance() 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...
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.
fileName objectPath() const
Return complete path + object name.
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.