From: Wolfgang Bangerth Date: Fri, 6 Feb 2004 19:19:57 +0000 (+0000) Subject: New tests. X-Git-Tag: v8.0.0~15835 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a993589eea4dc9227a53faeba0c9b0d236b04835;p=dealii.git New tests. git-svn-id: https://svn.dealii.org/trunk@8408 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/petsc_01.cc b/tests/bits/petsc_01.cc new file mode 100644 index 0000000000..ac4b0dd8d6 --- /dev/null +++ b/tests/bits/petsc_01.cc @@ -0,0 +1,91 @@ +//---------------------------- petsc_01.cc --------------------------- +// petsc_01.cc,v 1.4 2003/07/03 10:31:46 guido Exp +// Version: +// +// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli +// +// 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_01.cc --------------------------- + + +// check setting elements in a petsc matrix using set() + +#include "../tests.h" +#include +#include +#include + + +void test (petsc_wrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (petsc_wrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (petsc_wrappers::SparseMatrix &m) +{ + // first set a few entries + for (unsigned int i=0; i +#include +#include + + +void test (petsc_wrappers::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("petsc_04.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + try + { + PetscInitialize(&argc,&argv,0,0); + { + petsc_wrappers::SparseMatrix m (5,5,3); + 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_05.cc b/tests/bits/petsc_05.cc new file mode 100644 index 0000000000..26d0b16019 --- /dev/null +++ b/tests/bits/petsc_05.cc @@ -0,0 +1,86 @@ +//---------------------------- petsc_05.cc --------------------------- +// petsc_05.cc,v 1.4 2003/07/03 10:31:46 guido Exp +// Version: +// +// Copyright (C) 2004 by the deal.II authors and Anna Schneebeli +// +// 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_05.cc --------------------------- + + +// check querying the number of nonzero elements + +#include "../tests.h" +#include +#include +#include + + +void test (petsc_wrappers::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 (petsc_wrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (petsc_wrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + for (unsigned int i=0; i +#include +#include + + +void test (petsc_wrappers::SparseMatrix &m) +{ + // first set a few entries. count how many + // entries we have + double norm = 0; + for (unsigned int i=0; i