baseq2patch.h

Go to the documentation of this file.
00001 #ifndef __baseq22dPatch_h
00002 #define __baseq22dPatch_h
00003 
00004 #include  "baseq22d.h"
00005 
00006 #define NDOF   25
00007 #define NDOF1d 5
00008 
00009 namespace Gascoigne
00010 {
00011 /**************************************************/
00012 
00013   class BaseQ22dPatch : public Base2d
00014   {
00015     protected:
00016       bool                 second;
00017       mutable int          pB;
00018       BaseQ22d             B2;
00019       nvector<int>         perm;
00020       mutable DoubleVector dxx,dxy,dyy;
00021 
00022       void BasicInit()
00023       {
00024         N.resize(NDOF);
00025         DN.resize(NDOF);
00026         dxy.resize(NDOF);
00027       }
00028 
00029     public:
00030       BaseQ22dPatch() : Base2d(), second(false), perm(9)
00031       {
00032         BasicInit();
00033 
00034         perm[0] = 0;
00035         perm[1] = 1;
00036         perm[2] = 2;
00037         perm[3] = 5;
00038         perm[4] = 6;
00039         perm[5] = 7;
00040         perm[6] = 10;
00041         perm[7] = 11;
00042         perm[8] = 12;
00043       }
00044 
00045       int  n() const {return NDOF;}
00046       double phi   (int i) const {return N  [i];}
00047       double phi_x (int i) const {return DN [i].x();}
00048       double phi_y (int i) const {return DN [i].y();}
00049       double phi_xx(int i) const {assert(second); return dxx[i];}
00050       double phi_xy(int i) const {assert(second); return dxy[i];}
00051       double phi_yy(int i) const {assert(second); return dyy[i];}
00052       const Vertex2d& phi_grad(int i) const {return DN [i];}
00053 
00054       void point(const Vertex2d& s) const
00055       {
00056         Vertex2d t(s);
00057         if( (s.x()<=0.5) && (s.y()<=0.5) )
00058         {
00059           pB = 0;
00060         }
00061         else if( (s.x()>=0.5) && (s.y()<=0.5) )
00062         {
00063           pB = 2;
00064           t.x() -= 0.5;
00065         }
00066         else if( (s.x()<=0.5) && (s.y()>=0.5) )
00067         {
00068           pB = 10;
00069           t.y() -= 0.5;
00070         }
00071         else
00072         {
00073           pB = 12;
00074           t.x() -= 0.5;
00075           t.y() -= 0.5;
00076         }
00077         t *= 2.;
00078 
00079         B2.point(t);
00080 
00081         N.zero();
00082         for(int i=0; i<NDOF; i++)
00083         {
00084           DN[i].zero();
00085         }
00086 
00087         for(int i=0; i<9; i++)
00088         {
00089           int j  = pB + perm[i];
00090           N[j]   = B2.phi(i);
00091           DN[j]  = B2.phi_grad(i);
00092           DN[j] *= 2.;
00093           if(second)
00094           {
00095             dxx[j] = 2.*B2.phi_xx(i);
00096             dxy[j] = 2.*B2.phi_xy(i);
00097             dyy[j] = 2.*B2.phi_yy(i);
00098           }
00099         }
00100       }
00101   };
00102 }
00103 
00104 #undef NDOF
00105 #undef NDOF1d
00106 
00107 #endif

Generated on Thu Sep 14 10:34:36 2006 for Gascoigne by  doxygen 1.4.7