From 6c6feb2fd1e0269e697a63059720d7dccd93ccab Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 27 Feb 2004 20:07:42 +0000 Subject: [PATCH] New tests. git-svn-id: https://svn.dealii.org/trunk@8607 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/petsc_full_matrix_01.cc | 92 +++++++++++++++++ tests/bits/petsc_full_matrix_02.cc | 92 +++++++++++++++++ tests/bits/petsc_full_matrix_03.cc | 98 +++++++++++++++++++ tests/bits/petsc_full_matrix_04.cc | 72 ++++++++++++++ tests/bits/petsc_full_matrix_05.cc | 87 ++++++++++++++++ tests/bits/petsc_full_matrix_06.cc | 83 ++++++++++++++++ tests/bits/petsc_full_matrix_07.cc | 83 ++++++++++++++++ tests/bits/petsc_full_matrix_08.cc | 88 +++++++++++++++++ tests/bits/petsc_full_matrix_09.cc | 95 ++++++++++++++++++ tests/bits/petsc_full_matrix_10.cc | 95 ++++++++++++++++++ .../bits/petsc_full_matrix_01.output | 2 + .../bits/petsc_full_matrix_02.output | 2 + .../bits/petsc_full_matrix_03.output | 2 + .../bits/petsc_full_matrix_04.output | 2 + .../bits/petsc_full_matrix_05.output | 3 + .../bits/petsc_full_matrix_06.output | 3 + .../bits/petsc_full_matrix_07.output | 3 + .../bits/petsc_full_matrix_08.output | 3 + .../bits/petsc_full_matrix_09.output | 2 + .../bits/petsc_full_matrix_10.output | 2 + 20 files changed, 909 insertions(+) create mode 100644 tests/bits/petsc_full_matrix_01.cc create mode 100644 tests/bits/petsc_full_matrix_02.cc create mode 100644 tests/bits/petsc_full_matrix_03.cc create mode 100644 tests/bits/petsc_full_matrix_04.cc create mode 100644 tests/bits/petsc_full_matrix_05.cc create mode 100644 tests/bits/petsc_full_matrix_06.cc create mode 100644 tests/bits/petsc_full_matrix_07.cc create mode 100644 tests/bits/petsc_full_matrix_08.cc create mode 100644 tests/bits/petsc_full_matrix_09.cc create mode 100644 tests/bits/petsc_full_matrix_10.cc create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_01.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_02.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_03.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_04.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_05.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_06.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_07.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_08.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_09.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_10.output diff --git a/tests/bits/petsc_full_matrix_01.cc b/tests/bits/petsc_full_matrix_01.cc new file mode 100644 index 0000000000..2cf0e97750 --- /dev/null +++ b/tests/bits/petsc_full_matrix_01.cc @@ -0,0 +1,92 @@ +//---------------------------- petsc_full_matrix_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- petsc_full_matrix_01.cc --------------------------- + + +// check setting elements in a petsc matrix using +// PETScWrappers::FullMatrix::set() + +#include "../tests.h" +#include +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::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("petsc_full_matrix_04.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + try + { + PetscInitialize(&argc,&argv,0,0); + { + PETScWrappers::FullMatrix m (5,5); + test (m); + } + PetscFinalize(); + } + 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/bits/petsc_full_matrix_05.cc b/tests/bits/petsc_full_matrix_05.cc new file mode 100644 index 0000000000..d81d5490c3 --- /dev/null +++ b/tests/bits/petsc_full_matrix_05.cc @@ -0,0 +1,87 @@ +//---------------------------- petsc_full_matrix_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- petsc_full_matrix_05.cc --------------------------- + + +// check querying the number of nonzero elements in +// PETScWrappers::FullMatrix + +#include "../tests.h" +#include +#include +#include + + +void test (PETScWrappers::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 (PETScWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries. count how many + // entries we have + double norm = 0; + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (PETScWrappers::FullMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i