From 05de226910f44a37f701aaa912214dd836397a66 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 17 Apr 2020 12:13:29 -0400 Subject: [PATCH] Remove deprecated ratio member functions --- .../incompatibilities/20200417DanielArndt | 4 + include/deal.II/lac/petsc_vector_base.h | 14 --- include/deal.II/lac/vector.h | 16 --- include/deal.II/lac/vector.templates.h | 21 ---- source/lac/petsc_vector_base.cc | 10 -- tests/lac/vector-vector.cc | 6 +- tests/lac/vector-vector.output | 19 ++-- tests/petsc/48.cc | 104 ------------------ tests/petsc/48.output | 2 - tests/vector/complex_vector_48.cc | 101 ----------------- ...ex_vector_48.with_complex_values=on.output | 2 - tests/vector/vector_48.cc | 95 ---------------- tests/vector/vector_48.output | 2 - 13 files changed, 13 insertions(+), 383 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20200417DanielArndt delete mode 100644 tests/petsc/48.cc delete mode 100644 tests/petsc/48.output delete mode 100644 tests/vector/complex_vector_48.cc delete mode 100644 tests/vector/complex_vector_48.with_complex_values=on.output delete mode 100644 tests/vector/vector_48.cc delete mode 100644 tests/vector/vector_48.output diff --git a/doc/news/changes/incompatibilities/20200417DanielArndt b/doc/news/changes/incompatibilities/20200417DanielArndt new file mode 100644 index 0000000000..d02108dc24 --- /dev/null +++ b/doc/news/changes/incompatibilities/20200417DanielArndt @@ -0,0 +1,4 @@ +Removed: The deprecated member functions PETScWrappers::VectorBase::ratio() and +Vector::ratio() have been removed. +
+(Daniel Arndt, 2020/04/17) diff --git a/include/deal.II/lac/petsc_vector_base.h b/include/deal.II/lac/petsc_vector_base.h index 2166b5f42d..1cc009da61 100644 --- a/include/deal.II/lac/petsc_vector_base.h +++ b/include/deal.II/lac/petsc_vector_base.h @@ -690,20 +690,6 @@ namespace PETScWrappers void equ(const PetscScalar a, const VectorBase &V); - /** - * Compute the elementwise ratio of the two given vectors, that is let - * this[i] = a[i]/b[i]. This is useful for example if you want to - * compute the cellwise ratio of true to estimated error. - * - * This vector is appropriately scaled to hold the result. - * - * If any of the b[i] is zero, the result is undefined. No - * attempt is made to catch such situations. - */ - DEAL_II_DEPRECATED - void - ratio(const VectorBase &a, const VectorBase &b); - /** * Prints the PETSc vector object values using PETSc internal vector * viewer function VecView. The default format prints the diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 3f7a5bfb7a..15e60b0e0d 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -835,22 +835,6 @@ public: void equ(const Number a, const Vector &u); - /** - * Compute the elementwise ratio of the two given vectors, that is let - * this[i] = a[i]/b[i]. This is useful for example if you want to - * compute the cellwise ratio of true to estimated error. - * - * This vector is appropriately scaled to hold the result. - * - * If any of the b[i] is zero, the result is undefined. No attempt - * is made to catch such situations. - * - * @dealiiOperationIsMultithreaded - */ - DEAL_II_DEPRECATED - void - ratio(const Vector &a, const Vector &b); - /** * This function does nothing but exists for compatibility with the @p * parallel vector classes (e.g., LinearAlgebra::distributed::Vector class). diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index 4227388e60..3ea2e3b3e8 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -735,27 +735,6 @@ Vector::equ(const Number a, const Vector &u) -template -void -Vector::ratio(const Vector &a, const Vector &b) -{ - Assert(size() != 0, ExcEmptyObject()); - Assert(a.size() == b.size(), ExcDimensionMismatch(a.size(), b.size())); - - // no need to reinit with zeros, since - // we overwrite them anyway - reinit(a.size(), true); - - internal::VectorOperations::Vectorization_ratio vector_ratio( - values.begin(), a.begin(), b.begin()); - internal::VectorOperations::parallel_for(vector_ratio, - 0, - size(), - thread_loop_partitioner); -} - - - template Vector & Vector::operator=(const BlockVector &v) diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 328af05d32..6b0e112f93 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -824,16 +824,6 @@ namespace PETScWrappers - void - VectorBase::ratio(const VectorBase &a, const VectorBase &b) - { - Assert(!has_ghost_elements(), ExcGhostsPresent()); - const PetscErrorCode ierr = VecPointwiseDivide(vector, a, b); - AssertThrow(ierr == 0, ExcPETScError(ierr)); - } - - - void VectorBase::write_ascii(const PetscViewerFormat format) { diff --git a/tests/lac/vector-vector.cc b/tests/lac/vector-vector.cc index 19ae25e841..da4725d7b2 100644 --- a/tests/lac/vector-vector.cc +++ b/tests/lac/vector-vector.cc @@ -139,19 +139,15 @@ check_vectors(Vector &d1, Vector &d2) d2.equ(.25, d1); print(d2); - - d1.ratio(d1, d2); - print(d1); } int main() { - std::ofstream logfile("output"); + initlog(); deallog << std::fixed; deallog << std::setprecision(2); - deallog.attach(logfile); Vector d1(N), d2(N); Vector f1(N), f2(N); diff --git a/tests/lac/vector-vector.output b/tests/lac/vector-vector.output index 0f394f47fe..a597a8de3f 100644 --- a/tests/lac/vector-vector.output +++ b/tests/lac/vector-vector.output @@ -1,13 +1,13 @@ DEAL::Fill & Swap -DEAL::0 0 0 0 0 0 0 0 0 0 -DEAL::0 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 -DEAL::0 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00 -DEAL::2.00 1.50 1.00 0.50 0 -0.50 -1.00 -1.50 -2.00 -2.50 -DEAL::0 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00 -DEAL::0 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 +DEAL::0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +DEAL::0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 +DEAL::0.00 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00 +DEAL::2.00 1.50 1.00 0.50 0.00 -0.50 -1.00 -1.50 -2.00 -2.50 +DEAL::0.00 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00 +DEAL::0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 DEAL::2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 -DEAL::0 1.10 2.20 3.30 +DEAL::0.00 1.10 2.20 3.30 DEAL::Extract number DEAL::-105.00 -105.00 DEAL::1140.00 1140.00 @@ -23,11 +23,10 @@ DEAL::8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 DEAL::4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25 10.00 10.75 DEAL::sadd & scale DEAL::-1.00 -0.25 0.50 1.25 2.00 2.75 3.50 4.25 5.00 5.75 -DEAL::0 1.88 3.75 5.62 7.50 9.38 11.25 13.12 15.00 16.88 +DEAL::0.00 1.88 3.75 5.62 7.50 9.38 11.25 13.12 15.00 16.88 DEAL::16.00 19.00 22.00 25.00 28.00 31.00 34.00 37.00 40.00 43.00 DEAL::equ DEAL::4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25 10.00 10.75 -DEAL::4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 DEAL::Fill & Swap DEAL::0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 DEAL::0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 @@ -56,7 +55,6 @@ DEAL::0.00 1.88 3.75 5.62 7.50 9.38 11.25 13.12 15.00 16.88 DEAL::16.00 19.00 22.00 25.00 28.00 31.00 34.00 37.00 40.00 43.00 DEAL::equ DEAL::4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25 10.00 10.75 -DEAL::4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 DEAL::Fill & Swap DEAL::0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 DEAL::0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 @@ -85,4 +83,3 @@ DEAL::0.00 1.88 3.75 5.62 7.50 9.38 11.25 13.12 15.00 16.88 DEAL::16.00 19.00 22.00 25.00 28.00 31.00 34.00 37.00 40.00 43.00 DEAL::equ DEAL::4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25 10.00 10.75 -DEAL::4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 4.00 diff --git a/tests/petsc/48.cc b/tests/petsc/48.cc deleted file mode 100644 index c13ae66886..0000000000 --- a/tests/petsc/48.cc +++ /dev/null @@ -1,104 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 2018 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.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - - -// check PETScWrappers::MPI::Vector::ratio - -#include - -#include -#include - -#include "../tests.h" - - -void -test(PETScWrappers::MPI::Vector &v, - PETScWrappers::MPI::Vector &w, - PETScWrappers::MPI::Vector &x) -{ - for (unsigned int i = 0; i < v.size(); ++i) - { - v(i) = i; - w(i) = i + 1.; - x(i) = i + 2.; - } - - v.compress(VectorOperation::insert); - w.compress(VectorOperation::insert); - x.compress(VectorOperation::insert); - - 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) - { - AssertThrow(w(i) == i + 1., ExcInternalError()); - AssertThrow(x(i) == i + 2., ExcInternalError()); - AssertThrow(std::fabs(v(i) - (i + 1.) / (i + 2.)) < eps * v(i), - ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - - - -int -main(int argc, char **argv) -{ - initlog(); - - try - { - Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); - { - IndexSet indices(100); - indices.add_range(0, 100); - PETScWrappers::MPI::Vector v(indices, MPI_COMM_WORLD); - PETScWrappers::MPI::Vector w(indices, MPI_COMM_WORLD); - PETScWrappers::MPI::Vector x(indices, MPI_COMM_WORLD); - 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; - }; -} diff --git a/tests/petsc/48.output b/tests/petsc/48.output deleted file mode 100644 index 0fd8fc12f0..0000000000 --- a/tests/petsc/48.output +++ /dev/null @@ -1,2 +0,0 @@ - -DEAL::OK diff --git a/tests/vector/complex_vector_48.cc b/tests/vector/complex_vector_48.cc deleted file mode 100644 index 524e5ca0fa..0000000000 --- a/tests/vector/complex_vector_48.cc +++ /dev/null @@ -1,101 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 2018 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.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - - -// check Vector >::ratio - -#include - -#include - -#include "../tests.h" - - -void -test(Vector> &v, - Vector> &w, - Vector> &x) -{ - for (unsigned int i = 0; i < v.size(); ++i) - { - v(i) = std::complex(i + 1., i + 2.); - w(i) = std::complex(i + 2., i + 3.); - x(i) = std::complex(i + 3., i + 4.); - } - - v.compress(); - w.compress(); - x.compress(); - - v.ratio(w, x); - - // make sure we get the expected result - for (unsigned int i = 0; i < v.size(); ++i) - { - AssertThrow(w(i) == std::complex(i + 2., i + 3.), - ExcInternalError()); - AssertThrow(x(i) == std::complex(i + 3., i + 4.), - ExcInternalError()); - AssertThrow(std::abs(v(i) - std::complex(i + 2., i + 3.) / - std::complex(i + 3., i + 4.)) < - 1e-14 * std::abs(v(i)), - ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - - - -int -main() -{ - initlog(); - - try - { - Vector> v(100); - Vector> w(100); - Vector> x(100); - test(v, w, x); - } - catch (std::exception &exc) - { - deallog << std::endl - << std::endl - << "----------------------------------------------------" - << std::endl; - deallog << "Exception on processing: " << std::endl - << exc.what() << std::endl - << "Aborting!" << std::endl - << "----------------------------------------------------" - << std::endl; - - return 1; - } - catch (...) - { - deallog << std::endl - << std::endl - << "----------------------------------------------------" - << std::endl; - deallog << "Unknown exception!" << std::endl - << "Aborting!" << std::endl - << "----------------------------------------------------" - << std::endl; - return 1; - }; -} diff --git a/tests/vector/complex_vector_48.with_complex_values=on.output b/tests/vector/complex_vector_48.with_complex_values=on.output deleted file mode 100644 index 0fd8fc12f0..0000000000 --- a/tests/vector/complex_vector_48.with_complex_values=on.output +++ /dev/null @@ -1,2 +0,0 @@ - -DEAL::OK diff --git a/tests/vector/vector_48.cc b/tests/vector/vector_48.cc deleted file mode 100644 index 9561310059..0000000000 --- a/tests/vector/vector_48.cc +++ /dev/null @@ -1,95 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 2018 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.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - - -// check Vector::ratio - -#include - -#include - -#include "../tests.h" - - -void -test(Vector &v, Vector &w, 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 - 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.)) < 1e-14 * v(i), - ExcInternalError()); - } - - deallog << "OK" << std::endl; -} - - - -int -main() -{ - initlog(); - - try - { - Vector v(100); - Vector w(100); - Vector x(100); - test(v, w, x); - } - catch (std::exception &exc) - { - deallog << std::endl - << std::endl - << "----------------------------------------------------" - << std::endl; - deallog << "Exception on processing: " << std::endl - << exc.what() << std::endl - << "Aborting!" << std::endl - << "----------------------------------------------------" - << std::endl; - - return 1; - } - catch (...) - { - deallog << std::endl - << std::endl - << "----------------------------------------------------" - << std::endl; - deallog << "Unknown exception!" << std::endl - << "Aborting!" << std::endl - << "----------------------------------------------------" - << std::endl; - return 1; - }; -} diff --git a/tests/vector/vector_48.output b/tests/vector/vector_48.output deleted file mode 100644 index 0fd8fc12f0..0000000000 --- a/tests/vector/vector_48.output +++ /dev/null @@ -1,2 +0,0 @@ - -DEAL::OK -- 2.39.5