Workspace 6.21.5
Public Member Functions | Protected Member Functions | List of all members
MeshReader Class Referenceabstract

Base class from which all file readers that import meshes must inherit. More...

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

Inheritance diagram for MeshReader:
[legend]

Public Member Functions

 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)
 

Protected Member Functions

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 &)
 

Additional Inherited Members

- Public Types inherited from Logger
enum  Styles { Warning , Error , Preformat }
 
- Protected Attributes inherited from BaseReader
std::string baseName
 
std::string baseNameSuffix
 
iautogzstream inFile
 
int progress_
 
bool terminateExecution_
 

Detailed Description

Readers must obey some basic rules (and clients should be able to rely on these):

Constructor & Destructor Documentation

◆ MeshReader()

MeshReader ( const std::string &  fName)
Parameters
fNameDefines the base file name for the reader. The file name extension can be omitted if it matches the return value of GetFormatExtension().

By default, readers are allowed to create degenerate elements. This can be changed by a call to DisallowDegenerateElements().

◆ ~MeshReader()

~MeshReader ( )
overridedefault

Member Function Documentation

◆ addNode()

Node * addNode ( MeshModel model,
const Node node 
)
protected

Add a copy of node to model.

Returns
A pointer to the new node, or a null pointer if there was an error.

◆ addPointMass()

PointMass * addPointMass ( MeshModel model,
const PointMass mass 
)
protected

◆ addSegment()

Segment * addSegment ( MeshModel model,
const Segment elem 
)
protected

Add a copy of the segment elem to model. Node ID lookup makes the computational cost of this function non-trivial for a large number of calls.

Returns
A pointer to the newly created Segment, or a null pointer if there was an error.

◆ addShellElement()

ShellElement * addShellElement ( MeshModel model,
const ShellElement elem 
)
protected

Add a copy of the shell element elem to model. Node ID lookup makes the computational cost of this function non-trivial for a large number of calls.

Returns
A pointer to the newly created ShellElement, or a null pointer if there was an error.

◆ addVolumeElement()

VolumeElement * addVolumeElement ( MeshModel model,
const VolumeElement elem 
)
protected

Add a copy of the segment elem to model. Node ID lookup makes the computational cost of this function non-trivial for a large number of calls.

Returns
A pointer to the newly created VolumeElement, or a null pointer if there was an error.

◆ AllowDegenerateElements()

void AllowDegenerateElements ( )

When an element is created, don't warn or fail with an error if it is degenerate. Currently, this is only relevent for shell elements.

◆ DisallowDegenerateElements()

void DisallowDegenerateElements ( )

When an element is created, warn or fail with an error if it is degenerate. Currently, this is only relevent for shell elements.

◆ GetNodeState()

State * GetNodeState ( long  nodeID)
Returns
The state for the node specified by nodeID, or a null pointer if that node could not be found.

◆ GetTransform()

virtual void GetTransform ( ObjectTransforms trans)
inlinevirtual

◆ HasTransformData()

virtual bool HasTransformData ( ) const
inlinevirtual

◆ Read()

bool Read ( MeshModel model,
bool  shouldOverwrite = false 
)
Parameters
modelThe model to read data into.
shouldOverwriteIf true, then any nodes or elements read in with an ID the same as an existing one will replace it. If false, all nodes and elements read in will be created as new ones.

This function calls ReadImpl as the last thing it does. Subclasses are responsible for implementing that function to do the actual reading.

◆ ReadStateInfo()

bool ReadStateInfo ( StateInfoArray nodeStates,
StateInfoArray elementStates 
)
virtual

Analyse the file currently open to determine what state data it contains. By default, this function simply returns false, meaning no state data will be read. Some file formats don't support state data, hence this default behaviour. Those readers that are capable of providing state data will over-ride this function and therefore provide some meaningful state info. In this case, they should return true to indicate they support reading states.

◆ SetNodeID()

bool SetNodeID ( long  oldNodeID,
long  newNodeID 
)
protected

Reassign a new ID newNodeID to the node currently mapped as oldNodeID. The node affected will still retain its oldNodeID within the reader's ID map so that it can still be referenced by it after returning from this call. The ID associated with the node in the model itself is what gets updated. Note that this ID will still get offset by nodeIDoffset_ if that is non-zero.

Returns
True if the ID reassignment was successful. It can only fail if no node can be found corresponding to oldNodeID.

◆ WillAllowDegenerateElements()

bool WillAllowDegenerateElements ( ) const
inlineprotected