NGSolve  4.9
comp/hdivhofespace.hpp
00001 #ifndef FILE_HDIVHOFESPACE
00002 #define FILE_HDIVHOFESPACE
00003 
00004 /*********************************************************************/
00005 /* File:   hdivhofespace.hpp                                         */
00006 /* Author: START                                                     */
00007 /* Date:   Feb. 2003, update (SZ) Jan. 2007                          */
00008 /*********************************************************************/
00009 
00010 namespace ngcomp
00011 {
00012 
00017   class NGS_DLL_HEADER HDivHighOrderFESpace : public FESpace
00018   {
00019   protected:
00020     // Level
00021     int level;
00022     // Number of Edges
00023     int ned;
00024     // Number of Faces
00025     int nfa;
00026     // Number of Elements
00027     int nel;
00028     // Number of Vertex
00029     int nv;
00030     // Number Dofs 
00031     int ndof;
00032     // order of curl-fields 
00033     int curl_order; 
00034 
00035     Array<int> first_facet_dof;
00036     Array<int> first_inner_dof;
00037 
00039     int rel_order; 
00040     // curl-order relative to mesh order 
00041     int rel_curl_order; 
00042     // space is of variable order 
00043     bool var_order;
00044     // space is continuous/discontinuous 
00045     bool discont; 
00046     
00047     Array<INT<3> > order_inner;
00048     Array<INT<3> > order_inner_curl;
00049     Array<INT<2> > order_facet; 
00050     Array<bool> fine_facet; 
00051  
00052     Array<int> ndlevel;
00053     int uniform_order_inner; 
00054     int uniform_order_facet; 
00055 
00056     // high order divergence free
00057     bool ho_div_free; 
00058 
00059     bool print; 
00060      
00061   public:
00062 
00063     HDivHighOrderFESpace (const MeshAccess & ama, const Flags & flags, bool parseflags=false);
00065     virtual ~HDivHighOrderFESpace ();
00066 
00067     static FESpace * Create (const MeshAccess & ma, const Flags & flags);
00068 
00069     void UpdateDofTables(); 
00070 
00071     void UpdateCouplingDofArray();   
00072     
00073     virtual string GetClassName () const
00074     {
00075       return "HDivHighOrderFESpace";
00076     }
00077 
00079     virtual void Update(LocalHeap & lh);
00081     virtual int GetNDof () const;
00083     virtual int GetNDofLevel (int level) const;
00085     virtual const FiniteElement & GetFE (int elnr, LocalHeap & lh) const;
00087     virtual const FiniteElement & GetHODivFE (int elnr, LocalHeap & lh) const;
00089     virtual const FiniteElement & GetSFE (int selnr, LocalHeap & lh) const; // 2D: array =0.;
00091     virtual void GetDofNrs (int elnr, Array<int> & dnums) const;
00093     virtual void GetSDofNrs (int selnr, Array<int> & dnums) const;
00095     virtual Table<int> * CreateSmoothingBlocks (const Flags & precflags) const;
00097     virtual Array<int> * CreateDirectSolverClusters (const Flags & precflags) const;
00099     virtual void GetVertexDofNrs (int vnr, Array<int> & dnums) const;
00101     virtual void GetEdgeDofNrs (int ednr, Array<int> & dnums) const;
00103     virtual void GetFaceDofNrs (int fanr, Array<int> & dnums) const;
00105     virtual void GetFacetDofNrs(int fanr, Array<int> & dnums) const 
00106     { 
00107       if (ma.GetDimension() == 2) GetEdgeDofNrs(fanr,dnums); 
00108       else if (ma.GetDimension() == 3) GetFaceDofNrs(fanr,dnums); 
00109     } 
00111     virtual void GetInnerDofNrs (int elnr, Array<int> & dnums) const; 
00112   
00114     void GetFacetOrder (Array<INT<2> > & of, Array<bool> & ff) const 
00115     {of = order_facet; ff = fine_facet;};
00116 
00118     int GetNElemDofs(int elnr) const 
00119     {
00120       if(discont) return(first_inner_dof[elnr+1] - first_inner_dof[elnr]); 
00121       else 
00122         { 
00123           Array<int> dnums; 
00124           this->GetDofNrs(elnr,dnums); 
00125           return(dnums.Size()); 
00126         } 
00127     }
00128 
00129     int GetFirstInnerDof(int elnr) const { return(first_inner_dof[elnr]);}; 
00130     // virtual int LowOrderDof() const { if(discont) return(0); else return(1);} 
00131 
00132 
00133     virtual bool VarOrder() const { return var_order; } 
00134     virtual int GetRelOrder() const { return rel_order; } 
00135 
00136     /*
00137     virtual int GetNLowOrderNodeDofs ( NODE_TYPE nt ) const
00138     { 
00139       bool isfacet = ( (ma.GetDimension() == 2 && nt == NT_EDGE) || (ma.GetDimension() == 3 && nt == NT_FACE));
00140       if ( isfacet ) return 1;
00141       else return 0; 
00142     }
00143     */
00144 
00145     IntRange GetFacetDofs (int nr) const
00146     {
00147       return IntRange (first_facet_dof[nr], first_facet_dof[nr+1]);
00148     }
00149 
00150     IntRange GetElementDofs (int nr) const
00151     {
00152       return IntRange (first_inner_dof[nr], first_inner_dof[nr+1]);
00153     }
00154 
00155   };
00156 
00157 }
00158 
00159 #endif
00160 
00161 
00162 
00163 
00164