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

Defines a node in (x,y,z) space with an ID. The node also has state info. More...

#include <Mesh/DataStructures/node.h>

Inheritance diagram for Node:
[legend]

Public Types

enum  {
  inflowBoundary = flag3 , modified1 = flag4 , modified2 = flag5 , merge = flag6 ,
  surface = flag7 , processed = flag8
}
 
- Public Types inherited from NumberedObject
enum  {
  flag0 , flag1 , flag2 , flag3 ,
  flag4 , flag5 , flag6 , flag7 ,
  flag8 , flag9 , flag10 , flag11 ,
  flag12 , flag13 , flag14 , flag15
}
 

Public Member Functions

 Node (long IDnum, const Vector3d &v)
 
 Node (long IDnum, double X, double Y, double Z)
 
 ~Node ()
 
void addToPosition (const Vector3d &v)
 
void AddToPosition (const Vector3d &v)
 
Vector3d calcNormal () const
 
void checkAttached ()
 
void clearAttachments ()
 
AttachmentsgetAttachments ()
 
AttachmentsGetAttachments ()
 
AttachmentsgetAttachments () const
 
AttachmentsGetAttachments () const
 
NodegetClosestAttachedNode () const
 
const Vector3dgetPosition () const
 
const Vector3dGetPosition () const
 
bool hasAttachments () const
 
bool HasAttachments () const
 
void rebuildAttachedNodesFromElements ()
 
void setPosition (const Vector3d &v)
 
void SetPosition (const Vector3d &v)
 
void setPositionX (double x)
 
void SetPositionX (double x)
 
void setPositionY (double y)
 
void SetPositionY (double y)
 
void setPositionZ (double z)
 
void SetPositionZ (double z)
 
void sortAttachedShellElements ()
 
- Public Member Functions inherited from NumberedObject
 NumberedObject (long ID)
 Create an object with the specified ID and all flags except isValid not set.
 
void clearFlag (unsigned flag)
 Clear flag. Do not use this to manipulate the isValid flag, since list managers are responsible for that.
 
void copyFlags (const NumberedObject &t)
 
long getID () const
 
long getIndex () const
 
bool isFlagSet (unsigned flag) const
 
bool isValid () const
 
void setFlag (unsigned flag, bool b=true)
 Set flag to b. Do not use this to manipulate the isValid flag, since list managers are responsible for that.
 
void setID (long ID)
 
void setIndex (long i)
 
void SetID (long ID)
 
long GetID () const
 
void SetIndex (long i)
 
long GetIndex () const
 
bool IsFlagSet (unsigned flag) const
 
void ClearFlag (unsigned flag)
 
void SetFlag (unsigned flag)
 
void setFlagTo (unsigned flag, bool b=true)
 
void SetFlagTo (unsigned flag, bool b=true)
 
bool IsValid () const
 
- Public Member Functions inherited from State
 State (unsigned stateSize, unsigned integerDataSize)
 
 ~State ()
 
void addToIntegerData (int index, long val)
 
void addToState (int index, const Vector3d &v)
 
void addToState (int index, double val)
 
void copyIntegerData (int index, const State &s)
 
void copyState (int index, const State &s)
 
void copyStateVector (int index, const State &s)
 
long getIntegerData (int index) const
 
double getState (int index) const
 
Vector3d getStateVector (int index) const
 
void setIntegerData (int index, long val)
 
void setState (int index, const Vector3d &v)
 
void setState (int index, double val)
 
void CopyIntegerData (int index, const State &s)
 
void AddToIntegerData (int index, long val)
 
void SetIntegerData (int index, long val)
 
long GetIntegerData (int index) const
 
void CopyStateVector (int index, const State &s)
 
void CopyState (int index, const State &s)
 
void AddToState (int index, const Vector3d &v)
 
void AddToState (int index, double val)
 
double GetState (int index) const
 
Vector3d GetStateVector (int index) const
 
void SetState (int index, double val)
 
void SetState (int index, const Vector3d &v)
 

Additional Inherited Members

Detailed Description

A Node should only be created by a NodeList object. Similarly, the nature of the node's state or integer data should only be changed by a NodeList object, although the state or integer data itself can be modified by other things.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
inflowBoundary 
modified1 
modified2 
merge 
surface 
processed 

Constructor & Destructor Documentation

◆ Node() [1/2]

Node ( long  IDnum,
double  X,
double  Y,
double  Z 
)
Parameters
IDnumID number of the new node. You should avoid duplicating node ID numbers within a model. Same ID numbers in different models is okay though.
XX co-ordinate.
YY co-ordinate.
ZZ co-ordinate.

This constructor creates a node with no state arrays defined. Calling any function related to node state the constructed object will lead to undefined results. You should only use this constructor if all you need is position and ID information or if you want to create a temporary element and need some equally temporary nodes for it.

◆ Node() [2/2]

Node ( long  IDnum,
const Vector3d v 
)
Parameters
IDnumID number of the new node. You should avoid duplicating node ID numbers within a model. Same ID numbers in different models is okay though.
v(X,Y,Z) co-ordinates.

This constructor creates a node with no state arrays defined. Calling any function related to node state the constructed object will lead to undefined results. You should only use this constructor if all you need is position and ID information or if you want to create a temporary element and need some equally temporary nodes for it.

◆ ~Node()

~Node ( )

Member Function Documentation

◆ addToPosition()

void addToPosition ( const Vector3d v)
inline
Parameters
vThe vector to add to the current location of the node.

◆ AddToPosition()

void AddToPosition ( const Vector3d v)
inline

◆ calcNormal()

Vector3d calcNormal ( ) const
Returns
The normal vector for the node. If no shell elements are attached to the node, a zero vector will be returned instead.

