From c4f15fc099b21c34dd9ab5fb4870baa8be6761c1 Mon Sep 17 00:00:00 2001
From: Felix Albrecht <felix.albrecht@uni-muenster.de>
Date: Wed, 10 Oct 2012 14:05:42 +0200
Subject: [PATCH] [common.{matrix,vector}] changed clear()

---
 dune/stuff/common/matrix.hh | 26 ++++++++++++++------------
 dune/stuff/common/vector.hh | 22 +++++++++++++++-------
 2 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/dune/stuff/common/matrix.hh b/dune/stuff/common/matrix.hh
index c05c4bdae..59239a0d1 100644
--- a/dune/stuff/common/matrix.hh
+++ b/dune/stuff/common/matrix.hh
@@ -24,25 +24,27 @@
 #endif // THIS_WORKS
 
 namespace Dune {
+
 namespace Stuff {
-namespace Common {
 
+namespace Common {
 
 // \todo doc
 template <class MatrixImp>
 void clear(Dune::DenseMatrix<MatrixImp>& matrix)
 {
-  // preparations
-  const typename Dune::DenseMatrix<MatrixImp>::value_type zero(0.0);
-  // loop over all rows
-  for (unsigned int i = 0; i < matrix.rows(); ++i) {
-    // get row
-    typename Dune::DenseMatrix<MatrixImp>::row_reference row = matrix[i];
-    // loop over all cols
-    for (unsigned int j = 0; j < matrix.cols(); ++j) {
-      row[j] = zero;
-    } // loop over all cols
-  } // loop over all rows
+  matrix = Dune::DenseMatrix<MatrixImp>::value_type(0);
+  //  // preparations
+  //  const typename Dune::DenseMatrix< MatrixImp >::value_type zero(0.0);
+  //  // loop over all rows
+  //  for(unsigned int i = 0; i < matrix.rows(); ++i) {
+  //    // get row
+  //    typename Dune::DenseMatrix< MatrixImp >::row_reference row = matrix[i];
+  //    // loop over all cols
+  //    for(unsigned int j = 0; j < matrix.cols(); ++j) {
+  //      row[j] = zero;
+  //    } // loop over all cols
+  //  } // loop over all rows
 } // void clear(Dune::DenseMatrix< MatrixImp >& matrix)
 
 #ifdef THIS_WORKS
diff --git a/dune/stuff/common/vector.hh b/dune/stuff/common/vector.hh
index 52c50b184..66ab6885d 100644
--- a/dune/stuff/common/vector.hh
+++ b/dune/stuff/common/vector.hh
@@ -3,8 +3,13 @@
 
 #include <iostream>
 
+// dune-common
+#include <dune/common/densevector.hh>
+
 namespace Dune {
+
 namespace Stuff {
+
 namespace Common {
 
 template <class T, class stream = std::ostream>
@@ -20,15 +25,18 @@ void print(const T& arg, stream& out = std::cout, std::string name = "", std::st
   out << arg[arg.size() - 1] << "]" << std::endl;
 }
 
-template <class DenseVectorType>
-void clear(DenseVectorType& vector)
+template <class VectorImp>
+void clearVector(Dune::DenseVector<VectorImp>& vector)
 {
-  typedef typename DenseVectorType::value_type ValueType;
+  vector = Dune::DenseVector<VectorImp>::value_type(0);
+  //  typedef typename DenseVectorType::value_type
+  //    ValueType;
 
-  const unsigned int size = vector.size();
-  for (unsigned int i = 0; i < size; ++i) {
-    vector[i] = ValueType(0.0);
-  }
+  //  const unsigned int size = vector.size();
+  //  for( unsigned int i = 0; i < size; ++i )
+  //  {
+  //    vector[i] = ValueType(0.0);
+  //  }
 } // void clear( DenseVectorType& vector )
 
 } // namespace Common
-- 
GitLab