include/deal.II/hp/mapping_collection.h

00001 //------------------------  mapping_collection.h  --------------------------
00002 //    @f$Id: mapping_collection.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2005, 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 //------------------------  mapping_collection.h  --------------------------
00012 #ifndef __deal2__mapping_collection_h
00013 #define __deal2__mapping_collection_h
00014 
00015 #include <deal.II/base/config.h>
00016 #include <deal.II/base/subscriptor.h>
00017 #include <deal.II/fe/mapping_q1.h>
00018 #include <deal.II/fe/fe.h>
00019 
00020 #include <vector>
00021 #include <deal.II/base/std_cxx1x/shared_ptr.h>
00022 
00023 DEAL_II_NAMESPACE_OPEN
00024 
00025 namespace hp
00026 {
00050   template<int dim, int spacedim=dim>
00051   class MappingCollection : public Subscriptor
00052   {
00053     public:
00060       MappingCollection ();
00061 
00073       explicit MappingCollection (const Mapping<dim,spacedim> &mapping);
00074 
00078       MappingCollection (const MappingCollection<dim,spacedim> &mapping_collection);
00079 
00093       void push_back (const Mapping<dim,spacedim> &new_mapping);
00094 
00107       const Mapping<dim,spacedim> &
00108       operator[] (const unsigned int index) const;
00109 
00115       unsigned int size () const;
00116 
00122       std::size_t memory_consumption () const;
00123 
00124     private:
00130       std::vector<std_cxx1x::shared_ptr<const Mapping<dim,spacedim> > > mappings;
00131   };
00132 
00133 
00141   template<int dim, int spacedim=dim>
00142   struct StaticMappingQ1
00143   {
00144     private:
00155       static MappingQ1<dim,spacedim> mapping_q1;
00156 
00157     public:
00163       static MappingCollection<dim,spacedim> mapping_collection;
00164   };
00165 
00166 
00167 /* --------------- inline functions ------------------- */
00168 
00169   template<int dim, int spacedim>
00170   inline
00171   unsigned int
00172   MappingCollection<dim,spacedim>::size () const
00173   {
00174     return mappings.size();
00175   }
00176 
00177 
00178 
00179   template<int dim, int spacedim>
00180   inline
00181   const Mapping<dim,spacedim> &
00182   MappingCollection<dim,spacedim>::operator[] (const unsigned int index) const
00183   {
00184     Assert (index < mappings.size (),
00185             ExcIndexRange (index, 0, mappings.size ()));
00186     return *mappings[index];
00187   }
00188 
00189 } // namespace hp
00190 
00191 
00192 DEAL_II_NAMESPACE_CLOSE
00193 
00194 #endif
00195 
 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