// ---------------------------------------------------------------------
-// $Id: 00.cc$
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
//
// ---------------------------------------------------------------------
-
-// PETSc includes: We would like to do this cleanly
-//
-#include <petscksp.h>
-#include <petscsys.h>
-#include <petscmath.h>
-//
-// though a horrible warning message
-//
-// warning: imaginary constants are a GCC extension [enabled by default]
-//
-// appears. This seems to be related to the direct useage of
-// PetscScalar in accordance with gcc.gnu.org bug 7263.
-
-// deal.II includes
#include "../tests.h"
#include <deal.II/base/logstream.h>
deallog << "OK" << std::endl;
}
+
int main (int argc, char **argv)
{
std::ofstream logfile ("output");
dealii::deallog.attach (logfile);
- dealii::deallog.depth_console (0);
deallog.threshold_double(1.e-10);
try
{
- PetscInitialize (&argc, &argv, (char *) 0, (char *) 0);
+ Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1);
{
// initialisation (zero and nonzero)
init_petsc_complex ();
divide_petsc_complex_by_a_number ();
multiply_petsc_complex_by_a_number ();
}
- PetscFinalize ();
}
catch (std::exception &exc)
return 1;
}
- logfile << std::endl;
-
return 0;
}
DEAL::OK
DEAL::Check PetscScalar multiply
DEAL::OK
-
// ---------------------------------------------------------------------
-// $Id: 01.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if ((i+2*j+1) % 3 == 0)
m.set (i,j, std::complex<double> (0.,i*j*.5+.5));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// then make sure we retrieve the same ones
for (unsigned int i=0; i<m.m(); ++i)
// ---------------------------------------------------------------------
-// $Id: 02.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: 04.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: 05.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
++counter;
}
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
deallog << m.n_nonzero_elements() << std::endl;
Assert (m.n_nonzero_elements() == counter,
// ---------------------------------------------------------------------
-// $Id: 06.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if ((i+2*j+1) % 3 == 0)
m.set (i,j, std::complex<double> (0.,i*j*.5+.5));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// compare against the exact value of the l1-norm (max col-sum)
deallog << m.l1_norm() << std::endl;
// ---------------------------------------------------------------------
-// $Id: 07.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if ((i+2*j+1) % 3 == 0)
m.set (i,j, std::complex<double> (0.,i*j*.5+.5));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// compare against the exact value of the linfty-norm (max row-sum).
deallog << m.linfty_norm() << std::endl;
// ---------------------------------------------------------------------
-// $Id: 08.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
}
norm = std::sqrt(norm);
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// compare against the exact value of the l2-norm (max row-sum)
deallog << m.frobenius_norm() << std::endl;
// ---------------------------------------------------------------------
-// $Id: 09.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if ((i+2*j+1) % 3 == 0)
m.set (i,j, std::complex<double> (i*j*.5+.5,i*j*.5));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// then multiply everything by 1.25
m *= 1.25;
// ---------------------------------------------------------------------
-// $id: 10.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if ((i+2*j+1) % 3 == 0)
m.set (i,j, std::complex<double> (0.,i*j*.5+.5));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// then divide everything by 4/3 and make sure we retrieve the
// values we expect
// ---------------------------------------------------------------------
-// $Id: 11.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
for (unsigned int k=0; k<v.size(); k+=1+k)
v(k) = std::complex<double> (k,.5*k);
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
Assert (v.size() == 100, ExcInternalError());
// ---------------------------------------------------------------------
-// $Id: 12.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
pattern[k] = true;
}
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
// check that they are ok, and this time all of them
for (unsigned int k=0; k<v.size(); ++k)
// ---------------------------------------------------------------------
-// $Id: 13.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: 17.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
v(k) = PetscScalar (k,2.*k);
norm += std::fabs (1.*k+2.*k);
}
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
// then check the norm
Assert (v.l1_norm() == norm, ExcInternalError());
// ---------------------------------------------------------------------
-// $Id: 18.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
norm += std::fabs (1.*k*1.*k /*+ 1.*k*2*ki - 1.*k*2*ki*/ + 2*k*2.*k/*i*/);
}
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
// then check the l2-norm
PetscReal l2_norm = v.l2_norm();
// ---------------------------------------------------------------------
-// $Id: 19.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
norm = std::max (norm,std::fabs (std::sqrt ((k*k + 2.*k*2.*k))));
}
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
// then check the norm
Assert (v.linfty_norm() == norm, ExcInternalError());
// ---------------------------------------------------------------------
-// $Id: 23.cc 31349 2013-10-20 19:07:06Z maier $
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
}
}
- v.compress (VectorOperation::add);
- w.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
+ w.compress (VectorOperation::insert);
// make sure the scalar product is zero
Assert (v*w == product, ExcInternalError());
-
// ---------------------------------------------------------------------
-// $Id:
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
for (unsigned int k=0; k<v.size(); ++k)
v(k) = std::complex<double> (k,v.size()-k);
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
// check that is what we get by casting PetscScalar to std::real()
// and std::imag()
try
{
- PetscInitialize (&argc, &argv, (char *) 0, (char *) 0);
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
{
PETScWrappers::Vector v (5);
test_vector (v);
deallog << "vector:" << std::endl;
v.print (logfile);
}
- PetscFinalize ();
}
-
// ---------------------------------------------------------------------
-// $Id:
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
m.set (k,l, std::complex<double> (el_r,el_i));
}
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
for (unsigned int k=0; k<m.m(); ++k)
for (unsigned int l=0; l<m.n(); ++l)
try
{
- PetscInitialize (&argc, &argv, (char *) 0, (char *) 0);
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
{
PETScWrappers::SparseMatrix m (5,5,5);
test_matrix (m);
deallog << "matrix:" << std::endl;
m.print (logfile);
}
- PetscFinalize ();
}
-
// ---------------------------------------------------------------------
-// $Id: element_access_02.cc
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if (k>l)
m.set (k,l, PetscScalar (k+l,-1.*(k+l)));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// check the matrix is correctly filled
for (unsigned int k=0; k<m.m(); ++k)
try
{
- PetscInitialize (&argc, &argv, (char *) 0, (char *) 0);
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
{
PETScWrappers::SparseMatrix m (10,10,10);
test (m);
deallog << "matrix:" << std::endl;
m.print (logfile);
}
- PetscFinalize ();
}
catch (std::exception &exc)
-
// ---------------------------------------------------------------------
-// $Id:
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
for (unsigned int l=0; l<m.n(); ++l)
m.set (k,l, PetscScalar ((k+l)*r,(k+l)*i));
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
// Check elements have the correct value
for (unsigned int k=0; k<m.m(); ++k)
try
{
- PetscInitialize (&argc, &argv, (char *) 0, (char *) 0);
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
{
PETScWrappers::SparseMatrix m (5,5,5);
test_matrix (m);
deallog << "matrix:" << std::endl;
m.print (logfile);
}
- PetscFinalize ();
}
catch (std::exception &exc)
// ---------------------------------------------------------------------
-// $Id: testsuite.html 32446 2014-05-21 14:31:22Z davydov $
//
-// Copyright (C) 2013 by the deal.II Authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv);
-
- test ();
-
-}
\ No newline at end of file
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+ {
+ test ();
+ }
+}
// ---------------------------------------------------------------------
-// $Id: testsuite.html 32446 2014-02-10 14:31:22Z bangerth $
//
-// Copyright (C) 2013 by the deal.II Authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
if (cell->is_locally_owned())
{
fe_values.reinit (cell);
- cell_mass_matrix = PetscScalar(0);
+ cell_mass_matrix = PetscScalar();
for (unsigned int q_point=0; q_point<n_q_points; ++q_point)
for (unsigned int i=0; i<dofs_per_cell; ++i)
vector.compress(VectorOperation::insert);
constraints.distribute(vector);
- deallog<<"symmetric: "<<mass_matrix.is_symmetric()<<std::endl;
- deallog<<"hermitian: "<<mass_matrix.is_hermitian()<<std::endl;
+ deallog<<"symmetric: "<<(mass_matrix.is_symmetric()==PETSC_TRUE)<<std::endl;
+ deallog<<"hermitian: "<<(mass_matrix.is_hermitian()==PETSC_TRUE)<<std::endl;
PETScWrappers::MPI::Vector tmp(vector);
mass_matrix.vmult (tmp, vector);
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv);
-
- test<2>();
-
-}
\ No newline at end of file
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+ {
+ test<2>();
+ }
+}
// ---------------------------------------------------------------------
-// $Id: solver_real_01.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
PETScWrappers::Vector f(dim);
PETScWrappers::Vector u(dim);
f = 1.;
- A.compress (VectorOperation::add);
- f.compress (VectorOperation::add);
- u.compress (VectorOperation::add);
+ A.compress (VectorOperation::insert);
+ f.compress (VectorOperation::insert);
+ u.compress (VectorOperation::insert);
PETScWrappers::SolverRichardson solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
// ---------------------------------------------------------------------
-// $Id: solver_real_02.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
PETScWrappers::Vector f(dim);
PETScWrappers::Vector u(dim);
f = 1.;
- A.compress (VectorOperation::add);
- f.compress (VectorOperation::add);
- u.compress (VectorOperation::add);
+ A.compress (VectorOperation::insert);
+ f.compress (VectorOperation::insert);
+ u.compress (VectorOperation::insert);
PETScWrappers::SolverChebychev solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
// ---------------------------------------------------------------------
-// $Id: solver_real_03.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
PETScWrappers::Vector f(dim);
PETScWrappers::Vector u(dim);
f = 1.;
- A.compress (VectorOperation::add);
- f.compress (VectorOperation::add);
- u.compress (VectorOperation::add);
+ A.compress (VectorOperation::insert);
+ f.compress (VectorOperation::insert);
+ u.compress (VectorOperation::insert);
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
// ---------------------------------------------------------------------
-// $Id: solver_03_mf.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
PETScWrappers::Vector f(dim);
PETScWrappers::Vector u(dim);
f = 1.;
- A.compress (VectorOperation::add);
- f.compress (VectorOperation::add);
- u.compress (VectorOperation::add);
+ A.compress (VectorOperation::insert);
+ f.compress (VectorOperation::insert);
+ u.compress (VectorOperation::insert);
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionNone preconditioner(A);
// ---------------------------------------------------------------------
-// $Id: solver_real_04.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
PETScWrappers::Vector f(dim);
PETScWrappers::Vector u(dim);
f = 1.;
- A.compress (VectorOperation::add);
- f.compress (VectorOperation::add);
- u.compress (VectorOperation::add);
+ A.compress (VectorOperation::insert);
+ f.compress (VectorOperation::insert);
+ u.compress (VectorOperation::insert);
PETScWrappers::SolverBiCG solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
// ---------------------------------------------------------------------
-// $Id sparse_matrix_01.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
for (unsigned int l=0; l<=k; ++l)
m.set (k,l, k+2*l);
- m.compress (VectorOperation::add);
+ m.compress (VectorOperation::insert);
PETScWrappers::SparseMatrix m2(s,s,s);
m2.set(0,1,5.0);
for (unsigned int k=0; k<m2.m(); ++k)
m2.set(k,k,PetscScalar(1.0+k,-1.0-k));
- m2.compress(VectorOperation::add);
+ m2.compress(VectorOperation::insert);
// we now print the matrix m, it is all real. Then print after
// adding m2 which is complex, and then subtract m2 again to get the
// ---------------------------------------------------------------------
-// $Id vector_02.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
for (unsigned int k=0; k<v.size(); ++k)
v(k) = k;
- v.compress (VectorOperation::add);
+ v.compress (VectorOperation::insert);
PETScWrappers::Vector v2(s);
for (unsigned int k=0; k<v2.size(); ++k)
v2(k) = PetscScalar (k,-1.0*k);
}
- v2.compress(VectorOperation::add);
+ v2.compress(VectorOperation::insert);
// we now print the vector v, it is all real. Then print after
// adding v2 which is complex, and then subtract v2 again to get the
// ---------------------------------------------------------------------
-// $Id: vector_assign_01.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: vector_assign_02.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: vector_equality_1.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: vector_equality_2.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: vector_print.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// ---------------------------------------------------------------------
-// $Id: vector_wrap_01.cc $
//
-// Copyright (C) 2013 by the deal.II authors
+// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//