]> https://gitweb.dealii.org/ - dealii.git/commitdiff
scaling of blocks implemented
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 29 Oct 2001 09:47:59 +0000 (09:47 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 29 Oct 2001 09:47:59 +0000 (09:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@5172 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_matrix_array.h

index 8ad7c822c12c218eb22eea9557daedd0c3f63fa0..cde75f9ffb5f988598fe5e442c88dffc93374461 100644 (file)
@@ -228,18 +228,31 @@ BlockMatrixArray<MATRIX>::vmult_add (BlockVector<VECTOR>& dst,
   Assert (src.n_blocks() == block_cols,
          ExcDimensionMismatch(src.n_blocks(), block_cols));
 
+  static Vector<VECTOR> aux;
+  
   typename vector<Entry>::const_iterator m = entries.begin();
   typename vector<Entry>::const_iterator end = entries.end();
   
   for (; m != end ; ++m)
     {
-      Assert (m->prefix==1., ExcNotImplemented());
-      if (m->transpose)
-       m->matrix->Tvmult_add(dst.block(m->row),
+      if (m->prefix==1.)
+       {
+         if (m->transpose)
+           m->matrix->Tvmult_add(dst.block(m->row),
+                                 src.block(m->col));
+         else
+           m->matrix->vmult_add(dst.block(m->row),
+                                src.block(m->col));
+       } else {
+         aux.reinit(dst.block(m->row));
+         if (m->transpose)
+           m->matrix->Tvmult(aux,
                              src.block(m->col));
-      else
-       m->matrix->vmult_add(dst.block(m->row),
+         else
+           m->matrix->vmult(aux,
                             src.block(m->col));
+         dst.block(m->row).add (m->prefix, aux);
+       }
     }
 }
 
@@ -275,15 +288,28 @@ BlockMatrixArray<MATRIX>::Tvmult_add (BlockVector<VECTOR>& dst,
   typename vector<Entry>::const_iterator m = entries.begin();
   typename vector<Entry>::const_iterator end = entries.end();
   
+  static Vector<VECTOR> aux;
+  
   for (; m != end ; ++m)
     {
-      Assert (m->prefix==1., ExcNotImplemented());
-      if (m->transpose)
-       m->matrix->vmult_add(dst.block(m->col),
-                            src.block(m->row));
-      else
-       m->matrix->Tvmult_add(dst.block(m->col),
-                             src.block(m->row));
+      if (m->prefix==1.)
+       {
+         if (m->transpose)
+           m->matrix->vmult_add(dst.block(m->row),
+                                 src.block(m->col));
+         else
+           m->matrix->Tvmult_add(dst.block(m->row),
+                                src.block(m->col));
+       } else {
+         aux.reinit(dst.block(m->row));
+         if (m->transpose)
+           m->matrix->vmult(aux,
+                             src.block(m->col));
+         else
+           m->matrix->Tvmult(aux,
+                            src.block(m->col));
+         dst.block(m->row).add (m->prefix, aux);
+       }
     }
 }
 

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.