From b0409a50388e1b3620718ffde5790f1054910f0f Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Tue, 16 Jun 2015 10:32:36 -0500 Subject: [PATCH] Deprecate the following functions: sadd with 5 arguments and equ with 4 arguments. --- examples/step-14/step-14.cc | 2 +- examples/step-35/step-35.cc | 15 ++++--- examples/step-44/step-44.cc | 3 +- examples/step-52/step-52.cc | 1 + include/deal.II/lac/parallel_vector.h | 8 +++- include/deal.II/lac/petsc_vector_base.h | 8 +++- include/deal.II/lac/solver_bicgstab.h | 5 ++- include/deal.II/lac/trilinos_vector_base.h | 47 +++------------------- include/deal.II/lac/vector.h | 8 +++- source/lac/trilinos_vector_base.cc | 38 +++++++++++++++++ 10 files changed, 80 insertions(+), 55 deletions(-) diff --git a/examples/step-14/step-14.cc b/examples/step-14/step-14.cc index 3a72348ea5..8bc7621cbb 100644 --- a/examples/step-14/step-14.cc +++ b/examples/step-14/step-14.cc @@ -2577,7 +2577,7 @@ namespace Step14 FaceIntegrals &face_integrals) const { // Because of WorkStream, estimate_on_one_cell requires a CopyData object - // even if it is no used. The next line silence a warning about this unused + // even if it is no used. The next line silences a warning about this unused // variable. (void) copy_data; diff --git a/examples/step-35/step-35.cc b/examples/step-35/step-35.cc index f7e526da06..d89d039294 100644 --- a/examples/step-35/step-35.cc +++ b/examples/step-35/step-35.cc @@ -982,7 +982,10 @@ namespace Step35 NavierStokesProjection::interpolate_velocity() { for (unsigned int d=0; d::diffusion_step (const bool reinit_prec) { - pres_tmp = pres_n; - pres_tmp.sadd(-1., -4./3., phi_n, 1./3., phi_n_minus_1); + pres_tmp.equ (-1., pres_n); + pres_tmp.add (-4./3., phi_n, 1./3., phi_n_minus_1); assemble_advection_term(); for (unsigned int d=0; d &y) { + (void) time; SparseDirectUMFPACK inverse_mass_minus_tau_Jacobian; mass_minus_tau_Jacobian.copy_from(mass_matrix); diff --git a/include/deal.II/lac/parallel_vector.h b/include/deal.II/lac/parallel_vector.h index bca43440d8..d2e78f7c92 100644 --- a/include/deal.II/lac/parallel_vector.h +++ b/include/deal.II/lac/parallel_vector.h @@ -858,12 +858,14 @@ namespace parallel /** * Scaling and multiple addition. + * + * This function is deprecated. */ void sadd (const Number s, const Number a, const Vector &V, const Number b, - const Vector &W); + const Vector &W) DEAL_II_DEPRECATED; /** * Scaling and multiple addition. *this = s*(*this)+a*V + b*W + @@ -917,9 +919,11 @@ namespace parallel /** * Assignment *this = a*u + b*v. + * + * This function is deprecated. */ void equ (const Number a, const Vector &u, - const Number b, const Vector &v); + const Number b, const Vector &v) DEAL_II_DEPRECATED; /** * Assignment *this = a*u + b*v + b*w. diff --git a/include/deal.II/lac/petsc_vector_base.h b/include/deal.II/lac/petsc_vector_base.h index 84e051cea7..38412c37ab 100644 --- a/include/deal.II/lac/petsc_vector_base.h +++ b/include/deal.II/lac/petsc_vector_base.h @@ -629,12 +629,14 @@ namespace PETScWrappers /** * Scaling and multiple addition. + * + * This function is deprecated. */ void sadd (const PetscScalar s, const PetscScalar a, const VectorBase &V, const PetscScalar b, - const VectorBase &W); + const VectorBase &W) DEAL_II_DEPRECATED; /** * Scaling and multiple addition. *this = s*(*this)+a*V + b*W + @@ -664,9 +666,11 @@ namespace PETScWrappers /** * Assignment *this = a*V + b*W. + * + * This function is deprecated. */ void equ (const PetscScalar a, const VectorBase &V, - const PetscScalar b, const VectorBase &W); + const PetscScalar b, const VectorBase &W) DEAL_II_DEPRECATED; /** * Compute the elementwise ratio of the two given vectors, that is let diff --git a/include/deal.II/lac/solver_bicgstab.h b/include/deal.II/lac/solver_bicgstab.h index 5c08b27705..0992dd6c9a 100644 --- a/include/deal.II/lac/solver_bicgstab.h +++ b/include/deal.II/lac/solver_bicgstab.h @@ -376,7 +376,10 @@ SolverBicgstab::iterate(const MATRIX &A, startup = false; } else - p.sadd(beta, 1., r, -beta*omega, v); + { + p.sadd(beta, 1., r); + p.add(-beta*omega, v); + } precondition.vmult(y,p); A.vmult(v,y); diff --git a/include/deal.II/lac/trilinos_vector_base.h b/include/deal.II/lac/trilinos_vector_base.h index 6a0aca5595..896e71b499 100644 --- a/include/deal.II/lac/trilinos_vector_base.h +++ b/include/deal.II/lac/trilinos_vector_base.h @@ -737,12 +737,14 @@ namespace TrilinosWrappers /** * Scaling and multiple addition. + * + * This function is deprecated. */ void sadd (const TrilinosScalar s, const TrilinosScalar a, const VectorBase &V, const TrilinosScalar b, - const VectorBase &W); + const VectorBase &W) DEAL_II_DEPRECATED; /** * Scaling and multiple addition. *this = s*(*this) + a*V + b*W + @@ -773,11 +775,13 @@ namespace TrilinosWrappers /** * Assignment *this = a*V + b*W. + * + * This function is deprecated. */ void equ (const TrilinosScalar a, const VectorBase &V, const TrilinosScalar b, - const VectorBase &W); + const VectorBase &W) DEAL_II_DEPRECATED; /** * Compute the elementwise ratio of the two given vectors, that is let @@ -1936,45 +1940,6 @@ namespace TrilinosWrappers - inline - void - VectorBase::equ (const TrilinosScalar a, - const VectorBase &v, - const TrilinosScalar b, - const VectorBase &w) - { - // if we have ghost values, do not allow - // writing to this vector at all. - Assert (!has_ghost_elements(), ExcGhostsPresent()); - Assert (v.local_size() == w.local_size(), - ExcDimensionMismatch (v.local_size(), w.local_size())); - - AssertIsFinite(a); - AssertIsFinite(b); - - // If we don't have the same map, copy. - if (vector->Map().SameAs(v.vector->Map())==false) - { - sadd(0., a, v, b, w); - } - else - { - // Otherwise, just update. verify - // that *this does not only have - // the same map as v (the - // if-condition above) but also as - // w - Assert (vector->Map().SameAs(w.vector->Map()), - ExcDifferentParallelPartitioning()); - int ierr = vector->Update(a, *v.vector, b, *w.vector, 0.0); - AssertThrow (ierr == 0, ExcTrilinosError(ierr)); - - last_action = Zero; - } - } - - - inline void VectorBase::ratio (const VectorBase &v, diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 4882789621..f80c0a2e78 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -707,13 +707,15 @@ public: /** * Scaling and multiple addition. * + * This function is deprecated. + * * @dealiiOperationIsMultithreaded */ void sadd (const Number s, const Number a, const Vector &V, const Number b, - const Vector &W); + const Vector &W) DEAL_II_DEPRECATED; /** * Scaling and multiple addition. *this = s*(*this)+a*V + b*W + @@ -778,10 +780,12 @@ public: /** * Assignment *this = a*u + b*v. * + * This function is deprecated. + * * @dealiiOperationIsMultithreaded */ void equ (const Number a, const Vector &u, - const Number b, const Vector &v); + const Number b, const Vector &v) DEAL_II_DEPRECATED; /** * Assignment *this = a*u + b*v + b*w. diff --git a/source/lac/trilinos_vector_base.cc b/source/lac/trilinos_vector_base.cc index 552b534c49..d90e9c6b2b 100644 --- a/source/lac/trilinos_vector_base.cc +++ b/source/lac/trilinos_vector_base.cc @@ -414,6 +414,44 @@ namespace TrilinosWrappers + void + VectorBase::equ (const TrilinosScalar a, + const VectorBase &v, + const TrilinosScalar b, + const VectorBase &w) + { + // if we have ghost values, do not allow + // writing to this vector at all. + Assert (!has_ghost_elements(), ExcGhostsPresent()); + Assert (v.local_size() == w.local_size(), + ExcDimensionMismatch (v.local_size(), w.local_size())); + + AssertIsFinite(a); + AssertIsFinite(b); + + // If we don't have the same map, copy. + if (vector->Map().SameAs(v.vector->Map())==false) + { + sadd(0., a, v, b, w); + } + else + { + // Otherwise, just update. verify + // that *this does not only have + // the same map as v (the + // if-condition above) but also as + // w + Assert (vector->Map().SameAs(w.vector->Map()), + ExcDifferentParallelPartitioning()); + int ierr = vector->Update(a, *v.vector, b, *w.vector, 0.0); + AssertThrow (ierr == 0, ExcTrilinosError(ierr)); + + last_action = Zero; + } + } + + + // TODO: up to now only local // data printed out! Find a // way to neatly output -- 2.39.5