--- /dev/null
+//---------------------------- petsc_deal_solver_01.cc ---------------------------
+// petsc_deal_solver_01.cc,v 1.33 2003/05/30 19:19:16 guido Exp
+// Version:
+//
+// Copyright (C) 2004 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.
+//
+//---------------------------- petsc_deal_solver_01.cc ---------------------------
+
+// test the CG solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+ VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+ deallog << "Solver type: " << typeid(solver).name() << std::endl;
+
+ u = 0.;
+ f = 1.;
+ try
+ {
+ solver.solve(A,u,f,P);
+ }
+ catch (std::exception& e)
+ {
+ deallog << e.what() << std::endl;
+ abort ();
+ }
+
+ deallog << "Solver stopped after " << solver.control().last_step()
+ << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ std::ofstream logfile("petsc_deal_solver_01.output");
+ logfile.precision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ SolverControl control(100, 1.e-3);
+
+ const unsigned int size = 32;
+ unsigned int dim = (size-1)*(size-1);
+
+ deallog << "Size " << size << " Unknowns " << dim << std::endl;
+
+ // Make matrix
+ FDMatrix testproblem(size, size);
+ petsc_wrappers::SparseMatrix A(dim, dim, 5);
+ testproblem.five_point(A);
+
+ petsc_wrappers::Vector f(dim);
+ petsc_wrappers::Vector u(dim);
+ f = 1.;
+ A.compress ();
+ f.compress ();
+ u.compress ();
+
+ GrowingVectorMemory<petsc_wrappers::Vector> mem;
+ SolverCG<petsc_wrappers::Vector> solver(control,mem);
+ PreconditionIdentity preconditioner;
+ check_solve (solver, A,u,f, preconditioner);
+ }
+ PetscFinalize ();
+}
+
--- /dev/null
+//---------------------------- petsc_deal_solver_02.cc ---------------------------
+// petsc_deal_solver_02.cc,v 1.33 2003/05/30 19:19:16 guido Exp
+// Version:
+//
+// Copyright (C) 2004 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.
+//
+//---------------------------- petsc_deal_solver_02.cc ---------------------------
+
+// test the BiCGStab solver
+
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/solver.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+ VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+ deallog << "Solver type: " << typeid(solver).name() << std::endl;
+
+ u = 0.;
+ f = 1.;
+ try
+ {
+ solver.solve(A,u,f,P);
+ }
+ catch (std::exception& e)
+ {
+ deallog << e.what() << std::endl;
+ abort ();
+ }
+
+ deallog << "Solver stopped after " << solver.control().last_step()
+ << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ std::ofstream logfile("petsc_deal_solver_02.output");
+ logfile.precision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ SolverControl control(100, 1.e-3);
+
+ const unsigned int size = 32;
+ unsigned int dim = (size-1)*(size-1);
+
+ deallog << "Size " << size << " Unknowns " << dim << std::endl;
+
+ // Make matrix
+ FDMatrix testproblem(size, size);
+ petsc_wrappers::SparseMatrix A(dim, dim, 5);
+ testproblem.five_point(A);
+
+ petsc_wrappers::Vector f(dim);
+ petsc_wrappers::Vector u(dim);
+ f = 1.;
+ A.compress ();
+ f.compress ();
+ u.compress ();
+
+ GrowingVectorMemory<petsc_wrappers::Vector> mem;
+ SolverBicgstab<petsc_wrappers::Vector> solver(control,mem);
+ PreconditionIdentity preconditioner;
+ check_solve (solver, A,u,f, preconditioner);
+ }
+ PetscFinalize ();
+}
+
--- /dev/null
+//---------------------------- petsc_deal_solver_03.cc ---------------------------
+// petsc_deal_solver_03.cc,v 1.33 2003/05/30 19:19:16 guido Exp
+// Version:
+//
+// Copyright (C) 2004 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.
+//
+//---------------------------- petsc_deal_solver_03.cc ---------------------------
+
+// test the GMRES solver
+
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/solver.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+ VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+ deallog << "Solver type: " << typeid(solver).name() << std::endl;
+
+ u = 0.;
+ f = 1.;
+ try
+ {
+ solver.solve(A,u,f,P);
+ }
+ catch (std::exception& e)
+ {
+ deallog << e.what() << std::endl;
+ abort ();
+ }
+
+ deallog << "Solver stopped after " << solver.control().last_step()
+ << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ std::ofstream logfile("petsc_deal_solver_03.output");
+ logfile.precision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ SolverControl control(100, 1.e-3);
+
+ const unsigned int size = 32;
+ unsigned int dim = (size-1)*(size-1);
+
+ deallog << "Size " << size << " Unknowns " << dim << std::endl;
+
+ // Make matrix
+ FDMatrix testproblem(size, size);
+ petsc_wrappers::SparseMatrix A(dim, dim, 5);
+ testproblem.five_point(A);
+
+ petsc_wrappers::Vector f(dim);
+ petsc_wrappers::Vector u(dim);
+ f = 1.;
+ A.compress ();
+ f.compress ();
+ u.compress ();
+
+ GrowingVectorMemory<petsc_wrappers::Vector> mem;
+ SolverGMRES<petsc_wrappers::Vector> solver(control,mem);
+ PreconditionIdentity preconditioner;
+ check_solve (solver, A,u,f, preconditioner);
+ }
+ PetscFinalize ();
+}
+
--- /dev/null
+//---------------------------- petsc_deal_solver_04.cc ---------------------------
+// petsc_deal_solver_04.cc,v 1.33 2003/05/30 19:19:16 guido Exp
+// Version:
+//
+// Copyright (C) 2004 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.
+//
+//---------------------------- petsc_deal_solver_04.cc ---------------------------
+
+// test the MINRES solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/solver_minres.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+ VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+ deallog << "Solver type: " << typeid(solver).name() << std::endl;
+
+ u = 0.;
+ f = 1.;
+ try
+ {
+ solver.solve(A,u,f,P);
+ }
+ catch (std::exception& e)
+ {
+ deallog << e.what() << std::endl;
+ abort ();
+ }
+
+ deallog << "Solver stopped after " << solver.control().last_step()
+ << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ std::ofstream logfile("petsc_deal_solver_04.output");
+ logfile.precision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ SolverControl control(100, 1.e-3);
+
+ const unsigned int size = 32;
+ unsigned int dim = (size-1)*(size-1);
+
+ deallog << "Size " << size << " Unknowns " << dim << std::endl;
+
+ // Make matrix
+ FDMatrix testproblem(size, size);
+ petsc_wrappers::SparseMatrix A(dim, dim, 5);
+ testproblem.five_point(A);
+
+ petsc_wrappers::Vector f(dim);
+ petsc_wrappers::Vector u(dim);
+ f = 1.;
+ A.compress ();
+ f.compress ();
+ u.compress ();
+
+ GrowingVectorMemory<petsc_wrappers::Vector> mem;
+ SolverMinRes<petsc_wrappers::Vector> solver(control,mem);
+ PreconditionIdentity preconditioner;
+ check_solve (solver, A,u,f, preconditioner);
+ }
+ PetscFinalize ();
+}
+
--- /dev/null
+//---------------------------- petsc_deal_solver_05.cc ---------------------------
+// petsc_deal_solver_05.cc,v 1.33 2003/05/30 19:19:16 guido Exp
+// Version:
+//
+// Copyright (C) 2004 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.
+//
+//---------------------------- petsc_deal_solver_05.cc ---------------------------
+
+// test the QMRS solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+ VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+ deallog << "Solver type: " << typeid(solver).name() << std::endl;
+
+ u = 0.;
+ f = 1.;
+ try
+ {
+ solver.solve(A,u,f,P);
+ }
+ catch (std::exception& e)
+ {
+ deallog << e.what() << std::endl;
+ abort ();
+ }
+
+ deallog << "Solver stopped after " << solver.control().last_step()
+ << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ std::ofstream logfile("petsc_deal_solver_05.output");
+ logfile.precision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ SolverControl control(100, 1.e-3);
+
+ const unsigned int size = 32;
+ unsigned int dim = (size-1)*(size-1);
+
+ deallog << "Size " << size << " Unknowns " << dim << std::endl;
+
+ // Make matrix
+ FDMatrix testproblem(size, size);
+ petsc_wrappers::SparseMatrix A(dim, dim, 5);
+ testproblem.five_point(A);
+
+ petsc_wrappers::Vector f(dim);
+ petsc_wrappers::Vector u(dim);
+ f = 1.;
+ A.compress ();
+ f.compress ();
+ u.compress ();
+
+ GrowingVectorMemory<petsc_wrappers::Vector> mem;
+ SolverQMRS<petsc_wrappers::Vector> solver(control,mem);
+ PreconditionIdentity preconditioner;
+ check_solve (solver, A,u,f, preconditioner);
+ }
+ PetscFinalize ();
+}
+
--- /dev/null
+//---------------------------- petsc_deal_solver_06.cc ---------------------------
+// petsc_deal_solver_06.cc,v 1.33 2003/05/30 19:19:16 guido Exp
+// Version:
+//
+// Copyright (C) 2004 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.
+//
+//---------------------------- petsc_deal_solver_06.cc ---------------------------
+
+// test the Richardson solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+ VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+ deallog << "Solver type: " << typeid(solver).name() << std::endl;
+
+ u = 0.;
+ f = 1.;
+ try
+ {
+ solver.solve(A,u,f,P);
+ }
+ catch (std::exception& e)
+ {
+ deallog << e.what() << std::endl;
+ }
+
+ deallog << "Solver stopped after " << solver.control().last_step()
+ << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+ PetscInitialize(&argc,&argv,0,0);
+ {
+ std::ofstream logfile("petsc_deal_solver_06.output");
+ logfile.precision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+
+ const unsigned int size = 32;
+ unsigned int dim = (size-1)*(size-1);
+ SolverControl control(10000, 1.e-3);
+
+ deallog << "Size " << size << " Unknowns " << dim << std::endl;
+
+ // Make matrix
+ FDMatrix testproblem(size, size);
+ petsc_wrappers::SparseMatrix A(dim, dim, 5);
+ testproblem.five_point(A);
+
+ petsc_wrappers::Vector f(dim);
+ petsc_wrappers::Vector u(dim);
+ f = 1.;
+ A.compress ();
+ f.compress ();
+ u.compress ();
+
+ GrowingVectorMemory<petsc_wrappers::Vector> mem;
+ SolverRichardson<petsc_wrappers::Vector> solver(control,mem);
+ PreconditionIdentity preconditioner;
+ check_solve (solver, A,u,f, preconditioner);
+ }
+ PetscFinalize ();
+}
+
--- /dev/null
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: 8SolverCGIN14petsc_wrappers6VectorEE
+DEAL:cg::Starting value 31.00
+DEAL:cg::Convergence step 43 value 0.0008189
+DEAL::Solver stopped after 43 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 4
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 4
--- /dev/null
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: 14SolverBicgstabIN14petsc_wrappers6VectorEE
+DEAL:Bicgstab::Starting value 31.00
+DEAL:Bicgstab::Convergence step 35 value 0.0004909
+DEAL::Solver stopped after 35 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 8
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 8
--- /dev/null
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: 11SolverGMRESIN14petsc_wrappers6VectorEE
+DEAL:GMRES::Starting value 31.00
+DEAL:GMRES::Convergence step 75 value 0.0008096
+DEAL::Solver stopped after 75 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 30
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 30
--- /dev/null
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: 10SolverQMRSIN14petsc_wrappers6VectorEE
+DEAL:QMRS::Starting value 31.00
+DEAL:QMRS::Convergence step 46 value 0.0009063
+DEAL::Solver stopped after 46 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 5
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 5
--- /dev/null
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: 16SolverRichardsonIN14petsc_wrappers6VectorEE
+DEAL:Richardson::Starting value 31.00
+DEAL:Richardson::Failure step 372 value nan
+DEAL::Iterative method reported convergence failure in step 372 with residual nan
+DEAL::Solver stopped after 372 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 2
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 2