--- /dev/null
+Removed: The deprecated member functions PETScWrappers::VectorBase::ratio() and
+Vector::ratio() have been removed.
+<br>
+(Daniel Arndt, 2020/04/17)
void
equ(const PetscScalar a, const VectorBase &V);
- /**
- * Compute the elementwise ratio of the two given vectors, that is let
- * <tt>this[i] = a[i]/b[i]</tt>. 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 <tt>b[i]</tt> 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 <tt>VecView</tt>. The default format prints the
void
equ(const Number a, const Vector<Number2> &u);
- /**
- * Compute the elementwise ratio of the two given vectors, that is let
- * <tt>this[i] = a[i]/b[i]</tt>. 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 <tt>b[i]</tt> is zero, the result is undefined. No attempt
- * is made to catch such situations.
- *
- * @dealiiOperationIsMultithreaded
- */
- DEAL_II_DEPRECATED
- void
- ratio(const Vector<Number> &a, const Vector<Number> &b);
-
/**
* This function does nothing but exists for compatibility with the @p
* parallel vector classes (e.g., LinearAlgebra::distributed::Vector class).
-template <typename Number>
-void
-Vector<Number>::ratio(const Vector<Number> &a, const Vector<Number> &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<Number> vector_ratio(
- values.begin(), a.begin(), b.begin());
- internal::VectorOperations::parallel_for(vector_ratio,
- 0,
- size(),
- thread_loop_partitioner);
-}
-
-
-
template <typename Number>
Vector<Number> &
Vector<Number>::operator=(const BlockVector<Number> &v)
- 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)
{
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<double> d1(N), d2(N);
Vector<float> f1(N), f2(N);
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
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
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
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
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// 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 <deal.II/lac/petsc_vector.h>
-
-#include <iostream>
-#include <vector>
-
-#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;
- };
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// 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<std::complex<double> >::ratio
-
-#include <deal.II/lac/vector.h>
-
-#include <vector>
-
-#include "../tests.h"
-
-
-void
-test(Vector<std::complex<double>> &v,
- Vector<std::complex<double>> &w,
- Vector<std::complex<double>> &x)
-{
- for (unsigned int i = 0; i < v.size(); ++i)
- {
- v(i) = std::complex<double>(i + 1., i + 2.);
- w(i) = std::complex<double>(i + 2., i + 3.);
- x(i) = std::complex<double>(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<double>(i + 2., i + 3.),
- ExcInternalError());
- AssertThrow(x(i) == std::complex<double>(i + 3., i + 4.),
- ExcInternalError());
- AssertThrow(std::abs(v(i) - std::complex<double>(i + 2., i + 3.) /
- std::complex<double>(i + 3., i + 4.)) <
- 1e-14 * std::abs(v(i)),
- ExcInternalError());
- }
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int
-main()
-{
- initlog();
-
- try
- {
- Vector<std::complex<double>> v(100);
- Vector<std::complex<double>> w(100);
- Vector<std::complex<double>> 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;
- };
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// 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<double>::ratio
-
-#include <deal.II/lac/vector.h>
-
-#include <vector>
-
-#include "../tests.h"
-
-
-void
-test(Vector<double> &v, Vector<double> &w, Vector<double> &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<double> v(100);
- Vector<double> w(100);
- Vector<double> 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;
- };
-}
+++ /dev/null
-
-DEAL::OK