From 7efedb5cbcae51db5b774c18bc346f21451a4dc8 Mon Sep 17 00:00:00 2001 From: young Date: Tue, 22 Oct 2013 11:06:15 +0000 Subject: [PATCH] Radically simplify the testsuite to test *only* one element of petsc-scalar=complex (deal'ify). Remove temporary files. git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@31384 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/petsc_complex/00.cc | 15 ++-- tests/petsc_complex/01.cc | 52 ++--------- tests/petsc_complex/02.cc | 56 ++---------- tests/petsc_complex/04.cc | 5 +- tests/petsc_complex/05.cc | 45 ++-------- tests/petsc_complex/06.cc | 39 ++------- tests/petsc_complex/07.cc | 41 ++------- tests/petsc_complex/08.cc | 51 ++--------- tests/petsc_complex/09.cc | 63 ++----------- tests/petsc_complex/10.cc | 56 ++---------- tests/petsc_complex/11.cc | 38 ++------ tests/petsc_complex/12.cc | 47 +--------- tests/petsc_complex/13.cc | 2 +- tests/petsc_complex/17.cc | 4 +- tests/petsc_complex/18.cc | 5 +- tests/petsc_complex/19.cc | 2 +- tests/petsc_complex/README | 15 ---- tests/petsc_complex/solver_real_01.cc | 3 +- tests/petsc_complex/solver_real_02.cc | 2 +- tests/petsc_complex/solver_real_03.cc | 2 +- tests/petsc_complex/solver_real_03_mf.cc | 12 ++- tests/petsc_complex/solver_real_04.cc | 2 +- tests/petsc_complex/sparse_matrix_01.cc | 37 +++++++- tests/petsc_complex/sparse_matrix_02.cc | 92 ------------------- tests/petsc_complex/vector_02.cc | 37 +++++++- tests/petsc_complex/vector_assign_01.cc | 11 +-- tests/petsc_complex/vector_assign_02.cc | 37 ++------ tests/petsc_complex/vector_equality_1.cc | 40 ++------- tests/petsc_complex/vector_equality_2.cc | 29 ++---- tests/petsc_complex/vector_equality_5.cc | 107 ----------------------- tests/petsc_complex/vector_print.cc | 2 +- tests/petsc_complex/vector_wrap_01.cc | 25 +----- 32 files changed, 184 insertions(+), 790 deletions(-) delete mode 100644 tests/petsc_complex/README delete mode 100644 tests/petsc_complex/sparse_matrix_02.cc delete mode 100644 tests/petsc_complex/vector_equality_5.cc diff --git a/tests/petsc_complex/00.cc b/tests/petsc_complex/00.cc index aa445fd055..6cd0187b51 100644 --- a/tests/petsc_complex/00.cc +++ b/tests/petsc_complex/00.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 00.cc$ // // Copyright (C) 2013 by the deal.II authors // @@ -40,8 +40,8 @@ // PetscSclar=complex. They check that std::complex and // PetscScalar complex are compatible without explicitly casting. // -// These tests look archaic - they are the original tests used by the -// authors to figure out how PetscScalar complex works... +// These tests look archaic - they are the original tests used to +// figure out how PetscScalar complex works... // Multiply a PETSc complex number by a complex number. void multiply_petsc_complex_by_a_number () @@ -67,7 +67,6 @@ void multiply_petsc_complex_by_a_number () deallog << "OK" << std::endl; } - // Divide a PETSc complex number by a real number. void divide_petsc_complex_by_a_number () { @@ -136,7 +135,6 @@ void make_petsc_complex () deallog << "OK" << std::endl; } - // Initialize a PETSc complex number directly only, check he is // initialised to 0+0i. void init_petsc_complex () @@ -172,22 +170,21 @@ int main (int argc, char **argv) { PetscInitialize (&argc, &argv, (char*) 0, (char*) 0); { - // check initialisation (zero and nonzero) + // initialisation (zero and nonzero) init_petsc_complex (); make_petsc_complex (); - // check initialisation from std::complex (and vice versa) + // initialisation from std::complex (and vice versa) make_petsc_complex_from_std_complex (); make_std_complex_from_petsc_complex (); - // Check some operators + // some operators divide_petsc_complex_by_a_number (); multiply_petsc_complex_by_a_number (); } PetscFinalize (); } - catch (std::exception &exc) { std::cerr << std::endl << std::endl diff --git a/tests/petsc_complex/01.cc b/tests/petsc_complex/01.cc index f676244b54..589a868d5c 100644 --- a/tests/petsc_complex/01.cc +++ b/tests/petsc_complex/01.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 01.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -23,47 +23,16 @@ #include -void test_real (PETScWrappers::SparseMatrix &m) +void test (PETScWrappers::SparseMatrix &m) { - deallog << "Real test" << std::endl; - - // first set a few entries - for (unsigned int i=0; i (i*j*.5+.5,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex (i*j*.5+.5,0.), ExcInternalError()); - } - else - { - Assert (m(i,j) == std::complex (0.,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - -void test_complex (PETScWrappers::SparseMatrix &m) -{ - deallog << "Complex test" << std::endl; - // first set a few entries for (unsigned int i=0; i (0.,i*j*.5+.5)); - + m.compress (VectorOperation::add); - + // then make sure we retrieve the same ones for (unsigned int i=0; i (0.,0.), ExcInternalError()); Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); } - + deallog << "OK" << std::endl; } @@ -89,18 +58,13 @@ int main (int argc,char **argv) deallog.attach(logfile); deallog.depth_console(0); deallog.threshold_double(1.e-10); - + try { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); { - PETScWrappers::SparseMatrix m; - - m.reinit (5,5,3); - test_real (m); - - m.reinit (5,5,3); - test_complex (m); + PETScWrappers::SparseMatrix m (5,5,3); + test (m); } } diff --git a/tests/petsc_complex/02.cc b/tests/petsc_complex/02.cc index 74b941f3c8..3ba03071bc 100644 --- a/tests/petsc_complex/02.cc +++ b/tests/petsc_complex/02.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 02.cc $ // -// Copyright (C) 2004 - 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // // This file is part of the deal.II library. // @@ -15,58 +15,26 @@ // --------------------------------------------------------------------- - // check setting elements in a petsc matrix using // PETScWrappers::SparseMatrix::add() + #include "../tests.h" #include #include #include -void test_real (PETScWrappers::SparseMatrix &m) -{ - deallog << "Real test" << std::endl; - - // first set a few entries - for (unsigned int i=0; i (i*j*.5+.5,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex (i*j*.5+.5,0.), ExcInternalError()); - } - else - { - Assert (m(i,j) == std::complex (0.,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - - -void test_complex (PETScWrappers::SparseMatrix &m) +void test (PETScWrappers::SparseMatrix &m) { - deallog << "Complex test" << std::endl; - // first set a few entries for (unsigned int i=0; i (0.,i*j*.5+.5)); - + m.compress (VectorOperation::add); - + // then make sure we retrieve the same ones for (unsigned int i=0; i (0.,0.), ExcInternalError()); Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); } - + deallog << "OK" << std::endl; } - int main (int argc,char **argv) { std::ofstream logfile("output"); @@ -97,13 +64,8 @@ int main (int argc,char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); { - PETScWrappers::SparseMatrix m; - - m.reinit (5,5,3); - test_real (m); - - m.reinit (5,5,3); - test_complex (m); + PETScWrappers::SparseMatrix m(5,5,3); + test (m); } } diff --git a/tests/petsc_complex/04.cc b/tests/petsc_complex/04.cc index 60a1d76b01..b0a8d51e01 100644 --- a/tests/petsc_complex/04.cc +++ b/tests/petsc_complex/04.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- -// $Id: 04.cc 30045 2013-07-18 19:18:00Z maier $ +// $Id: 04.cc $ // -// Copyright (C) 2004 - 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // // This file is part of the deal.II library. // @@ -15,7 +15,6 @@ // --------------------------------------------------------------------- - // check querying matrix sizes #include "../tests.h" diff --git a/tests/petsc_complex/05.cc b/tests/petsc_complex/05.cc index 3b5fa6e40e..dac7e46348 100644 --- a/tests/petsc_complex/05.cc +++ b/tests/petsc_complex/05.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 05.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -15,7 +15,6 @@ // --------------------------------------------------------------------- - // check querying the number of nonzero elements in // PETScWrappers::SparseMatrix @@ -25,34 +24,8 @@ #include -void test_real (PETScWrappers::SparseMatrix &m) +void test (PETScWrappers::SparseMatrix &m) { - deallog << "Real test" << std::endl; - - // first set a few entries. count how many entries we have - unsigned int counter = 0; - for (unsigned int i=0; i -void test_real (PETScWrappers::SparseMatrix &m) -{ - deallog << "Real test" << std::endl; - - // first set a few entries. count how many entries we have - for (unsigned int i=0; i -void test_real (PETScWrappers::SparseMatrix &m) +void test (PETScWrappers::SparseMatrix &m) { - deallog << "Real test" << std::endl; - - // first set a few entries. count how many entries we have - for (unsigned int i=0; i (0.,i*j*.5+.5)); - + m.compress (VectorOperation::add); - + // compare against the exact value of the linfty-norm (max row-sum). deallog << m.linfty_norm() << std::endl; Assert (m.linfty_norm() == 8.5, ExcInternalError()); - + deallog << "OK" << std::endl; } + int main (int argc,char **argv) { std::ofstream logfile("output"); @@ -73,13 +53,8 @@ int main (int argc,char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); { - PETScWrappers::SparseMatrix m; - - m.reinit (5,5,3); - test_real (m); - - m.reinit (5,5,3); - test_complex (m); + PETScWrappers::SparseMatrix m(5,5,3); + test (m); } } diff --git a/tests/petsc_complex/08.cc b/tests/petsc_complex/08.cc index 04c5937679..a00273506d 100644 --- a/tests/petsc_complex/08.cc +++ b/tests/petsc_complex/08.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 08.cc $ // -// Copyright (C) 2004 - 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // // This file is part of the deal.II library. // @@ -24,35 +24,8 @@ #include - -void test_real (PETScWrappers::SparseMatrix &m) -{ - deallog << "Real test" << std::endl; - - // first set a few entries. count how many entries we have - PetscScalar norm = 0; - for (unsigned int i=0; i - -void test_real (PETScWrappers::SparseMatrix &m) -{ - deallog << "Real test" << std::endl; - - // first set a few entries - for (unsigned int i=0; i ((i*j*.5+.5)*1.25,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex ((i*j*.5+.5)*1.25,0.), ExcInternalError()); - } - else - { - Assert (m(i,j) == std::complex (0.,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - void test_complex (PETScWrappers::SparseMatrix &m) { - deallog << "Complex test" << std::endl; - // first set a few entries for (unsigned int i=0; i (i*j*.5+.5,i*j*.5)); - } - + m.set (i,j, std::complex (i*j*.5+.5,i*j*.5)); + m.compress (VectorOperation::add); - + // then multiply everything by 1.25 m *= 1.25; @@ -92,7 +50,7 @@ void test_complex (PETScWrappers::SparseMatrix &m) Assert (m(i,j) == std::complex (0.,0.), ExcInternalError()); Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); } - + deallog << "OK" << std::endl; } @@ -109,13 +67,8 @@ int main (int argc,char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); { - PETScWrappers::SparseMatrix m; - - m.reinit (5,5,3); - test_real (m); - - m.reinit (5,5,3); - test_complex (m); + PETScWrappers::SparseMatrix m(5,5,3); + test (m); } } diff --git a/tests/petsc_complex/10.cc b/tests/petsc_complex/10.cc index b07b4204cf..49099bffbc 100644 --- a/tests/petsc_complex/10.cc +++ b/tests/petsc_complex/10.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $id: +// $id: 10.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -23,55 +23,20 @@ -void test_real (PETScWrappers::SparseMatrix &m) -{ - deallog << "Real test" << std::endl; - - // first set a few entries - for (unsigned int i=0; i ((i*j*.5+.5)/4*3, 0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex ((i*j*.5+.5)/4*3, 0.), ExcInternalError()); - } - else - { - Assert (m(i,j) == std::complex (0.,0.), ExcInternalError()); - Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - - void test_complex (PETScWrappers::SparseMatrix &m) { - deallog << "Complex test" << std::endl; - // first set a few entries for (unsigned int i=0; i (0.,i*j*.5+.5)); - + m.compress (VectorOperation::add); - + // then divide everything by 4/3 and make sure we retrieve the // values we expect m /= 4./3.; - + for (unsigned int i=0; i (0.,0.), ExcInternalError()); Assert (m.el(i,j) == std::complex (0.,0.), ExcInternalError()); } - + deallog << "OK" << std::endl; } @@ -96,18 +61,13 @@ int main (int argc,char **argv) deallog.attach(logfile); deallog.depth_console(0); deallog.threshold_double(1.e-10); - + try { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); { - PETScWrappers::SparseMatrix m; - - m.reinit (5,5,3); - test_real (m); - - m.reinit (5,5,3); - test_complex (m); + PETScWrappers::SparseMatrix m(5,5,3); + test (m); } } diff --git a/tests/petsc_complex/11.cc b/tests/petsc_complex/11.cc index af6b6b7ac3..fbbb87b88c 100644 --- a/tests/petsc_complex/11.cc +++ b/tests/petsc_complex/11.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 11.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -24,38 +24,20 @@ #include -void test_real (PETScWrappers::Vector &v) +void test (PETScWrappers::Vector &v) { - deallog << "Real test" << std::endl; - - // set only certain elements of the vector - for (unsigned int k=0; k (k,.5*k); - + v.compress (VectorOperation::add); - + Assert (v.size() == 100, ExcInternalError()); - + deallog << "OK" << std::endl; } - int main (int argc,char **argv) { std::ofstream logfile("output"); @@ -67,15 +49,9 @@ int main (int argc,char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); { - PETScWrappers::Vector v; - - v.reinit (100); - test_real (v); - - v.reinit (100); - test_complex (v); + PETScWrappers::Vector v(100); + test (v); } - } catch (std::exception &exc) { diff --git a/tests/petsc_complex/12.cc b/tests/petsc_complex/12.cc index 5a587bb3c0..9280ed4db9 100644 --- a/tests/petsc_complex/12.cc +++ b/tests/petsc_complex/12.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: +// $Id: 12.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -25,41 +25,8 @@ #include -void test_real (PETScWrappers::Vector &v) -{ - deallog << "Real test" << std::endl; - - // 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 k=0; k and -PetscScalar. - -(*) Cloned - Reason: Check the correct (expected) behaviour is -obtained for petsc-scalar=complex is obtained as was for -petsc-scalar=real. In this case the .cc file is (almost) identical to -the original and the expected output (cmp/generic) is copied from the -original without modification. - -(*) New - Reason: Obvious. \ No newline at end of file diff --git a/tests/petsc_complex/solver_real_01.cc b/tests/petsc_complex/solver_real_01.cc index ec39333c03..9c045ca958 100644 --- a/tests/petsc_complex/solver_real_01.cc +++ b/tests/petsc_complex/solver_real_01.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: solver_real_01.cc +// $Id: solver_real_01.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -93,6 +93,5 @@ int main(int argc, char **argv) PETScWrappers::PreconditionJacobi preconditioner(A); check_solve (solver, A,u,f, preconditioner); } - } diff --git a/tests/petsc_complex/solver_real_02.cc b/tests/petsc_complex/solver_real_02.cc index 9c3bc11c1b..28f4e0484b 100644 --- a/tests/petsc_complex/solver_real_02.cc +++ b/tests/petsc_complex/solver_real_02.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: solver_real_02.cc +// $Id: solver_real_02.cc $ // // Copyright (C) 2013 by the deal.II authors // diff --git a/tests/petsc_complex/solver_real_03.cc b/tests/petsc_complex/solver_real_03.cc index 392f127fee..0b69601e07 100644 --- a/tests/petsc_complex/solver_real_03.cc +++ b/tests/petsc_complex/solver_real_03.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: solver_real_03.cc +// $Id: solver_real_03.cc $ // // Copyright (C) 2013 by the deal.II authors // diff --git a/tests/petsc_complex/solver_real_03_mf.cc b/tests/petsc_complex/solver_real_03_mf.cc index b81fac55d3..d2a77bbb99 100644 --- a/tests/petsc_complex/solver_real_03_mf.cc +++ b/tests/petsc_complex/solver_real_03_mf.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: solver_03_mf.cc +// $Id: solver_03_mf.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -25,10 +25,14 @@ // into this directory and // play with it, but, by // using *that* file - // directly is itself a test - // of syntax compatibility + // directly is instead + // represents a test of + // syntax compatibility // between petsc-scalar=real - // and petsc-scalar=complex. + // and assigning real + // numbers to a possibly + // complex matrix where + // petsc-scalar=complex. #include #include #include diff --git a/tests/petsc_complex/solver_real_04.cc b/tests/petsc_complex/solver_real_04.cc index 5caa9918dc..9ace49088c 100644 --- a/tests/petsc_complex/solver_real_04.cc +++ b/tests/petsc_complex/solver_real_04.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: solver_real_04.cc +// $Id: solver_real_04.cc $ // // Copyright (C) 2013 by the deal.II authors // diff --git a/tests/petsc_complex/sparse_matrix_01.cc b/tests/petsc_complex/sparse_matrix_01.cc index 82a1e4b41d..7d7a749b1c 100644 --- a/tests/petsc_complex/sparse_matrix_01.cc +++ b/tests/petsc_complex/sparse_matrix_01.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id sparse_matrix_01.cc +// $Id sparse_matrix_01.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -15,7 +15,6 @@ // --------------------------------------------------------------------- - // check SparseMatrix::add(other, factor) #include "../tests.h" @@ -77,7 +76,37 @@ int main (int argc, char **argv) deallog.depth_console(0); deallog.threshold_double(1.e-10); - Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); - test (); + try + { + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + { + 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/petsc_complex/sparse_matrix_02.cc b/tests/petsc_complex/sparse_matrix_02.cc deleted file mode 100644 index b5e2ce2f14..0000000000 --- a/tests/petsc_complex/sparse_matrix_02.cc +++ /dev/null @@ -1,92 +0,0 @@ -// --------------------------------------------------------------------- -// $Id sparse_matrix_01.cc -// -// Copyright (C) 2013 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - - - -// check SparseMatrix::add(other, factor) - -// This is in general the same as sparse_matrix_02.cc, but uses -// integer input to complex numbers. Since it was done, make a note of -// a generic failure / annoyance - -#include "../tests.h" -#include -#include -#include -#include -#include - - -void test () -{ - const unsigned int s = 10; - PETScWrappers::SparseMatrix m(s,s,s); - for (unsigned int k=0; k @@ -79,7 +79,36 @@ int main (int argc, char **argv) deallog.depth_console(0); deallog.threshold_double(1.e-10); - Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); - test (); + try + { + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + { + 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/petsc_complex/vector_assign_01.cc b/tests/petsc_complex/vector_assign_01.cc index 20712f3364..d8f85360c0 100644 --- a/tests/petsc_complex/vector_assign_01.cc +++ b/tests/petsc_complex/vector_assign_01.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: vector_assign_01.cc +// $Id: vector_assign_01.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -16,14 +16,7 @@ -// when calling PETScWrappers::Vector::operator() (), the return type is a -// reference object, not a reference to the actual element. this leads to the -// funny situation that an assignment like v2(i)=v1(i) isn't really what it -// looks like: it tries to copy the reference objects, not the values they -// point to, as one would expect -// -// this was fixed 2004-04-05, and this test checks that it works - +// See notes in petsc/vector_assign_01.cc #include "../tests.h" #include #include diff --git a/tests/petsc_complex/vector_assign_02.cc b/tests/petsc_complex/vector_assign_02.cc index 56ad6d8ad0..5bfcfdea53 100644 --- a/tests/petsc_complex/vector_assign_02.cc +++ b/tests/petsc_complex/vector_assign_02.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: vector_assign_02.cc +// $Id: vector_assign_02.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -26,31 +26,9 @@ #include -void test_real (PETScWrappers::Vector &v, - PETScWrappers::Vector &w) +void test (PETScWrappers::Vector &v, + PETScWrappers::Vector &w) { - deallog << "Real test" << std::endl; - - // set the first vector - for (unsigned int k=0; k -void test_real (PETScWrappers::Vector &v, - PETScWrappers::Vector &w) +void test (PETScWrappers::Vector &v, + PETScWrappers::Vector &w) { - deallog << "Real test" << std::endl; - - // set only certain elements of each vector - for (unsigned int k=0; k -void test_real (PETScWrappers::Vector &v, - PETScWrappers::Vector &w) -{ - // set only certain elements of each vector where, on the "master - // vector", some elements are complex and the other is real. - for (unsigned int k=0; k (k+1.,k+1); - } - - // then copy elements and make sure the vectors are actually equal - v = w; - Assert (v==w, ExcInternalError()); - - deallog << "OK" << std::endl; -} - -void test_complex (PETScWrappers::Vector &v, - PETScWrappers::Vector &w) +void test (PETScWrappers::Vector &v, + PETScWrappers::Vector &w) { // set only certain elements of each vector for (unsigned int k=0; k (k+1.,k+1); } - + // then copy elements and make sure the vectors are actually equal v = w; Assert (v==w, ExcInternalError()); - + deallog << "OK" << std::endl; } diff --git a/tests/petsc_complex/vector_equality_5.cc b/tests/petsc_complex/vector_equality_5.cc deleted file mode 100644 index 2c88628f87..0000000000 --- a/tests/petsc_complex/vector_equality_5.cc +++ /dev/null @@ -1,107 +0,0 @@ -// --------------------------------------------------------------------- -// $Id: vector_equality_5.cc -// -// Copyright (C) 2013 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - - - -// check PETScWrappers::Vector::operator=(PETScWrappers::Vector) for vectors that are -// equal and initialised from PETScWrappers::Vector (PETScWrappers::Vector) - -#include "../tests.h" -#include -#include -#include -#include - - -void test_real (PETScWrappers::Vector &v) -{ - deallog << "Real test" << std::endl; - - // set only certain elements of vector - for (unsigned int k=0; k (k,k+1.); - - PETScWrappers::Vector w (v); - - Assert (v==w, ExcInternalError()); - - deallog << "OK" << std::endl; -} - - - -int main (int argc, char **argv) -{ - std::ofstream logfile("output"); - deallog.attach(logfile); - deallog.depth_console(0); - deallog.threshold_double(1.e-10); - - try - { - Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); - { - PETScWrappers::Vector v (100); - test_real (v); - - v.reinit (100); - test_complex (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/petsc_complex/vector_print.cc b/tests/petsc_complex/vector_print.cc index be22c05450..7d7b64cf1b 100644 --- a/tests/petsc_complex/vector_print.cc +++ b/tests/petsc_complex/vector_print.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: vector_print.cc +// $Id: vector_print.cc $ // // Copyright (C) 2013 by the deal.II authors // diff --git a/tests/petsc_complex/vector_wrap_01.cc b/tests/petsc_complex/vector_wrap_01.cc index 91156f9372..7ad00a6421 100644 --- a/tests/petsc_complex/vector_wrap_01.cc +++ b/tests/petsc_complex/vector_wrap_01.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: vector_wrap_01.cc +// $Id: vector_wrap_01.cc $ // // Copyright (C) 2013 by the deal.II authors // @@ -25,8 +25,8 @@ #include -void test_01 (PETScWrappers::Vector &v, - PETScWrappers::Vector &w) +void test (PETScWrappers::Vector &v, + PETScWrappers::Vector &w) { // set the first vector for (unsigned int k=0; k