]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
set ignores zeroes
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 16 Apr 2003 10:52:30 +0000 (10:52 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 16 Apr 2003 10:52:30 +0000 (10:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@7396 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix_ez.h

index c8542d1e354141c2dfcd650b43bf30f536987b9f..f49ec9d6be515b3a41e5a955ae0a39e8543c31a1 100644 (file)
@@ -439,9 +439,9 @@ class SparseMatrixEZ : public Subscriptor
 
                                     /**
                                      * Set the element @p{(i,j)} to
-                                     * @p{value}. Allocates the entry
-                                     * if it does not exist. Filters
-                                     * out zeroes automatically.
+                                     * @p{value}. Allocates the entry,
+                                     * if it does not exist and
+                                     * @p{value} is non-zero.
                                      */
     void set (const unsigned int i, const unsigned int j,
              const number value);
@@ -1322,9 +1322,18 @@ void SparseMatrixEZ<number>::set (const unsigned int i,
   Assert (i<m(), ExcIndexRange(i,0,m()));
   Assert (j<n(), ExcIndexRange(j,0,n()));
 
-//TODO[GK]: Do as the documentation promises: ignore zero values. The complication is that we should ignore the zero entry if no entry is there already, but set an existing entry to zero
-  Entry* entry = allocate(i,j);
-  entry->value = value;
+  if (value == 0.)
+    {
+      Entry* entry = locate(i,j);
+      if (entry != 0)
+       {
+       }
+    }
+  else
+    {
+      Entry* entry = allocate(i,j);
+      entry->value = value;
+    }
 }
 
 

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.