Workspace 6.21.5
Public Member Functions | List of all members
STLReader Class Reference

Reads models in STL format (ASCII only). More...

#include <Mesh/FileIO/Readers/stlreader.h>

Inheritance diagram for STLReader:
[legend]

Public Member Functions

 STLReader (const std::string &fName, double nodeMergeTol, double smallElementSize)
 
 STLReader (const std::string &fName="")
 
long GetDefaultCompID () const
 
std::string GetFormatExtension () const override
 
std::string GetFormatName () const override
 
double GetNodeMergeTol () const
 
double GetSmallElementSize () const
 
void SetDefaultCompID (long id)
 
void SetNodeMergeTol (double nodeMergeTol)
 
void SetSmallElementSize (double smallElementSize)
 
- Public Member Functions inherited from MeshReader
 MeshReader (const std::string &fName)
 
 ~MeshReader () override=default
 
void AllowDegenerateElements ()
 
void DisallowDegenerateElements ()
 
StateGetNodeState (long nodeID)
 
virtual void GetTransform (ObjectTransforms &trans)
 
virtual bool HasTransformData () const
 
bool Read (MeshModel &model, bool shouldOverwrite=false)
 
virtual bool ReadStateInfo (StateInfoArray &nodeStates, StateInfoArray &elementStates)
 
- Public Member Functions inherited from BaseReader
 BaseReader (const std::string &fName)
 
 ~BaseReader () override=default
 Have virtual functions, so also have a virtual destructor.
 
virtual void Close ()
 
std::string ExtractBaseName (const std::string &fileName)
 
int FileLength ()
 
int FilePosition ()
 
void Flush ()
 
std::string GetBaseName () const
 
std::string GetBaseNameSuffix () const
 
std::string GetFileName () const
 
virtual std::string GetFormatExtension () const =0
 
virtual std::string GetFormatName () const =0
 
bool GetTerminateExecution () const
 
bool IsOpen () const
 
bool IsReady () const
 
virtual std::string Open ()
 
void SetBaseName (const std::string &base)
 
void SetBaseNameSuffix (const std::string &suffix)
 
void SetBaseNameSuffix (double caseNum, const std::string &caseLabel="_")
 
void SetBaseNameSuffix (int caseNum, const std::string &caseLabel="_")
 
template<typename T >
void SetBaseNameSuffix (T caseNum, const std::string &caseLabel="_")
 
void SetFileName (const std::string &fileName)
 
virtual void SetProgress (int progress)
 
void SetTerminateExecution (bool b)
 
- Public Member Functions inherited from Logger
 Logger ()
 The default constructor logs to standard output with a plain text log mode.
 
 Logger (const Logger &logger)
 
virtual ~Logger ()
 We own the log mode, so delete it.
 
std::string ErrorOff () const
 
std::string ErrorOn () const
 
std::ostream & GetLog () const
 
const LogModeGetLogMode () const
 
void SetLog (std::ostream &log)
 
void SetLogMode (const LogMode &logMode)
 
void SetLogModeHTML ()
 
void SetLogModePlainText ()
 Set log mode to plain text output.
 
template<Styles s>
void StyleOff () const
 
template<Styles s>
void StyleOn () const
 
std::string WarningOff () const
 
std::string WarningOn () const
 
- Public Member Functions inherited from Observable
virtual ~Observable ()
 
void attachObserver (Observer &observer)
 
void destroy ()
 
void detachObserver (Observer &observer)
 
void notifyEvent (const ObservableEvent &event)
 

Additional Inherited Members

- Public Types inherited from Logger
enum  Styles { Warning , Error , Preformat }
 
- Protected Member Functions inherited from MeshReader
NodeaddNode (MeshModel &model, const Node &node)
 
PointMassaddPointMass (MeshModel &model, const PointMass &mass)
 
SegmentaddSegment (MeshModel &model, const Segment &elem)
 
ShellElementaddShellElement (MeshModel &model, const ShellElement &elem)
 
VolumeElementaddVolumeElement (MeshModel &model, const VolumeElement &elem)
 
bool SetNodeID (long oldNodeID, long newNodeID)
 
bool WillAllowDegenerateElements () const
 
- Protected Member Functions inherited from BaseReader
bool GetNextNonBlankLine (std::string &inputLine)
 
virtual void postFileNameChanged ()
 
- Protected Member Functions inherited from Logger
virtual void LogChanged ()
 
virtual void LogModeChanged ()
 
- Protected Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
- Protected Attributes inherited from BaseReader
std::string baseName
 
std::string baseNameSuffix
 
iautogzstream inFile
 
int progress_
 
bool terminateExecution_
 

Detailed Description

Note that this is only a basic STL reader. It should not be relied upon to read complex files or to keep up to date with any extensions to the file format.

Constructor & Destructor Documentation

◆ STLReader() [1/2]

STLReader ( const std::string &  fName,
double  nodeMergeTol,
double  smallElementSize 
)
Parameters
fNameDefines the base file name for the reader.
nodeMergeTolNodes closer than this distance will be merged.
smallElementSizeThis determines the cell size to use when searching for nodes to merge. It is typically set to about half the smallest reasonable element edge length. If set too low, too many cells may be needed for the search and numerical overflow will result. If set too big, the search will be very slow.

◆ STLReader() [2/2]

STLReader ( const std::string &  fName = "")
Parameters
fNameDefines the base file name for the reader.

This constructor specifies that no node merging will be done by default. This is useful if you have no idea what sort of scale the model is. Note, however, that there will be a lot of duplicate nodes using this approach, since no element will be connected to any other element (i.e. all elements create three new nodes each).

Member Function Documentation

◆ GetDefaultCompID()

long GetDefaultCompID ( ) const
inline
Returns
The component ID currently being used for all elements read in.

◆ GetFormatExtension()

std::string GetFormatExtension ( ) const
inlineoverridevirtual
Returns
The default file name extension for this format.

Implements BaseReader.

◆ GetFormatName()

std::string GetFormatName ( ) const
inlineoverridevirtual
Returns
The name of the format this reader expects.

Implements BaseReader.

◆ GetNodeMergeTol()

double GetNodeMergeTol ( ) const
Returns
The node merge tolerance being used, or a negative number if it has not been set. Node merges will only be performed if the small element size has also been set.
See also
GetSmallElementSize

◆ GetSmallElementSize()

double GetSmallElementSize ( ) const
Returns
The value currently being used to characterise a small element edge. This is used to determine cell spacing when merging duplicate nodes. It will be a negative number if it has not been set.

Node merges will only be performed if the node merge tolerance has also been set.

See also
GetNodeMergeTol

◆ SetDefaultCompID()

void SetDefaultCompID ( long  id)
inline
Parameters
idThe default ID to use for elements.

◆ SetNodeMergeTol()

void SetNodeMergeTol ( double  nodeMergeTol)
Parameters
nodeMergeTolThe node merge tolerance to use.

Node merges will only be performed if the small element size has also been set.

See also
SetSmallElementSize

◆ SetSmallElementSize()

void SetSmallElementSize ( double  smallElementSize)
Parameters
smallElementSizeThe distance signifying a small element edge. This is used only to determine cell spacing when searching for nodes to merge. The actual tolerance controlling whether two nodes will be merged is set by SetNodeMergeTol.