NGSolve  4.9
fem/h1hofe.hpp
00001 #ifndef FILE_H1HOFE
00002 #define FILE_H1HOFE
00003 
00004 /*********************************************************************/
00005 /* File:   h1hofe.hpp                                                */
00006 /* Author: Start                                                     */
00007 /* Date:   6. Feb. 2003                                              */
00008 /*********************************************************************/
00009 
00010 
00011 #include "tscalarfe.hpp"
00012 
00013 
00014 namespace ngfem
00015 {
00016 
00020   template<int DIM>
00021   class H1HighOrderFiniteElement : virtual public ScalarFiniteElement<DIM>
00022   {
00023   public:
00025     int vnums[8];
00027     INT<3> order_cell;
00029     INT<2> order_face[6];
00031     int order_edge[12];
00032 
00033     using ScalarFiniteElement<DIM>::eltype;
00034 
00035     bool nodalp2;  // 
00036 
00037   public:
00038     H1HighOrderFiniteElement () 
00039       : nodalp2(false) { ; }
00040 
00042     template <typename TA> 
00043     void SetVertexNumbers (const TA & avnums)
00044     { for (int i = 0; i < avnums.Size(); i++) vnums[i] = avnums[i]; }
00045 
00047     void SetVertexNumber (int nr, int vnum) { vnums[nr] = vnum; }
00048 
00050     void SetOrderCell (INT<3> oi)  { order_cell = oi; }
00051 
00053     template <typename TA>
00054     void SetOrderFace (const TA & of)
00055     { for (int i = 0; i < of.Size(); i++) order_face[i] = of[i]; }
00056 
00058     void SetOrderFace (int nr, INT<2> order) { order_face[nr] = order; }
00059 
00061     template <typename TA>
00062     void SetOrderEdge (const TA & oe)
00063     { for (int i = 0; i < oe.Size(); i++) order_edge[i] = oe[i]; }
00064 
00066     void SetOrderEdge (int nr, int order) { order_edge[nr] = order; }
00067 
00068     void SetNodalP2 (bool anp2) { nodalp2 = anp2; }
00069 
00071     virtual void ComputeNDof () = 0;
00072   };
00073 
00074 
00075 
00076 
00080   template <ELEMENT_TYPE ET>
00081   class T_H1HighOrderFiniteElement : 
00082     public H1HighOrderFiniteElement<ET_trait<ET>::DIM>, 
00083     public ET_trait<ET> 
00084   {
00085   protected:
00086     enum { DIM = ET_trait<ET>::DIM };
00087 
00088     using ScalarFiniteElement<DIM>::ndof;
00089     using ScalarFiniteElement<DIM>::order;
00090     using ScalarFiniteElement<DIM>::eltype;
00091 
00092     using H1HighOrderFiniteElement<DIM>::vnums;
00093     using H1HighOrderFiniteElement<DIM>::order_edge;
00094     using H1HighOrderFiniteElement<DIM>::order_face;
00095     using H1HighOrderFiniteElement<DIM>::order_cell;
00096 
00097 
00098     using ET_trait<ET>::N_VERTEX;
00099     using ET_trait<ET>::N_EDGE;
00100     using ET_trait<ET>::N_FACE;
00101     using ET_trait<ET>::FaceType;
00102     using ET_trait<ET>::GetEdgeSort;
00103     using ET_trait<ET>::GetFaceSort;
00104     using ET_trait<ET>::PolDimension;
00105     using ET_trait<ET>::PolBubbleDimension;
00106 
00107   public:
00108 
00109     T_H1HighOrderFiniteElement () { ; }
00110 
00111     T_H1HighOrderFiniteElement (int aorder) 
00112     {
00113       ndof = PolDimension (aorder);
00114 
00115       for (int i = 0; i < N_VERTEX; i++) vnums[i] = i;
00116       for (int i = 0; i < N_EDGE; i++) order_edge[i] = aorder;
00117       for (int i = 0; i < N_FACE; i++) order_face[i] = aorder;   
00118       if (DIM == 3) order_cell = aorder; 
00119 
00120       order = aorder;
00121     }
00122 
00123     virtual void ComputeNDof();
00124   };
00125 
00126 
00127 
00128 
00129 
00131   template <ELEMENT_TYPE ET> class H1HighOrderFE_Shape;
00132 
00133 
00139   template <ELEMENT_TYPE ET> 
00140   class  NGS_DLL_HEADER H1HighOrderFE :  public T_H1HighOrderFiniteElement<ET>,
00141                                          public T_ScalarFiniteElement2< H1HighOrderFE_Shape<ET>, ET >
00142 
00143   {   
00144   public:
00146     H1HighOrderFE () { ; }
00147 
00149     H1HighOrderFE (int aorder)
00150       : T_H1HighOrderFiniteElement<ET> (aorder) { ; }
00151   };
00152 
00153 
00154 
00159   template <> 
00160   class H1HighOrderFE_Shape<ET_POINT> : public H1HighOrderFE<ET_POINT>
00161   {
00162   public:
00164     template<typename Tx, typename TFA>  
00165     void T_CalcShape (Tx hx[], TFA & shape) const
00166     {
00167       shape[0] = 1.0;
00168     }
00169   };
00170 
00171 
00172 
00177   template <> 
00178   class H1HighOrderFE_Shape<ET_SEGM> : public H1HighOrderFE<ET_SEGM>
00179   {
00180   public:
00182     template<typename Tx, typename TFA>  
00183     void T_CalcShape (Tx x[], TFA & shape) const;
00184   };
00185 
00186 
00190   template <>
00191   class H1HighOrderFE_Shape<ET_TRIG> : public H1HighOrderFE<ET_TRIG>
00192   {
00193   public:
00195     template<typename Tx, typename TFA>  
00196     void T_CalcShape (Tx x[], TFA & shape) const;
00197   };
00198 
00199 
00203   template <>
00204   class NGS_DLL_HEADER H1HighOrderFE_Shape<ET_QUAD> : public H1HighOrderFE<ET_QUAD>
00205   {
00206   public:
00208     template<typename Tx, typename TFA>  
00209     void T_CalcShape (Tx hx[], TFA & shape) const;
00210   };
00211 
00212 
00216   template <>
00217   class NGS_DLL_HEADER H1HighOrderFE_Shape<ET_TET> : public H1HighOrderFE<ET_TET>
00218   {
00219   public:
00221     template<typename Tx, typename TFA>  
00222     void T_CalcShape (Tx hx[], TFA & shape) const; 
00223   };
00224 
00225 
00229   template <>
00230   class H1HighOrderFE_Shape<ET_PRISM> : public H1HighOrderFE<ET_PRISM>
00231   {
00232   public:
00234     template<typename Tx, typename TFA>  
00235     void T_CalcShape (Tx hx[], TFA & shape) const; 
00236   };
00237 
00238 
00239 
00243   template <> 
00244   class H1HighOrderFE_Shape<ET_HEX> : public H1HighOrderFE<ET_HEX>
00245   {
00246   public:
00248     template<typename Tx, typename TFA>  
00249     void T_CalcShape (Tx hx[], TFA & shape) const; 
00250   };
00251 
00252 
00256   template <> 
00257   class H1HighOrderFE_Shape<ET_PYRAMID> : public H1HighOrderFE<ET_PYRAMID>
00258   {
00259   public:
00261     template<typename Tx, typename TFA>  
00262     void T_CalcShape (Tx hx[], TFA & shape) const; 
00263   };
00264 }
00265 
00266 
00267 #endif