]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Call resize(0) before calling resize(n_levels-1) as CopyConstructor of SparseMatrix...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 17 Dec 2002 11:09:24 +0000 (11:09 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 17 Dec 2002 11:09:24 +0000 (11:09 +0000)
git-svn-id: https://svn.dealii.org/trunk@6839 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 77f21ef1be311b30cbe70d1d9b3435037bc72a74..17edfc0d8e36b7b949c69e747be9281f215a7e0e 100644 (file)
@@ -31,7 +31,7 @@
 template <typename number>
 template <int dim>
 void MGTransferPrebuilt<number>::build_matrices (
-  const MGDoFHandler<dim> &mg_dof) 
+  const MGDoFHandler<dim> &mg_dof)
 {
   const unsigned int n_levels      = mg_dof.get_tria().n_levels();
   const unsigned int dofs_per_cell = mg_dof.get_fe().dofs_per_cell;
@@ -40,11 +40,19 @@ void MGTransferPrebuilt<number>::build_matrices (
   for (unsigned int l=0;l<n_levels;++l)
     sizes[l] = mg_dof.n_dofs(l);
   
-                                  // reset the size of the array of
-                                  // matrices
-  prolongation_sparsities.resize (n_levels-1);
+                                  // Reset the size of the array of
+                                  // matrices. Call resize(0) first,
+                                  // in order to delete all elements
+                                  // as otherwise the copy
+                                  // constructor of SparseMatrix and
+                                  // SparsityPattern is called what
+                                  // throws an error if existing
+                                  // SparseMatrices/SparsityPatterns
+                                  // have a size greater zero.
+  prolongation_matrices.resize (0);
   prolongation_matrices.resize (n_levels-1);
-
+  prolongation_sparsities.resize (0);
+  prolongation_sparsities.resize (n_levels-1);
 
                                   // two fields which will store the
                                   // indices of the multigrid dofs

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.