41 #ifndef Foam_triSurface_H 42 #define Foam_triSurface_H 66 template<
class Face>
class MeshedSurface;
69 Ostream&
operator<<(Ostream&,
const triSurface&);
97 mutable std::unique_ptr<labelListList> sortedEdgeFacesPtr_;
101 mutable std::unique_ptr<labelList> edgeOwnerPtr_;
107 void calcSortedEdgeFaces()
const;
110 void calcEdgeOwner()
const;
118 void setDefaultPatches();
124 const scalar tol = SMALL,
125 const bool verbose =
false 135 bool readSTL(
const fileName& filename,
bool forceBinary=
false);
142 const word& fileType,
143 const bool check =
true 148 void writeSTLASCII(
const fileName& filename,
const bool sort)
const;
151 void writeSTLBINARY(
const fileName& filename)
const;
154 void writeGTS(
const fileName& filename,
const bool sort)
const;
163 const label defaultRegion = 0
170 const label defaultRegion = 0
248 const bool isGlobal =
true 256 const bool isGlobal =
true 266 const bool isGlobal =
true 274 const bool isGlobal =
true 284 const bool isGlobal =
true 337 const scalar scaleFactor = -1
345 const word& fileType,
346 const scalar scaleFactor = -1
365 const bool isGlobal =
true 412 return static_cast<const List<labelledTri>&
>(*this);
467 virtual void scalePoints(
const scalar scaleFactor);
476 void cleanup(
const bool verbose);
493 const label currentZone,
511 template<
class BoolListType>
514 const BoolListType& include,
587 void write(
const fileName&,
const bool sortByRegion =
false)
const;
595 const word& fileType,
596 const bool sortByRegion =
false const Field< point_type > & faceAreas() const
Return face area vectors for patch.
triSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.
void cleanup(const bool verbose)
Remove non-valid triangles.
A class for handling file names.
const scalarField & magSf() const
Face area magnitudes.
static fileName checkFile(const IOobject &io, const bool isGlobal=true)
Return fileName to load IOobject from.
void writeStats(Ostream &os) const
Write some statistics.
friend Istream & operator>>(Istream &is, triSurface &s)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void compactPoints(labelList &pointMap=const_cast< labelList &>(labelList::null()))
Remove unused points and renumber faces in local visit order.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
virtual void movePoints(const pointField &pts)
Move points.
void transfer(triSurface &surf)
Alter contents by transferring (triangles, points) components.
void subsetMeshMap(const BoolListType &include, labelList &pointMap, labelList &faceMap) const
Create mappings for a sub-surface.
std::vector< Triangle > triangles
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format?
void clearPatchMeshAddr()
const Field< scalar > & magFaceAreas() const
Return face area magnitudes for patch.
List< labelList > labelListList
List of labelList.
List< labelledTri > & storedFaces()
Non-const access to the faces.
const List< labelledTri > & surfFaces() const noexcept
Return const access to the faces.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void write(Ostream &os) const
Write to Ostream in simple OpenFOAM format.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
static fileName relativeFilePath(const IOobject &io, const fileName &f, const bool isGlobal=true)
Return fileName.
A list of faces which address into the list of points.
static fileName triSurfInstance(const Time &)
Name of triSurface directory to use.
ClassName("triSurface")
Runtime type information.
const geometricSurfacePatchList & patches() const noexcept
vectorField pointField
pointField is a vectorField.
const labelListList & sortedEdgeFaces() const
Return edge-face addressing sorted (for edges with more than.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void sort(UList< T > &list)
Sort the list.
Istream & operator>>(Istream &, directionInfo &)
void checkTriangles(const bool verbose)
Check/remove duplicate/degenerate triangles.
labelledTri face_type
The face type (same as the underlying PrimitivePatch)
const Field< point_type > & faceCentres() const
Return face centres for patch.
void checkEdges(const bool verbose)
Check triply (or more) connected edges.
A List of wordRe with additional matching capabilities.
void swapFaces(List< labelledTri > &faceLst)
Swap the list of faces being addressed.
A triFace with additional (region) index.
const Field< point_type > & points() const noexcept
Return reference to global points.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
pointField & storedPoints()
Non-const access to global points.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void markZone(const boolList &borderEdge, const label facei, const label currentZone, labelList &faceZone) const
Fill faceZone with currentZone for every face reachable.
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format?
static autoPtr< triSurface > New(const fileName &name, const word &fileType)
Read construct from filename with given file type.
void triFaceFaces(List< face > &plainFaceList) const
Create a list of faces from the triFaces.
OBJstream os(runTime.globalPath()/outputName)
static void check(const int retVal, const char *what)
const vectorField & Sf() const
Face area vectors (normals)
static wordHashSet writeTypes()
Known writable file-types, including via friends or proxies.
virtual void swapPoints(pointField &pts)
Swap points. Similar to movePoints, but returns the old points.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
triSurface()
Default construct.
static fileName findFile(const IOobject &io, const bool isGlobal=true)
Use IOobject information to resolve file to load from, or empty if the file does not exist...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
List< surfZone > sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
void swap(triSurface &surf)
bool BoundaryMesh
Placeholder only, but do not remove - it is needed for GeoMesh.
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
label markZones(const boolList &borderEdge, labelList &faceZone) const
(size and) fills faceZone with zone of face. Zone is area
virtual ~triSurface()
Destructor.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Triangulated surface description with patch information.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
point point_type
The point type (same as the underlying PrimitivePatch)
static wordHashSet readTypes()
Known readable file-types, including via friends or proxies.
void operator=(const triSurface &surf)
Copy assignment.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const labelList & edgeOwner() const
If 2 face neighbours: label of face where ordering of edge.
List< bool > boolList
A List of bools.
friend Ostream & operator<<(Ostream &os, const triSurface &s)
static const List< label > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
const vectorField & Cf() const
Face centres.