/Users/jack/Code/basso_dev/inc/Tria6Basis.h

00001 
00012 #ifndef _TRIA6_BASIS_BASSO_H_
00013 #define _TRIA6_BASIS_BASSO_H_
00014 
00015 #include "basso.h"
00016 #include "Basis.h"
00017 
00018 namespace basso {
00019 
00032 class Tria6Basis : public Basis {
00033 
00034 public:
00035         
00036         // constructors
00037         Tria6Basis() { }
00038         
00039         // destructors
00040         virtual ~Tria6Basis() { }
00041         
00042         // member functions
00043         virtual BasisType       Type() const { return kTRIA6; }
00044         virtual BasisShape      Shape() const { return kTRIANGLE; }
00045         virtual int                     NumNodes() const { return 6; }     
00046         virtual int                     NumEdges() const { return 3; }      
00047         virtual int                     NumFaces() const { return 0; }      
00048         virtual int                     Dimension() const { return 2; }
00049         virtual int                     Order() const { return 2; }
00050         
00051         virtual void            ParentCoord( Array< Point > &xi ) const;
00052         virtual Point           Centroid() const { return Point( 0.33333333333333333, 0.33333333333333333 ); }
00053         virtual void            NumNodesOnFaces( iArray &nn_face ) const;
00054         virtual void            NumNodesOnEdges( iArray &nn_edge )      const;
00055         virtual void            NodesOnFace ( int f, iArray &face_nodeids ) const;
00056         virtual void            NodesOnEdge ( int e, iArray &edge_nodeids )     const;
00057         virtual void            FaceBasisType( Array<BasisType> &face_basis ) const;
00058         virtual void            EdgeBasisType( Array< BasisType > &edge_basis ) const;
00059         
00060         virtual void            Quadrature( int order, QuadratureRule &qrule ) const;
00061         
00062         virtual void            Na( const Point &p, nArray &shapefunct )  const { shape_tria6(shapefunct,p.x(),p.y()); }
00063         virtual void            DNa( const Point &p, nMatrix &grad_shape )      const { dshape_tria6(grad_shape,p.x(),p.y()); }
00064         virtual void            Na( nArray &shapefunct )    const { Na( Centroid(), shapefunct ); }
00065         virtual void            DNa( nMatrix &grad_shape ) const { DNa( Centroid(), grad_shape ); }
00066 
00067 private:
00068         
00069 };
00070 
00071 void Tria6Basis::ParentCoord( Array< Point > &xi ) const
00072 {
00073 #ifdef ALLOW_DYNAMIC_RESIZE 
00074         if ( xi.size()!=NumNodes() )
00075                 xi.resize(NumNodes());
00076 #endif
00077         xi[0]=Point(0.0,0.0);
00078         xi[1]=Point(1.0,0.0);
00079         xi[2]=Point(0.0,1.0);
00080         xi[3]=Point(0.5,0.0);
00081         xi[4]=Point(0.5,0.5);
00082         xi[5]=Point(0.0,0.5);
00083 }
00084 
00085 void    Tria6Basis::NumNodesOnFaces( iArray &nn_face )  const
00086 {
00087 #ifdef ALLOW_DYNAMIC_RESIZE 
00088         if ( nn_face.size()!=NumEdges() )
00089                 nn_face.resize( NumEdges() );
00090 #endif
00091 }
00092 
00093 void    Tria6Basis::NumNodesOnEdges( iArray &nn_edge )  const
00094 {
00095 #ifdef ALLOW_DYNAMIC_RESIZE 
00096         if ( nn_edge.size()!=NumEdges() )
00097                 nn_edge.resize( NumEdges() );
00098 #endif
00099         for ( int i=0; i<NumEdges(); ++i )
00100                 nn_edge[i]=3; 
00101 }
00102 
00103 void Tria6Basis::NodesOnFace ( int e, iArray &face_nodeids ) const
00104 {
00105 #ifdef ALLOW_DYNAMIC_RESIZE 
00106         if ( face_nodeids.size()!=0 )
00107                 face_nodeids.resize(0);
00108 #endif
00109 }
00110 
00111 void Tria6Basis::NodesOnEdge ( int e, iArray &edge_nodeids ) const
00112 {
00113 #ifdef ALLOW_DYNAMIC_RESIZE 
00114         if ( edge_nodeids.size()!=3 )
00115                 edge_nodeids.resize(3);
00116 #endif
00117         
00118         switch (e) {
00119         
00120                 case 0:
00121                 edge_nodeids[0]=1;  edge_nodeids[1]=2; edge_nodeids[2]=3;
00122                 break;
00123                 
00124                 case 1:
00125                 edge_nodeids[0]=2; edge_nodeids[1]=0; edge_nodeids[2]=4;
00126                 break;
00127                 
00128                 case 2:
00129                 edge_nodeids[0]=0; edge_nodeids[1]=1; edge_nodeids[2]=5;
00130                 break;
00131                 
00132                 default:
00133                 WarningMessage("Tria6Basis::NodesOnFace","face id out of range");
00134                 break;
00135                 
00136         }
00137 }
00138 
00139 void Tria6Basis::FaceBasisType( Array< BasisType > &face_basis ) const
00140 {
00141 #ifdef ALLOW_DYNAMIC_RESIZE 
00142         if ( face_basis.size()!=NumFaces() )
00143                 face_basis.resize(NumFaces());
00144 #endif
00145 }
00146 
00147 void Tria6Basis::EdgeBasisType( Array< BasisType > &edge_basis ) const
00148 {
00149 #ifdef ALLOW_DYNAMIC_RESIZE 
00150         if ( edge_basis.size()!=NumEdges() )
00151                 edge_basis.resize(NumEdges());
00152 #endif
00153         for ( int i=0; i<NumEdges(); ++i )
00154                 edge_basis[i]=kLINE3; 
00155 }
00156 
00157 void Tria6Basis::Quadrature( int order, QuadratureRule &qrule ) const
00158 {
00159         
00160         int npts;
00161         switch (order)
00162         {
00163                 case 0:
00164                 npts=1;
00165                 break;
00166                 
00167                 case 1:
00168                 npts=1;
00169                 break;
00170                 
00171                 case 2:
00172                 npts=3;
00173                 break;  
00174                 
00175                 case 3:
00176                 npts=4;
00177                 break;
00178                 
00179                 case 4:
00180                 npts=6;
00181                 break;
00182                 
00183                 case 5:
00184                 npts=7;
00185                 break;
00186                 
00187                 case 6:
00188                 npts=12;
00189                 break;
00190                 
00191                 case 7:
00192                 npts=13;
00193                 break;  
00194                 
00195                 default:
00196                 WarningMessage("Tria6Basis::Quadrature( int order )","quadrature order >7");
00197                 npts=13;
00198                 break;
00199                 
00200         }
00201 
00202         if ( vect_size(qrule)!=npts )
00203                 resize(qrule,npts);
00204 
00205         quadrature_tria( qrule );
00206         
00207 }
00208 
00209 } // end namespace
00210 
00211 #endif
00212 
00213 

Generated on Sat Jan 19 09:03:57 2008 for Basso by  doxygen 1.5.2