]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Move the MGLevelObject class from mg_base.h to separate mg_level_object.h file.
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 Feb 2003 14:58:22 +0000 (14:58 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 Feb 2003 14:58:22 +0000 (14:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@7078 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/multigrid/mg_base.h
deal.II/deal.II/include/multigrid/mg_smoother.h
deal.II/deal.II/include/multigrid/mg_transfer.h
deal.II/deal.II/include/multigrid/multigrid.h
deal.II/deal.II/source/multigrid/mg_dof_tools.cc

index 9322e39d456c7bd685f1b3744a1b5d21c40fdaee..d536b4d30bd3781f61c59c50d24e208b7dd16938 100644 (file)
 #include <vector>
 
 
-/**
- * An array with an object for each level.  The purpose of this class
- * is mostly to allow access by level number, even if the lower levels
- * are not used and therefore have no object at all; this is done by
- * simply shifting the given index by the minimum level we have
- * stored.
- *
- * In most cases, the objects which are stored on each levels, are
- * either matrices or vectors.
- *
- * @author Wolfgang Bangerth, Guido Kanschat, 1999
- */
-template<class Object>
-class MGLevelObject : public Subscriptor
-{
-  public:
-                                    /**
-                                     * Constructor allowing to
-                                     * initialize the number of
-                                     * levels. By default, the object
-                                     * is created empty.
-                                     */
-    MGLevelObject (const unsigned int minlevel = 0,
-                  const unsigned int maxlevel = 0);
-    
-                                    /**
-                                     * Access object on level @p{level}.
-                                     */
-    Object & operator[] (const unsigned int level);
-    
-                                    /**
-                                     * Access object on level
-                                     * @p{level}. Constant version.
-                                     */
-    const Object & operator[] (const unsigned int level) const;
-
-                                    /**
-                                     * Delete all previous contents
-                                     * of this object and reset its
-                                     * size according to the values
-                                     * of @p{new_minlevel} and
-                                     * @p{new_maxlevel}.
-                                     */
-    void resize (const unsigned int new_minlevel,
-                const unsigned int new_maxlevel);
-    
-                                    /**
-                                     * Call @p{clear} on all objects
-                                     * stored by this object. This
-                                     * function is only implemented
-                                     * for some @p{Object} classes,
-                                     * most notably for vectors and
-                                     * matrices. Note that if
-                                     * @p{Object==Vector<T>}, @p{clear}
-                                     * will set all entries to zero,
-                                     * while if
-                                     * @p{Object==vector<T>},
-                                     * @p{clear} deletes the elements
-                                     * of the vectors. This class
-                                     * might therefore not be useful
-                                     * for STL vectors.
-                                     */
-    void clear();
-
-                                    //////
-    unsigned int get_minlevel () const;
-    unsigned int get_maxlevel () const;
-    
-  private:
-                                    /**
-                                     * Level of first component.
-                                     */
-    unsigned int minlevel;
-
-                                    /**
-                                     * Array of the objects to be held.
-                                     */
-    std::vector<Object> objects;
-};
 
 
 /**
@@ -276,76 +197,6 @@ class MGSmootherBase : public Subscriptor
 };
 
 
-/* ------------------------------------------------------------------- */
-
-
-template<class Object>
-MGLevelObject<Object>::MGLevelObject(const unsigned int min,
-                                    const unsigned int max)
-               :
-               minlevel(0)
-{
-  resize (min, max);
-}
-
-
-template<class Object>
-Object &
-MGLevelObject<Object>::operator[] (const unsigned int i)
-{
-  Assert((i>=minlevel) && (i<minlevel+objects.size()),
-        ExcIndexRange (i, minlevel, minlevel+objects.size()));
-  return objects[i-minlevel];
-}
-
-
-template<class Object>
-const Object &
-MGLevelObject<Object>::operator[] (const unsigned int i) const
-{
-  Assert((i>=minlevel) && (i<minlevel+objects.size()),
-        ExcIndexRange (i, minlevel, minlevel+objects.size()));
-  return objects[i-minlevel];
-}
-
-
-template<class Object>
-void
-MGLevelObject<Object>::resize (const unsigned int new_minlevel,
-                              const unsigned int new_maxlevel)
-{
-  Assert (new_minlevel <= new_maxlevel, ExcInternalError());
-  objects.clear ();
-
-  minlevel = new_minlevel;
-  objects.resize (new_maxlevel - new_minlevel + 1);
-}
-
-
-template<class Object>
-void
-MGLevelObject<Object>::clear ()
-{
-  typename std::vector<Object>::iterator v;
-  for (v = objects.begin(); v != objects.end(); ++v)
-    v->clear();  
-}
-
-
-template<class Object>
-unsigned int
-MGLevelObject<Object>::get_minlevel () const
-{
-  return minlevel;
-}
-
-
-template<class Object>
-unsigned int
-MGLevelObject<Object>::get_maxlevel () const
-{
-  return minlevel + objects.size() - 1;
-}
 
 /*----------------------------   mgbase.h     ---------------------------*/
 
index 813dcdb5654a9fbcf13355b731a8cc6a20c29160..0f890c68212d7f63ca944acb4026b2ff8b1d3c22 100644 (file)
@@ -18,6 +18,7 @@
 #include <base/smartpointer.h>
 #include <lac/pointer_matrix.h>
 #include <multigrid/mg_base.h>
+#include <multigrid/mg_level_object.h>
 #include <vector>
 
 template <int dim> class MGDoFHandler;
index a7cd15ca8180510d0261bf99e0b6b4d866fdd745..1b234e5906a807beab3911bb7db9578925b76625 100644 (file)
@@ -18,6 +18,7 @@
 #include <lac/block_vector.h>
 #include <lac/block_sparsity_pattern.h>
 #include <multigrid/mg_base.h>
+#include <multigrid/mg_level_object.h>
 
 template <int dim> class MGDoFHandler;
 
index 4b2e4ee6993e76eebfe892bc3f59f4f2336db1bf..d9127dceebae964becf4f9b1b41a0422677c40b8 100644 (file)
@@ -20,6 +20,7 @@
 #include <lac/sparse_matrix.h>
 #include <lac/vector.h>
 #include <multigrid/mg_base.h>
+#include <multigrid/mg_level_object.h>
 #include <multigrid/mg_dof_handler.h>
 
 #include <vector>
index 8d3e0105bfc4d12ad3d8d0a3f9197bb4f1172ecf..28bf830e964111ad93b3ca6b011196e88a1632a7 100644 (file)
@@ -25,6 +25,7 @@
 #include <multigrid/mg_dof_accessor.h>
 #include <multigrid/mg_dof_tools.h>
 #include <multigrid/mg_base.h>
+#include <multigrid/mg_level_object.h>
 #include <dofs/dof_tools.h>
 #include <fe/fe.h>
 
@@ -356,7 +357,7 @@ MGTools::count_dofs_per_component (const MGDoFHandler<dim>& dof_handler,
 template<int dim, typename number>
 void
 MGTools::reinit_vector (const MGDoFHandler<dim>& mg_dof,
-                          MGLevelObject<Vector<number> >& v)
+                       MGLevelObject<Vector<number> >& v)
 {
   for (unsigned int level=v.get_minlevel();
        level<=v.get_maxlevel();++level)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.