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

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

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