Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions
STLsurfaceFormat< Face > Class Template Reference

Provide a means of reading/writing STL files (ASCII and binary). More...

Inheritance diagram for STLsurfaceFormat< Face >:
Inheritance graph
[legend]
Collaboration diagram for STLsurfaceFormat< Face >:
Collaboration graph
[legend]

Public Member Functions

 STLsurfaceFormat (const fileName &)
 Construct from file name. More...
 
virtual ~STLsurfaceFormat ()
 Destructor. More...
 
virtual bool read (const fileName &)
 Read from file. More...
 
virtual void write (const fileName &name) const
 Write object. More...
 
- Public Member Functions inherited from MeshedSurface< Face >
 MeshedSurface ()
 Construct null. More...
 
 MeshedSurface (const Xfer< pointField > &, const Xfer< List< Face > > &, const Xfer< surfZoneList > &)
 Construct by transferring components (points, faces, zones). More...
 
 MeshedSurface (const Xfer< pointField > &, const Xfer< List< Face > > &, const labelUList &zoneSizes=labelUList(), const UList< word > &zoneNames=UList< word >())
 Construct by transferring components (points, faces). More...
 
 MeshedSurface (const MeshedSurface &)
 Construct as copy. More...
 
 MeshedSurface (const UnsortedMeshedSurface< Face > &)
 Construct from a UnsortedMeshedSurface. More...
 
 MeshedSurface (const polyBoundaryMesh &, const bool globalPoints=false)
 Construct from a boundary mesh with local points/faces. More...
 
 MeshedSurface (const surfMesh &)
 Construct from a surfMesh. More...
 
 MeshedSurface (const Xfer< UnsortedMeshedSurface< Face > > &)
 Construct by transferring the contents from a UnsortedMeshedSurface. More...
 
 MeshedSurface (const Xfer< MeshedSurface< Face > > &)
 Construct by transferring the contents from a MeshedSurface. More...
 
 MeshedSurface (const fileName &)
 Construct from file name (uses extension to determine type) More...
 
 MeshedSurface (const fileName &, const word &ext)
 Construct from file name (uses extension to determine type) More...
 
 MeshedSurface (const Time &, const word &surfName="")
 Construct from database. More...
 
 MeshedSurface ()
 
 MeshedSurface (const Xfer< pointField > &pointLst, const Xfer< List< Face > > &faceLst, const Xfer< surfZoneList > &zoneLst)
 
 MeshedSurface (const Xfer< pointField > &pointLst, const Xfer< List< Face > > &faceLst, const labelUList &zoneSizes, const UList< word > &zoneNames)
 
 MeshedSurface (const MeshedSurface< Face > &surf)
 
 MeshedSurface (const UnsortedMeshedSurface< Face > &surf)
 
 MeshedSurface (const surfMesh &mesh)
 
 MeshedSurface (const polyBoundaryMesh &bMesh, const bool useGlobalPoints)
 
 MeshedSurface (const fileName &name, const word &ext)
 
 MeshedSurface (const fileName &name)
 
 MeshedSurface (const Time &t, const word &surfName)
 
 MeshedSurface (const Xfer< UnsortedMeshedSurface< Face > > &surf)
 
 MeshedSurface (const Xfer< MeshedSurface< Face > > &surf)
 
 ClassName ("MeshedSurface")
 Runtime type information. More...
 
bool isTri ()
 Specialization for holding triangulated information. More...
 
 declareRunTimeSelectionTable (autoPtr, MeshedSurface, fileExtension,(const fileName &name),(name))
 
virtual ~MeshedSurface ()
 Destructor. More...
 
 declareMemberFunctionSelectionTable (void, UnsortedMeshedSurface, write, fileExtension,(const fileName &name, const MeshedSurface< Face > &surf),(name, surf))
 
void write (const Time &, const word &surfName="") const
 Write to database. More...
 
label size () const
 The surface size is the number of faces. More...
 
const List< Face > & faces () const
 Return const access to the faces. More...
 
const List< surfZone > & surfZones () const
 Const access to the surface zones. More...
 
virtual void addZones (const UList< surfZone > &, const bool cullEmpty=false)
 Add surface zones. More...
 
virtual void addZones (const labelUList &sizes, const UList< word > &names, const bool cullEmpty=false)
 Add surface zones. More...
 
virtual void addZones (const labelUList &sizes, const bool cullEmpty=false)
 Add surface zones. More...
 
virtual void removeZones ()
 Remove surface zones. More...
 
virtual void clear ()
 Clear all storage. More...
 
virtual void movePoints (const pointField &)
 Move points. More...
 
virtual void scalePoints (const scalar)
 Scale points. A non-positive factor is ignored. More...
 
