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

The shell element class defines triangular and quadrilateral polygonal elements. More...

#include <Mesh/DataStructures/shellelement.h>

Inheritance diagram for ShellElement:
[legend]

Public Member Functions

 ShellElement (long ID, long compID, Node &n0, Node &n1, Node &n2, bool allowBadNormal=false, unsigned stateSize=0, unsigned integerDataSize=0)
 
 ShellElement (long ID, long compID, Node &n0, Node &n1, Node &n2, Node &n3, bool allowBadNormal=false, unsigned stateSize=0, unsigned integerDataSize=0)
 
 ~ShellElement () override
 
void addToNormal (const Vector3d &v)
 
double area () const
 
void attachElement () override
 
void attachNodes () override
 
bool calcNormal (bool allowWarnings=true, bool updateOldNormal=true)
 
void convertToQuad (Node &oppositeNode, int afterIndex)
 
void copyNormal (ShellElement &elem)
 
void detachElement () override
 
const Vector3dgetNormal () const
 
const Vector3dgetOldNormal () const
 
bool isDuplicateOf (const ShellElement &elem) const
 
bool isQuad () const
 
bool isSplinter (double edgeDistTol_2) const
 
bool isTri () const
 
double minNodeToEdgeDist () const
 
double minNodeToEdgeDist (Node *&closeNode) const
 
double minNodeToEdgeDist2 () const
 
double minNodeToEdgeDist2 (Node *&closeNode) const
 
NodenearestNode (Node &node) const
 
void scaleNormal (double d)
 
void scaleOldNormal (double d)
 
void scaleToUnitNormal ()
 
void setNormal (const Vector3d &v)
 
void setOldNormal (const Vector3d &v)
 
ShellElementsharedEdge (int indexToNode) const
 
ShellElementsharedEdge (Node &node_A, Node &node_B) const
 
void truncateToTRI3 (ElementNodes::iterator j)
 
void truncateToTRI3 (Node &node)
 
void updateOldNormal ()
 
Deprecated functions
bool CalcNormal (bool allowWarnings=true, bool updateOldNormal=true)
 
void CopyNormal (ShellElement &elem)
 
void UpdateOldNormal ()
 
ShellElementTypes GetElementType () const
 
bool IsDuplicateOf (const ShellElement &elem) const
 
void TruncateToTRI3 (ElementNodes::iterator j)
 
void TruncateToTRI3 (Node &node)
 
void ConvertToQuad (Node &oppositeNode, int afterIndex)
 
bool IsTri () const
 
bool IsQuad () const
 
bool IsSplinter (double edgeDistTol_2) const
 
bool IsPorousInterface () const
 
bool IsInflow () const
 
bool IsBoundary () const
 
bool InvolvedInCollision () const
 
void SetCollided ()
 
double MinNodeToEdgeDist2 (Node *&closeNode) const
 
double MinNodeToEdgeDist2 () const
 
double MinNodeToEdgeDist (Node *&closeNode) const
 
double MinNodeToEdgeDist () const
 
NodeNearestNode (Node &node) const
 
double Area () const
 
ShellElementSharedEdge (Node &node_A, Node &node_B) const
 
ShellElementSharedEdge (int indexToNode) const
 
const Vector3dGetNormal () const
 
const Vector3dGetOldNormal () const
 
void SetOldNormal (const Vector3d &v)
 
void ScaleOldNormal (double d)
 
void SetNormal (const Vector3d &v)
 
void ScaleNormal (double d)
 
void AddToNormal (const Vector3d &v)
 
void ScaleToUnitNormal ()
 
- Public Member Functions inherited from Element
virtual ~Element ()=default
 
virtual void attachElement ()=0
 
virtual void attachNodes ()=0
 
virtual void detachElement ()=0
 
Vector3d getCentroid () const
 
NodegetNode (int index) const
 
ElementNodesgetNodes ()
 
const ElementNodesgetNodes () const
 
NodenodeAfter (const Node &node) const
 
NodenodeBefore (const Node &node) const
 
unsigned numNodes () const
 
void setNode (int index, Node &n)
 
void setNodeStates (int index, const Vector3d &v)
 
void setNodeStates (int index, double v)
 
void setNodeStates (int index, int v)
 
bool usesNode (const Node &node) const
 
bool UsesNode (const Node &node) const
 
bool usesNode (long id) const
 
bool UsesNode (long id) const
 
const ElementNodesGetNodes () const
 
ElementNodesGetNodes ()
 
NodeGetNode (int index) const
 
void SetNode (int index, Node &n)
 
NodeNodeBefore (const Node &node) const
 
NodeNodeAfter (const Node &node) const
 
void setNodeFlags (unsigned flag, bool b=true)
 
void SetNodeFlags (unsigned flag, bool b=true)
 
void SetNodeStates (int index, double v)
 
void SetNodeStates (int index, const Vector3d &v)
 
Vector3d GetCentroid () const
 
- Public Member Functions inherited from Entity
long getCompID () const
 Get the ID of the component this entity belongs to.
 
void setCompID (long compID)
 
void SetCompID (long compID)
 
long GetCompID () const
 
- 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)
 

Static Public Member Functions

static void copyElementStates (const StateInfoArray &states, const ShellElement &source, ShellElement &dest)
 

Additional Inherited Members

- Public Types inherited from Element
typedef std::vector< Node * > ElementNodes
 
- Public Types inherited from NumberedObject
enum  {
  flag0 , flag1 , flag2 , flag3 ,
  flag4 , flag5 , flag6 , flag7 ,
  flag8 , flag9 , flag10 , flag11 ,
  flag12 , flag13 , flag14 , flag15
}
 
- Protected Member Functions inherited from Element
 Element (long IDnum, long compIDnum, unsigned stateSize=0, unsigned integerDataSize=0)
 
- Protected Member Functions inherited from Entity
 Entity (long id, long compID)
 
- Protected Attributes inherited from Element
ElementNodes nodes_
 

Detailed Description

There are some assumptions made in various algorithms about some of the data stored for a shell element. In general, you should not try to modify a shell element directly, but most non-modifying member functions that return information about the element should be safe to call. Note that a shell element should only be created and removed by a ShellElementList and never directly by the user.

The node ordering of a shell element is such that the normal vector follows the right-hand rule.

Constructor & Destructor Documentation

◆ ShellElement() [1/2]

ShellElement ( long  ID,
long  compID,
Node n0,
Node n1,
Node n2,
bool  allowBadNormal = false,
unsigned  stateSize = 0,
unsigned  integerDataSize = 0 
)

Creates a tri shell element and calculates its normal by calling CalcNormal() just before returning. It does not try to attach the element to anything. In particular, it does not update the attached element lists for the nodes it uses. This is the responsibility of the caller.

◆ ShellElement() [2/2]

ShellElement ( long  ID,
long  compID,
Node n0,
Node n1,
Node n2,
Node n3,
bool  allowBadNormal = false,
unsigned  stateSize = 0,
unsigned  integerDataSize = 0 
)

Creates a quad shell element and calculates its normal by calling CalcNormal() just before returning. It does not try to attach the element to anything. In particular, it does not update the attached element lists for the nodes it uses. This is the responsibility of the caller.

◆ ~ShellElement()

~ShellElement ( )
override

Member Function Documentation

◆ addToNormal()

void addToNormal ( const Vector3d v)
inline

◆ AddToNormal()

void AddToNormal ( const Vector3d v)
inline

◆ area()

double area ( ) const
Returns
The area of the element.

◆ Area()

double Area ( ) const
inline

◆ attachElement()

void attachElement ( )
overridevirtual

Implements Element.

◆ attachNodes()

void attachNodes ( )
overridevirtual

The shell element's nodes are attached to each other only around the edges. Diagonally opposing nodes are not attached to each other.

Implements Element.

◆ calcNormal()

bool calcNormal ( bool  allowWarnings = true,
bool  updateOldNormal = true 
)
Parameters
allowWarningsIf this is true, then any problems found will be reported. If it is false, then if a problem is encountered, the old normal is retained where an invalid normal has been created, and the function then returns.
updateOldNormalThe shell element also retains a copy of a previous normal vector (this is useful for some algorithms). If this parameter is true, the old normal vector is set to the element's normal vector at the time this function was called, regardless of whether or not the calculation of the new normal vector is successful.

For triangular elements, the normal is calculated from the cross-product of the three nodes. For quad elements, the normal is an area-weighted average of the four cross-products (i.e. remove a node and generate the cross-product for the remaining three). This is necessary because quad elements can be warped, so we cannot just take any three nodes to find the element normal. The area-weighting is a natural part of using the cross-product and sensibly weights each of the normals.

A check is made to see if the normal appears to have flipped its direction. Some algorithms rely on this to detect severe local distortions in the mesh between iterations.

The normal vector is always of unit length.

Returns
True if a warning was found or if a fatal error was found but was explicitly allowed.

◆ CalcNormal()

bool CalcNormal ( bool  allowWarnings = true,
bool  updateOldNormal = true 
)
inline

◆ convertToQuad()

void convertToQuad ( Node oppositeNode,
int  afterIndex 
)

◆ ConvertToQuad()

void ConvertToQuad ( Node oppositeNode,
int  afterIndex 
)
inline

◆ copyElementStates()

void copyElementStates ( const StateInfoArray states,
const ShellElement source,
ShellElement dest 
)
static

◆ copyNormal()

void copyNormal ( ShellElement elem)

◆ CopyNormal()

void CopyNormal ( ShellElement elem)
inline

◆ detachElement()

void detachElement ( )
overridevirtual

Detach this element from its nodes' attached elements list, then rebuild the attached nodes list for each element node too.

Note
Unlike the detachElement() function for Segment and VolumeElement, the ShellElement class forcibly rebuilds the attached node lists at the end of this call. This behavior will eventually be changed to make it consistent with those classes, but currently the PreProcess module depends on this behavior.

Implements Element.

◆ GetElementType()

ShellElementTypes GetElementType ( ) const
inline

◆ getNormal()

