00001
00010 #ifndef _LINE3_BASIS_BASSO_H_
00011 #define _LINE3_BASIS_BASSO_H_
00012
00013 #include "basso.h"
00014 #include "Basis.h"
00015
00016 namespace basso {
00017
00029 class Line3Basis : public Basis {
00030
00031 public:
00032
00033
00034 Line3Basis() { }
00035
00036
00037 virtual ~Line3Basis() { }
00038
00039
00040 virtual BasisType Type() const { return kLINE3; }
00041 virtual BasisShape Shape() const { return kLINE; }
00042 virtual int NumNodes() const { return 3; }
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 2; }
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_line3(shapefunct,p.x()); }
00060 virtual void DNa( const Point &p, nMatrix &grad_shape ) const { dshape_line3(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 Line3Basis::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 Line3Basis::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 Line3Basis::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 Line3Basis::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 Line3Basis::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 Line3Basis::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 Line3Basis::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 Line3Basis::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 }
00140
00141 #endif
00142
00143