virtual void reset (const Xfer< pointField > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
 Reset primitive data (points, faces and zones) More...
 
virtual void reset (const Xfer< List< point > > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
 Reset primitive data (points, faces and zones) More...
 
virtual void cleanup (const bool verbose)
 Remove invalid faces. More...
 
virtual bool stitchFaces (const scalar tol=SMALL, const bool verbose=false)
 
virtual bool checkFaces (const bool verbose=false)
 
virtual label triangulate ()
 Triangulate in-place, returning the number of triangles added. More...
 
virtual label triangulate (List< label > &faceMap)
 Triangulate in-place, returning the number of triangles added. More...
 
label triangulate ()
 Specialization for holding triangulated information. More...
 
label triangulate (List< label > &faceMap)
 Specialization for holding triangulated information. More...
 
MeshedSurface subsetMesh (const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
 Return new surface. More...
 
MeshedSurface subsetMesh (const labelHashSet &include) const
 Return new surface. More...
 
void transfer (MeshedSurface< Face > &)
 Transfer the contents of the argument and annul the argument. More...
 
void transfer (UnsortedMeshedSurface< Face > &)
 Transfer the contents of the argument and annul the argument. More...
 
Xfer< MeshedSurface< Face > > xfer ()
 Transfer contents to the Xfer container. More...
 
bool read (const fileName &, const word &ext)
 Read from file. Chooses reader based on explicit extension. More...
 
void writeStats (Ostream &os) const
 
void operator= (const MeshedSurface< Face > &)
 
 operator MeshedSurfaceProxy< Face > () const
 Conversion operator to MeshedSurfaceProxy. More...
 

Static Public Member Functions

static autoPtr< MeshedSurface< Face > > New (const fileName &name)
 Read file and return surface. More...
 
static void writeAscii (const fileName &, const MeshedSurfaceProxy< Face > &)
 Write surface mesh components by proxy (as ASCII) More...
 
static void writeBinary (const fileName &, const MeshedSurfaceProxy< Face > &)
 Write surface mesh components by proxy (as BINARY) More...
 
static void write (const fileName &, const MeshedSurfaceProxy< Face > &)
 Write surface mesh components by proxy. More...
 
static void writeAscii (const fileName &, const UnsortedMeshedSurface< Face > &)
 Write UnsortedMeshedSurface (as ASCII) sorted by zone. More...
 
static void writeBinary (const fileName &, const UnsortedMeshedSurface< Face > &)
 Write UnsortedMeshedSurface (as BINARY) unsorted by zone. More...
 
static void write (const fileName &, const UnsortedMeshedSurface< Face > &)
 Write UnsortedMeshedSurface. More...
 
- Static Public Member Functions inherited from MeshedSurface< Face >
static bool isTri ()
 Face storage only handles triangulated faces. More...
 
static bool canRead (const fileName &, const bool verbose=false)
 Can we read this file format? More...
 
static bool canReadType (const word &ext, const bool verbose=false)
 Can we read this file format? More...
 
static bool canWriteType (const word &ext, const bool verbose=false)
 Can we write this file format? More...
 
static wordHashSet readTypes ()
 
static wordHashSet writeTypes ()
 
static autoPtr< MeshedSurfaceNew (const fileName &, const word &ext)
 Select constructed from filename (explicit extension) More...
 
static autoPtr< MeshedSurfaceNew (const fileName &)
 Select constructed from filename (implicit extension) More...
 
static void write (const fileName &, const MeshedSurface< Face > &)
 Write to file. More...
 

Private Member Functions

 STLsurfaceFormat (const STLsurfaceFormat< Face > &)
 Disallow default bitwise copy construct. More...
 
void operator= (const STLsurfaceFormat< Face > &)
 Disallow default bitwise assignment. More...
 

Static Private Member Functions

static void writeShell (Ostream &, const pointField &, const Face &)
 Write Face (ASCII) More...
 
static void writeShell (ostream &, const pointField &, const Face &, const label zoneI)
 Write Face (BINARY) More...
 

Additional Inherited Members

- Public Types inherited from MeshedSurface< Face >
typedef Face FaceType
 Face type used. More...
 
- Protected Member Functions inherited from MeshedSurface< Face >
void transcribe (MeshedSurface< face > &)
 Transfer points/zones and transcribe face -> triFace. More...
 
void transcribe (MeshedSurface< face > &surf)
 
void transcribe (MeshedSurface< face > &surf)
 
void checkZones ()
 Basic sanity check on zones. More...
 
pointFieldstoredPoints ()
 Non-const access to global points. More...
 
List< Face > & storedFaces ()
 Non-const access to the faces. More...
 
surfZoneListstoredZones ()
 Non-const access to the zones. More...
 
void sortFacesAndStore (const Xfer< List< Face > > &unsortedFaces, const Xfer< List< label > > &zoneIds, const bool sorted)
 Sort faces by zones and store sorted faces. More...
 
virtual void remapFaces (const labelUList &faceMap)
 Set new zones from faceMap. More...
 

Detailed Description

template<class Face>
class Foam::fileFormats::STLsurfaceFormat< Face >

Provide a means of reading/writing STL files (ASCII and binary).

Note
For efficiency, the zones are sorted before creating the faces. The class is thus derived from MeshedSurface.
Source files

Definition at line 59 of file STLsurfaceFormat.H.

Constructor & Destructor Documentation

◆ STLsurfaceFormat() [1/2]

STLsurfaceFormat ( const STLsurfaceFormat< Face > &  )
private

Disallow default bitwise copy construct.

◆ STLsurfaceFormat() [2/2]

STLsurfaceFormat ( const fileName filename)

Construct from file name.

Definition at line 115 of file STLsurfaceFormat.C.

References Foam::read().

Here is the call graph for this function:

◆ ~STLsurfaceFormat()

virtual ~STLsurfaceFormat ( )
inlinevirtual

Destructor.

Definition at line 110 of file STLsurfaceFormat.H.

Member Function Documentation

◆ writeShell() [1/2]

void writeShell ( Ostream os,
const pointField pointLst,
const Face &  f 
)
inlinestaticprivate

Write Face (ASCII)

Definition at line 34 of file STLsurfaceFormat.C.

References Foam::endl(), f(), Foam::mag(), Foam::nl, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ writeShell() [2/2]

void writeShell ( ostream &  os,
const pointField pointLst,
const Face &  f,
const label  zoneI 
)
inlinestaticprivate

Write Face (BINARY)

Definition at line 74 of file STLsurfaceFormat.C.

References f(), Foam::mag(), and STLtriangle::write().

Here is the call graph for this function:

◆ operator=()

void operator= ( const STLsurfaceFormat< Face > &  )
private

Disallow default bitwise assignment.

◆ New()

static autoPtr<MeshedSurface<Face> > New ( const fileName name)
inlinestatic

Read file and return surface.

Definition at line 100 of file STLsurfaceFormat.H.

References Foam::name().

Here is the call graph for this function:

◆ writeAscii() [1/2]

void writeAscii ( const fileName filename,
const MeshedSurfaceProxy< Face > &  surf 
)
static

◆ writeBinary() [1/2]

void writeBinary ( const fileName filename,
const MeshedSurfaceProxy< Face > &  surf 
)
static

◆ write() [1/3]

void write ( const fileName filename,
const MeshedSurfaceProxy< Face > &  surf 
)
static

Write surface mesh components by proxy.

as ASCII or BINARY, depending on the extension

Definition at line 428 of file STLsurfaceFormat.C.

References fileName::ext().

Referenced by STLsurfaceFormat< Face >::write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeAscii() [2/2]

void writeAscii ( const fileName filename,
const UnsortedMeshedSurface< Face > &  surf 
)
static

Write UnsortedMeshedSurface (as ASCII) sorted by zone.

Definition at line 330 of file STLsurfaceFormat.C.

References Foam::endl(), Foam::exit(), Foam::faceMap(), Foam::FatalError, FatalErrorInFunction, forAll, IOstream::good(), UnsortedMeshedSurface::sortedZones(), and UnsortedMeshedSurface::zoneToc().

Here is the call graph for this function:

◆ writeBinary() [2/2]

void writeBinary ( const fileName filename,
const UnsortedMeshedSurface< Face > &  surf 
)
static

Write UnsortedMeshedSurface (as BINARY) unsorted by zone.

Definition at line 378 of file STLsurfaceFormat.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, List::size(), and UnsortedMeshedSurface::zoneIds().

Here is the call graph for this function:

◆ write() [2/3]

void write ( const fileName filename,
const UnsortedMeshedSurface< Face > &  surf 
)
static

Write UnsortedMeshedSurface.

as ASCII or BINARY, depending on the extension

Definition at line 449 of file STLsurfaceFormat.C.

References fileName::ext().

Here is the call graph for this function:

◆ read()

bool read ( const fileName filename)
virtual

◆ write() [3/3]

virtual void write ( const fileName name) const
inlinevirtual

Write object.

Reimplemented from MeshedSurface< Face >.

Definition at line 156 of file STLsurfaceFormat.H.

References Foam::name(), and STLsurfaceFormat< Face >::write().

Here is the call graph for this function:

The documentation for this class was generated from the following files: