From: bangerth Date: Thu, 23 Oct 2008 02:08:33 +0000 (+0000) Subject: Add a bunch of tests for Trilinos. Many of them fail right now, we'll work on that... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4c440468b641429a5a11255e3127e064d307aca;p=dealii-svn.git Add a bunch of tests for Trilinos. Many of them fail right now, we'll work on that over time. git-svn-id: https://svn.dealii.org/trunk@17308 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/Makefile b/tests/Makefile index b8e367f8a5..5da88de4af 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -15,6 +15,7 @@ nofail-dirs = base \ hp \ aniso \ $(shell if test "$(USE_CONTRIB_PETSC)" = yes ; then echo petsc ; fi) \ + $(shell if test "$(USE_CONTRIB_TRILINOS)" = yes ; then echo trilinos ; fi) \ $(shell if test "$(USE_CONTRIB_UMFPACK)" = yes ; then echo umfpack ; fi) \ $(shell if grep -q 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ;\ then echo umfpack ; fi) diff --git a/tests/trilinos/01.cc b/tests/trilinos/01.cc new file mode 100644 index 0000000000..0c63dfd717 --- /dev/null +++ b/tests/trilinos/01.cc @@ -0,0 +1,91 @@ +//---------------------------- trilinos_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_01.cc --------------------------- + + +// check setting elements in a petsc matrix using +// TrilinosWrappers::SparseMatrix::set() + +#include "../tests.h" +#include +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + Assert (m.m() == 5, ExcInternalError()); + Assert (m.n() == 5, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("04/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::SparseMatrix m (5,5,3); + test (m); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/04/cmp/generic b/tests/trilinos/04/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/04/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/05.cc b/tests/trilinos/05.cc new file mode 100644 index 0000000000..2a5503adb8 --- /dev/null +++ b/tests/trilinos/05.cc @@ -0,0 +1,86 @@ +//---------------------------- trilinos_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_05.cc --------------------------- + + +// check querying the number of nonzero elements in +// TrilinosWrappers::SparseMatrix + +#include "../tests.h" +#include +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + unsigned int counter = 0; + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + PetscScalar norm = 0; + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + bool flag = false; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + double norm = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + PetscScalar norm = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + double norm = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector, but disjoint sets of elements + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector, and record the expected scalar + // product + double product = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + v.reinit (13, true); + + Assert (v.size() == 13, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("29/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::Vector v (100); + test (v); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/29/cmp/generic b/tests/trilinos/29/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/29/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/30.cc b/tests/trilinos/30.cc new file mode 100644 index 0000000000..6e34b81489 --- /dev/null +++ b/tests/trilinos/30.cc @@ -0,0 +1,81 @@ +//---------------------------- trilinos_30.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_30.cc --------------------------- + + +// check TrilinosWrappers::Vector::reinit(!fast) + +#include "../tests.h" +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + PetscScalar norm = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + PetscScalar sum = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + PetscScalar sum = 0; + for (unsigned int i=0; i (1./3.)); + Assert (std::fabs(v.lp_norm(3) - true_value) < eps*true_value, + ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("33/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::Vector v (100); + test (v); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/33/cmp/generic b/tests/trilinos/33/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/33/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/34.cc b/tests/trilinos/34.cc new file mode 100644 index 0000000000..317382aad6 --- /dev/null +++ b/tests/trilinos/34.cc @@ -0,0 +1,84 @@ +//---------------------------- trilinos_34.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_34.cc --------------------------- + + +// check TrilinosWrappers::Vector::all_zero + +#include "../tests.h" +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some elements of the vector + double sum = 0; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x, + TrilinosWrappers::Vector &y) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x) +{ + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x) +{ + for (unsigned int i=0; i) + +#include "../tests.h" +#include +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + Vector w (v.size()); + + for (unsigned int i=0; i) with T!=PetscScalar + +#include "../tests.h" +#include +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + Vector w (v.size()); + Vector x (v.size()); + + for (unsigned int i=0; i must be different from + // PetscScalar + v = w; + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i row_lengths (5, 3U); + row_lengths.back() = 2; + TrilinosWrappers::SparseMatrix m (5,5,row_lengths); + test (m); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/52/cmp/generic b/tests/trilinos/52/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/52/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/53.cc b/tests/trilinos/53.cc new file mode 100644 index 0000000000..db662706bf --- /dev/null +++ b/tests/trilinos/53.cc @@ -0,0 +1,91 @@ +//---------------------------- trilinos_53.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_53.cc --------------------------- + + +// check TrilinosWrappers::Vector::operator() in set, and later in add-mode + +#include "../tests.h" +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. have a bit pattern of where we + // actually wrote elements to + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. they are all positive + std::vector pattern (v.size(), false); + for (unsigned int i=0; i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. + std::vector pattern (v.size(), false); + for (unsigned int i=0; i w (v); + Vector x (v); + + for (unsigned int i=0; i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. + std::vector pattern (v.size(), false); + for (unsigned int i=0; i w (v); + Vector x (v); + + TrilinosWrappers::Vector w1 (w); + TrilinosWrappers::Vector x1 (x); + + for (unsigned int i=0; i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. + std::vector pattern (v.size(), false); + for (unsigned int i=0; i w; w=v; + Vector x; x=v; + + for (unsigned int i=0; i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + // set only certain elements of the + // vector. + std::vector pattern (v.size(), false); + for (unsigned int i=0; i w; w=v; + Vector x; x=v; + + TrilinosWrappers::Vector w1; w1=w; + TrilinosWrappers::Vector x1; x1=x; + + for (unsigned int i=0; i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::MatrixBase &m) +{ + Assert (m.m() != 0, ExcInternalError()); + Assert (m.n() != 0, ExcInternalError()); + + m.clear (); + + Assert (m.m() == 0, ExcInternalError()); + Assert (m.n() == 0, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("62/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::SparseMatrix v (100,100,5); + test (v); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/62/cmp/generic b/tests/trilinos/62/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/62/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/63.cc b/tests/trilinos/63.cc new file mode 100644 index 0000000000..9fdf84f581 --- /dev/null +++ b/tests/trilinos/63.cc @@ -0,0 +1,77 @@ +//---------------------------- trilinos_63.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_63.cc --------------------------- + + +#include "../tests.h" +#include +#include + +#include +#include +#include + + +void test (TrilinosWrappers::MatrixBase &m) +{ + Assert (m.m() == 100, ExcInternalError()); + Assert (m.n() == 100, ExcInternalError()); + + m = 0; + + Assert (m.m() == 100, ExcInternalError()); + Assert (m.n() == 100, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("63/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::SparseMatrix v (100,100,5); + test (v); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/63/cmp/generic b/tests/trilinos/63/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/63/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/64.cc b/tests/trilinos/64.cc new file mode 100644 index 0000000000..669aacc7a9 --- /dev/null +++ b/tests/trilinos/64.cc @@ -0,0 +1,98 @@ +//---------------------------- trilinos_64.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_64.cc --------------------------- + + +// This test should be run on multiple processors. note that this test also +// started to fail with the upgrade to petsc 2.2.1 which required a fix in +// TrilinosWrappers::MatrixBase::operator= + + +#include "../tests.h" +#include +#include +#include + +#include +#include +#include + + +template +void test (MatrixType &m) +{ + m.add(0,0,1); + m = 0; + m.compress(); + + Assert(fabs(m.frobenius_norm())<1e-15, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("64/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + const unsigned int n_dofs=420; + // check + // TrilinosWrappers::SparseMatrix + TrilinosWrappers::SparseMatrix + v1 (n_dofs, n_dofs, 5); + test (v1); + + // check + // TrilinosWrappers::MPI::SparseMatrix + MPI_Comm mpi_communicator (MPI_COMM_WORLD); + int n_jobs=1; + MPI_Comm_size (mpi_communicator, &n_jobs); + const unsigned int n_mpi_processes=static_cast(n_jobs); + Assert(n_dofs%n_mpi_processes==0, ExcInternalError()); + const unsigned int n_local_dofs=n_dofs/n_mpi_processes; + TrilinosWrappers::MPI::SparseMatrix + v2 (mpi_communicator, n_dofs, n_dofs, n_local_dofs, n_local_dofs, 5); + test (v2); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/64/cmp/generic b/tests/trilinos/64/cmp/generic new file mode 100644 index 0000000000..8b3b075900 --- /dev/null +++ b/tests/trilinos/64/cmp/generic @@ -0,0 +1,3 @@ + +DEAL::OK +DEAL::OK diff --git a/tests/trilinos/65.cc b/tests/trilinos/65.cc new file mode 100644 index 0000000000..cf74b47295 --- /dev/null +++ b/tests/trilinos/65.cc @@ -0,0 +1,74 @@ +//---------------------------- trilinos_65.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_65.cc --------------------------- + + +// This test used to fail after upgrading to petsc 2.2.1 + + +#include "../tests.h" +#include + +#include +#include +#include + + +void test () +{ + TrilinosWrappers::MPI::Vector v(PETSC_COMM_WORLD, 100, 100); + v(0) = 1; + v = 0; + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("65/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + test (); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/65/cmp/generic b/tests/trilinos/65/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/65/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/66.cc b/tests/trilinos/66.cc new file mode 100644 index 0000000000..679d927230 --- /dev/null +++ b/tests/trilinos/66.cc @@ -0,0 +1,133 @@ +//---------------------------- trilinos_66.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_66.cc --------------------------- + + +// check TrilinosWrappers::MatrixBase::clear_row () + +#include "../tests.h" +#include +#include + +#include +#include +#include + + +void test (TrilinosWrappers::MatrixBase &m) +{ + Assert (m.m() != 0, ExcInternalError()); + Assert (m.n() != 0, ExcInternalError()); + + // build a tri-diagonal pattern + double norm_sqr = 0; + unsigned int nnz = 0; + const unsigned int N = m.m(); + for (unsigned int i=0; i=5) + { + const double s = rand(); + m.add (i,i-5, s); + norm_sqr += s*s; + ++nnz; + } + + if (i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::MatrixBase &m) +{ + Assert (m.m() != 0, ExcInternalError()); + Assert (m.n() != 0, ExcInternalError()); + + // build a tri-diagonal pattern + double norm_sqr = 0; + unsigned int nnz = 0; + const unsigned int N = m.m(); + for (unsigned int i=0; i=5) + { + const double s = rand(); + m.add (i,i-5, s); + norm_sqr += s*s; + ++nnz; + } + + if (i(&rows[0], &rows[2])); + + deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr) + << std::endl; + deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl; + + Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr)) + < std::fabs (std::sqrt (norm_sqr)), + ExcInternalError()); + + // make sure that zeroing out rows does at + // least not add new nonzero entries (it + // may remove some, though) + Assert (m.n_nonzero_elements() <= nnz, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("67/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::SparseMatrix v (14,14,3); + test (v); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/67/cmp/generic b/tests/trilinos/67/cmp/generic new file mode 100644 index 0000000000..8a0f539840 --- /dev/null +++ b/tests/trilinos/67/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::7.15267e+09 7.15267e+09 +DEAL::32 32 +DEAL::6.71272e+09 6.71272e+09 +DEAL::29 32 +DEAL::OK diff --git a/tests/trilinos/67/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/67/cmp/powerpc-apple-darwin8.10.0+gcc4.0 new file mode 100644 index 0000000000..6094697881 --- /dev/null +++ b/tests/trilinos/67/cmp/powerpc-apple-darwin8.10.0+gcc4.0 @@ -0,0 +1,6 @@ + +DEAL::6.88709e+09 6.88709e+09 +DEAL::32 32 +DEAL::6.20640e+09 6.20640e+09 +DEAL::27 32 +DEAL::OK diff --git a/tests/trilinos/67/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/67/cmp/x86_64-unknown-linux-gnu+gcc3.3 new file mode 100644 index 0000000000..729838e63f --- /dev/null +++ b/tests/trilinos/67/cmp/x86_64-unknown-linux-gnu+gcc3.3 @@ -0,0 +1,6 @@ + +DEAL::7.15267e+09 7.15267e+09 +DEAL::32 32 +DEAL::6.71272e+09 6.71272e+09 +DEAL::27 32 +DEAL::OK diff --git a/tests/trilinos/68.cc b/tests/trilinos/68.cc new file mode 100644 index 0000000000..5c4412fc7c --- /dev/null +++ b/tests/trilinos/68.cc @@ -0,0 +1,137 @@ +//---------------------------- trilinos_68.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_68.cc --------------------------- + + +// check TrilinosWrappers::MatrixBase::clear_row () with used second argument + +#include "../tests.h" +#include +#include + +#include +#include +#include + + +void test (TrilinosWrappers::MatrixBase &m) +{ + Assert (m.m() != 0, ExcInternalError()); + Assert (m.n() != 0, ExcInternalError()); + + // build a tri-diagonal pattern + double norm_sqr = 0; + unsigned int nnz = 0; + const unsigned int N = m.m(); + for (unsigned int i=0; i=5) + { + const double s = rand(); + m.add (i,i-5, s); + norm_sqr += s*s; + ++nnz; + } + + if (i +#include + +#include +#include +#include + + +void test (TrilinosWrappers::MatrixBase &m) +{ + Assert (m.m() != 0, ExcInternalError()); + Assert (m.n() != 0, ExcInternalError()); + + // build a tri-diagonal pattern + double norm_sqr = 0; + unsigned int nnz = 0; + const unsigned int N = m.m(); + for (unsigned int i=0; i=5) + { + const double s = rand(); + m.add (i,i-5, s); + norm_sqr += s*s; + ++nnz; + } + + if (i(&rows[0], &rows[2]), rnd); + + deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr) + << std::endl; + deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl; + + Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr)) + < std::fabs (std::sqrt (norm_sqr)), + ExcInternalError()); + + // make sure that zeroing out rows does at + // least not add new nonzero entries (it + // may remove some, though) + Assert (m.n_nonzero_elements() <= nnz, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("69/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::SparseMatrix v (14,14,3); + test (v); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/69/cmp/generic b/tests/trilinos/69/cmp/generic new file mode 100644 index 0000000000..2000691fac --- /dev/null +++ b/tests/trilinos/69/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::7.15267e+09 7.15267e+09 +DEAL::32 32 +DEAL::6.96580e+09 6.96580e+09 +DEAL::29 32 +DEAL::OK diff --git a/tests/trilinos/69/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/69/cmp/powerpc-apple-darwin8.10.0+gcc4.0 new file mode 100644 index 0000000000..1a75a21781 --- /dev/null +++ b/tests/trilinos/69/cmp/powerpc-apple-darwin8.10.0+gcc4.0 @@ -0,0 +1,6 @@ + +DEAL::6.88709e+09 6.88709e+09 +DEAL::32 32 +DEAL::6.25737e+09 6.25737e+09 +DEAL::29 32 +DEAL::OK diff --git a/tests/trilinos/70.cc b/tests/trilinos/70.cc new file mode 100644 index 0000000000..8536246ac1 --- /dev/null +++ b/tests/trilinos/70.cc @@ -0,0 +1,36 @@ +//---------------------------- trilinos_70.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_70.cc --------------------------- + + +// check PetscScalar + +#include "../tests.h" +#include +#include + +#include + +int main () +{ + std::ofstream logfile("70/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + if (typeid(PetscScalar)==typeid(double)) + deallog << "double" << std::endl; + else if (typeid(PetscScalar)==typeid(float)) + deallog << "float" << std::endl; + else + Assert(false, ExcNotImplemented()); +} diff --git a/tests/trilinos/70/cmp/generic b/tests/trilinos/70/cmp/generic new file mode 100644 index 0000000000..04c108ac22 --- /dev/null +++ b/tests/trilinos/70/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::double diff --git a/tests/trilinos/Makefile b/tests/trilinos/Makefile new file mode 100644 index 0000000000..381c3f731a --- /dev/null +++ b/tests/trilinos/Makefile @@ -0,0 +1,39 @@ +############################################################ +# $Id$ +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors +############################################################ + +############################################################ +# Include general settings for including DEAL libraries +############################################################ + +include ../Makefile.paths +include $D/common/Make.global_options +debug-mode = on + +libraries = $(lib-lac.g) \ + $(lib-base.g) +libraries_o = $(lib-lac.o) \ + $(lib-base.o) + +default: run-tests + +############################################################ + +tests_x = * + + +# from above list of regular expressions, generate the real set of +# tests +expand = $(shell echo $(addsuffix .cc,$(1)) \ + | $(PERL) -pi -e 's/\.cc//g;') +tests = $(call expand,$(tests_x)) + +############################################################ + + +include ../Makefile.rules +include Makefile.depend +include Makefile.tests + +.PHONY: default \ No newline at end of file diff --git a/tests/trilinos/block_vector_iterator_01.cc b/tests/trilinos/block_vector_iterator_01.cc new file mode 100644 index 0000000000..132a13813f --- /dev/null +++ b/tests/trilinos/block_vector_iterator_01.cc @@ -0,0 +1,115 @@ +//---------------------------- trilinos_block_vector_iterator_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_block_vector_iterator_01.cc --------------------------- + + +// make sure that block vector iterator allows reading and writing correctly + +#include "../tests.h" +#include +#include +#include + + +void test () +{ + TrilinosWrappers::BlockVector v(2,1); + v(0) = 1; + v(1) = 2; + + // first check reading through a const + // iterator + { + TrilinosWrappers::BlockVector::const_iterator i=v.begin(); + Assert (*i == 1, ExcInternalError()); + ++i; + Assert (*i == 2, ExcInternalError()); + } + + // same, but create iterator in a different + // way + { + TrilinosWrappers::BlockVector::const_iterator + i=const_cast(v).begin(); + Assert (*i == 1, ExcInternalError()); + ++i; + Assert (*i == 2, ExcInternalError()); + } + + // read through a read-write iterator + { + TrilinosWrappers::BlockVector::iterator i = v.begin(); + Assert (*i == 1, ExcInternalError()); + ++i; + Assert (*i == 2, ExcInternalError()); + } + + // write through a read-write iterator + { + TrilinosWrappers::BlockVector::iterator i = v.begin(); + + *i = 2; + ++i; + *i = 3; + } + + // and read again + { + TrilinosWrappers::BlockVector::iterator i = v.begin(); + Assert (*i == 2, ExcInternalError()); + ++i; + Assert (*i == 3, ExcInternalError()); + } + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("block_vector_iterator_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + test (); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/block_vector_iterator_01/cmp/generic b/tests/trilinos/block_vector_iterator_01/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/block_vector_iterator_01/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/block_vector_iterator_02.cc b/tests/trilinos/block_vector_iterator_02.cc new file mode 100644 index 0000000000..b68c61618e --- /dev/null +++ b/tests/trilinos/block_vector_iterator_02.cc @@ -0,0 +1,109 @@ +//---------------------------- trilinos_block_vector_iterator_02.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_block_vector_iterator_02.cc --------------------------- + + +// like _01, except that we use operator[] instead of operator* + +#include "../tests.h" +#include +#include +#include + + +void test () +{ + TrilinosWrappers::BlockVector v(2,1); + v(0) = 1; + v(1) = 2; + + // first check reading through a const + // iterator + { + TrilinosWrappers::BlockVector::const_iterator i=v.begin(); + Assert (i[0] == 1, ExcInternalError()); + Assert (i[1] == 2, ExcInternalError()); + } + + // same, but create iterator in a different + // way + { + TrilinosWrappers::BlockVector::const_iterator + i=const_cast(v).begin(); + Assert (i[0] == 1, ExcInternalError()); + Assert (i[1] == 2, ExcInternalError()); + } + + // read through a read-write iterator + { + TrilinosWrappers::BlockVector::iterator i = v.begin(); + Assert (i[0] == 1, ExcInternalError()); + Assert (i[1] == 2, ExcInternalError()); + } + + // write through a read-write iterator + { + TrilinosWrappers::BlockVector::iterator i = v.begin(); + i[0] = 2; + i[1] = 3; + } + + // and read again + { + TrilinosWrappers::BlockVector::iterator i = v.begin(); + Assert (i[0] == 2, ExcInternalError()); + Assert (i[1] == 3, ExcInternalError()); + } + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("block_vector_iterator_02/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + test (); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/block_vector_iterator_02/cmp/generic b/tests/trilinos/block_vector_iterator_02/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/block_vector_iterator_02/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/block_vector_iterator_03.cc b/tests/trilinos/block_vector_iterator_03.cc new file mode 100644 index 0000000000..056af8dd7a --- /dev/null +++ b/tests/trilinos/block_vector_iterator_03.cc @@ -0,0 +1,364 @@ +//-------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 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. +// +//-------------------------------------------------------------------- + +// this test is an adaptation of lac/block_vector_iterator for PETSc block +// vectors + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +bool operator == (const TrilinosWrappers::BlockVector &v1, + const TrilinosWrappers::BlockVector &v2) +{ + if (v1.size() != v2.size()) + return false; + for (unsigned int i=0; i ivector(4); + ivector[0] = 2; + ivector[1] = 4; + ivector[2] = 3; + ivector[3] = 5; + + // Check 1: initialization via + // iterators + if (true) + { + TrilinosWrappers::BlockVector v1(ivector); + TrilinosWrappers::BlockVector v2(ivector); + + // initialize first vector with + // simple loop + for (unsigned int i=0; i(v1.size()) ? + "true" : "false") + << std::endl; + + // check std::copy + TrilinosWrappers::BlockVector v2(ivector); + std::copy (v1.begin(), v1.end(), v2.begin()); + deallog << "Check 6: " << (v1 == v2 ? "true" : "false") << std::endl; + + // check std::transform + std::transform (v1.begin(), v1.end(), v2.begin(), + std::bind2nd (std::multiplies(), + 2.0)); + v2 *= 1./2.; + deallog << "Check 7: " << (v1 == v2 ? "true" : "false") << std::endl; + + + // check operators +/-, +=/-= + deallog << "Check 8: " + << (std::distance(v1.begin(), v1.begin()+3) == 3 ? + "true" : "false") + << std::endl; + deallog << "Check 9: " + << (std::distance(v1.end()-6, v1.end()) == 6 ? + "true" : "false") + << std::endl; + deallog << "Check 10: " + << (std::distance(v1.begin(), v1.end()) == (signed)v1.size() ? + "true" : "false") + << std::endl; + deallog << "Check 11: " + << (std::distance(v1.begin(), (v1.begin()+=7)) == 7 ? + "true" : "false") + << std::endl; + deallog << "Check 12: " + << (std::distance((v1.end()-=4), v1.end()) == 4 ? + "true" : "false") + << std::endl; + + // check advance + TrilinosWrappers::BlockVector::iterator p2 = v1.begin(); + std::advance (p2, v1.size()); + deallog << "Check 13: " << (p2 == v1.end() ? "true" : "false") << std::endl; + + TrilinosWrappers::BlockVector::const_iterator p3 = v1.begin(); + std::advance (p3, v1.size()); + deallog << "Check 14: " << (p3 == v1.end() ? "true" : "false") << std::endl; + }; + + // Check 15: initialization through + // iterators + if (true) + { + TrilinosWrappers::BlockVector v1(ivector); + // initialize first vector with + // simple loop + for (unsigned int i=0; i v2(v1.begin(), v1.end()); + + // and reverse way + TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end()); + deallog << "Check 15: " << (v1==v3 ? "true" : "false") << std::endl; + }; + + // Check 16: initialization through + // iterators. variant with one + // constant object + if (true) + { + TrilinosWrappers::BlockVector v1(ivector); + // initialize first vector with + // simple loop + for (unsigned int i=0; i v2(v1.begin(), v1.end()); + + // and reverse way + TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end()); + deallog << "Check 16: " << (v1==v3 ? "true" : "false") << std::endl; + }; + + // Check 17: initialization through + // iterators. variant with two + // constant object + if (true) + { + TrilinosWrappers::BlockVector v1(ivector); + // initialize first vector with + // simple loop + for (unsigned int i=0; i v2(v1.begin(), v1.end()); + + // and reverse way + const TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end()); + deallog << "Check 17: " << (v1==v3 ? "true" : "false") << std::endl; + }; + + // Check 18: initialization through + // iterators. variant with three + // constant object + if (true) + { + TrilinosWrappers::BlockVector v0(ivector); + // initialize first vector with + // simple loop + for (unsigned int i=0; i v2(v1.begin(), v1.end()); + + // and reverse way + const TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end()); + deallog << "Check 18: " << (v1==v3 ? "true" : "false") << std::endl; + }; + + // Check 19: operator[] + if (true) + { + TrilinosWrappers::BlockVector v1(ivector); + for (unsigned int i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("deal_solver_01/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + GrowingVectorMemory mem; + SolverCG solver(control,mem); + PreconditionIdentity preconditioner; + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/deal_solver_01/cmp/generic b/tests/trilinos/deal_solver_01/cmp/generic new file mode 100644 index 0000000000..72d2bc0d11 --- /dev/null +++ b/tests/trilinos/deal_solver_01/cmp/generic @@ -0,0 +1,8 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii8SolverCGINS_13PETScWrappers6VectorEEE +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 diff --git a/tests/trilinos/deal_solver_02.cc b/tests/trilinos/deal_solver_02.cc new file mode 100644 index 0000000000..ede7e691ba --- /dev/null +++ b/tests/trilinos/deal_solver_02.cc @@ -0,0 +1,96 @@ +//---------------------------- trilinos_deal_solver_02.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_deal_solver_02.cc --------------------------- + +// test the BiCGStab solver using the PETSc matrix and vector classes + + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("deal_solver_02/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + GrowingVectorMemory mem; + SolverBicgstab solver(control,mem); + PreconditionIdentity preconditioner; + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/deal_solver_02/cmp/generic b/tests/trilinos/deal_solver_02/cmp/generic new file mode 100644 index 0000000000..6a6c9d882e --- /dev/null +++ b/tests/trilinos/deal_solver_02/cmp/generic @@ -0,0 +1,8 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii14SolverBicgstabINS_13PETScWrappers6VectorEEE +DEAL:Bicgstab::Starting value 31.00 +DEAL:Bicgstab::Convergence step 29 value 0.0008735 +DEAL::Solver stopped after 29 iterations +DEAL::GrowingVectorMemory:Overall allocated vectors: 8 +DEAL::GrowingVectorMemory:Maximum allocated vectors: 8 diff --git a/tests/trilinos/deal_solver_03.cc b/tests/trilinos/deal_solver_03.cc new file mode 100644 index 0000000000..d435f1edc0 --- /dev/null +++ b/tests/trilinos/deal_solver_03.cc @@ -0,0 +1,96 @@ +//---------------------------- trilinos_deal_solver_03.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_deal_solver_03.cc --------------------------- + +// test the GMRES solver using the PETSc matrix and vector classes + + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("deal_solver_03/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + GrowingVectorMemory mem; + SolverGMRES solver(control,mem); + PreconditionIdentity preconditioner; + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/deal_solver_03/cmp/generic b/tests/trilinos/deal_solver_03/cmp/generic new file mode 100644 index 0000000000..d5452305fa --- /dev/null +++ b/tests/trilinos/deal_solver_03/cmp/generic @@ -0,0 +1,8 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii11SolverGMRESINS_13PETScWrappers6VectorEEE +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 diff --git a/tests/trilinos/deal_solver_04.cc b/tests/trilinos/deal_solver_04.cc new file mode 100644 index 0000000000..551342016c --- /dev/null +++ b/tests/trilinos/deal_solver_04.cc @@ -0,0 +1,95 @@ +//---------------------------- trilinos_deal_solver_04.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_deal_solver_04.cc --------------------------- + +// test the MINRES solver using the PETSc matrix and vector classes + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("deal_solver_04/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + GrowingVectorMemory mem; + SolverMinRes solver(control,mem); + PreconditionIdentity preconditioner; + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/deal_solver_04/cmp/generic b/tests/trilinos/deal_solver_04/cmp/generic new file mode 100644 index 0000000000..e323192fbb --- /dev/null +++ b/tests/trilinos/deal_solver_04/cmp/generic @@ -0,0 +1,8 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii12SolverMinResINS_13PETScWrappers6VectorEEE +DEAL:minres::Starting value 31.00 +DEAL:minres::Convergence step 43 value 0.0006916 +DEAL::Solver stopped after 43 iterations +DEAL::GrowingVectorMemory:Overall allocated vectors: 7 +DEAL::GrowingVectorMemory:Maximum allocated vectors: 7 diff --git a/tests/trilinos/deal_solver_05.cc b/tests/trilinos/deal_solver_05.cc new file mode 100644 index 0000000000..c6a2b3b06f --- /dev/null +++ b/tests/trilinos/deal_solver_05.cc @@ -0,0 +1,94 @@ +//---------------------------- trilinos_deal_solver_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_deal_solver_05.cc --------------------------- + +// test the QMRS solver using the PETSc matrix and vector classes + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("deal_solver_05/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + GrowingVectorMemory mem; + SolverQMRS solver(control,mem); + PreconditionIdentity preconditioner; + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/deal_solver_05/cmp/generic b/tests/trilinos/deal_solver_05/cmp/generic new file mode 100644 index 0000000000..d864cd6c23 --- /dev/null +++ b/tests/trilinos/deal_solver_05/cmp/generic @@ -0,0 +1,8 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii10SolverQMRSINS_13PETScWrappers6VectorEEE +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 diff --git a/tests/trilinos/deal_solver_06.cc b/tests/trilinos/deal_solver_06.cc new file mode 100644 index 0000000000..8b36eaf271 --- /dev/null +++ b/tests/trilinos/deal_solver_06.cc @@ -0,0 +1,92 @@ +//---------------------------- trilinos_deal_solver_06.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_deal_solver_06.cc --------------------------- + +// test the Richardson solver using the PETSc matrix and vector classes + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("deal_solver_06/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + GrowingVectorMemory mem; + SolverRichardson solver(control,mem); + PreconditionIdentity preconditioner; + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/deal_solver_06/cmp/generic b/tests/trilinos/deal_solver_06/cmp/generic new file mode 100644 index 0000000000..487ad5bc2c --- /dev/null +++ b/tests/trilinos/deal_solver_06/cmp/generic @@ -0,0 +1,9 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii16SolverRichardsonINS_13PETScWrappers6VectorEEE +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 diff --git a/tests/trilinos/deal_solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/deal_solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 new file mode 100644 index 0000000000..de4c75be9b --- /dev/null +++ b/tests/trilinos/deal_solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 @@ -0,0 +1,9 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii16SolverRichardsonINS_13PETScWrappers6VectorEEE +DEAL:Richardson::Starting value 31.00 +DEAL:Richardson::Failure step 10000 value nan +DEAL::Iterative method reported convergence failure in step 10000 with residual nan +DEAL::Solver stopped after 10000 iterations +DEAL::GrowingVectorMemory:Overall allocated vectors: 2 +DEAL::GrowingVectorMemory:Maximum allocated vectors: 2 diff --git a/tests/trilinos/full_matrix_01.cc b/tests/trilinos/full_matrix_01.cc new file mode 100644 index 0000000000..5c7138ee20 --- /dev/null +++ b/tests/trilinos/full_matrix_01.cc @@ -0,0 +1,91 @@ +//---------------------------- trilinos_full_matrix_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_full_matrix_01.cc --------------------------- + + +// check setting elements in a petsc matrix using +// TrilinosWrappers::FullMatrix::set() + +#include "../tests.h" +#include +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + Assert (m.m() == 5, ExcInternalError()); + Assert (m.n() == 5, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("full_matrix_04/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + TrilinosWrappers::FullMatrix m (5,5); + test (m); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/full_matrix_04/cmp/generic b/tests/trilinos/full_matrix_04/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/trilinos/full_matrix_04/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/trilinos/full_matrix_05.cc b/tests/trilinos/full_matrix_05.cc new file mode 100644 index 0000000000..f5b86a3dc6 --- /dev/null +++ b/tests/trilinos/full_matrix_05.cc @@ -0,0 +1,101 @@ +//---------------------------- trilinos_full_matrix_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005, 2007 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. +// +//---------------------------- trilinos_full_matrix_05.cc --------------------------- + + +// check querying the number of nonzero elements in +// TrilinosWrappers::FullMatrix + +#include "../tests.h" +#include +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + unsigned int counter = 0; + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + PetscScalar norm = 0; + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (TrilinosWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test () +{ + TrilinosWrappers::FullMatrix m(5,5); + m.set (0,0,1); + m.set (1,1,2); + m.set (1,2,3); + m.compress (); + TrilinosWrappers::FullMatrix::const_iterator i = m.begin(); + deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl; + ++i; + deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl; + i++; + deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("full_matrix_iterator_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + test (); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/full_matrix_iterator_01/cmp/generic b/tests/trilinos/full_matrix_iterator_01/cmp/generic new file mode 100644 index 0000000000..144ae94bb8 --- /dev/null +++ b/tests/trilinos/full_matrix_iterator_01/cmp/generic @@ -0,0 +1,5 @@ + +DEAL::0 0 1.00000 +DEAL::0 1 0 +DEAL::0 2 0 +DEAL::OK diff --git a/tests/trilinos/full_matrix_vector_01.cc b/tests/trilinos/full_matrix_vector_01.cc new file mode 100644 index 0000000000..fadd44b711 --- /dev/null +++ b/tests/trilinos/full_matrix_vector_01.cc @@ -0,0 +1,98 @@ +//---------------------------- trilinos_full_matrix_vector_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_full_matrix_vector_01.cc --------------------------- + + +// check FullMatrix::vmult + +#include "../tests.h" +#include +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i + const PetscScalar s = m.matrix_scalar_product (w,v); + + // make sure we get the expected result + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i + const PetscScalar s = m.matrix_norm_square (v); + + // make sure we get the expected result + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x) +{ + TrilinosWrappers::FullMatrix m(v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include + + +unsigned int +get_n_mpi_processes () +{ + int n_jobs; + MPI_Comm_size (MPI_COMM_WORLD, &n_jobs); + + return n_jobs; +} + + + +unsigned int +get_this_mpi_process () +{ + int rank; + MPI_Comm_rank (MPI_COMM_WORLD, &rank); + + return rank; +} + + +void test () +{ + // create a parallel matrix where the first + // process has 10 rows, the second one 20, + // the third one 30, and so on + unsigned int N = 0; + std::vector local_rows_per_process (get_n_mpi_processes()); + std::vector start_row (get_n_mpi_processes()); + for (unsigned int i=0; i local_rows_per_process.back()) + csp.add (i,i-local_rows_per_process.back()); + } + + // here is a sparsity pattern for which no + // Inodes are used, but it doesn't allocate + // additional memory +// for (unsigned int bi=0; bi +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // first build the sparsity pattern + SparsityPattern sparsity (N*N, N*N, 5); + for(unsigned int i=0; i0) + { + sparsity.add(global-1, global); + sparsity.add(global, global-1); + } + if (j0) + { + sparsity.add(global-N, global); + sparsity.add(global, global-N); + } + if (i matrix (sparsity); + for(unsigned int i=0; i0) + { + matrix.add(global-1, global, -1); + matrix.add(global, global-1, -1); + } + if (j0) + { + matrix.add(global-N, global, -1); + matrix.add(global, global-N, -1); + } + if (i v1(N*N), v2(N*N); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // build the sparse matrix + TrilinosWrappers::SparseMatrix matrix (N*N, N*N, 5); + for(unsigned int i=0; i0) + { + matrix.add(global-1, global, -1); + matrix.add(global, global-1, -1); + } + if (j0) + { + matrix.add(global-N, global, -1); + matrix.add(global, global-N, -1); + } + if (i +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // build the sparse matrix + TrilinosWrappers::MPI::SparseMatrix matrix (PETSC_COMM_WORLD, + N*N, N*N, + N*N, N*N, + 5); + for(unsigned int i=0; i0) + { + matrix.add(global-1, global, -1); + matrix.add(global, global-1, -1); + } + if (j0) + { + matrix.add(global-N, global, -1); + matrix.add(global, global-N, -1); + } + if (i +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // first find a random permutation of the + // indices + std::vector permutation (N); + { + std::vector unused_indices (N); + for (unsigned int i=0; i0) + { + matrix.add(global-1, global, rand()); + matrix.add(global, global-1, rand()); + } + if (j0) + { + matrix.add(global-N, global, rand()); + matrix.add(global, global-N, rand()); + } + if (i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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; + // it needs to be expected for the + // richardson solver that we end up + // here, so don't abort + } + + deallog << "Solver stopped after " << solver.control().last_step() + << " iterations" << std::endl; +} + + +int main(int argc, char **argv) +{ + std::ofstream logfile("solver_01/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverRichardson solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_01/cmp/generic b/tests/trilinos/solver_01/cmp/generic new file mode 100644 index 0000000000..208bfd4911 --- /dev/null +++ b/tests/trilinos/solver_01/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers16SolverRichardsonE +DEAL::Starting value 7.750 +DEAL::Failure step 100 value 4.004 +DEAL::Iterative method reported convergence failure in step 100 with residual 4.00437 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/solver_02.cc b/tests/trilinos/solver_02.cc new file mode 100644 index 0000000000..5eb0ff3831 --- /dev/null +++ b/tests/trilinos/solver_02.cc @@ -0,0 +1,89 @@ +//---------------------------- trilinos_solver_02.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_02.cc --------------------------- + +// test the PETSc Chebychev solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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; + // just like for Richardson: we end up + // here normally for this solver + } + + deallog << "Solver stopped after " << solver.control().last_step() + << " iterations" << std::endl; +} + + +int main(int argc, char **argv) +{ + std::ofstream logfile("solver_02/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverChebychev solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_02/cmp/generic b/tests/trilinos/solver_02/cmp/generic new file mode 100644 index 0000000000..ec6166756a --- /dev/null +++ b/tests/trilinos/solver_02/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers15SolverChebychevE +DEAL::Starting value 7.745 +DEAL::Failure step 100 value 3.885 +DEAL::Iterative method reported convergence failure in step 100 with residual 3.88526 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/solver_03.cc b/tests/trilinos/solver_03.cc new file mode 100644 index 0000000000..9a68a746bf --- /dev/null +++ b/tests/trilinos/solver_03.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_03.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_03.cc --------------------------- + +// test the PETSc CG solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_03/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverCG solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_03/cmp/generic b/tests/trilinos/solver_03/cmp/generic new file mode 100644 index 0000000000..2237281800 --- /dev/null +++ b/tests/trilinos/solver_03/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE +DEAL::Starting value 7.750 +DEAL::Convergence step 41 value 0.0006730 +DEAL::Solver stopped after 41 iterations diff --git a/tests/trilinos/solver_04.cc b/tests/trilinos/solver_04.cc new file mode 100644 index 0000000000..ddd924f342 --- /dev/null +++ b/tests/trilinos/solver_04.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_04.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_04.cc --------------------------- + +// test the PETSc BiCG solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_04/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverBiCG solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_04/cmp/generic b/tests/trilinos/solver_04/cmp/generic new file mode 100644 index 0000000000..d69ef9440f --- /dev/null +++ b/tests/trilinos/solver_04/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers10SolverBiCGE +DEAL::Starting value 7.750 +DEAL::Convergence step 41 value 0.0006730 +DEAL::Solver stopped after 41 iterations diff --git a/tests/trilinos/solver_05.cc b/tests/trilinos/solver_05.cc new file mode 100644 index 0000000000..86f9e02675 --- /dev/null +++ b/tests/trilinos/solver_05.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_05.cc --------------------------- + +// test the PETSc GMRES solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_05/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverGMRES solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_05/cmp/generic b/tests/trilinos/solver_05/cmp/generic new file mode 100644 index 0000000000..d06c236119 --- /dev/null +++ b/tests/trilinos/solver_05/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverGMRESE +DEAL::Starting value 7.750 +DEAL::Convergence step 48 value 0.0009841 +DEAL::Solver stopped after 48 iterations diff --git a/tests/trilinos/solver_06.cc b/tests/trilinos/solver_06.cc new file mode 100644 index 0000000000..806f3b9a6c --- /dev/null +++ b/tests/trilinos/solver_06.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_06.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_06.cc --------------------------- + +// test the PETSc Bicgstab solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_06/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverBicgstab solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_06/cmp/generic b/tests/trilinos/solver_06/cmp/generic new file mode 100644 index 0000000000..073a21521e --- /dev/null +++ b/tests/trilinos/solver_06/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE +DEAL::Starting value 7.750 +DEAL::Convergence step 33 value 0.0005745 +DEAL::Solver stopped after 33 iterations diff --git a/tests/trilinos/solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 new file mode 100644 index 0000000000..3251a82276 --- /dev/null +++ b/tests/trilinos/solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE +DEAL::Starting value 7.750 +DEAL::Convergence step 33 value 0.0005777 +DEAL::Solver stopped after 33 iterations diff --git a/tests/trilinos/solver_06/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/solver_06/cmp/powerpc-apple-darwin8.10.0+gcc4.0 new file mode 100644 index 0000000000..fc4eb83b57 --- /dev/null +++ b/tests/trilinos/solver_06/cmp/powerpc-apple-darwin8.10.0+gcc4.0 @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE +DEAL::Starting value 7.750 +DEAL::Convergence step 33 value 0.0005766 +DEAL::Solver stopped after 33 iterations diff --git a/tests/trilinos/solver_06/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/solver_06/cmp/x86_64-unknown-linux-gnu+gcc3.3 new file mode 100644 index 0000000000..3251a82276 --- /dev/null +++ b/tests/trilinos/solver_06/cmp/x86_64-unknown-linux-gnu+gcc3.3 @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE +DEAL::Starting value 7.750 +DEAL::Convergence step 33 value 0.0005777 +DEAL::Solver stopped after 33 iterations diff --git a/tests/trilinos/solver_07.cc b/tests/trilinos/solver_07.cc new file mode 100644 index 0000000000..797ca4ff13 --- /dev/null +++ b/tests/trilinos/solver_07.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_07.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_07.cc --------------------------- + +// test the PETSc CGS solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_07/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverCGS solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_07/cmp/generic b/tests/trilinos/solver_07/cmp/generic new file mode 100644 index 0000000000..f4c27026d0 --- /dev/null +++ b/tests/trilinos/solver_07/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers9SolverCGSE +DEAL::Starting value 7.750 +DEAL::Convergence step 40 value 0.0007519 +DEAL::Solver stopped after 40 iterations diff --git a/tests/trilinos/solver_08.cc b/tests/trilinos/solver_08.cc new file mode 100644 index 0000000000..519d061412 --- /dev/null +++ b/tests/trilinos/solver_08.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_08.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_08.cc --------------------------- + +// test the PETSc TFQMR solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_08/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverTFQMR solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_08/cmp/generic b/tests/trilinos/solver_08/cmp/generic new file mode 100644 index 0000000000..7f1d94f542 --- /dev/null +++ b/tests/trilinos/solver_08/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverTFQMRE +DEAL::Starting value 7.750 +DEAL::Convergence step 40 value 0.0008680 +DEAL::Solver stopped after 40 iterations diff --git a/tests/trilinos/solver_09.cc b/tests/trilinos/solver_09.cc new file mode 100644 index 0000000000..39e6bed163 --- /dev/null +++ b/tests/trilinos/solver_09.cc @@ -0,0 +1,92 @@ +//---------------------------- trilinos_solver_09.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_09.cc --------------------------- + +// test the PETSc TCQMR solver +// +// note that this test fails on PETSc 2.1.6 due to a bug in the TCQMR +// implementation. this is reported and should be fixed soonish + + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_09/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverTCQMR solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_09/cmp/generic b/tests/trilinos/solver_09/cmp/generic new file mode 100644 index 0000000000..c1e7ffb703 --- /dev/null +++ b/tests/trilinos/solver_09/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE +DEAL::Starting value 7.750 +DEAL::Starting value 7.750 +DEAL::Convergence step 44 value 0.0007016 +DEAL::Solver stopped after 44 iterations diff --git a/tests/trilinos/solver_09/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/solver_09/cmp/i386-apple-darwin8.10.1+gcc4.0 new file mode 100644 index 0000000000..c6b97de860 --- /dev/null +++ b/tests/trilinos/solver_09/cmp/i386-apple-darwin8.10.1+gcc4.0 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE +DEAL::Starting value 7.750 +DEAL::Starting value 7.750 +DEAL::Convergence step 44 value 0.0007012 +DEAL::Solver stopped after 44 iterations diff --git a/tests/trilinos/solver_09/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/solver_09/cmp/powerpc-apple-darwin8.10.0+gcc4.0 new file mode 100644 index 0000000000..5757c5d52d --- /dev/null +++ b/tests/trilinos/solver_09/cmp/powerpc-apple-darwin8.10.0+gcc4.0 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE +DEAL::Starting value 7.750 +DEAL::Starting value 7.750 +DEAL::Convergence step 44 value 0.0007011 +DEAL::Solver stopped after 44 iterations diff --git a/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc3.3 new file mode 100644 index 0000000000..34a22672b0 --- /dev/null +++ b/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc3.3 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE +DEAL::Starting value 7.750 +DEAL::Starting value 7.750 +DEAL::Convergence step 44 value 0.0007008 +DEAL::Solver stopped after 44 iterations diff --git a/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc4.1 b/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc4.1 new file mode 100644 index 0000000000..7fad18ad6e --- /dev/null +++ b/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc4.1 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE +DEAL::Starting value 7.750 +DEAL::Starting value 7.750 +DEAL::Convergence step 44 value 0.0007010 +DEAL::Solver stopped after 44 iterations diff --git a/tests/trilinos/solver_10.cc b/tests/trilinos/solver_10.cc new file mode 100644 index 0000000000..d7cd3b7273 --- /dev/null +++ b/tests/trilinos/solver_10.cc @@ -0,0 +1,88 @@ +//---------------------------- trilinos_solver_10.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_10.cc --------------------------- + +// test the PETSc CR solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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) +{ + std::ofstream logfile("solver_10/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverCR solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_10/cmp/generic b/tests/trilinos/solver_10/cmp/generic new file mode 100644 index 0000000000..0c6333fd40 --- /dev/null +++ b/tests/trilinos/solver_10/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers8SolverCRE +DEAL::Starting value 7.750 +DEAL::Convergence step 41 value 0.0005700 +DEAL::Solver stopped after 41 iterations diff --git a/tests/trilinos/solver_11.cc b/tests/trilinos/solver_11.cc new file mode 100644 index 0000000000..14a216ee89 --- /dev/null +++ b/tests/trilinos/solver_11.cc @@ -0,0 +1,89 @@ +//---------------------------- trilinos_solver_11.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_solver_11.cc --------------------------- + +// test the PETSc LSQR solver + + +#include "../tests.h" +#include "../lac/testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +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; + // just like for Richardson: expect to + // get here, don't abort the program + } + + deallog << "Solver stopped after " << solver.control().last_step() + << " iterations" << std::endl; +} + + +int main(int argc, char **argv) +{ + std::ofstream logfile("solver_11/output"); + logfile.precision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + 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); + TrilinosWrappers::SparseMatrix A(dim, dim, 5); + testproblem.five_point(A); + + TrilinosWrappers::Vector f(dim); + TrilinosWrappers::Vector u(dim); + f = 1.; + A.compress (); + f.compress (); + u.compress (); + + TrilinosWrappers::SolverLSQR solver(control); + TrilinosWrappers::PreconditionJacobi preconditioner(A); + check_solve (solver, A,u,f, preconditioner); + } +} + diff --git a/tests/trilinos/solver_11/cmp/generic b/tests/trilinos/solver_11/cmp/generic new file mode 100644 index 0000000000..2a67dabd0f --- /dev/null +++ b/tests/trilinos/solver_11/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE +DEAL::Starting value 31.00 +DEAL::Failure step 100 value 24.01 +DEAL::Iterative method reported convergence failure in step 100 with residual 24.0098 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/solver_11/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/solver_11/cmp/i386-apple-darwin8.10.1+gcc4.0 new file mode 100644 index 0000000000..ef72f8d07b --- /dev/null +++ b/tests/trilinos/solver_11/cmp/i386-apple-darwin8.10.1+gcc4.0 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE +DEAL::Starting value 31.00 +DEAL::Failure step 100 value 24.02 +DEAL::Iterative method reported convergence failure in step 100 with residual 24.0185 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/solver_11/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/solver_11/cmp/powerpc-apple-darwin8.10.0+gcc4.0 new file mode 100644 index 0000000000..a7a6ad6cd2 --- /dev/null +++ b/tests/trilinos/solver_11/cmp/powerpc-apple-darwin8.10.0+gcc4.0 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE +DEAL::Starting value 31.00 +DEAL::Failure step 100 value 24.02 +DEAL::Iterative method reported convergence failure in step 100 with residual 24.0199 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc3.3 new file mode 100644 index 0000000000..3b0d9868be --- /dev/null +++ b/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc3.3 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE +DEAL::Starting value 31.00 +DEAL::Failure step 100 value 24.02 +DEAL::Iterative method reported convergence failure in step 100 with residual 24.0219 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc4.1 b/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc4.1 new file mode 100644 index 0000000000..b4f65146aa --- /dev/null +++ b/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc4.1 @@ -0,0 +1,7 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE +DEAL::Starting value 31.00 +DEAL::Failure step 100 value 24.02 +DEAL::Iterative method reported convergence failure in step 100 with residual 24.0221 +DEAL::Solver stopped after 100 iterations diff --git a/tests/trilinos/sparse_matrix_iterator_01.cc b/tests/trilinos/sparse_matrix_iterator_01.cc new file mode 100644 index 0000000000..f12b977fc6 --- /dev/null +++ b/tests/trilinos/sparse_matrix_iterator_01.cc @@ -0,0 +1,79 @@ +//---------------------------- trilinos_sparse_matrix_iterator_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_sparse_matrix_iterator_01.cc --------------------------- + + +// test TrilinosWrappers::MatrixBase::const_iterator + +#include "../tests.h" +#include +#include +#include + + +void test () +{ + TrilinosWrappers::SparseMatrix m(5,5,5); + m.set (0,0,1); + m.set (1,1,2); + m.set (1,2,3); + m.compress (); + TrilinosWrappers::SparseMatrix::const_iterator i = m.begin(); + deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl; + ++i; + deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl; + i++; + deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("sparse_matrix_iterator_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + { + test (); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/trilinos/sparse_matrix_iterator_01/cmp/generic b/tests/trilinos/sparse_matrix_iterator_01/cmp/generic new file mode 100644 index 0000000000..e6bdc2e87e --- /dev/null +++ b/tests/trilinos/sparse_matrix_iterator_01/cmp/generic @@ -0,0 +1,5 @@ + +DEAL::0 0 1.00000 +DEAL::1 1 2.00000 +DEAL::1 2 3.00000 +DEAL::OK diff --git a/tests/trilinos/sparse_matrix_vector_01.cc b/tests/trilinos/sparse_matrix_vector_01.cc new file mode 100644 index 0000000000..d414b47ddd --- /dev/null +++ b/tests/trilinos/sparse_matrix_vector_01.cc @@ -0,0 +1,98 @@ +//---------------------------- trilinos_sparse_matrix_vector_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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. +// +//---------------------------- trilinos_sparse_matrix_vector_01.cc --------------------------- + + +// check SparseMatrix::vmult + +#include "../tests.h" +#include +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i + const PetscScalar s = m.matrix_scalar_product (w,v); + + // make sure we get the expected result + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i + const PetscScalar s = m.matrix_norm_square (v); + + // make sure we get the expected result + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w, + TrilinosWrappers::Vector &x) +{ + TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size()); + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set the first vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set the first vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector + for (unsigned int i=0; i +#include +#include +#include + + +void test (TrilinosWrappers::Vector &v, + TrilinosWrappers::Vector &w) +{ + // set only certain elements of each + // vector + for (unsigned int i=0; i