The node normal is calculated as an angle-weighted average of the attached shell elements' normals. The angle weighting is achieved by multiplying each normal by the vertex angle formed at this node. When the node normal vector is scaled to unit length, the angle-weighting has already been conveniently incorporated.

Exceptions
ThinWedgeErrorShell elements attached to the node have directly opposing normal vectors. This can only arise when the geometry is effectively an infinitely thin wedge (ie zero wedge angle).
Warning
Do not call this function from outside of the Mesh plugin, since it may throw exceptions and these cannot be reliably caught on all platforms from outside of the Mesh plugin. In such cases, MeshFeatureIdentifier::updateNormal() might be sufficient for your needs and it handles the relevant exceptions internally.

◆ checkAttached()

void checkAttached ( )

This function checks the attached shell elements and nodes of this node to determine if the geometry is physically meaningful. If there is more than one free edge at this node, then an error is flagged. This would indicate geometry that could not be physically built (multiple spikes coming together at a point). It will also detect if two or more surfaces are coming together at this node. This is evidenced by more than two shell elements sharing a node pair.

This function also calls sortAttachedShellElements() as the last thing it does. This does most of the error checking as a by-product of sorting the attached shell element list into the correct order.

Exceptions
DuplicateElementErrorTwo or more shell elements use the same nodes, of which this node is one. The element normal directions are not necessarily in the same direction.
SurfaceIntersectErrorAt least one edge attached to the node is shared by more than two shell elements.
InconsistentSurfaceNormalsErrorShell elements attached to the node do not have consistent normal vectors (ie neighbouring shells have positive normal vectors on opposite sides).
MultipleFreeEdgesErrorThere can be at most two free edges attached to any given node. If there are more, the surface has a point connection between different surfaces, and this is typically not meaningful. Such geometry can usually be modified by either breaking off one of the surfaces from this node, or by adding an extra shell element(s) to fill in the gap and reduce the number of free edges.

◆ clearAttachments()

void clearAttachments ( )

Deletes the existing attachments object, regardless of whether it is empty or not.

◆ getAttachments() [1/2]

Attachments * getAttachments ( )
Returns
The attachments for this node. If none exist when the function is called, a new attachments object will be created (this also applies to the const version of this function because the internal attachments object is declared mutable).

◆ GetAttachments() [1/2]

Attachments * GetAttachments ( )
inline

◆ getAttachments() [2/2]

Attachments * getAttachments ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ GetAttachments() [2/2]

Attachments * GetAttachments ( ) const
inline

◆ getClosestAttachedNode()

Node * getClosestAttachedNode ( ) const
Returns
The closest attached node to this one, or a null pointer if no nodes are attached.

◆ getPosition()

const Vector3d & getPosition ( ) const
inline
Returns
The current location of the node.

◆ GetPosition()

const Vector3d & GetPosition ( ) const
inline

◆ hasAttachments()

bool hasAttachments ( ) const
inline

◆ HasAttachments()

bool HasAttachments ( ) const
inline

◆ rebuildAttachedNodesFromElements()

void rebuildAttachedNodesFromElements ( )

Calling this function rebuilds the attached nodes list using the attached elements list. This allows the caller to set the attached elements list to what they want, then call this function to easily get an attached nodes list to match. It also allows the attached node list to be updated whenever an attached element is removed. Because elements can share nodes, removing an element doesn't necessarily mean all its nodes will be removed from attached node lists. The only way to reliably update the attached node list is to rebuild it from scratch by re-attaching all attached elements' nodes.

◆ setPosition()

void setPosition ( const Vector3d v)
inline
Parameters
vThe new location of the node.

◆ SetPosition()

void SetPosition ( const Vector3d v)
inline

◆ setPositionX()

void setPositionX ( double  x)
inline
Parameters
xThe new X co-ordinate of the node.

◆ SetPositionX()

void SetPositionX ( double  x)
inline

◆ setPositionY()

void setPositionY ( double  y)
inline
Parameters
yThe new Y co-ordinate of the node.

◆ SetPositionY()

void SetPositionY ( double  y)
inline

◆ setPositionZ()

void setPositionZ ( double  z)
inline
Parameters
zThe new Z co-ordinate of the node.

◆ SetPositionZ()

void SetPositionZ ( double  z)
inline

◆ sortAttachedShellElements()

void sortAttachedShellElements ( )
Precondition
There are no surface intersections at this node, meaning that an edge with the node at one end of it is not used by any more than two shell elements.
The normal vectors for the attached shell elements are all consistent, meaning that they all point to out of the same side of the surface they define.

When the function exits, the elements in the attached shell element list will be ordered clockwise when looking along the direction of the node normal. If there is a free edge at this node, then the first and last elements in the list are on the edge and therefore do not share a node pair.

This function is typically called many times, particularly by cleanup routines. Although its name suggests that its primary purpose is to sort the attached element list, the process by which this is done conveniently uncovers most geometry errors. It is for this by-product that many calls to sortAttachedElements() are made. Bad performance of this function will typically hurt overall application performance quite strongly.

Exceptions
DuplicateElementErrorTwo or more shell elements use the same nodes, of which this node is one. The element normal directions are not necessarily in the same direction.
SurfaceIntersectErrorAt least one edge attached to the node is shared by more than two shell elements.
InconsistentSurfaceNormalsErrorShell elements attached to the node do not have consistent normal vectors (ie neighbouring shells have positive normal vectors on opposite sides).
MultipleFreeEdgesErrorThere can be at most two free edges attached to any given node. If there are more, the surface has a point connection between different surfaces, and this is typically not meaningful. Such geometry can usually be modified by either breaking off one of the surfaces from this node, or by adding an extra shell element(s) to fill in the gap and reduce the number of free edges.