NGSolve  4.9
fem/hcurlhofe.hpp
00001 #ifndef FILE_HCURLHOFE_
00002 #define FILE_HCURLHOFE_  
00003 
00004 /*********************************************************************/
00005 /* File:   hcurlhofe.hpp                                             */
00006 /* Author: Sabine Zaglmayr                                           */
00007 /* Date:   20. Maerz 2003                                            */
00008 /*                                                                   */
00009 /* AutoCurl - revision: J. Schoeberl, March 2009                     */
00010 /*********************************************************************/
00011    
00012 namespace ngfem
00013 {
00014 
00018 template <int D>
00019 class HCurlHighOrderFiniteElement : public HCurlFiniteElement<D> 
00020 {
00021 protected:
00022   int vnums[8]; 
00023   int order_edge[12];
00024   INT<2> order_face[6];
00025   INT<3> order_cell;
00026 
00027   bool usegrad_edge[12]; 
00028   bool usegrad_face[6]; 
00029   bool usegrad_cell; 
00030 
00031   bool discontinuous;
00032   
00033 public:
00034   HCurlHighOrderFiniteElement (ELEMENT_TYPE aeltype);
00035   HCurlHighOrderFiniteElement () { discontinuous = false; }
00036 
00037   void SetVertexNumber (int nr, int vnum) { vnums[nr] = vnum; }
00038   void SetOrderEdge (int nr, int order) { order_edge[nr] = order; }
00039   void SetOrderFace (int nr, INT<2> order) { order_face[nr] = order; }
00040 
00041   void SetUseGradEdge(int nr, int uge) { usegrad_edge[nr] = uge; }
00042   void SetUseGradFace(int nr, int ugf) { usegrad_face[nr] = ugf; }
00043 
00044   void SetVertexNumbers (FlatArray<int> & avnums);
00045   void SetOrderCell (int oi);
00046   void SetOrderCell (INT<3> oi);
00047   void SetOrderFace (FlatArray<int> & of);
00048   void SetOrderFace (FlatArray<INT<2> > & of); 
00049   void SetOrderEdge (FlatArray<int> & oen);
00050   void SetUsegradEdge(FlatArray<bool> & uge); 
00051   void SetUsegradFace(FlatArray<bool> & ugf); 
00052   void SetUsegradCell(int ugc); 
00053   void SetDiscontinuous ( bool adiscont ) { discontinuous = adiscont; }
00054   
00055   virtual void ComputeNDof () = 0;
00056   void PrintInfo() const;
00057 };
00058 
00059 
00064 template <ELEMENT_TYPE ET> class HCurlHighOrderFE;
00065 
00066 
00067 
00072 template <ELEMENT_TYPE ET>
00073 class T_HCurlHighOrderFiniteElement 
00074   : public HCurlHighOrderFiniteElement<ET_trait<ET>::DIM>, public ET_trait<ET> 
00075 
00076 {
00077 protected:
00078   enum { DIM = ET_trait<ET>::DIM };
00079   
00080   using HCurlFiniteElement<DIM>::DIM_CURL;
00081   using HCurlFiniteElement<DIM>::ndof;
00082   using HCurlFiniteElement<DIM>::order;
00083   using HCurlFiniteElement<DIM>::eltype;
00084   // using HCurlFiniteElement<DIM>::dimspace;
00085 
00086   using HCurlHighOrderFiniteElement<DIM>::vnums;
00087   using HCurlHighOrderFiniteElement<DIM>::order_edge;
00088   using HCurlHighOrderFiniteElement<DIM>::order_face;
00089   using HCurlHighOrderFiniteElement<DIM>::order_cell;
00090 
00091   using HCurlHighOrderFiniteElement<DIM>::usegrad_edge;
00092   using HCurlHighOrderFiniteElement<DIM>::usegrad_face;
00093   using HCurlHighOrderFiniteElement<DIM>::usegrad_cell;
00094 
00095   using HCurlHighOrderFiniteElement<DIM>::discontinuous;
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   
00105 
00106 
00107   typedef IntegratedLegendreMonomialExt T_ORTHOPOL;
00108 
00109   // typedef TrigShapesInnerLegendre T_TRIGSHAPES;
00110   // typedef TrigShapesInnerJacobi T_TRIGSHAPES;
00111 
00112 public:
00113 
00114   T_HCurlHighOrderFiniteElement () 
00115   {
00116     for (int i = 0; i < N_VERTEX; i++)
00117       vnums[i] = i;
00118     // dimspace = DIM;
00119     eltype = ET;
00120   }
00121 
00122   T_HCurlHighOrderFiniteElement (int aorder);
00123 
00124   virtual void ComputeNDof();
00125   virtual void GetInternalDofs (Array<int> & idofs) const;
00126 
00127   virtual void CalcShape (const IntegrationPoint & ip, 
00128                           FlatMatrixFixWidth<DIM> shape) const;
00129 
00130   virtual void CalcCurlShape (const IntegrationPoint & ip, 
00131                               FlatMatrixFixWidth<DIM_CURL> curlshape) const;
00132 
00133   virtual void CalcMappedShape (const MappedIntegrationPoint<DIM,DIM> & mip,
00134                                 FlatMatrixFixWidth<DIM> shape) const;
00135 
00136   virtual void CalcMappedCurlShape (const MappedIntegrationPoint<DIM,DIM> & mip,
00137                                     FlatMatrixFixWidth<DIM_CURL> curlshape) const;
00138 
00139   /*
00140   virtual Vec <DIM_CURL_TRAIT<ET_trait<ET>::DIM>::DIM>
00141   EvaluateCurlShape (const IntegrationPoint & ip, 
00142                      FlatVector<double> x,
00143                      LocalHeap & lh) const;
00144   */
00145 };
00146 
00147  
00149 template <>
00150 class HCurlHighOrderFE<ET_SEGM>:  public HCurlHighOrderFiniteElement<1>
00151 {
00152 private: 
00153   typedef IntegratedLegendreMonomialExt T_ORTHOPOL;
00154  
00155 public:
00156   HCurlHighOrderFE ();
00157   HCurlHighOrderFE (int aorder);
00158   virtual void ComputeNDof();
00159  
00160   virtual void CalcShape (const IntegrationPoint & ip, 
00161                           FlatMatrixFixWidth<1> shape) const;
00162 };
00163 
00165 template <>
00166 class HCurlHighOrderFE<ET_TRIG> : public T_HCurlHighOrderFiniteElement<ET_TRIG>
00167 {
00168 private:
00169   typedef TrigShapesInnerLegendre T_INNERSHAPES; 
00170 public:
00171   HCurlHighOrderFE () { ; }
00172   HCurlHighOrderFE (int aorder);
00173 
00174   template<typename Tx, typename TFA>  
00175   void T_CalcShape (Tx hx[2], TFA & shape) const; 
00176 };
00177 
00179 template <>
00180 class HCurlHighOrderFE<ET_QUAD> : public T_HCurlHighOrderFiniteElement<ET_QUAD>
00181 {
00182 public:
00183   HCurlHighOrderFE () { ; }
00184   HCurlHighOrderFE (int aorder);
00185 
00186   template<typename Tx, typename TFA>  
00187   void T_CalcShape (Tx hx[2], TFA & shape) const; 
00188 };
00189 
00191 template <>
00192 class HCurlHighOrderFE<ET_TET> : public T_HCurlHighOrderFiniteElement<ET_TET>
00193 {
00194 private:
00195   typedef TetShapesFaceLegendre T_FACESHAPES; 
00196   typedef TetShapesInnerLegendre T_INNERSHAPES; 
00197 public:
00198   HCurlHighOrderFE () { ; }
00199   HCurlHighOrderFE (int aorder);
00200 
00201   template<typename Tx, typename TFA>  
00202   void T_CalcShape (Tx hx[3], TFA & shape) const; 
00203 };
00204 
00206 template <>
00207 class HCurlHighOrderFE<ET_HEX> : public T_HCurlHighOrderFiniteElement<ET_HEX>
00208 {
00209 public:
00210   HCurlHighOrderFE () { ; }
00211   HCurlHighOrderFE (int aorder);
00212 
00213   template<typename Tx, typename TFA>  
00214   void T_CalcShape (Tx hx[3], TFA & shape) const; 
00215 };
00216 
00218 template <>
00219 class HCurlHighOrderFE<ET_PRISM> : public T_HCurlHighOrderFiniteElement<ET_PRISM>
00220 {
00221 private:
00222   typedef TrigShapesInnerLegendre T_TRIGFACESHAPES;
00223 
00224 public:
00225   HCurlHighOrderFE () { ; }
00226   HCurlHighOrderFE (int aorder);
00227 
00228   template<typename Tx, typename TFA>  
00229   void T_CalcShape (Tx hx[3], TFA & shape) const; 
00230 };
00231 
00233 template <>
00234 class HCurlHighOrderFE<ET_PYRAMID> : public T_HCurlHighOrderFiniteElement<ET_PYRAMID>
00235 {
00236   typedef TrigShapesInnerLegendre T_TRIGFACESHAPES;  
00237 public:
00238   HCurlHighOrderFE () { ; }
00239   HCurlHighOrderFE (int aorder);
00240 
00241   template<typename Tx, typename TFA>  
00242   void T_CalcShape (Tx hx[3], TFA & shape) const; 
00243 };
00244 
00245 }
00246 
00247 #endif
00248