]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Externalize this function since it does not depend on the dimension
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Dec 1999 10:55:51 +0000 (10:55 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Dec 1999 10:55:51 +0000 (10:55 +0000)
and therefore leads to problems when linking with libdeal_II_2d and
libdeal_II_3d at the same time.

git-svn-id: https://svn.dealii.org/trunk@2117 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/vectors.all_dimensions.cc [new file with mode: 0644]

diff --git a/deal.II/deal.II/source/numerics/vectors.all_dimensions.cc b/deal.II/deal.II/source/numerics/vectors.all_dimensions.cc
new file mode 100644 (file)
index 0000000..d5eaf90
--- /dev/null
@@ -0,0 +1,33 @@
+/* $Id$ */
+/* Copyright W. Bangerth, University of Heidelberg, 1998 */
+
+#include <lac/vector.h>
+#include <numerics/vectors.h>
+
+
+void
+VectorTools::subtract_mean_value(Vector<double>     &v,
+                                const vector<bool> &p_select)
+{
+  unsigned int n = v.size();
+  Assert(n == p_select.size(), ExcDimensionMismatch(n, p_select.size()));
+
+  double       s       = 0;
+  unsigned int counter = 0;
+  
+  for (unsigned int i=0; i<n; ++i)
+    if (p_select[i])
+      {
+       s += v(i);
+       ++counter;
+      };
+
+  s /= counter;
+  
+  for (unsigned int i=0; i<n; ++i)
+    if (p_select[i])
+      v(i) -= s;  
+};
+
+
+

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.