From: young Date: Sat, 19 Oct 2013 18:41:39 +0000 (+0000) Subject: Same as before, but here for the linfty norm. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bcdd3ce8452783aa612828865b9dacf04dd625a;p=dealii-svn.git Same as before, but here for the linfty norm. git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@31321 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/petsc_scalar_complex/19.cc b/tests/petsc_scalar_complex/19.cc new file mode 100644 index 0000000000..de1c69bb4d --- /dev/null +++ b/tests/petsc_scalar_complex/19.cc @@ -0,0 +1,88 @@ +// --------------------------------------------------------------------- +// $Id: 19.cc +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// check PETScWrappers::Vector::linfty_norm() + +#include "../tests.h" +#include +#include +#include +#include + + +void test (PETScWrappers::Vector &v) +{ + // set some elements of the vector + double norm = 0; + for (unsigned int k=0; k (k,2.*k); + + // Ugly, but equal. + norm = std::max (norm,std::fabs (std::sqrt ((k*k + 2.*k*2.*k)))); + } + + v.compress (VectorOperation::add); + + // then check the norm + Assert (v.linfty_norm() == norm, ExcInternalError()); + + deallog << "OK" << std::endl; +} + +int main (int argc,char **argv) +{ + std::ofstream logfile("19/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; + }; +} diff --git a/tests/petsc_scalar_complex/19/cmp/generic b/tests/petsc_scalar_complex/19/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/petsc_scalar_complex/19/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK