// FEElement.h: interface for the FEElement class.//#if !defined(AFX_FEELEMENT_H__4A869671_045F_4EDD_AC13_25C849922373__INCLUDED_)#define AFX_FEELEMENT_H__4A869671_045F_4EDD_AC13_25C849922373__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000#include<assert.h>#include"math3d.h"//-----------------------------------------------------------------------------// FE State Flags#define FE_VISIBLE 0x01#define FE_SELECTED 0x02//-----------------------------------------------------------------------------// The FEItem class is the base class for all FEMesh items. It stores the // common attributes such as the state flags and the group ID.//classFEItem{public:FEItem(){m_state=FE_VISIBLE;m_gid=-1;}boolIsVisible()const{return((m_state&FE_VISIBLE)!=0);}boolIsSelected()const{return((m_state&FE_SELECTED)!=0);}voidSelect(){m_state=m_state|FE_SELECTED;}voidUnSelect(){m_state=m_state&~FE_SELECTED;}voidShow(){m_state=m_state|FE_VISIBLE;}voidHide(){m_state=0;}unsignedintGetFEState()const{returnm_state;}voidSetFEState(unsignedintstate){m_state=state;}public:intm_ntag;// tag of itemintm_gid;// group idintm_nid;// item id (used e.g. in export).//double m_ndata; //scalar data associated with a nodeprivate:unsignedintm_state;// the state flag of the mesh(-item)};//-----------------------------------------------------------------------------// The FENode class stores the nodal data.//classFENode:publicFEItem{public:FENode(){m_bext=false;}public:vec3dr;// nodal positionboolm_bext;// exterior node or not?doublem_ndata;};//-----------------------------------------------------------------------------// The FEEdge class stores the edge data.// An edge can be either linear or quadratic. In the linear case, only the// first two nodes are used, the third one is set to -1. In the latter case,// all three nodes are used, with the first two being the outside nodes and// the third one being the inside node.//// 1 3 2// +---------o----------+//classFEEdge:publicFEItem{public:enum{MAX_NODES=3};public:FEEdge();booloperator==(constFEEdge&e);intNodes(){return(n[2]==-1?2:3);}intFindNode(intnode);public:intn[MAX_NODES];intm_elem;intm_nbr[2];};//-----------------------------------------------------------------------------// FEFace class stores face data. // A face can either have 3, 4, 6, 8 or 9 nodes. It is a triangle if it has 3 nodes and// a quad if it has 4. If it has 6 it is a quadratic triangle. The first three are the// cornder nodes, the other three are the midpoints of the edges. If it has 8 or 9 it is // a quadratic quad. The first four nodes are the corner nodes, the next four the // interior edge nodes and in the case of a 9-node quad, the last node is in the center.//// 4 7 3 3// +-------o-------+ +// | | |\// | | | \// 8o x9 o6 6o o5// | | | \// | | | \// +-------o-------+ +--o--+// 1 5 2 1 4 2//classFEFace:publicFEItem{public:enum{MAX_NODES=9};public:FEFace();booloperator==(constFEFace&f);intNodes(){returnm_nodes;}intEdges();voidGetEdgeNodes(inti,int*n);boolHasEdge(intn1,intn2);boolHasNode(inti);intFindNode(inti);boolIsExternal(){return(m_elem[1]==-1);}public:intn[MAX_NODES];intm_nodes;intm_nbr[4];vec3dm_fn;vec3dm_nn[MAX_NODES];intm_sid;intm_elem[2];};//-----------------------------------------------------------------------------// element types// NOTE: do not change the order or values of these macros.#define FE_HEX8 1#define FE_TET4 2#define FE_PENTA6 3#define FE_QUAD4 4#define FE_TRI3 5#define FE_BEAM2 6#define FE_HEX20 7#define FE_QUAD8 8#define FE_BEAM3 9#define FE_TET10 10#define FE_TRI6 11#define FE_TET15 12#define FE_HEX27 13#define MAX_ELEM 13//-----------------------------------------------------------------------------// The FEElement_ class defines the data interface to the element data. // Specialized element classes are then defined by deriving from this base class.classFEElement_:publicFEItem{public:FEElement_();// comparison operatorboolis_equal(FEElement_&e);intGetType()const{returnm_ntype;}boolIsType(intntype)const{returnm_ntype==ntype;}intNodes()const{returnm_nodes;}intFaces()const{returnm_nfaces;}intEdges()const{returnm_nedges;}intGetFace(inti,int*n);FEFaceGetFace(inti);FEFaceGetShellFace();FEEdgeGetEdge(inti);boolIsExterior();protected:// help class for copy-ing element datavoidcopy(constFEElement_&el);public:// Check the element classboolIsSolid(){return(m_ntype==FE_HEX8)||(m_ntype==FE_HEX20)||(m_ntype==FE_HEX27)||(m_ntype==FE_PENTA6)||(m_ntype==FE_TET4)||(m_ntype==FE_TET10)||(m_ntype==FE_TET15);}boolIsShell(){return(m_ntype==FE_TRI3)||(m_ntype==FE_QUAD4)||(m_ntype==FE_TRI6);}boolIsBeam(){return(m_ntype==FE_BEAM2);}public:int*m_node;int*m_nbr;int*m_face;double*m_h;public:vec3dm_fiber;mat3dm_Q;boolm_Qactive;doublem_a0;protected:intm_ntype;intm_nodes;intm_nfaces;intm_nedges;};//-----------------------------------------------------------------------------// Class for 3-node triangular elementsclassFETri3:publicFEElement_{public:FETri3();FETri3(FETri3&el);FETri3&operator=(FETri3&el);private:int_node[3];int_nbr[3];int_face[1];double_h[3];};//-----------------------------------------------------------------------------// The FEElement class can be used to represent a general purpose element. // This class can represent an element of all different types. classFEElement:publicFEElement_{public:enum{MAX_NODES=27};public:FEElement();FEElement(constFEElement&el);FEElement&operator=(constFEElement&el);voidSetType(intntype);private:int_node[MAX_NODES];int_nbr[6];int_face[6];double_h[9];};#endif // !defined(AFX_FEELEMENT_H__4A869671_045F_4EDD_AC13_25C849922373__INCLUDED_)