// FACE.H #ifndef FACE_H #define FACE_H #include "node.h" #include "edge.h" #include "tetra.h" #include "coord.h" #include "bc.h" #include "densemat.h" #include "material.h" #include #include "quadrature.h" #include "array.h" #include "vtr.h" #include #include #include "Constants.h" #include "../dgtd-performance.hpp" class tetra;//change class face{ friend class FemGrp; friend class tetra; private: int cnt; //position of the face in faceARRAY int bType; //BC type in defines fp_t modeIMP; node* nd[NumOfNodesPerFace]; //nodes of the face edge* eg[NumOfEdgesPerFace]; //edges of the face tetra* hydra[NumOfTetrasPerFace]; //Tetras that share this face hydra[0] < hydra[1] bc* bcPtr; //Pointer to the bc in bcARRAY vtr evtr[6]; vtr hvtr[6]; Material* face_mat; fp_t Frequency; //Freq: Central Modulation Frequency (MHz) fp_t to; //Tdelay: Delay of excitation pulse (sec) fp_t tau; //Tau: Parameter for pulse width (sec) int TimeDistributionFlag; // Port Waveform (0)TH (1)Gauss int ExcitationFlag; // Scattering Planewave Waveform: (0)Time Harmonic (1)Gauss (2)Neumann (3) Modulated Gauss fp_t area_; //area of the face vtr gradZeta_[3]; //Inward normal vectors to the edges (nd2-nd1) and (nd0-nd2) and contained in the face with the same magnitude as the edges they are normal to vtr FaceNormal_; //normal vector to the face and inward to hydra[0] vtr center; //centroid (barycenter) // Excitation from file int NumofSamples; vector TimeVal; vector VoltageVal; // Added for Non-conformal vtr CoordOfFaceNodes[NumOfNodes]; //Coordinates of the nodes of the face int FaceNodeIds[NumOfNodes]; //Ids of the nodes of the face // static int const NodeNumber = 3; int* pec_; int* pmc_; int eDOF_, cntpec_; int hDOF_, cntpmc_; public: face(); ~face(); // operators int operator > (const face &) const; int operator < (const face &) const; int operator == (const face &) const; face &operator = (const face &); fp_t* E_coeff; fp_t* H_coeff; // set functions void setFace(node*, node*, node*); void setbType(int b_type){bType = (b_type > bType) ? b_type : bType;} void ReplacebType(int b_type){bType = b_type;} void setcnt(int nn){cnt = nn;} void setEdge(edge* egPtr, int n){eg[n] = egPtr;} void setTetra(int nn, tetra * ptr){hydra[nn] = ptr;} void tetraArrange(); void setbcPtr(bc *); void setbcPtr(int); void setTo(fp_t val){to = val;} void setTau(fp_t val){tau = val;} void setTimeDist(int val){TimeDistributionFlag = val;} void setExciFlag(int val){ExcitationFlag = val;} void setFrequency(fp_t val){Frequency = val;} int* setPECMaps(int); void setPECMaps(int* pec_map, int PolyOrder); int* setPMCMaps(int); void setPMCMaps(int* pmc_map, int PolyOrder); vtr Center(); bool essentiallyEqual(double a, double b, double epsilon); char* ReturnIntferfacePlaneCoord(double coord2D[6], double& lastcoord); void ReturnIntferfacePlaneCoord(double coord2D[6], double& lastcoord, int& PlaneID); void setCoordOfFaceNodes(vtr nd0, vtr nd1, vtr nd2){ CoordOfFaceNodes[0].setvtr(nd0.getx(), nd0.gety(), nd0.getz()); CoordOfFaceNodes[1].setvtr(nd1.getx(), nd1.gety(), nd1.getz()); CoordOfFaceNodes[2].setvtr(nd2.getx(), nd2.gety(), nd2.getz()); } // make element matrices void Calculate_Fii_Matrix(tetra*, denseMat*); void Calculate_Be_Matrix(denseMat*); void Calculate_Bh_Matrix(denseMat*); void Calculate_Fii_Matrix_Numeric(tetra*, denseMat*, int); void Calculate_Be_Matrix_Numeric(denseMat*, int); void Calculate_Bh_Matrix_Numeric(denseMat*, int); void ApplyPEC_Be(denseMat*); void ApplyPMC_Bh(denseMat*); void ApplyPMC_PEC(denseMat*); void ApplyPEC_PMC(denseMat*); // get functions int getbType(){return bType;} int getbType() const {return bType;} int getcnt(){return cnt;} int getcnt() const {return cnt;} int getNodeID(int); int getEdgeID(int); fp_t getArea_(){return area_;} node* getNode(int n){return nd[n];} node* getNodePtr(int n){return nd[n];} edge* getEdge(int n){return eg[n];} tetra* gettetraPtr(int nn){return hydra[nn];} bc* getbcPtr(){return bcPtr;} tetra& getTetra(int n){return *(hydra[n]);} int getNumTetra(){ if(hydra[0] != 0 && hydra[1] == 0) return 1; else if(hydra[1] != 0) return 2; else return 0; } fp_t getArea(); void getAreaNormal(fp_t *, vtr *); void getFaceArea(fp_t* area); // non-conformal void P2toH1(vtr *, fp_t *, Coordinate); void H1toP2(vtr *, fp_t *, Coordinate); void geometry(Coordinate, vtr *, fp_t *); void geometry(vtr *, fp_t *); tetra* neighborTETRA(tetra *); // Added by qi jian to return node coordinates of face std::array, 3> getNodeCoordinates() { std::array, 3> probe_xyz = { std::array{nd[0]->getCoord().getx(), nd[0]->getCoord().gety(), nd[0]->getCoord().getz()}, std::array{nd[1]->getCoord().getx(), nd[1]->getCoord().gety(), nd[1]->getCoord().getz()}, std::array{nd[2]->getCoord().getx(), nd[2]->getCoord().gety(), nd[2]->getCoord().getz()} }; return probe_xyz; } // Added for the BLAS implementation void SetUpMatrixFree(); // Excitation void getCartesianCoord(fp_t *zeta, vtr &pnt); void getCartesianCoord_NC(fp_t *zeta, vtr &pnt); void CartesianToSimplex_NC(vtr &pnt, fp_t *zeta); void FaceBasisW(fp_t *zeta, int p, vtr *W); void FaceBasisNxW(fp_t *zeta, int p, vtr &nxW, vtr &FaceNormal); void H_updateinc(fp_t, vtr, vtr &normalvtr, vtr &nxEinc, vtr &nxnxHinc, fp_t *zeta); void E_updateinc(fp_t, vtr, vtr &normalvtr, vtr &nxHinc, vtr &nxnxEinc, fp_t *zeta); void make_upd_Einc(Coordinate &coord, ArrayFP*, ArrayFP*, fp_t, tetra*, int&); void make_upd_Hinc(Coordinate &coord, ArrayFP*, ArrayFP*, fp_t, tetra*, int&); int PointInFace(vtr, fp_t&, fp_t&, fp_t&); void Evaluate_E_field(fp_t *zeta, vtr& E_field); void Evaluate_H_field(fp_t *zeta, vtr& H_field); void PlaneWaveFields(int ExcitationFlag, fp_t t, vtr r, vtr kvtr, fp_t &IncidExcit_E, fp_t &IncidExcit_H); // Port Excitation void Set_WgSolverExcitation_E(vtr E_vtr[6]); void Set_WgSolverExcitation_H(vtr H_vtr[6]); void SparEinc(fp_t, vtr, vtr &, fp_t*); void TimeModulationInc(fp_t t, vtr r, vtr R_o, vtr kvtr, fp_t Emagnitude, fp_t Hmagnitude, fp_t &IncidExcit_E, fp_t &IncidExcit_H); void PortFields(int PortFlag, fp_t &Emagnitude, fp_t &Hmagnitude, vtr &Epol, vtr &Hpol, vtr &kvtr, vtr &R_o, fp_t* zeta); void Calculate_w_w_Matrix_NC(face* InterMeshArray, int ArraySize, face* localFace, face* neighFace, denseMat* w_w, int PolyOrderFlag); void Calculate_w_nxw_Matrix_NC(face* InterMeshArray, int ArraySize, face* localFace, face* neighFace, denseMat* w_nxw, tetra* TetPtr, int PolyOrderFlag); }; vtr AreaNormal(vtr, vtr, vtr); #endif