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

Go to the documentation of this file.
00001 
00010 #ifndef _LINE2_BASIS_BASSO_H_
00011 #define _LINE2_BASIS_BASSO_H_
00012 
00013 #include "basso.h"
00014 #include "Basis.h"
00015 
00016 namespace basso {
00017 
00029 class Line2Basis : public Basis {
00030 
00031 public:
00032         
00033         // constructors
00034         Line2Basis() { }
00035         
00036         // destructors
00037         virtual ~Line2Basis() { }
00038         
00039         // member functions
00040         virtual BasisType       Type() const { return kLINE2; }
00041         virtual BasisShape Shape() const { return kLINE; }
00042         virtual int                             NumNodes() const { return 2; }     
00043         virtual int                             NumEdges() const { return 0; }      
00044         virtual int                             NumFaces() const { return 0; }      
00045         virtual int                             Dimension() const { return 1; }
00046         virtual int                             Order() const { return 1; }
00047         
00048         virtual void            ParentCoord( Array< Point > &xi )       const;
00049         virtual Point           Centroid() const { return Point( 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_line2(shapefunct,p.x()); }
00060         virtual void            DNa( const Point &p, nMatrix &grad_shape )      const { dshape_line2(grad_shape,p.x()); }
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 Line2Basis::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);
00075         xi[1]=Point(1.0);
00076 }
00077 
00078 void    Line2Basis::NumNodesOnFaces( iArray &nn_face )  const
00079 {
00080 #ifdef ALLOW_DYNAMIC_RESIZE 
00081         if ( nn_face.size()!=NumEdges() )
00082                 nn_face.resize( NumEdges() );
00083 #endif
00084 }
00085 
00086 void    Line2Basis::NumNodesOnEdges( iArray &nn_edge )  const
00087 {
00088 #ifdef ALLOW_DYNAMIC_RESIZE 
00089         if ( nn_edge.size()!=NumEdges() )
00090                 nn_edge.resize( NumEdges() );
00091 #endif 
00092 }
00093 
00094 void Line2Basis::NodesOnFace ( int e, iArray &face_nodeids ) const
00095 {
00096 #ifdef ALLOW_DYNAMIC_RESIZE 
00097         if ( face_nodeids.size()!=0 )
00098                 face_nodeids.resize(0);
00099 #endif
00100 }
00101 
00102 void Line2Basis::NodesOnEdge ( int e, iArray &edge_nodeids ) const
00103 {
00104 #ifdef ALLOW_DYNAMIC_RESIZE 
00105         if ( edge_nodeids.size()!=0 )
00106                 edge_nodeids.resize(0);
00107 #endif
00108 }
00109 
00110 void Line2Basis::FaceBasisType( Array< BasisType > &face_basis ) const
00111 {
00112 #ifdef ALLOW_DYNAMIC_RESIZE 
00113         if ( face_basis.size()!=NumFaces() )
00114                 face_basis.resize(NumFaces());
00115 #endif
00116 }
00117 
00118 void Line2Basis::EdgeBasisType( Array< BasisType > &edge_basis ) const
00119 {
00120 #ifdef ALLOW_DYNAMIC_RESIZE 
00121         if ( edge_basis.size()!=NumEdges() )
00122                 edge_basis.resize(NumEdges());
00123 #endif
00124 }
00125 
00126 void Line2Basis::Quadrature( int order, QuadratureRule &qrule ) const
00127 {
00128         
00129         int npts;
00130         npts=(order+1)/2;
00131 
00132         if ( vect_size(qrule)!=npts )
00133                 resize(qrule,npts);
00134 
00135         quadrature_gauss1d( qrule );
00136         
00137 }
00138 /*
00139  void Line2Basis::Na( const Point &p, nArray &shapefunct ) const
00140 {
00141 #ifdef ALLOW_DYNAMIC_RESIZE 
00142         if ( shapefunct.size()!=NumNodes() )
00143                 shapefunct.resize(NumNodes());  
00144 #endif
00145         shapefunct[0]=1-p.x();
00146         shapefunct[1]=p.x();
00147 }
00148 
00149 void Line2Basis::DNa( const Point &p, nMatrix &grad_shape ) const
00150 {
00151 #ifdef ALLOW_DYNAMIC_RESIZE 
00152         if ( mat_nrows(grad_shape)!=NumNodes() || mat_ncols(grad_shape)!=Dimension() )
00153                 resize( grad_shape, NumNodes(), Dimension() );  
00154 #endif
00155         grad_shape(0,0)=-1.0;  
00156         grad_shape(1,0)= 1.0; 
00157 }
00158 */
00159 } // end namespace
00160 
00161 #endif
00162 
00163 

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