include/deal.II/hp/fe_collection.h

00001 //----------------------------  fe_collection.h  ---------------------------
00002 //    @f$Id: fe_collection.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2003, 2004, 2006, 2012 by the deal.II authors
00005 //
00006 //    This file is subject to QPL and may not be  distributed
00007 //    without copyright and license information. Please refer
00008 //    to the file deal.II/doc/license.html for the  text  and
00009 //    further information on this license.
00010 //
00011 //----------------------------  fe_collection.h  ---------------------------
00012 #ifndef __deal2__fe_collection_h
00013 #define __deal2__fe_collection_h
00014 
00015 #include <deal.II/base/config.h>
00016 #include <deal.II/base/std_cxx1x/shared_ptr.h>
00017 #include <deal.II/fe/fe.h>
00018 
00019 DEAL_II_NAMESPACE_OPEN
00020 
00021 namespace hp
00022 {
00023 
00045   template <int dim, int spacedim=dim>
00046   class FECollection : public Subscriptor
00047   {
00048     public:
00055       FECollection ();
00056 
00068       explicit FECollection (const FiniteElement<dim,spacedim> &fe);
00069 
00073       FECollection (const FECollection<dim,spacedim> &fe_collection);
00074 
00092       void push_back (const FiniteElement<dim,spacedim> &new_fe);
00093 
00103       const FiniteElement<dim,spacedim> &
00104       operator[] (const unsigned int index) const;
00105 
00111       unsigned int size () const;
00112 
00120       unsigned int n_components () const;
00121 
00127       unsigned int max_dofs_per_vertex () const;
00128 
00134       unsigned int max_dofs_per_line () const;
00135 
00141       unsigned int max_dofs_per_quad () const;
00142 
00148       unsigned int max_dofs_per_hex () const;
00149 
00155       unsigned int max_dofs_per_face () const;
00156 
00162       unsigned int max_dofs_per_cell () const;
00163 
00168       std::size_t memory_consumption () const;
00169 
00170 
00204       bool hp_constraints_are_implemented () const;
00205 
00206 
00210       DeclException0 (ExcNoFiniteElements);
00211 
00212     private:
00217       std::vector<std_cxx1x::shared_ptr<const FiniteElement<dim,spacedim> > > finite_elements;
00218   };
00219 
00220 
00221 
00222 /* --------------- inline functions ------------------- */
00223 
00224   template <int dim, int spacedim>
00225   inline
00226   unsigned int
00227   FECollection<dim,spacedim>::size () const
00228   {
00229     return finite_elements.size();
00230   }
00231 
00232 
00233   template <int dim, int spacedim>
00234   inline
00235   unsigned int
00236   FECollection<dim,spacedim>::n_components () const
00237   {
00238     Assert (finite_elements.size () > 0, ExcNoFiniteElements());
00239     return finite_elements[0]->n_components ();
00240   }
00241 
00242 
00243   template <int dim, int spacedim>
00244   inline
00245   const FiniteElement<dim,spacedim> &
00246   FECollection<dim,spacedim>::operator[] (const unsigned int index) const
00247   {
00248     Assert (index < finite_elements.size(),
00249             ExcIndexRange (index, 0, finite_elements.size()));
00250     return *finite_elements[index];
00251   }
00252 
00253 
00254 
00255   template <int dim, int spacedim>
00256   unsigned int
00257   FECollection<dim,spacedim>::max_dofs_per_vertex () const
00258   {
00259     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00260 
00261     unsigned int max = 0;
00262     for (unsigned int i=0; i<finite_elements.size(); ++i)
00263       if (finite_elements[i]->dofs_per_vertex > max)
00264         max = finite_elements[i]->dofs_per_vertex;
00265 
00266     return max;
00267   }
00268 
00269 
00270 
00271   template <int dim, int spacedim>
00272   unsigned int
00273   FECollection<dim,spacedim>::max_dofs_per_line () const
00274   {
00275     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00276 
00277     unsigned int max = 0;
00278     for (unsigned int i=0; i<finite_elements.size(); ++i)
00279       if (finite_elements[i]->dofs_per_line > max)
00280         max = finite_elements[i]->dofs_per_line;
00281 
00282     return max;
00283   }
00284 
00285 
00286 
00287   template <int dim, int spacedim>
00288   unsigned int
00289   FECollection<dim,spacedim>::max_dofs_per_quad () const
00290   {
00291     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00292 
00293     unsigned int max = 0;
00294     for (unsigned int i=0; i<finite_elements.size(); ++i)
00295       if (finite_elements[i]->dofs_per_quad > max)
00296         max = finite_elements[i]->dofs_per_quad;
00297 
00298     return max;
00299   }
00300 
00301 
00302 
00303   template <int dim, int spacedim>
00304   unsigned int
00305   FECollection<dim,spacedim>::max_dofs_per_hex () const
00306   {
00307     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00308 
00309     unsigned int max = 0;
00310     for (unsigned int i=0; i<finite_elements.size(); ++i)
00311       if (finite_elements[i]->dofs_per_hex > max)
00312         max = finite_elements[i]->dofs_per_hex;
00313 
00314     return max;
00315   }
00316 
00317 
00318 
00319   template <int dim, int spacedim>
00320   unsigned int
00321   FECollection<dim,spacedim>::max_dofs_per_face () const
00322   {
00323     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00324 
00325     unsigned int max = 0;
00326     for (unsigned int i=0; i<finite_elements.size(); ++i)
00327       if (finite_elements[i]->dofs_per_face > max)
00328         max = finite_elements[i]->dofs_per_face;
00329 
00330     return max;
00331   }
00332 
00333 
00334 
00335   template <int dim, int spacedim>
00336   unsigned int
00337   FECollection<dim,spacedim>::max_dofs_per_cell () const
00338   {
00339     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00340 
00341     unsigned int max = 0;
00342     for (unsigned int i=0; i<finite_elements.size(); ++i)
00343       if (finite_elements[i]->dofs_per_cell > max)
00344         max = finite_elements[i]->dofs_per_cell;
00345 
00346     return max;
00347   }
00348 
00349 
00350   template <int dim, int spacedim>
00351   bool
00352   FECollection<dim,spacedim>::hp_constraints_are_implemented () const
00353   {
00354     Assert (finite_elements.size() > 0, ExcNoFiniteElements());
00355 
00356     bool hp_constraints = true;
00357     for (unsigned int i=0; i<finite_elements.size(); ++i)
00358       hp_constraints = hp_constraints &&
00359                        finite_elements[i]->hp_constraints_are_implemented();
00360 
00361     return hp_constraints;
00362   }
00363 
00364 
00365 } // namespace hp
00366 
00367 DEAL_II_NAMESPACE_CLOSE
00368 
00369 #endif
00370 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Tue May 22 2012 12:06:09 by doxygen 1.7.3