]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Instantiate VectorTools::subtract_mean_value for all serial vector types. Throw an...
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Apr 2013 21:16:53 +0000 (21:16 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Apr 2013 21:16:53 +0000 (21:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@29231 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/numerics/vector_tools.templates.h
deal.II/source/numerics/vector_tools.inst.in

index 01b12b9a27307827a051058f1b2bf3116e6d275f..129cc5f779dacacc40e0018b34fac0722fc00ae3 100644 (file)
@@ -5641,10 +5641,6 @@ namespace VectorTools
   subtract_mean_value(VECTOR                  &v,
                       const std::vector<bool> &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<Vector<double> *>(& v)
+               || dynamic_cast<Vector<float> *>(& v)
+               || dynamic_cast<Vector<long double> *>(& v)
+               || dynamic_cast<BlockVector<double> *>(& v)
+               || dynamic_cast<BlockVector<float> *>(& v)
+               || dynamic_cast<BlockVector<long double> *>(& 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<n; ++i)
index 31dc829f4f5a954a7d802ae7281d4ab30da5b02d..d4f394f95c6e342f7df9d09d8f323977c146cf7f 100644 (file)
@@ -268,11 +268,11 @@ for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimens
   }
 
 
-for (VEC : DEAL_II_VEC_TEMPLATES; real : REAL_SCALARS)
+for (VEC : SERIAL_VECTORS)
 {
     namespace VectorTools \{
       template
-        void subtract_mean_value(VEC<real> &, const std::vector<bool> &);
+        void subtract_mean_value(VEC &, const std::vector<bool> &);
     \}
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.