]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fix block structure in prolongation
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 1 May 2007 21:37:18 +0000 (21:37 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 1 May 2007 21:37:18 +0000 (21:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@14652 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/multigrid/multigrid.all_dimensions.cc

index d5871ad6ed964e2b76c168b50a74553d9e994f81..556afba18021f19e1744c8a44955d1309b132b04 100644 (file)
@@ -169,16 +169,19 @@ void MGTransferBlock<number>::prolongate (
 {
   Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
          ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
-  Assert (src.n_blocks() == prolongation_matrices[to_level-1]->n_block_cols(),
-         ExcDimensionMismatch(src.n_blocks(),
-                              prolongation_matrices[to_level-1]->n_block_cols()));
-  Assert (dst.n_blocks() == prolongation_matrices[to_level-1]->n_block_rows(),
-         ExcDimensionMismatch(dst.n_blocks(),
-                              prolongation_matrices[to_level-1]->n_block_rows()));
-  
-  for (unsigned int b=0; b<src.n_blocks();++b)
+  Assert (src.n_blocks() == this->n_mg_blocks,
+         ExcDimensionMismatch(src.n_blocks(), this->n_mg_blocks));
+  Assert (dst.n_blocks() == this->n_mg_blocks,
+         ExcDimensionMismatch(dst.n_blocks(), this->n_mg_blocks));
+
+                                  // Multiplicate with prolongation
+                                  // matrix, but only those blocks
+                                  // selected.
+  for (unsigned int b=0; b<this->mg_block.size();++b)
     {
-      prolongation_matrices[to_level-1]->block(b,b).vmult (dst.block(b), src.block(b));
+      if (this->selected[b])
+       prolongation_matrices[to_level-1]->block(b,b).vmult (
+         dst.block(this->mg_block[b]), src.block(this->mg_block[b]));
     }
 }
 
@@ -191,29 +194,31 @@ void MGTransferBlock<number>::restrict_and_add (
 {
   Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
          ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
-  Assert (src.n_blocks() == prolongation_matrices[from_level-1]->n_block_rows(),
-         ExcDimensionMismatch(src.n_blocks(),
-                              prolongation_matrices[from_level-1]->n_block_rows()));
-  Assert (dst.n_blocks() == prolongation_matrices[from_level-1]->n_block_cols(),
-         ExcDimensionMismatch(dst.n_blocks(),
-                              prolongation_matrices[from_level-1]->n_block_cols()));
-
-  for (unsigned int b=0; b<src.n_blocks();++b)
+  Assert (src.n_blocks() == this->n_mg_blocks,
+         ExcDimensionMismatch(src.n_blocks(), this->n_mg_blocks));
+  Assert (dst.n_blocks() == this->n_mg_blocks,
+         ExcDimensionMismatch(dst.n_blocks(), this->n_mg_blocks));
+  
+  for (unsigned int b=0; b<this->mg_block.size();++b)
     {
-      if (factors.size() != 0)
-       {
-         Assert (memory != 0, ExcNotInitialized());
-         Vector<number>* aux = memory->alloc();
-         aux->reinit(dst.block(b));
-         prolongation_matrices[from_level-1]->block(b,b).Tvmult (*aux, src.block(b));
-         
-         dst.block(b).add(factors[b], *aux);
-         memory->free(aux);
-       }
-      else
+      if (this->selected[b])
        {
-       prolongation_matrices[from_level-1]->block(b,b).Tvmult_add (dst.block(b),
-                                                                   src.block(b));
+         if (factors.size() != 0)
+           {
+             Assert (memory != 0, ExcNotInitialized());
+             Vector<number>* aux = memory->alloc();
+             aux->reinit(dst.block(this->mg_block[b]));
+             prolongation_matrices[from_level-1]->block(b,b).Tvmult (
+               *aux, src.block(this->mg_block[b]));
+             
+             dst.block(this->mg_block[b]).add(factors[b], *aux);
+             memory->free(aux);
+           }
+         else
+           {
+             prolongation_matrices[from_level-1]->block(b,b).Tvmult_add (
+               dst.block(this->mg_block[b]), src.block(this->mg_block[b]));
+           }
        }
     }
 }

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.