From 6b66e025859ed7a6ad76b6626f6807fcb5968f77 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 9 Apr 2013 21:16:53 +0000 Subject: [PATCH] Instantiate VectorTools::subtract_mean_value for all serial vector types. Throw an error if a distributed one is used. git-svn-id: https://svn.dealii.org/trunk@29231 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/numerics/vector_tools.templates.h | 19 +++++++++++++++---- deal.II/source/numerics/vector_tools.inst.in | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/deal.II/include/deal.II/numerics/vector_tools.templates.h b/deal.II/include/deal.II/numerics/vector_tools.templates.h index 01b12b9a27..129cc5f779 100644 --- a/deal.II/include/deal.II/numerics/vector_tools.templates.h +++ b/deal.II/include/deal.II/numerics/vector_tools.templates.h @@ -5641,10 +5641,6 @@ namespace VectorTools subtract_mean_value(VECTOR &v, const std::vector &p_select) { - const unsigned int n = v.size(); - Assert(p_select.size() == 0 || p_select.size() == n, - ExcDimensionMismatch(p_select.size(), n)); - if(p_select.size() == 0) { // In case of an empty boolean mask operate on the whole vector: @@ -5652,6 +5648,21 @@ namespace VectorTools } else { + // This function is not implemented for distributed vectors, so + // if v is not a boring Vector or BlockVector: + Assert( dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v), + ExcNotImplemented()); + + const unsigned int n = v.size(); + + Assert(p_select.size() == n, + ExcDimensionMismatch(p_select.size(), n)); + typename VECTOR::value_type s = 0.; unsigned int counter = 0; for (unsigned int i=0; i &, const std::vector &); + void subtract_mean_value(VEC &, const std::vector &); \} } -- 2.39.5