]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
debug functions included
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 24 May 2000 20:58:51 +0000 (20:58 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 24 May 2000 20:58:51 +0000 (20:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@2939 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/Makefile.in
tests/lac/full_matrix.cc [new file with mode: 0644]
tests/lac/mg.cc
tests/lac/mgbase.cc

index 2376cb512bf3f1b1989325a575eb7526448d4ab9..2fabd769145cdcad4243943020f705aae193137a 100644 (file)
@@ -95,6 +95,23 @@ solver.testcase: $(solver-o-files) $(libraries)
 ############################################################
 
 
+full_matrix-cc-files = full_matrix.cc
+
+ifeq ($(debug-mode),on)
+full_matrix-o-files = $(full_matrix-cc-files:.cc=.go)
+else
+full_matrix-o-files = $(full_matrix-cc-files:.cc=.o)
+endif
+
+full_matrix.testcase: $(full_matrix-o-files) $(libraries)
+       @echo =====linking======= $<
+       @$(CXX) $(flags) -o $@ $^
+
+
+
+############################################################
+
+
 mgbase-cc-files = mgbase.cc
 
 ifeq ($(debug-mode),on)
diff --git a/tests/lac/full_matrix.cc b/tests/lac/full_matrix.cc
new file mode 100644 (file)
index 0000000..441ea4f
--- /dev/null
@@ -0,0 +1,75 @@
+//----------------------------  $RCSfile$  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  $RCSfile$  ---------------------------
+
+
+#include <cmath>
+#include <fstream>
+#include <iomanip>
+
+#include <base/logstream.h>
+#include <lac/vector.h>
+#include <lac/full_matrix.h>
+#include <lac/eigen.h>
+
+int
+main ()
+{
+  FullMatrix<double> A(5,5), C(5,5), D(5,5), H(5,5);
+  D(0,0) = 1.;
+  D(1,1) = 2.;
+  D(2,2) = 3.;
+  D(3,3) = 4.;
+  D(4,4) = 5.;
+
+  A = D;
+  
+  for (unsigned int i=0;i<4;++i)
+    {
+                                      // Setup rotation matrix
+      C.clear();
+      C.diagadd(1.);
+      C(i,i) = C(i+1,i+1) = cos(i+1);
+      C(i+1,i) = sin(i+1);
+      C(i,i+1) = -sin(i+1);
+
+                                      // Rotate original matrix
+      A.mmult(H,C);
+      C.Tmmult(A,H);
+    }
+
+  A.print_formatted (cout);
+
+  Vector<double> u(5);
+  GrowingVectorMemory<Vector<double> > mem;
+  
+  SolverControl control (500,1.e-8, false, true);
+  
+  {
+    u = 1.;
+    EigenPower<Vector<double> >
+      von_Mises(control, mem, 0.);
+    double eigen = 0.;
+    von_Mises.solve(eigen, A, u);
+    deallog << "Eigenvalue: " << eigen << endl;
+  }
+  {
+    u = 1.;
+    EigenPower<Vector<double> >
+      von_Mises(control, mem, -4.);
+    double eigen = 0.;
+    von_Mises.solve(eigen, A, u);
+    deallog << "Eigenvalue: " << eigen << endl;
+  }
+}
+
+      
index 19a864ceb900b95300eeea037478800b6ada83a9..e7cb4d3b23aab1f5f1634450f55f86bc1b690b97 100644 (file)
@@ -69,6 +69,10 @@ virtual void level_vmult (unsigned int level,
 
     void copy_to_mg(const Vector<TYPE>& rhs);
     void copy_from_mg(Vector<TYPE>& lsg);
+    virtual void print_vector(unsigned int,
+                             const Vector<double> &,
+                             const char *) const;
+
 };
 
 class MGSmootherLAC
@@ -204,6 +208,13 @@ FDMG::copy_from_mg(Vector<TYPE>& v)
   v = solution[maxlevel];
 }
 
+void
+FDMG::print_vector(unsigned int,
+                  const Vector<double> &,
+                  const char *) const
+{}
+
+
 
 MGSmootherLAC::MGSmootherLAC(MGLevelObject<SparseMatrix<double> >& matrix)
                :
index b8cdb2058f8cc37cf84344339b1fd603f965534b..3aa316f2840f6b0a8dbe5790c9a728b015585d99 100644 (file)
@@ -76,6 +76,10 @@ class MGTest
                             Vector<double>& dst,
                             const Vector<double>& src,
                             const Vector<double>& rhs);
+
+    virtual void print_vector(unsigned int,
+                             const Vector<double> &,
+                             const char *) const;
     
     void doit()
       {
@@ -131,6 +135,14 @@ MGTest::level_vmult(unsigned l,
   deallog << "Residual on  " << l << endl;
 }
 
+void
+MGTest::print_vector(unsigned int,
+                    const Vector<double> &,
+                    const char *) const
+{}
+
+
+
 void
 MGCoarseGridTest::operator() (unsigned int level,
                              Vector<double>&,

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.