00001
00010 #ifndef _QUAD8_BASIS_BASSO_H_
00011 #define _QUAD8_BASIS_BASSO_H_
00012
00013 #include "basso.h"
00014 #include "Basis.h"
00015
00016 namespace basso {
00017
00030 class Quad8Basis : public Basis {
00031
00032 public:
00033
00034
00035 Quad8Basis() { }
00036
00037
00038 virtual ~Quad8Basis() { }
00039
00040
00041 virtual BasisType Type() const { return kQUAD8; }
00042 virtual BasisShape Shape() const { return kQUADRILATERAL; }
00043 virtual int NumNodes() const { return 8; }
00044 virtual int NumEdges() const { return 4; }
00045 virtual int NumFaces() const { return 0; }
00046 virtual int Dimension() const { return 2; }
00047 virtual int Order() const { return 3; }
00048
00049 virtual void ParentCoord( Array< Point > &xi ) const;
00050 virtual Point Centroid() const { return Point( 0.0, 0.0 ); }
00051 virtual void NumNodesOnFaces( iArray &nn_face ) const;
00052 virtual void NumNodesOnEdges( iArray &nn_edge ) const;
00053 virtual void NodesOnFace ( int f, iArray &face_nodeids ) const;
00054 virtual void NodesOnEdge ( int e, iArray &edge_nodeids ) const;
00055 virtual void FaceBasisType( Array<BasisType> &face_basis ) const;
00056 virtual void EdgeBasisType( Array< BasisType > &edge_basis ) const;
00057
00058 virtual void Quadrature( int order, QuadratureRule &qrule ) const;
00059
00060 virtual void Na( const Point &p, nArray &shapefunct ) const { shape_quad8(shapefunct,p.x(),p.y()); }
00061 virtual void DNa( const Point &p, nMatrix &grad_shape ) const { dshape_quad8(grad_shape,p.x(),p.y()); }
00062 virtual void Na( nArray &shapefunct ) const { Na( Centroid(), shapefunct ); }
00063 virtual void DNa( nMatrix &grad_shape ) const { DNa( Centroid(), grad_shape ); }
00064
00065 private:
00066
00067 };
00068
00069 void Quad8Basis::ParentCoord( Array< Point > &xi ) const
00070 {
00071 #ifdef ALLOW_DYNAMIC_RESIZE
00072 if ( xi.size()!=NumNodes() )
00073 xi.resize(NumNodes());
00074 #endif
00075 xi[0]=Point(-1.0,-1.0);
00076 xi[1]=Point( 1.0,-1.0);
00077 xi[2]=Point( 1.0, 1.0);
00078 xi[3]=Point(-1.0, 1.0);
00079 xi[4]=Point( 0.0,-1.0);
00080 xi[5]=Point( 1.0, 0.0);
00081 xi[6]=Point( 0.0, 1.0);
00082 xi[7]=Point(-1.0, 0.0);
00083 }
00084
00085 void Quad8Basis::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 Quad8Basis::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 Quad8Basis::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 Quad8Basis::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]=0; edge_nodeids[1]=1; edge_nodeids[2]=4;
00122 break;
00123
00124 case 1:
00125 edge_nodeids[0]=1; edge_nodeids[1]=2; edge_nodeids[2]=5;
00126 break;
00127
00128 case 2:
00129 edge_nodeids[0]=2; edge_nodeids[1]=3; edge_nodeids[2]=6;
00130 break;
00131
00132 case 3:
00133 edge_nodeids[0]=3; edge_nodeids[1]=4; edge_nodeids[2]=7;
00134 break;
00135
00136 default:
00137 WarningMessage("Quad8Basis::NodesOnFace","face id out of range");
00138 break;
00139
00140 }
00141 }
00142
00143 void Quad8Basis::FaceBasisType( Array< BasisType > &face_basis ) const
00144 {
00145 #ifdef ALLOW_DYNAMIC_RESIZE
00146 if ( face_basis.size()!=NumFaces() )
00147 face_basis.resize(NumFaces());
00148 #endif
00149 }
00150
00151 void Quad8Basis::EdgeBasisType( Array< BasisType > &edge_basis ) const
00152 {
00153 #ifdef ALLOW_DYNAMIC_RESIZE
00154 if ( edge_basis.size()!=NumEdges() )
00155 edge_basis.resize(NumEdges());
00156 #endif
00157 for ( int i=0; i<NumEdges(); ++i )
00158 edge_basis[i]=kLINE3;
00159 }
00160
00161 void Quad8Basis::Quadrature( int order, QuadratureRule &qrule ) const
00162 {
00163
00164 int npts;
00165 npts=(order+1)/2;
00166
00167 if ( vect_size(qrule)!=npts )
00168 resize(qrule,npts);
00169
00170 quadrature_gauss2d( qrule );
00171
00172 }
00173
00174 }
00175
00176 #endif
00177
00178