const Vector3d & getNormal ( ) const
inline
Returns
The normal vector for the shell element. This vector can get out of date, such as when the element's nodes are moved but the normal hasn't yet been updated. If you want to be sure the normal vector is current, call CalcNormal first.

◆ GetNormal()

const Vector3d & GetNormal ( ) const
inline

◆ getOldNormal()

const Vector3d & getOldNormal ( ) const
inline

◆ GetOldNormal()

const Vector3d & GetOldNormal ( ) const
inline

◆ InvolvedInCollision()

bool InvolvedInCollision ( ) const
inline

◆ IsBoundary()

bool IsBoundary ( ) const
inline

◆ isDuplicateOf()

bool isDuplicateOf ( const ShellElement elem) const
Returns
True if elem is a duplicate of this element, ignoring the direction of the normal vector.

◆ IsDuplicateOf()

bool IsDuplicateOf ( const ShellElement elem) const
inline

◆ IsInflow()

bool IsInflow ( ) const
inline

◆ IsPorousInterface()

bool IsPorousInterface ( ) const
inline

◆ isQuad()

bool isQuad ( ) const
inline
Returns
True if this element is a quad.

◆ IsQuad()

bool IsQuad ( ) const
inline

◆ isSplinter()

bool isSplinter ( double  edgeDistTol_2) const
inline

◆ IsSplinter()

bool IsSplinter ( double  edgeDistTol_2) const
inline

◆ isTri()

bool isTri ( ) const
inline
Returns
True if this element is a tri.

◆ IsTri()

bool IsTri ( ) const
inline

◆ minNodeToEdgeDist() [1/2]

double minNodeToEdgeDist ( ) const
inline

◆ MinNodeToEdgeDist() [1/2]

double MinNodeToEdgeDist ( ) const
inline

◆ minNodeToEdgeDist() [2/2]

double minNodeToEdgeDist ( Node *&  closeNode) const
inline

◆ MinNodeToEdgeDist() [2/2]

double MinNodeToEdgeDist ( Node *&  closeNode) const
inline

◆ minNodeToEdgeDist2() [1/2]

double minNodeToEdgeDist2 ( ) const

◆ MinNodeToEdgeDist2() [1/2]

double MinNodeToEdgeDist2 ( ) const
inline

◆ minNodeToEdgeDist2() [2/2]

double minNodeToEdgeDist2 ( Node *&  closeNode) const

◆ MinNodeToEdgeDist2() [2/2]

double MinNodeToEdgeDist2 ( Node *&  closeNode) const
inline

◆ nearestNode()

Node & nearestNode ( Node node) const

◆ NearestNode()

Node & NearestNode ( Node node) const
inline

◆ scaleNormal()

void scaleNormal ( double  d)
inline

◆ ScaleNormal()

void ScaleNormal ( double  d)
inline

◆ scaleOldNormal()

void scaleOldNormal ( double  d)
inline

◆ ScaleOldNormal()

void ScaleOldNormal ( double  d)
inline

◆ scaleToUnitNormal()

void scaleToUnitNormal ( )
inline

Make sure this element's normal is a unit vector. If the normal was a zero vector, an exception of type ScaledZeroVectorError is thrown.

◆ ScaleToUnitNormal()

void ScaleToUnitNormal ( )
inline

◆ SetCollided()

void SetCollided ( )
inline

◆ setNormal()

void setNormal ( const Vector3d v)
inline

Set the normal vector of this element to v. No attempt is made to check if this makes sense for the element.

◆ SetNormal()

void SetNormal ( const Vector3d v)
inline

◆ setOldNormal()

void setOldNormal ( const Vector3d v)
inline

◆ SetOldNormal()

void SetOldNormal ( const Vector3d v)
inline

◆ sharedEdge() [1/2]

ShellElement * sharedEdge ( int  indexToNode) const
Returns
The first element found to share this element's edge as defined by the start of the edge at nodes[indexToNode ]. If no element shares the edge, it returns NULL.

◆ SharedEdge() [1/2]

ShellElement * SharedEdge ( int  indexToNode) const
inline

◆ sharedEdge() [2/2]

ShellElement * sharedEdge ( Node node_A,
Node node_B 
) const
Returns
The first element found to share this element's edge as defined by the two nodes node_A and node_B. If no element shares the edge, it returns NULL. The relative ordering of node_A and node_B is not important.

◆ SharedEdge() [2/2]

ShellElement * SharedEdge ( Node node_A,
Node node_B 
) const
inline

◆ truncateToTRI3() [1/2]

void truncateToTRI3 ( ElementNodes::iterator  j)

◆ TruncateToTRI3() [1/2]

void TruncateToTRI3 ( ElementNodes::iterator  j)
inline

◆ truncateToTRI3() [2/2]

void truncateToTRI3 ( Node node)
inline

◆ TruncateToTRI3() [2/2]

void TruncateToTRI3 ( Node node)
inline

◆ updateOldNormal()

void updateOldNormal ( )
inline

◆ UpdateOldNormal()

void UpdateOldNormal ( )
inline