// FEMesh.h: interface for the FEMesh class.//#if !defined(AFX_FEMESH_H__CB7EC714_E3FD_46A4_A397_FEFB23429520__INCLUDED_)#define AFX_FEMESH_H__CB7EC714_E3FD_46A4_A397_FEFB23429520__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000#include"FECoreMesh.h"#include<vector>#include<set>usingnamespacestd;//-----------------------------------------------------------------------------classFEMesh;//-----------------------------------------------------------------------------// Element data fieldclassFEElementData{public:FEElementData();FEElementData(constFEElementData&d);FEElementData&operator=(constFEElementData&d);// create a data fieldvoidCreate(FEMesh*pm,doublev=0.0);// size of data fieldintSize(){return(int)m_data.size();}// get/setdoubleget(inti){returnm_data[i];}voidset(inti,doublev){m_data[i]=v;}// access operatordouble&operator[](inti){returnm_data[i];}// get/set namevoidSetName(constchar*sz);constchar*GetName(){returnm_szname;}voidFillRandomBox(doublefmin,doublefmax);private:charm_szname[256];FEMesh*m_pMesh;vector<double>m_data;};//-----------------------------------------------------------------------------// This class describes a finite element mesh. Every FEMesh must be owned by a// GObject class. classFEMesh:publicFECoreMesh{public:// --- C O N S T R U C T I O N ---FEMesh();FEMesh(FEMesh&m);virtual~FEMesh();// allocate space for meshvoidCreate(intnodes,intelems,intfaces=0,intedges=0);// copy part of the meshvoidShallowCopy(FEMesh*pm);voidClear();voidDeleteEdges(){if(!m_Edge.empty())m_Edge.clear();}public:// --- E L E M E N T A C C E S S ---intElements()const{returnm_Elem.size();}FEElement&Element(intn){returnm_Elem[n];}FEElement_&ElementRef(intn){returnm_Elem[n];}FEElement*ElementPtr(intn=0){return((n>=0)&&(n<(int)m_Elem.size())?&m_Elem[n]:0);}public:// --- S U B M E S H ---intFindFace(FEElement*pe,FEFace&f,FEFace&fe);voidFindNodesFromPart(intgid,vector<int>&node);std::vector<FENode>&NodeArray(){returnm_Node;}std::vector<FEFace>&FaceArray(){returnm_Face;}std::vector<FEElement>&ElementArray(){returnm_Elem;}// --- E V A L U A T I O N ---// get the current element valuedoubleGetElementValue(intn){returnm_data[n];}// set the element valuevoidSetElementValue(intn,doublev){m_data[n]=v;}// update the range of valuesvoidUpdateValueRange();// get the value rangevoidGetValueRange(double&vmin,double&vmax);vec3dProjectToSurface(vec3dr,vec3dt);vec3dProjectToFace(vec3dp,FEFace&f,double&r,double&s);vec3dProjectToEdge(vec3de1,vec3de2,vec3dp,double&r);boolFindIntersection(FEFace&f,vec3dx,vec3dn,vec3d&q,double&g);// --- U P D A T E ---voidUpdate();voidUpdateElementNeighbors();voidUpdateFaces();voidUpdateEdges();voidUpdateNodes();voidAutoSmooth(doublew);voidUpdateNormals();voidPartitionSelection();// --- O P E R A T I O N S ---voidRemoveIsolatedNodes();voidAddNode(FENode&n){m_Node.push_back(n);}// detach the selected elements and create a new meshFEMesh*DetachSelectedMesh();// detach selected elements and create a new partvoidDetachSelectedPart();FEMesh*ExtractSelectedFaces();voidDeleteTaggedElements(inttag);voidDeleteTaggedFaces(inttag);voidDeleteTaggedEdges(inttag);voidFindDuplicateFaces(vector<int>&l);voidFindDuplicateEdges(vector<int>&l);voidDeleteSelectedElements();voidDeleteSelectedFaces();voidDeleteSelectedNodes();voidInvertTaggedElements(intntag);voidInvertSelectedElements();doubleShellJacobian(FEElement&el);// Remove duplicated elementsvoidRemoveDuplicateElements();//Fix inverted elementsvoidFixinvertedElements();//Fix the reference surfacevoidFixReferenceSurface();//Interpolate shell thickness for elements whose thickness is unknownvoidInterpolateShellThickness(double);// Remove non-manifold elementsvoidRemoveNonManifoldElements();// fix element windingvoidFixElementWinding();voidFixElementWinding2();// tag all elementsvoidTagAllElements(intntag);public:intDataFields(){return(int)m_map.size();}FEElementData*AddDataField(constchar*szname,doublev=0.0);FEElementData&GetDataField(inti){returnm_map[i];}public:doubleShortestEdge();protected:boolIntersectTri(vec3d*y,vec3dx,vec3dn,vec3d&q,double&g);boolIntersectQuad(vec3d*y,vec3dx,vec3dn,vec3d&q,double&g);public:voidBuildNodeElementTable(vector<vector<int>>&NET);voidBuildNodeFaceTable(vector<vector<int>>&NFT);voidBuildNodeEdgeTable(vector<vector<int>>&NET);voidBuildEdgeTable(vector<pair<int,int>>&ET);voidBuildNodeNodeTable(vector<set<int>>&NNT);voidBuildSurfaceNodeNodeTable(vector<set<int>>&NNT);voidBuildElementEdgeTable(vector<vector<int>>&EET,vector<pair<int,int>>&ET);voidBuildFaceTable(vector<FEFace>&FT);voidBuildElementFaceTable(vector<vector<int>>&EFT,vector<FEFace>&FT);voidBuildFaceEdgeTable(vector<vector<int>>&FET,vector<pair<int,int>>&ET);voidBuildFaceFaceTable(vector<int>&FFT,vector<FEFace>&FT);voidBuildEdgeEdgeTable(vector<int>&EET,vector<pair<int,int>>&ET);protected:// element datastd::vector<FEElement>m_Elem;std::vector<double>m_data;doublem_min,m_max;// data fields (currently used as material maps)vector<FEElementData>m_map;};externintFTHEX8[6][4];externintFTHEX20[6][8];externintFTHEX27[6][9];externintFTPENTA[5][4];externintFTTET[4][3];externintFTTET10[4][6];externintFTTET15[4][7];doublebias(doubleb,doublex);doublegain(doubleg,doublex);doublearea_triangle(vec3dr[3]);#endif // !defined(AFX_FEMESH_H__CB7EC714_E3FD_46A4_A397_FEFB23429520__INCLUDED_)