+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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() in set-mode
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector. have a bit pattern of where we
-- // actually wrote elements to
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- pattern[i] = true;
-- }
--
-- v.compress ();
--
-- // check that they are ok, and this time
-- // all of them
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert ( ( (pattern[i] == true) && (v(i) == i) )
-- ||
-- ( (pattern[i] == false) && (v(i) == 0) ),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("12/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 *=
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector. have a bit pattern of where we
-- // actually wrote elements to
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- pattern[i] = true;
-- }
-- v.compress ();
--
-- // multiply v with 5/4
-- v *= 5./4.;
--
-- // check that the entries are ok
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert ( ( (pattern[i] == true) && (v(i) == i*5./4.) )
-- ||
-- ( (pattern[i] == false) && (v(i) == 0) ),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("20/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 /=
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector. have a bit pattern of where we
-- // actually wrote elements to
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- pattern[i] = true;
-- }
-- v.compress ();
--
-- // multiply v with 3/4
-- v /= 4./3.;
--
-- // check that the entries are ok
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert ( ( (pattern[i] == true) && (v(i) == i*3./4.) )
-- ||
-- ( (pattern[i] == false) && (v(i) == 0) ),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("21/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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*(Vector) on two vectors that are
--// orthogonal
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- // set only certain elements of each
-- // vector, but disjoint sets of elements
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i;
-- else
-- w(i) = i;
-- v.compress ();
-- w.compress ();
--
-- // make sure the scalar product is zero
-- Assert (v*w == 0, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("22/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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*(Vector) on two vectors that are
--// not orthogonal
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- // set only certain elements of each
-- // vector, and record the expected scalar
-- // product
-- double product = 0;
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- if (i%3 == 0)
-- {
-- w(i) = i+1.;
-- product += i*(i+1);
-- }
-- }
--
-- v.compress ();
-- w.compress ();
--
-- // make sure the scalar product is zero
-- Assert (v*w == product, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("23/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// this test used to check for PETScWrappers::Vector::clear(). However, this
--// function has since been removed, so we test for v=0 instead, although that
--// may be covered by one of the other tests
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- // then clear it again and make sure the
-- // vector is really empty
-- const unsigned int sz = v.size();
-- v = 0;
-- Assert (v.size() == sz, ExcInternalError());
-- Assert (v.l2_norm() == 0, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("24/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (PetscScalar) with setting to zero
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- // then clear it again and make sure the
-- // vector is really empty
-- const unsigned int sz = v.size();
-- v = 0;
-- Assert (v.size() == sz, ExcInternalError());
-- Assert (v.l2_norm() == 0, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("25/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (PetscScalar) with setting to a
--// nonzero value
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- const unsigned int sz = v.size();
-- v = 2;
-- Assert (v.size() == sz, ExcInternalError());
-- Assert (v.l2_norm() == std::sqrt(4.*sz), ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("26/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- // then copy it
-- PETScWrappers::Vector w (v.size());
-- w = v;
--
-- // make sure they're equal
-- deallog << v *w << ' ' << v.l2_norm() * w.l2_norm()
-- << ' ' << v *w - v.l2_norm() * w.l2_norm() << std::endl;
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < eps*(v*w),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("27/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (Vector), except that we don't
--// resize the vector to be copied to beforehand
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- // then copy it to a vector of different
-- // size
-- PETScWrappers::Vector w (1);
-- w = v;
--
-- // make sure they're equal
-- deallog << v *w << ' ' << v.l2_norm() * w.l2_norm()
-- << ' ' << v *w - v.l2_norm() * w.l2_norm() << std::endl;
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < eps*(v*w),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("28/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::reinit(fast)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::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");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::reinit(!fast)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- // then resize with setting to zero
-- v.reinit (13, false);
--
-- Assert (v.size() == 13, ExcInternalError());
-- Assert (v.l2_norm() == 0, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("30/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::l2_norm()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some elements of the vector
-- PetscScalar norm = 0;
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- norm += std::fabs(1.*i)*std::fabs(1.*i);
-- }
-- v.compress ();
--
-- // then check the norm
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- Assert (std::fabs(v.norm_sqr() - norm) < eps*norm,
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("31/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::mean_value()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some elements of the vector
-- PetscScalar sum = 0;
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- sum += i;
-- }
-- v.compress ();
--
-- // then check the norm
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- Assert (std::fabs(v.mean_value() - sum/v.size()) < eps*sum/v.size(),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("32/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::lp_norm(3)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some elements of the vector
-- PetscScalar sum = 0;
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- sum += i*i*i;
-- }
-- v.compress ();
--
-- // then check the norm
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- const double true_value=std::pow(sum, static_cast<PetscScalar> (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");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::all_zero
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some elements of the vector
-- double sum = 0;
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- sum += i*i*i;
-- }
-- v.compress ();
--
-- // set them to zero again
-- v = 0;
--
-- // then check all_zero
-- Assert (v.all_zero() == true, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("34/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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+=(Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- // set only certain elements of each
-- // vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- if (i%3 == 0)
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v += w;
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- if (i%3 == 0)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == i+i+1., ExcInternalError());
-- }
-- else
-- {
-- Assert (w(i) == 0, ExcInternalError());
-- Assert (v(i) == i, ExcInternalError());
-- }
-- }
--
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("35/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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-=(Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- // set only certain elements of each
-- // vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- if (i%3 == 0)
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v -= w;
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- if (i%3 == 0)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == i-(i+1.), ExcInternalError());
-- }
-- else
-- {
-- Assert (w(i) == 0, ExcInternalError());
-- Assert (v(i) == i, ExcInternalError());
-- }
-- }
--
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("36/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::add (scalar)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- v(i) = i;
--
-- v.compress ();
--
-- v.add (1.);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert (v(i) == i+1., ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("37/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::add(Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v.add (w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == i+(i+1.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("38/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::add(scalar, Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v.add (2, w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == i+2*(i+1.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("39/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::add(s,V,s,V)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w,
-- PETScWrappers::Vector &x)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- x(i) = i+2.;
-- }
--
-- v.compress ();
-- w.compress ();
-- x.compress ();
--
-- v.add (2, w, 3, x);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (x(i) == i+2., ExcInternalError());
-- Assert (v(i) == i+2*(i+1.)+3*(i+2.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("40/output");
- 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);
-- PETScWrappers::Vector w (100);
-- PETScWrappers::Vector x (100);
-- test (v,w,x);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::sadd(s, Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v.sadd (2, w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == 2*i+(i+1.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("41/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::sadd(scalar, scalar, Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v.sadd (3, 2, w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == 3*i+2*(i+1.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("42/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::sadd(s,s,V,s,V)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w,
-- PETScWrappers::Vector &x)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- x(i) = i+2.;
-- }
--
-- v.compress ();
-- w.compress ();
-- x.compress ();
--
-- v.sadd (1.5, 2, w, 3, x);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (x(i) == i+2., ExcInternalError());
-- Assert (v(i) == 1.5*i+2*(i+1.)+3*(i+2.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("43/output");
- 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);
-- PETScWrappers::Vector w (100);
-- PETScWrappers::Vector x (100);
-- test (v,w,x);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::sadd(s,s,V,s,V,s,V)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w,
-- PETScWrappers::Vector &x,
-- PETScWrappers::Vector &y)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- x(i) = i+2.;
-- y(i) = i+3.;
-- }
--
-- v.compress ();
-- w.compress ();
-- x.compress ();
-- y.compress ();
--
-- v.sadd (1.5, 2, w, 3, x, 4, y);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (x(i) == i+2., ExcInternalError());
-- Assert (y(i) == i+3., ExcInternalError());
-- Assert (v(i) == 1.5*i+2*(i+1.)+3*(i+2.)+4*(i+3), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("44/output");
- 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);
-- PETScWrappers::Vector w (100);
-- PETScWrappers::Vector x (100);
-- PETScWrappers::Vector y (100);
-- test (v,w,x,y);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::scale
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v.scale (w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == i*(i+1.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("45/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::equ (s,V)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- }
--
-- v.compress ();
-- w.compress ();
--
-- v.equ (2, w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (v(i) == 2*(i+1.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("46/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::equ (s,V,s,V)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w,
-- PETScWrappers::Vector &x)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- x(i) = i+2.;
-- }
--
-- v.compress ();
-- w.compress ();
-- x.compress ();
--
-- v.equ (2, w, 3, x);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (x(i) == i+2., ExcInternalError());
-- Assert (v(i) == 2*(i+1.)+3*(i+2.), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("47/output");
- 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);
-- PETScWrappers::Vector w (100);
-- PETScWrappers::Vector x (100);
-- test (v,w,x);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::ratio
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w,
-- PETScWrappers::Vector &x)
--{
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1.;
-- x(i) = i+2.;
-- }
--
-- v.compress ();
-- w.compress ();
-- x.compress ();
--
-- v.ratio (w, x);
--
-- // make sure we get the expected result
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i+1., ExcInternalError());
-- Assert (x(i) == i+2., ExcInternalError());
-- Assert (std::fabs(v(i) - (i+1.)/(i+2.)) < eps*v(i),
-- ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("48/output");
- 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);
-- PETScWrappers::Vector w (100);
-- PETScWrappers::Vector x (100);
-- test (v,w,x);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (Vector<PetscVector>)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- Vector<PetscScalar> w (v.size());
--
-- for (unsigned int i=0; i<w.size(); ++i)
-- w(i) = i;
--
-- v = w;
--
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i, ExcInternalError());
-- Assert (v(i) == i, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("49/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (Vector<T>) with T!=PetscScalar
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- Vector<double> w (v.size());
-- Vector<float> x (v.size());
--
-- for (unsigned int i=0; i<w.size(); ++i)
-- {
-- w(i) = i;
-- x(i) = i+1;
-- }
--
-- // first copy from w and make sure we get
-- // the expected result. then copy from x
-- // and do the same. in at least one of the
-- // two cases, the template argument to
-- // Vector<T> must be different from
-- // PetscScalar
-- v = w;
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i, ExcInternalError());
-- Assert (v(i) == i, ExcInternalError());
-- Assert (x(i) == i+1, ExcInternalError());
-- }
--
-- v = x;
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w(i) == i, ExcInternalError());
-- Assert (v(i) == i+1, ExcInternalError());
-- Assert (x(i) == i+1, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("50/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 copy constructor PETScWrappers::Vector::Vector(Vector)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set some entries of the vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- if (i%3 == 0)
-- v(i) = i+1.;
-- v.compress ();
--
-- // then copy it
-- PETScWrappers::Vector w (v);
-- w.compress ();
--
-- // make sure they're equal
-- deallog << v *w << ' ' << v.l2_norm() * w.l2_norm()
-- << ' ' << v *w - v.l2_norm() * w.l2_norm() << std::endl;
-- const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
-- Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < eps*(v*w),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("51/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 setting elements in a petsc matrix using
--// PETScWrappers::SparseMatrix::set(). like petsc_01, but use a different
--// constructor for the sparse matrix
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::SparseMatrix &m)
--{
-- // first set a few entries
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.set (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // then make sure we retrieve the same ones
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
-- Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
-- }
-- else
-- {
-- Assert (m(i,j) == 0, ExcInternalError());
-- Assert (m.el(i,j) == 0, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("52/output");
- 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);
-- {
-- typedef PETScWrappers::SparseMatrix::size_type size_type;
--
-- std::vector<size_type> row_lengths (5, 3U);
-- row_lengths.back() = 2;
-- PETScWrappers::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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() in set, and later in *= mode
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector. have a bit pattern of where we
-- // actually wrote elements to
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = i;
-- pattern[i] = true;
-- }
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- v(i) *= 2;
--
-- v.compress ();
--
-- // check that they are ok, and this time
-- // all of them
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert ( ( (pattern[i] == true) && (v(i) == 2*i) )
-- ||
-- ( (pattern[i] == false) && (v(i) == 0) ),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("55/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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() in set, and later in /= mode
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector. have a bit pattern of where we
-- // actually wrote elements to
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) = 2*i;
-- pattern[i] = true;
-- }
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- v(i) /= 2;
--
-- v.compress ();
--
-- // check that they are ok, and this time
-- // all of them
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert ( ( (pattern[i] == true) && (v(i) == i) )
-- ||
-- ( (pattern[i] == false) && (v(i) == 0) ),
-- ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("56/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::is_non_zero
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector. they are all positive
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) += i;
-- pattern[i] = true;
-- }
--
-- v.compress ();
--
-- // check that the vector is really
-- // non-negative
-- Assert (v.is_non_negative() == true, ExcInternalError());
--
-- // then set a single element to a negative
-- // value and check again
-- v(v.size()/2) = -1;
-- Assert (v.is_non_negative() == false, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("57/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 ::Vector (const PETScWrappers::Vector &) copy constructor
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector.
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) += i;
-- pattern[i] = true;
-- }
--
-- v.compress ();
--
-- Vector<double> w (v);
-- Vector<float> x (v);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == w(i), ExcInternalError());
-- Assert (v(i) == x(i), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("58/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 (const ::Vector &) copy constructor
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector.
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) += i;
-- pattern[i] = true;
-- }
--
-- v.compress ();
--
-- Vector<double> w (v);
-- Vector<float> x (v);
--
-- PETScWrappers::Vector w1 (w);
-- PETScWrappers::Vector x1 (x);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w1(i) == w(i), ExcInternalError());
-- Assert (x1(i) == x(i), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("59/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 ::Vector::operator = (const PETScWrappers::Vector &)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector.
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) += i;
-- pattern[i] = true;
-- }
--
-- v.compress ();
--
-- Vector<double> w;
-- w=v;
-- Vector<float> x;
-- x=v;
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == w(i), ExcInternalError());
-- Assert (v(i) == x(i), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("60/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 = (const ::Vector &)
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- // set only certain elements of the
-- // vector.
-- std::vector<bool> pattern (v.size(), false);
-- for (unsigned int i=0; i<v.size(); i+=1+i)
-- {
-- v(i) += i;
-- pattern[i] = true;
-- }
--
-- v.compress ();
--
-- Vector<double> w;
-- w=v;
-- Vector<float> x;
-- x=v;
--
-- PETScWrappers::Vector w1;
-- w1=w;
-- PETScWrappers::Vector x1;
-- x1=x;
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (w1(i) == w(i), ExcInternalError());
-- Assert (x1(i) == x(i), ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("61/output");
- 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 (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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::MatrixBase::clear ()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::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");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::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");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// 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
--// PETScWrappers::MatrixBase::operator=
--
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--template<typename MatrixType>
--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");
- 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);
-- {
-- const unsigned int n_dofs=420;
-- // check
-- // PETScWrappers::SparseMatrix
-- PETScWrappers::SparseMatrix
-- v1 (n_dofs, n_dofs, 5);
-- test (v1);
--
-- // check
-- // PETScWrappers::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<unsigned int>(n_jobs);
-- Assert(n_dofs%n_mpi_processes==0, ExcInternalError());
-- const unsigned int n_local_dofs=n_dofs/n_mpi_processes;
-- PETScWrappers::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// This test used to fail after upgrading to petsc 2.2.1
--
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_parallel_vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test ()
--{
-- PETScWrappers::MPI::Vector v(PETSC_COMM_WORLD, 100, 100);
-- v(0) = 1;
-- v.compress(VectorOperation::insert);
-- v = 0;
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("65/output");
- 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);
-- {
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::MatrixBase::clear_row ()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::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<N; ++i)
-- {
-- if (i>=5)
-- {
-- const double s = rand();
-- m.add (i,i-5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- if (i<N-5)
-- {
-- const double s = rand();
-- m.add (i,i+5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- const double s = rand();
-- m.add (i,i,s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
-- m.compress ();
--
-- 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());
-- Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
--
-- // now remove the entries of row N/2
-- for (unsigned int i=0; i<N; ++i)
-- {
-- const double s = m.el(N/2,i);
-- norm_sqr -= s*s;
-- }
-- m.clear_row (N/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("66/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::MatrixBase::clear_rows ()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::MatrixBase &m)
--{
-- typedef PETScWrappers::MatrixBase::size_type size_type;
--
-- Assert (m.m() != 0, ExcInternalError());
-- Assert (m.n() != 0, ExcInternalError());
--
-- // build a tri-diagonal pattern
-- double norm_sqr = 0;
-- unsigned int nnz = 0;
-- const size_type N = m.m();
-- for (size_type i=0; i<N; ++i)
-- {
-- if (i>=5)
-- {
-- const double s = rand();
-- m.add (i,i-5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- if (i<N-5)
-- {
-- const double s = rand();
-- m.add (i,i+5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- const double s = rand();
-- m.add (i,i,s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
-- m.compress ();
--
-- 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());
-- Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
--
-- // now remove the entries of rows N/2 and N/3
-- for (size_type i=0; i<N; ++i)
-- {
-- const double s = m.el(N/2,i);
-- norm_sqr -= s*s;
-- }
-- for (size_type i=0; i<N; ++i)
-- {
-- const double s = m.el(N/3,i);
-- norm_sqr -= s*s;
-- }
-- const size_type rows[2] = { N/3, N/2 };
-- m.clear_rows (std::vector<size_type>(&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");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::MatrixBase::clear_row () with used second argument
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::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<N; ++i)
-- {
-- if (i>=5)
-- {
-- const double s = rand();
-- m.add (i,i-5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- if (i<N-5)
-- {
-- const double s = rand();
-- m.add (i,i+5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- const double s = rand();
-- m.add (i,i,s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
-- m.compress ();
--
-- 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());
-- Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
--
-- // now remove the entries of row N/2. set
-- // diagonal entries to rnd
-- const double rnd = rand();
-- for (unsigned int i=0; i<N; ++i)
-- {
-- const double s = m.el(N/2,i);
-- norm_sqr -= s*s;
-- }
-- norm_sqr += rnd*rnd;
--
-- m.clear_row (N/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("68/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::MatrixBase::clear_rows () with used second argument
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::MatrixBase &m)
--{
-- Assert (m.m() != 0, ExcInternalError());
-- Assert (m.n() != 0, ExcInternalError());
--
-- typedef PETScWrappers::MatrixBase::size_type size_type;
--
-- // build a tri-diagonal pattern
-- double norm_sqr = 0;
-- unsigned int nnz = 0;
-- const size_type N = m.m();
-- for (size_type i=0; i<N; ++i)
-- {
-- if (i>=5)
-- {
-- const double s = rand();
-- m.add (i,i-5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- if (i<N-5)
-- {
-- const double s = rand();
-- m.add (i,i+5, s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
--
-- const double s = rand();
-- m.add (i,i,s);
-- norm_sqr += s*s;
-- ++nnz;
-- }
-- m.compress ();
--
-- 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());
-- Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
--
-- // now remove the entries of rows N/2 and
-- // N/3. set diagonal entries to rnd
-- const double rnd = rand();
-- for (size_type i=0; i<N; ++i)
-- {
-- const double s = m.el(N/2,i);
-- norm_sqr -= s*s;
-- }
-- for (size_type i=0; i<N; ++i)
-- {
-- const double s = m.el(N/3,i);
-- norm_sqr -= s*s;
-- }
-- norm_sqr += 2*rnd*rnd;
--
-- const size_type rows[2] = { N/3, N/2 };
-- m.clear_rows (std::vector<size_type>(&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");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 PetscScalar
--
--#include "../tests.h"
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_vector.h>
--
--#include <fstream>
--
--int main ()
--{
- std::ofstream logfile("70/output");
- std::ofstream logfile("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());
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// make sure that block vector iterator allows reading and writing correctly
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_block_vector.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- PETScWrappers::BlockVector v(2,1);
-- v(0) = 1;
-- v(1) = 2;
--
-- // first check reading through a const
-- // iterator
-- {
-- PETScWrappers::BlockVector::const_iterator i=v.begin();
-- Assert (*i == 1, ExcInternalError());
-- ++i;
-- Assert (*i == 2, ExcInternalError());
-- }
--
-- // same, but create iterator in a different
-- // way
-- {
-- PETScWrappers::BlockVector::const_iterator
-- i=const_cast<const PETScWrappers::BlockVector &>(v).begin();
-- Assert (*i == 1, ExcInternalError());
-- ++i;
-- Assert (*i == 2, ExcInternalError());
-- }
--
-- // read through a read-write iterator
-- {
-- PETScWrappers::BlockVector::iterator i = v.begin();
-- Assert (*i == 1, ExcInternalError());
-- ++i;
-- Assert (*i == 2, ExcInternalError());
-- }
--
-- // write through a read-write iterator
-- {
-- PETScWrappers::BlockVector::iterator i = v.begin();
--
-- *i = 2;
-- ++i;
-- *i = 3;
-- }
--
-- // and read again
-- {
-- PETScWrappers::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");
- 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);
-- {
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// like _01, except that we use operator[] instead of operator*
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_block_vector.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- PETScWrappers::BlockVector v(2,1);
-- v(0) = 1;
-- v(1) = 2;
--
-- // first check reading through a const
-- // iterator
-- {
-- PETScWrappers::BlockVector::const_iterator i=v.begin();
-- Assert (i[0] == 1, ExcInternalError());
-- Assert (i[1] == 2, ExcInternalError());
-- }
--
-- // same, but create iterator in a different
-- // way
-- {
-- PETScWrappers::BlockVector::const_iterator
-- i=const_cast<const PETScWrappers::BlockVector &>(v).begin();
-- Assert (i[0] == 1, ExcInternalError());
-- Assert (i[1] == 2, ExcInternalError());
-- }
--
-- // read through a read-write iterator
-- {
-- PETScWrappers::BlockVector::iterator i = v.begin();
-- Assert (i[0] == 1, ExcInternalError());
-- Assert (i[1] == 2, ExcInternalError());
-- }
--
-- // write through a read-write iterator
-- {
-- PETScWrappers::BlockVector::iterator i = v.begin();
-- i[0] = 2;
-- i[1] = 3;
-- }
--
-- // and read again
-- {
-- PETScWrappers::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");
- 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);
-- {
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2000 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// this test is an adaptation of lac/block_vector_iterator for PETSc block
--// vectors
--
--#include "../tests.h"
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_block_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--#include <algorithm>
--#include <numeric>
--#include <utility>
--#include <cmath>
--
--template <typename number>
--bool operator == (const PETScWrappers::BlockVector &v1,
-- const PETScWrappers::BlockVector &v2)
--{
-- if (v1.size() != v2.size())
-- return false;
-- for (unsigned int i=0; i<v1.size(); ++i)
-- if (v1(i) != v2(i))
-- return false;
-- return true;
--}
--
--
--void test ()
--{
-- std::vector<types::global_dof_index> ivector(4);
-- ivector[0] = 2;
-- ivector[1] = 4;
-- ivector[2] = 3;
-- ivector[3] = 5;
--
-- // Check 1: initialization via
-- // iterators
-- if (true)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- PETScWrappers::BlockVector v2(ivector);
--
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
-- // initialize other vector
-- // through iterators
-- PETScWrappers::BlockVector::iterator p2 = v2.begin();
-- for (unsigned int i=0; i<v1.size(); ++i, ++p2)
-- *p2 = i;
-- Assert (p2==v2.end(), ExcInternalError());
--
-- // check that the two vectors are equal
-- deallog << "Check 1: " << (v1==v2 ? "true" : "false") << std::endl;
-- };
--
-- // Check 1: initialization via
-- // iterators
-- if (true)
-- {
-- PETScWrappers::BlockVector v1(ivector);
--
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
-- // initialize other vector
-- // through iterators into first
-- // vector
-- PETScWrappers::BlockVector v2(ivector, v1.begin(), v1.end());
-- // check that the two vectors are equal
-- deallog << "Check 2: " << (v1==v2 ? "true" : "false") << std::endl;
-- };
--
-- // Check 3: loop forward and back
-- // and check that things are the
-- // same
-- if (true)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- PETScWrappers::BlockVector::iterator p1 = v1.begin();
-- for (unsigned int i=0; i<v1.size(); ++i, ++p1)
-- Assert (*p1 == i, ExcInternalError());
--
-- Assert (p1 == v1.end(), ExcInternalError());
--
-- // move back into allowable
-- // region
-- --p1;
--
-- // check backwards
-- for (unsigned int i=0; i<v1.size(); ++i, --p1)
-- Assert (*p1 == v1.size()-i-1, ExcInternalError());
--
-- // if we came thus far,
-- // everything is alright
-- deallog << "Check 3: true" << std::endl;
-- };
--
--
-- // Check 4: same, but this time
-- // with const iterators
-- if (true)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- PETScWrappers::BlockVector::const_iterator p1 = v1.begin();
-- for (unsigned int i=0; i<v1.size(); ++i, ++p1)
-- Assert (*p1 == i, ExcInternalError());
--
-- Assert (p1 == v1.end(), ExcInternalError());
--
-- // move back into allowable
-- // region
-- --p1;
--
-- // check backwards
-- for (unsigned int i=0; i<v1.size(); ++i, --p1)
-- {
-- const double val = *p1;
-- const double ref = v1.size()-i-1;
-- Assert (val==ref, ExcInternalError());
-- };
--
-- // if we came thus far,
-- // everything is alright
-- deallog << "Check 4: true" << std::endl;
-- };
--
-- // Checks 5-14: use some standard
-- // algorithms
-- if (true)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- // check std::distance
-- // algorithm
-- deallog << "Check 5: "
-- << (std::distance (v1.begin(), v1.end()) ==
-- static_cast<signed int>(v1.size()) ?
-- "true" : "false")
-- << std::endl;
--
-- // check std::copy
-- PETScWrappers::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<double>(),
-- 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
-- PETScWrappers::BlockVector::iterator p2 = v1.begin();
-- std::advance (p2, v1.size());
-- deallog << "Check 13: " << (p2 == v1.end() ? "true" : "false") << std::endl;
--
-- PETScWrappers::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)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- // initialize a normal vector
-- // from it
-- Vector<double> v2(v1.begin(), v1.end());
--
-- // and reverse way
-- PETScWrappers::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)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- // initialize a normal vector
-- // from it
-- const Vector<double> v2(v1.begin(), v1.end());
--
-- // and reverse way
-- PETScWrappers::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)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- // initialize a normal vector
-- // from it
-- const Vector<double> v2(v1.begin(), v1.end());
--
-- // and reverse way
-- const PETScWrappers::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)
-- {
-- PETScWrappers::BlockVector v0(ivector);
-- // initialize first vector with
-- // simple loop
-- for (unsigned int i=0; i<v0.size(); ++i)
-- v0(i) = i;
--
-- const PETScWrappers::BlockVector v1 = v0;
--
-- // initialize a normal vector
-- // from it
-- const Vector<double> v2(v1.begin(), v1.end());
--
-- // and reverse way
-- const PETScWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
-- deallog << "Check 18: " << (v1==v3 ? "true" : "false") << std::endl;
-- };
--
-- // Check 19: operator[]
-- if (true)
-- {
-- PETScWrappers::BlockVector v1(ivector);
-- for (unsigned int i=0; i<v1.size(); ++i)
-- v1(i) = i;
--
-- for (unsigned int i=0; i<v1.size(); ++i)
-- {
-- const PETScWrappers::BlockVector::iterator p = (v1.begin()+i);
-- for (unsigned int j=0; j<v1.size(); ++j)
-- Assert (p[(signed)j-(signed)i] == j, ExcInternalError());
-- };
--
-- // if we came thus far,
-- // everything is alright
-- deallog << "Check 19: true" << std::endl;
-- };
--}
--
--
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("block_vector_iterator_03/output");
- std::ofstream logfile("output");
-- logfile.setf(std::ios::fixed);
-- logfile.precision(3);
-- deallog.attach(logfile);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- try
-- {
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- test ();
-- }
--
-- }
-- catch (std::exception &e)
-- {
-- std::cerr << std::endl << std::endl
-- << "----------------------------------------------------"
-- << std::endl;
-- std::cerr << "Exception on processing: " << e.what() << std::endl
-- << "Aborting!" << std::endl
-- << "----------------------------------------------------"
-- << std::endl;
-- // abort
-- return 2;
-- }
-- catch (...)
-- {
-- std::cerr << std::endl << std::endl
-- << "----------------------------------------------------"
-- << std::endl;
-- std::cerr << "Unknown exception!" << std::endl
-- << "Aborting!" << std::endl
-- << "----------------------------------------------------"
-- << std::endl;
-- // abort
-- return 3;
-- };
--
--
-- return 0;
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the CG solver using the PETSc matrix and vector classes
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/solver_control.h>
--#include <deal.II/lac/solver_cg.h>
--#include <deal.II/lac/solver_gmres.h>
--#include <deal.II/lac/solver_bicgstab.h>
--#include <deal.II/lac/solver_richardson.h>
--#include <deal.II/lac/solver_qmrs.h>
--#include <deal.II/lac/precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("deal_solver_01/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- GrowingVectorMemory<PETScWrappers::Vector> mem;
-- SolverCG<PETScWrappers::Vector> solver(control,mem);
-- PreconditionIdentity preconditioner;
-- check_solve (solver, A,u,f, preconditioner);
-- }
-- GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the BiCGStab solver using the PETSc matrix and vector classes
--
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/solver_control.h>
--#include <deal.II/lac/solver_cg.h>
--#include <deal.II/lac/solver_gmres.h>
--#include <deal.II/lac/solver_bicgstab.h>
--#include <deal.II/lac/solver_richardson.h>
--#include <deal.II/lac/solver_qmrs.h>
--#include <deal.II/lac/solver.h>
--#include <deal.II/lac/precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("deal_solver_02/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- SolverControl control(100, 1.e-10);
--
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- GrowingVectorMemory<PETScWrappers::Vector> mem;
-- SolverBicgstab<PETScWrappers::Vector> solver(control,mem);
-- PreconditionIdentity preconditioner;
-- check_solve (solver, A,u,f, preconditioner);
-- }
-- GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the GMRES solver using the PETSc matrix and vector classes
--
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/solver_control.h>
--#include <deal.II/lac/solver_cg.h>
--#include <deal.II/lac/solver_gmres.h>
--#include <deal.II/lac/solver_bicgstab.h>
--#include <deal.II/lac/solver_richardson.h>
--#include <deal.II/lac/solver_qmrs.h>
--#include <deal.II/lac/solver.h>
--#include <deal.II/lac/precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("deal_solver_03/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- GrowingVectorMemory<PETScWrappers::Vector> mem;
-- SolverGMRES<PETScWrappers::Vector> solver(control,mem);
-- PreconditionIdentity preconditioner;
-- check_solve (solver, A,u,f, preconditioner);
-- }
-- GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the MINRES solver using the PETSc matrix and vector classes
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/solver_control.h>
--#include <deal.II/lac/solver_cg.h>
--#include <deal.II/lac/solver_gmres.h>
--#include <deal.II/lac/solver_bicgstab.h>
--#include <deal.II/lac/solver_richardson.h>
--#include <deal.II/lac/solver_qmrs.h>
--#include <deal.II/lac/solver_minres.h>
--#include <deal.II/lac/precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("deal_solver_04/output");
- std::ofstream logfile("output");
-- logfile.precision(4);
-- deallog.attach(logfile);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- GrowingVectorMemory<PETScWrappers::Vector> mem;
-- SolverMinRes<PETScWrappers::Vector> solver(control,mem);
-- PreconditionIdentity preconditioner;
-- check_solve (solver, A,u,f, preconditioner);
-- }
-- GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the QMRS solver using the PETSc matrix and vector classes
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/solver_control.h>
--#include <deal.II/lac/solver_cg.h>
--#include <deal.II/lac/solver_gmres.h>
--#include <deal.II/lac/solver_bicgstab.h>
--#include <deal.II/lac/solver_richardson.h>
--#include <deal.II/lac/solver_qmrs.h>
--#include <deal.II/lac/precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("deal_solver_05/output");
- std::ofstream logfile("output");
-- logfile.precision(4);
-- deallog.attach(logfile);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- GrowingVectorMemory<PETScWrappers::Vector> mem;
-- SolverQMRS<PETScWrappers::Vector> solver(control,mem);
-- PreconditionIdentity preconditioner;
-- check_solve (solver, A,u,f, preconditioner);
-- }
-- GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 setting elements in a petsc matrix using
--// PETScWrappers::FullMatrix::set()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.set (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // then make sure we retrieve the same ones
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
-- Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
-- }
-- else
-- {
-- Assert (m(i,j) == 0, ExcInternalError());
-- Assert (m.el(i,j) == 0, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_01/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 setting elements in a petsc matrix using
--// PETScWrappers::FullMatrix::add()
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.add (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // then make sure we retrieve the same ones
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
-- Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
-- }
-- else
-- {
-- Assert (m(i,j) == 0, ExcInternalError());
-- Assert (m.el(i,j) == 0, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_02/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 querying matrix sizes
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--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("full_matrix_04/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 querying the number of nonzero elements in
--// PETScWrappers::FullMatrix
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--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<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- m.set (i,j, i*j*.5+.5);
-- ++counter;
-- }
--
-- m.compress ();
--
-- // check n_nonzero_elements then
-- // output a dummy number.
-- deallog << counter << std::endl;
-- Assert (m.m() * m.m(), ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_05/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::FullMatrix::l1_norm
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries. count how many
-- // entries we have
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.set (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // compare against the exact value of the
-- // l1-norm (max col-sum)
-- deallog << m.l1_norm() << std::endl;
-- Assert (m.l1_norm() == 7, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_06/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::FullMatrix::linfty_norm
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries. count how many
-- // entries we have
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.set (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // 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("full_matrix_07/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::FullMatrix::frobenius_norm
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries. count how many
-- // entries we have
-- PetscScalar norm = 0;
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- m.set (i,j, i*j*.5+.5);
-- norm += (i*j*.5+.5)*(i*j*.5+.5);
-- }
-- norm = std::sqrt(norm);
--
-- m.compress ();
--
-- // compare against the exact value of the
-- // l2-norm (max row-sum)
-- deallog << m.frobenius_norm() << std::endl;
-- Assert (m.frobenius_norm() == norm, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_08/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::FullMatrix::operator *=
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.set (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // then multiply everything by 1.25 and
-- // make sure we retrieve the values we
-- // expect
-- m *= 1.25;
--
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- Assert (m(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
-- Assert (m.el(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
-- }
-- else
-- {
-- Assert (m(i,j) == 0, ExcInternalError());
-- Assert (m.el(i,j) == 0, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_09/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::FullMatrix::operator /=
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test (PETScWrappers::FullMatrix &m)
--{
-- // first set a few entries
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- m.set (i,j, i*j*.5+.5);
--
-- m.compress ();
--
-- // then divide everything by 4/3 and
-- // make sure we retrieve the values we
-- // expect
-- m /= 4./3.;
--
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- if ((i+2*j+1) % 3 == 0)
-- {
-- Assert (m(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
-- Assert (m.el(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
-- }
-- else
-- {
-- Assert (m(i,j) == 0, ExcInternalError());
-- Assert (m.el(i,j) == 0, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("full_matrix_10/output");
- 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::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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// test PETScWrappers::MatrixBase::const_iterator
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- PETScWrappers::FullMatrix m(5,5);
-- m.set (0,0,1);
-- m.set (1,1,2);
-- m.set (1,2,3);
-- m.compress ();
-- PETScWrappers::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");
- 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);
-- {
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 FullMatrix::Tvmult
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::FullMatrix m(v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- v(i) = i;
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // w:=Mv
-- m.Tvmult (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
--
-- double result = 0;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (j+2*i)*j;
-- Assert (w(i) == result, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("full_matrix_vector_02/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 FullMatrix::vmult_add
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::FullMatrix m(v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i;
-- }
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // w:=Mv
-- m.vmult_add (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
--
-- double result = 0;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (i+2*j)*j;
-- Assert (w(i) == i+result, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("full_matrix_vector_03/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 FullMatrix::Tvmult_add
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::FullMatrix m(v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i;
-- }
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // w:=Mv
-- m.Tvmult_add (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
--
-- double result = 0;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (j+2*i)*j;
-- Assert (w(i) == i+result, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("full_matrix_vector_04/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 FullMatrix::matrix_scalar_product
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::FullMatrix m(v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1;
-- }
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // <w,Mv>
-- const PetscScalar s = m.matrix_scalar_product (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
-- Assert (w(i) == i+1, ExcInternalError());
-- }
--
-- PetscScalar result = 0;
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (i+2*j)*j*(i+1);
--
-- Assert (s == result, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("full_matrix_vector_05/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 FullMatrix::matrix_norm_square
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- PETScWrappers::FullMatrix m(v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- v(i) = i;
--
-- m.compress ();
-- v.compress ();
--
-- // <w,Mv>
-- const PetscScalar s = m.matrix_norm_square (v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert (v(i) == i, ExcInternalError());
--
-- PetscScalar result = 0;
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (i+2*j)*j*i;
--
-- Assert (s == result, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("full_matrix_vector_06/output");
- 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 (30);
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 FullMatrix::matrix_norm_square
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_full_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w,
-- PETScWrappers::Vector &x)
--{
-- PETScWrappers::FullMatrix m(v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i+1;
-- }
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // x=w-Mv
-- const double s = m.residual (x, v, w);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
-- Assert (w(i) == i+1, ExcInternalError());
--
-- double result = i+1;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result -= (i+2*j)*j;
--
-- Assert (x(i) == result, ExcInternalError());
-- }
--
-- Assert (s == x.l2_norm(), ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("full_matrix_vector_07/output");
- 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);
-- PETScWrappers::Vector w (100);
-- PETScWrappers::Vector x (100);
-- test (v,w,x);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// PETScWrappers::MPI::SparseMatrix::reinit(CompressedSparsityPattern) should
--// create a matrix that, when filled with elements that match the sparsity
--// pattern, doesn't require any more memory allocation any more. This is
--// tricky to get right, though, and took a while until it worked.
--//
--// the test itself can only check this when run in parallel, but we can add it
--// anyway to the testsuite. in order to check that the library actually does
--// what it is supposed to do, run this program with more than one MPI process
--// and with the option -log_info. All the output should say that no additional
--// malloc calls have been performed
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
--#include <deal.II/lac/compressed_sparsity_pattern.h>
--#include <fstream>
--#include <cstdlib>
--
--
--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 ()
--{
-- typedef PETScWrappers::MPI::SparseMatrix::size_type size_type;
--
-- // 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<size_type> local_rows_per_process (get_n_mpi_processes());
-- std::vector<size_type> start_row (get_n_mpi_processes());
-- for (unsigned int i=0; i<get_n_mpi_processes(); ++i)
-- {
-- N += (i+1)*10;
-- local_rows_per_process[i] = (i+1)*10;
-- start_row[i] += i*10;
-- }
--
-- // here is a sparsity pattern for which we
-- // used to allocate additional memory for 2
-- // processes. note that only one of the
-- // four blocks uses Inodes
-- CompressedSparsityPattern csp (N,N);
-- for (unsigned int i=0; i<N; ++i)
-- for (unsigned int j=0; j<N; ++j)
-- {
-- csp.add (i,i);
-- if (i+local_rows_per_process.back() < N)
-- csp.add (i,i+local_rows_per_process.back());
-- if (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<get_n_mpi_processes(); ++bi)
--// for (unsigned int bj=0; bj<get_n_mpi_processes(); ++bj)
--// for (unsigned int i=0; i<local_rows_per_process[bi]; ++i)
--// for (unsigned int k=0; k<6; ++k)
--// csp.add (start_row[bi] + i,
--// start_row[bj] + (i+2*k) % local_rows_per_process[bj]);
--
--
--
-- // now create a matrix with this sparsity
-- // pattern
-- PETScWrappers::MPI::SparseMatrix m;
-- m.reinit (MPI_COMM_WORLD, csp, local_rows_per_process,
-- local_rows_per_process, get_this_mpi_process());
--
-- // no write into the exact same matrix
-- // entries as have been created by the
-- // sparsity pattern above
-- for (unsigned int i=0; i<N; ++i)
-- for (unsigned int j=0; j<csp.row_length(i); ++j)
-- m.add (i, csp.column_number(i,j), 1.);
--
-- m.compress ();
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("parallel_sparse_matrix_01/output");
- 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);
-- 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;
-- };
--}
+++ /dev/null
--// $Id$
--
--#include "../tests.h"
--#include <deal.II/base/exceptions.h>
--#include <iostream>
--#include <deal.II/lac/petsc_matrix_free.h>
--#include <deal.II/lac/vector.h>
--
--// A variant of the tests/lac/testmatrix.h file that uses the PETSc
--// matrix free interface
--
--
--/**
-- * Finite difference PETSc matrix-free object on uniform grid.
-- * Generator for simple 5-point discretization of Laplace problem.
-- */
--
--class PetscFDMatrix : public dealii::PETScWrappers::MatrixFree
--{
--public:
-- /**
-- * Constructor specifying grid resolution.
-- */
-- PetscFDMatrix(unsigned int size, unsigned int dim);
--
-- /**
-- * Matrix-vector multiplication:
-- * let <i>dst = M*src</i> with
-- * <i>M</i> being this matrix.
-- *
-- * Source and destination must
-- * not be the same vector.
-- */
-- void vmult (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const;
--
-- /**
-- * Matrix-vector multiplication: let
-- * <i>dst = M<sup>T</sup>*src</i> with
-- * <i>M</i> being this matrix. This
-- * function does the same as @p vmult()
-- * but takes the transposed matrix.
-- *
-- * Source and destination must
-- * not be the same vector.
-- */
-- void Tvmult (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const;
--
-- /**
-- * Adding Matrix-vector
-- * multiplication. Add
-- * <i>M*src</i> on <i>dst</i>
-- * with <i>M</i> being this
-- * matrix.
-- *
-- * Source and destination must
-- * not be the same vector.
-- */
-- void vmult_add (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const;
--
-- /**
-- * Adding Matrix-vector
-- * multiplication. Add
-- * <i>M<sup>T</sup>*src</i> to
-- * <i>dst</i> with <i>M</i> being
-- * this matrix. This function
-- * does the same as @p vmult_add()
-- * but takes the transposed
-- * matrix.
-- *
-- * Source and destination must
-- * not be the same vector.
-- */
-- void Tvmult_add (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const;
--
--private:
-- /**
-- * Number of gridpoints in x-direction.
-- */
-- unsigned int nx;
--
-- /**
-- * Number of gridpoints in y-direction.
-- */
-- unsigned int ny;
--};
--
--
--// --------------- inline and template functions -----------------
--
--inline
--PetscFDMatrix::PetscFDMatrix(unsigned int size, unsigned int dim)
-- : PETScWrappers::MatrixFree (dim, dim, dim, dim),
-- nx (size), ny (size)
--{}
--
--
--
--inline
--void
--PetscFDMatrix::vmult_add (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const
--{
-- for (unsigned int i=0; i<=ny-2; i++)
-- {
-- for (unsigned int j=0; j<=nx-2; j++)
-- {
-- // Number of the row to be entered
-- unsigned int row = j+(nx-1)*i;
--
-- dst(row) += 4. * src(row); // A.set(row, row, 4.);
--
-- if (j>0)
-- {
-- dst(row-1) += -1. * src(row); // A.set(row-1, row, -1.);
-- dst(row) += -1. * src(row-1); // A.set(row, row-1, -1.);
-- }
-- if (i>0)
-- {
-- dst(row-(nx-1)) += -1. * src(row); // A.set(row-(nx-1), row, -1.);
-- dst(row) += -1. * src(row-(nx-1)); // A.set(row, row-(nx-1), -1.);
-- }
-- }
-- }
--}
--
--
--
--inline
--void
--PetscFDMatrix::vmult (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const
--{
-- dst = 0;
-- vmult_add (dst, src);
--}
--
--
--
--inline
--void
--PetscFDMatrix::Tvmult (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const
--{
-- dst = 0;
-- vmult_add (dst, src);
--}
--
--
--
--inline
--void
--PetscFDMatrix::Tvmult_add (dealii::PETScWrappers::VectorBase &dst,
-- const dealii::PETScWrappers::VectorBase &src) const
--{
-- vmult_add (dst, src);
--}
--
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2005 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// this is part of a whole suite of tests that checks the relative speed of
--// using PETSc for sparse matrices as compared to the speed of our own
--// library. the tests therefore may not all actually use PETSc, but they are
--// meant to compare it
--//
--// the tests build the 5-point stencil matrix for a uniform grid of size N*N
--
--#include "../tests.h"
--#include <deal.II/lac/sparse_matrix.h>
--#include <deal.II/lac/vector.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- const unsigned int N = 200;
--
-- // first build the sparsity pattern
-- SparsityPattern sparsity (N*N, N*N, 5);
-- for (unsigned int i=0; i<N; i++)
-- for (unsigned int j=0; j<N; j++)
-- {
-- const unsigned int global = i*N+j;
-- sparsity.add(global, global);
-- if (j>0)
-- {
-- sparsity.add(global-1, global);
-- sparsity.add(global, global-1);
-- }
-- if (j<N-1)
-- {
-- sparsity.add(global+1, global);
-- sparsity.add(global, global+1);
-- }
-- if (i>0)
-- {
-- sparsity.add(global-N, global);
-- sparsity.add(global, global-N);
-- }
-- if (i<N-1)
-- {
-- sparsity.add(global+N, global);
-- sparsity.add(global, global+N);
-- }
-- }
-- sparsity.compress();
--
--
-- // next build the sparse matrix itself
-- SparseMatrix<double> matrix (sparsity);
-- for (unsigned int i=0; i<N; i++)
-- for (unsigned int j=0; j<N; j++)
-- {
-- const unsigned int global = i*N+j;
-- matrix.add(global, global, 4);
-- if (j>0)
-- {
-- matrix.add(global-1, global, -1);
-- matrix.add(global, global-1, -1);
-- }
-- if (j<N-1)
-- {
-- matrix.add(global+1, global, -1);
-- matrix.add(global, global+1, -1);
-- }
-- if (i>0)
-- {
-- matrix.add(global-N, global, -1);
-- matrix.add(global, global-N, -1);
-- }
-- if (i<N-1)
-- {
-- matrix.add(global+N, global, -1);
-- matrix.add(global, global+N, -1);
-- }
-- }
--
-- // then do a single matrix-vector
-- // multiplication with subsequent formation
-- // of the matrix norm
-- Vector<double> v1(N*N), v2(N*N);
-- for (unsigned int i=0; i<N*N; ++i)
-- v1(i) = i;
-- matrix.vmult (v2, v1);
--
-- deallog << v1 *v2 << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("slowness_01/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog.depth_console(0);
--
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2005 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// this is part of a whole suite of tests that checks the relative speed of
--// using PETSc for sparse matrices as compared to the speed of our own
--// library. the tests therefore may not all actually use PETSc, but they are
--// meant to compare it
--//
--// the tests build the 5-point stencil matrix for a uniform grid of size N*N
--
--#include "../tests.h"
--#include <deal.II/lac/sparse_matrix.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- const unsigned int N = 200;
--
-- // build the sparse matrix
-- PETScWrappers::SparseMatrix matrix (N*N, N*N, 5);
-- for (unsigned int i=0; i<N; i++)
-- for (unsigned int j=0; j<N; j++)
-- {
-- const unsigned int global = i*N+j;
-- matrix.add(global, global, 4);
-- if (j>0)
-- {
-- matrix.add(global-1, global, -1);
-- matrix.add(global, global-1, -1);
-- }
-- if (j<N-1)
-- {
-- matrix.add(global+1, global, -1);
-- matrix.add(global, global+1, -1);
-- }
-- if (i>0)
-- {
-- matrix.add(global-N, global, -1);
-- matrix.add(global, global-N, -1);
-- }
-- if (i<N-1)
-- {
-- matrix.add(global+N, global, -1);
-- matrix.add(global, global+N, -1);
-- }
-- }
-- matrix.compress ();
--
--
-- // then do a single matrix-vector
-- // multiplication with subsequent formation
-- // of the matrix norm
-- PETScWrappers::Vector v1(N*N), v2(N*N);
-- for (unsigned int i=0; i<N*N; ++i)
-- v1(i) = i;
-- matrix.vmult (v2, v1);
--
-- deallog << v1 *v2 << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("slowness_02/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog.depth_console(0);
--
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2005 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// this is part of a whole suite of tests that checks the relative speed of
--// using PETSc for sparse matrices as compared to the speed of our own
--// library. the tests therefore may not all actually use PETSc, but they are
--// meant to compare it
--//
--// the tests build the 5-point stencil matrix for a uniform grid of size N*N
--
--#include "../tests.h"
--#include <deal.II/lac/sparse_matrix.h>
--#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
--#include <deal.II/lac/petsc_parallel_vector.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- const unsigned int N = 200;
--
-- // build the sparse matrix
-- PETScWrappers::MPI::SparseMatrix matrix (PETSC_COMM_WORLD,
-- N*N, N*N,
-- N*N, N*N,
-- 5);
-- for (unsigned int i=0; i<N; i++)
-- for (unsigned int j=0; j<N; j++)
-- {
-- const unsigned int global = i*N+j;
-- matrix.add(global, global, 4);
-- if (j>0)
-- {
-- matrix.add(global-1, global, -1);
-- matrix.add(global, global-1, -1);
-- }
-- if (j<N-1)
-- {
-- matrix.add(global+1, global, -1);
-- matrix.add(global, global+1, -1);
-- }
-- if (i>0)
-- {
-- matrix.add(global-N, global, -1);
-- matrix.add(global, global-N, -1);
-- }
-- if (i<N-1)
-- {
-- matrix.add(global+N, global, -1);
-- matrix.add(global, global+N, -1);
-- }
-- }
-- matrix.compress ();
--
-- // then do a single matrix-vector
-- // multiplication with subsequent formation
-- // of the matrix norm
-- PETScWrappers::MPI::Vector v1(PETSC_COMM_WORLD, N*N, N*N);
-- PETScWrappers::MPI::Vector v2(PETSC_COMM_WORLD, N*N, N*N);
-- for (unsigned int i=0; i<N*N; ++i)
-- v1(i) = i;
-- matrix.vmult (v2, v1);
--
-- deallog << v1 *v2 << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("slowness_03/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog.depth_console(0);
--
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2005 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// this is part of a whole suite of tests that checks the relative speed of
--// using PETSc for sparse matrices as compared to the speed of our own
--// library. the tests therefore may not all actually use PETSc, but they are
--// meant to compare it
--//
--// the tests build the 5-point stencil matrix for a uniform grid of size N*N
--//
--// this test does the same as the _03 test, except that it does not allocate
--// the entries in consecutive order, but in pseudo-random order. the reason is
--// that in usual finite element programs, we do not write to the elements of a
--// matrix in a consecutive fashion, but rather according to the order of
--// degrees of freedom in the sequence of cells that we traverse
--
--#include "../tests.h"
--#include <deal.II/lac/sparse_matrix.h>
--#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
--#include <deal.II/lac/petsc_parallel_vector.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- const unsigned int N = 200;
--
-- // first find a random permutation of the
-- // indices
-- std::vector<unsigned int> permutation (N);
-- {
-- std::vector<unsigned int> unused_indices (N);
-- for (unsigned int i=0; i<N; i++)
-- unused_indices[i] = i;
--
-- for (unsigned int i=0; i<N; i++)
-- {
-- // pick a random element among the
-- // unused indices
-- const unsigned int k = rand() % (N-i);
-- permutation[i] = unused_indices[k];
--
-- // then swap this used element to the
-- // end where we won't consider it any
-- // more
-- std::swap (unused_indices[k], unused_indices[N-i-1]);
-- }
-- }
--
-- // build the sparse matrix
-- PETScWrappers::MPI::SparseMatrix matrix (PETSC_COMM_WORLD,
-- N*N, N*N,
-- N*N, N*N,
-- 5);
-- for (unsigned int i_=0; i_<N; i_++)
-- for (unsigned int j_=0; j_<N; j_++)
-- {
-- const unsigned int i=permutation[i_];
-- const unsigned int j=permutation[j_];
--
-- const unsigned int global = i*N+j;
-- matrix.add(global, global, rand());
-- if (j>0)
-- {
-- matrix.add(global-1, global, rand());
-- matrix.add(global, global-1, rand());
-- }
-- if (j<N-1)
-- {
-- matrix.add(global+1, global, rand());
-- matrix.add(global, global+1, rand());
-- }
-- if (i>0)
-- {
-- matrix.add(global-N, global, rand());
-- matrix.add(global, global-N, rand());
-- }
-- if (i<N-1)
-- {
-- matrix.add(global+N, global, rand());
-- matrix.add(global, global+N, rand());
-- }
-- }
-- matrix.compress ();
--
-- // then do a single matrix-vector
-- // multiplication with subsequent formation
-- // of the matrix norm
-- PETScWrappers::MPI::Vector v1(PETSC_COMM_WORLD, N*N, N*N);
-- PETScWrappers::MPI::Vector v2(PETSC_COMM_WORLD, N*N, N*N);
-- for (unsigned int i=0; i<N*N; ++i)
-- v1(i) = i;
-- matrix.vmult (v2, v1);
--
-- deallog << v1 *v2 << std::endl;
--}
--
--
--
--int main (int argc,char **argv)
--{
- std::ofstream logfile("slowness_04/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog.depth_console(0);
--
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver with the PreconditionBoomerAMG
--// preconditioner
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_boomeramg/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionBoomerAMG preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver with the PreconditionBoomerAMG
--// preconditioner. allow the preconditioner to exploit symmetry of the
--// matrix
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_boomeramg_symmetric/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionBoomerAMG preconditioner(A, true);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_eisenstat/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionEisenstat preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_icc/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionICC preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_ilu/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionILU preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver with the PreconditionLU
--// preconditioner. This should converge in exactly one iteration
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--
-- // we use a direct solver as a
-- // preconditioner. this should
-- // converge in one step!
-- Assert (solver.control().last_step() == 1,
-- ExcInternalError());
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_lu/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionLU preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_parasails/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionParaSails preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_sor/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionSOR preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CG solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_03_precondition_ssor/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCG solver(control);
-- PETScWrappers::PreconditionSSOR preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc GMRES solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_05/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverGMRES solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc Bicgstab solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_06/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverBicgstab solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CGS solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_07/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCGS solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc TFQMR solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_08/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverTFQMR solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// 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 <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_09/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverTCQMR solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc CR solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_10/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverCR solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc LSQR solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
- catch (std::exception &e)
- catch (dealii::SolverControl::NoConvergence &e)
-- {
- deallog << e.what() << std::endl;
-- // just like for Richardson: expect to
-- // get here, don't abort the program
- deallog << "Catched exception dealii::SolverControl::NoConvergence" << std::endl;
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_11/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverLSQR solver(control);
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc PreOnly solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
--
-- solver.solve(A,u,f,P);
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_12/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- PETScWrappers::SolverPreOnly solver(control);
--
-- PETScWrappers::PreconditionJacobi preconditioner(A);
-- check_solve (solver, A,u,f, preconditioner);
--
-- //run twice because this errored out at some point
-- check_solve (solver, A,u,f, preconditioner);
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETScWrapper::Precondition*::vmult
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- solver.solve(A,u,f,P);
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("solver_13/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- u = 0.;
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
-- PETScWrappers::Vector t=u;
--
-- PETScWrappers::SolverPreOnly solver(control);
--
-- PETScWrappers::PreconditionJacobi preconditioner(A);
--
-- check_solve (solver, A,u,f, preconditioner);
--
-- deallog << u.l2_norm() << std::endl;
--
-- check_solve (solver, A,t,u, preconditioner);
--
-- deallog << t.l2_norm() << std::endl;
--
-- u = 0;
-- preconditioner.vmult(u, f);
-- deallog << u.l2_norm() << std::endl;
-- preconditioner.vmult(t, u);
-- deallog << t.l2_norm() << std::endl;
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--// test the PETSc SparseDirectMumps solver
--
--
--#include "../tests.h"
--#include "../lac/testmatrix.h"
--#include <cmath>
--#include <fstream>
--#include <iostream>
--#include <iomanip>
--#include <deal.II/base/logstream.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_solver.h>
--#include <deal.II/lac/petsc_precondition.h>
--#include <deal.II/lac/vector_memory.h>
--#include <typeinfo>
--
--template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
--void
--check_solve( SOLVER &solver, const MATRIX &A,
-- VECTOR &u, VECTOR &f, const PRECONDITION &P)
--{
-- deallog << "Solver type: " << typeid(solver).name() << std::endl;
--
-- u = 0.;
-- f = 1.;
-- try
-- {
-- solver.solve(A,u,f,P);
-- }
-- catch (std::exception &e)
-- {
-- deallog << e.what() << std::endl;
-- abort ();
-- }
--
-- deallog << "Solver stopped after " << solver.control().last_step()
-- << " iterations" << std::endl;
--}
--
--
--int main(int argc, char **argv)
--{
- std::ofstream logfile("sparse_direct_mumps/output");
- std::ofstream logfile("output");
-- deallog.attach(logfile);
-- deallog << std::setprecision(4);
-- deallog.depth_console(0);
-- deallog.threshold_double(1.e-10);
--
-- Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
-- {
-- 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);
-- PETScWrappers::SparseMatrix A(dim, dim, 5);
-- testproblem.five_point(A);
--
-- PETScWrappers::Vector f(dim);
-- PETScWrappers::Vector u(dim);
-- u = 0.;
-- f = 1.;
-- A.compress ();
-- f.compress ();
-- u.compress ();
--
-- SolverControl cn;
-- PETScWrappers::SparseDirectMUMPS solver(cn);
--// solver.set_symmetric_mode(true);
-- solver.solve(A,u,f);
--
-- PETScWrappers::Vector tmp(dim);
-- deallog << "residual = " << A.residual (tmp, u, f)
-- << std::endl;
-- }
--
--}
--
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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.
--//
--// ---------------------------------------------------------------------
--
--
--
--// test PETScWrappers::MatrixBase::const_iterator
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--
--
--void test ()
--{
-- PETScWrappers::SparseMatrix m(5,5,5);
-- m.set (0,0,1);
-- m.set (1,1,2);
-- m.set (1,2,3);
-- m.compress ();
-- PETScWrappers::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");
- 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);
-- {
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::vmult
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::SparseMatrix m(v.size(),v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- v(i) = i;
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // w:=Mv
-- m.vmult (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
--
-- double result = 0;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (i+2*j)*j;
-- Assert (w(i) == result, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("sparse_matrix_vector_01/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::Tvmult
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::SparseMatrix m(v.size(),v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- v(i) = i;
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // w:=Mv
-- m.Tvmult (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
--
-- double result = 0;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (j+2*i)*j;
-- Assert (w(i) == result, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("sparse_matrix_vector_02/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::vmult_add
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- PETScWrappers::SparseMatrix m(v.size(),v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- w(i) = i;
-- }
--
-- m.compress ();
-- v.compress ();
-- w.compress ();
--
-- // w:=Mv
-- m.vmult_add (w,v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- Assert (v(i) == i, ExcInternalError());
--
-- double result = 0;
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (i+2*j)*j;
-- Assert (w(i) == i+result, ExcInternalError());
-- }
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("sparse_matrix_vector_03/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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::matrix_norm_square
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <deal.II/lac/petsc_sparse_matrix.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v)
--{
-- PETScWrappers::SparseMatrix m(v.size(),v.size(),v.size());
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- m.set (i,j, i+2*j);
--
-- for (unsigned int i=0; i<v.size(); ++i)
-- v(i) = i;
--
-- m.compress ();
-- v.compress ();
--
-- // <w,Mv>
-- const PetscScalar s = m.matrix_norm_square (v);
--
-- // make sure we get the expected result
-- for (unsigned int i=0; i<v.size(); ++i)
-- Assert (v(i) == i, ExcInternalError());
--
-- PetscScalar result = 0;
-- for (unsigned int i=0; i<m.m(); ++i)
-- for (unsigned int j=0; j<m.m(); ++j)
-- result += (i+2*j)*j*i;
--
-- Assert (s == result, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("sparse_matrix_vector_06/output");
- 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 (30);
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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 not
--// equal
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- // set only certain elements of each
-- // vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- if (i%3 == 0)
-- w(i) = i+1.;
-- }
--
-- Assert (v!=w, ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("vector_equality_3/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
+++ /dev/null
--// ---------------------------------------------------------------------
--// $Id$
--//
--// Copyright (C) 2004 - 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
--
--#include "../tests.h"
--#include <deal.II/lac/petsc_vector.h>
--#include <fstream>
--#include <iostream>
--#include <vector>
--
--
--void test (PETScWrappers::Vector &v,
-- PETScWrappers::Vector &w)
--{
-- // set only certain elements of each
-- // vector
-- for (unsigned int i=0; i<v.size(); ++i)
-- {
-- v(i) = i;
-- if (i%3 == 0)
-- w(i) = i+1.;
-- }
-- // but then copy elements and make sure the
-- // vectors are actually equal
-- v = w;
-- Assert (! (v!=w), ExcInternalError());
--
-- deallog << "OK" << std::endl;
--}
--
--
--
--int main (int argc, char **argv)
--{
- std::ofstream logfile("vector_equality_4/output");
- 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);
-- PETScWrappers::Vector w (100);
-- test (v,w);
-- }
--
-- }
-- 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;
-- };
--}
--- /dev/null
--- /dev/null
++ADD_CUSTOM_TARGET(foobar)
--- /dev/null
--- /dev/null
++ADD_CUSTOM_TARGET(foobar)