From: guido Date: Wed, 24 May 2000 20:58:51 +0000 (+0000) Subject: debug functions included X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5f9e16a4890271ee7124b1f11e7d859a48fb106;p=dealii-svn.git debug functions included git-svn-id: https://svn.dealii.org/trunk@2939 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/Makefile.in b/tests/lac/Makefile.in index 2376cb512b..2fabd76914 100644 --- a/tests/lac/Makefile.in +++ b/tests/lac/Makefile.in @@ -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 index 0000000000..441ea4f6e3 --- /dev/null +++ b/tests/lac/full_matrix.cc @@ -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 +#include +#include + +#include +#include +#include +#include + +int +main () +{ + FullMatrix 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 u(5); + GrowingVectorMemory > mem; + + SolverControl control (500,1.e-8, false, true); + + { + u = 1.; + EigenPower > + von_Mises(control, mem, 0.); + double eigen = 0.; + von_Mises.solve(eigen, A, u); + deallog << "Eigenvalue: " << eigen << endl; + } + { + u = 1.; + EigenPower > + von_Mises(control, mem, -4.); + double eigen = 0.; + von_Mises.solve(eigen, A, u); + deallog << "Eigenvalue: " << eigen << endl; + } +} + + diff --git a/tests/lac/mg.cc b/tests/lac/mg.cc index 19a864ceb9..e7cb4d3b23 100644 --- a/tests/lac/mg.cc +++ b/tests/lac/mg.cc @@ -69,6 +69,10 @@ virtual void level_vmult (unsigned int level, void copy_to_mg(const Vector& rhs); void copy_from_mg(Vector& lsg); + virtual void print_vector(unsigned int, + const Vector &, + const char *) const; + }; class MGSmootherLAC @@ -204,6 +208,13 @@ FDMG::copy_from_mg(Vector& v) v = solution[maxlevel]; } +void +FDMG::print_vector(unsigned int, + const Vector &, + const char *) const +{} + + MGSmootherLAC::MGSmootherLAC(MGLevelObject >& matrix) : diff --git a/tests/lac/mgbase.cc b/tests/lac/mgbase.cc index b8cdb2058f..3aa316f284 100644 --- a/tests/lac/mgbase.cc +++ b/tests/lac/mgbase.cc @@ -76,6 +76,10 @@ class MGTest Vector& dst, const Vector& src, const Vector& rhs); + + virtual void print_vector(unsigned int, + const Vector &, + 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 &, + const char *) const +{} + + + void MGCoarseGridTest::operator() (unsigned int level, Vector&,