]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Test for abstract multigrid
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Apr 1999 12:13:15 +0000 (12:13 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Apr 1999 12:13:15 +0000 (12:13 +0000)
git-svn-id: https://svn.dealii.org/trunk@1136 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/mg1.cc [new file with mode: 0644]

diff --git a/tests/deal.II/mg1.cc b/tests/deal.II/mg1.cc
new file mode 100644 (file)
index 0000000..0497bec
--- /dev/null
@@ -0,0 +1,85 @@
+// $Id$
+
+// deal_II_libraries.g=-ldeal_II_2d.g
+// deal_II_libraries=-ldeal_II_2d
+
+#include <numerics/multigrid.h>
+
+class TransferTest
+  :
+  public MGTransferBase
+{
+    virtual void prolongate(unsigned l,
+                           Vector<float>& dst,
+                           const Vector<float>& src) const;
+    virtual void restrict(unsigned l,
+                         Vector<float>& dst,
+                         const Vector<float>& src) const;
+    friend class MultiGridBase;
+};
+
+class MGTest
+  :
+  public MultiGridBase
+{
+  public:
+    MGTest(TransferTest& t)
+                   : MultiGridBase(t, 9, 3, 2, 4)
+      {}
+    
+    virtual void level_residual(unsigned level,
+                               Vector<float>& dst,
+                               const Vector<float>& src,
+                               const Vector<float>& rhs);
+    
+    virtual void smooth(unsigned level,
+                       Vector<float>& x,
+                       const Vector<float>& b,
+                       unsigned steps);
+    void doit()
+      {
+       level_mgstep(9);
+      }
+};
+
+main()
+{
+  TransferTest tr;
+  MGTest mg(tr);
+  mg.doit();
+  
+}
+
+void
+TransferTest::prolongate(unsigned l,
+                        Vector<float>&,
+                        const Vector<float>&) const
+{
+  cout << "Prolongating " << l-1 << " to " << l << endl;
+}
+
+void
+TransferTest::restrict(unsigned l,
+                      Vector<float>&,
+                      const Vector<float>&) const
+{
+  cout << "Restricting  " << l << " to " << l-1 << endl;
+}
+
+void
+MGTest::level_residual(unsigned l,
+                      Vector<float>&,
+                      const Vector<float>&,
+                      const Vector<float>&)
+{
+  cout << "Residual on  " << l << endl;
+}
+
+void
+MGTest::smooth(unsigned l,
+              Vector<float>&,
+              const Vector<float>&,
+              unsigned steps)
+{
+  cout << "Smooth on    " << l << " : " << steps << " steps" << endl;
+}

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.