elem/Tri3.hpp

00001 #ifndef __TRI3_HPP__
00002 #define __TRI3_HPP__
00003 
00004 #include "elem/Simplex.hpp"
00005 #include "tools/ElementConList.hpp"
00006 
00007 #include <vector>
00008 #include <string>
00009 
00010 #include <boost/array.hpp>
00011 
00012 namespace DAPTA { // Define namespace DAPTA
00013 
00015 
00018 template <typename V>
00019 class Tri3 {
00020    public:
00021       typedef V                             VertexType;
00022       typedef V*                            VertexHandle;
00023       typedef Tri3<V>                       ElementType;
00024       typedef Tri3<V>*                      ElementHandle;
00025       typedef CohElem<Tri3<V> >             CohElementType;
00026       typedef CohElementType*               CohElementHandle;
00027       typedef Simplex<V,2>                  FaceElementType;
00028       typedef FaceElementType*              FaceElementHandle;
00029       typedef Simplex<V,1>                  EdgeElementType;
00030       typedef EdgeElementType*              EdgeElementHandle;
00031       typedef ElementConList                ElementConListType;
00032       typedef ElementConListType*           ElementConListHandle;
00033       
00034       static const int num_vertices = 3;
00035       static const int num_adjacents = 3;
00036       static const int num_edges = 3;
00037       
00038       static const std::string deck_keyword; 
00039       
00040       Tri3(VertexHandle i, VertexHandle j, VertexHandle k);
00041       Tri3(boost::array<VertexHandle, num_vertices> nodes);
00042       Tri3() : globalID(0) {;}
00043       ~Tri3() {;}
00044       
00045       int                          FindVertex(VertexHandle v);                                               
00046       ElementHandle                AdjElement(VertexHandle v)     { return AdjElement(FindVertex(v)); }      
00047       ElementHandle                AdjElement(int i)              { return adjacents.at(i); }                
00048       
00049       bool                         IsBoundaryNode(VertexHandle v1);                                          
00050       bool                         IsBoundaryNode(int v1);                                                   
00051       bool                         IsBoundaryEdge(VertexHandle v1, VertexHandle v2);                         
00052       bool                         IsBoundaryEdge(int v1, int v2);                                           
00053       
00054       ElementHandle                NextTriOnNode(int &v1, int &f);                                           
00055       int                          FaceToVertex(VertexHandle v1, VertexHandle v2);                           
00056       int                          FaceToVertex(int v1, int v2);                                             
00057       int                          FaceToVertex(boost::array<VertexHandle, (num_adjacents-1)> vs);           
00058       void                         BreakConnection(int f)                          { adjacents.at(f)=NULL; }
00059       void                         MakeConnection(VertexHandle f, ElementHandle t) { MakeConnection(FindVertex(f), t); }
00060       void                         MakeConnection(int f, ElementHandle t)          { adjacents.at(f)=t; }
00061       
00062       FaceElementType              GetFace(int ind);                                                         
00063       int                          GetFaceIndex(FaceElementType face);                                       
00064       EdgeElementType              GetEdge(int ind);                                                         
00065       int                          GetEdgeIndex(EdgeElementType edge);                                       
00066       std::vector<EdgeElementType> GetEdges(int f);                                                          
00067       std::vector<EdgeElementType> GetAllEdges();                                                            
00068       ElementHandle                NextOnEdge(int ind);                                                      
00069       ElementHandle                PrevOnEdge(int ind);                                                      
00070       ElementHandle                NextOnEdge(EdgeElementType edge) {return NextOnEdge(GetEdgeIndex(edge));} 
00071       ElementHandle                PrevOnEdge(EdgeElementType edge) {return PrevOnEdge(GetEdgeIndex(edge));} 
00072       CohElementHandle             NextCohOnEdge(int ind);                                                   
00073       CohElementHandle             PrevCohOnEdge(int ind);                                                   
00074       
00075       VertexHandle                 GetCentre();                                                              
00076       
00077       boost::array<VertexHandle,num_vertices>      vertices;
00078       boost::array<ElementHandle,num_adjacents>    adjacents;
00079       boost::array<CohElementHandle,num_adjacents> coh_adjacents;
00080       boost::array<ElementConListHandle,num_edges> con_lists;
00081       
00082       int globalID;
00083       
00084       // OLD FRACTURE ALGORITHMS
00085       //CohElementHandle             FractureFace(VertexHandle f, std::vector<VertexHandle>* new_vertices, bool &new_elem);
00086       //CohElementHandle             FractureFace(int f, std::vector<VertexHandle>* new_vertices, bool &new_elem);
00087    private:
00088 };
00089 
00090 template <typename V>
00091 const std::string Tri3<V>::deck_keyword = "TRI3";
00092 
00093 } // namespace DAPTA
00094 
00095 #include "Tri3.cpp"
00096 
00097 #endif

Generated on Tue May 29 17:13:48 2007 for DAPTA by  doxygen 1.5.1