]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a bug in the multigrid code.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 8 Apr 1999 17:35:32 +0000 (17:35 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 8 Apr 1999 17:35:32 +0000 (17:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@1109 0785d39b-7218-0410-832d-ea1e28bc413d

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

index c51528c279fd89239b3eab39b92c543eee6d2015..835d134a7a29456398147a4cb080b1e7e4c4dbd4 100644 (file)
 #include <lac/vector.h>
 
 
+MultiGridBase::~MultiGridBase () 
+{};
+
+
+
 MultiGridBase::MultiGridBase(MGTransferBase& transfer,
                             unsigned maxlevel, unsigned minlevel,
                             unsigned pre_smooth, unsigned post_smooth)
@@ -116,6 +121,16 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
   for (unsigned int level=0; level<n_levels-1; ++level)
     {
       prolongation_sparsities.push_back (SparseMatrixStruct());
+                                      // reset the dimension of the structure.
+                                      // note that for the number of entries
+                                      // per row, the number of mother dofs
+                                      // coupling to a child dof is
+                                      // necessary. this, of course, is the
+                                      // number of degrees of freedom per
+                                      // cell
+      prolongation_sparsities.back().reinit (mg_dof.n_dofs(level+1),
+                                            mg_dof.n_dofs(level),
+                                            dofs_per_cell);
       
       for (typename MGDoFHandler<dim>::cell_iterator cell=mg_dof.begin(level);
           cell != mg_dof.end(level); ++cell)
@@ -132,7 +147,7 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
                const FullMatrix<double> &prolongation
                  = mg_dof.get_fe().prolongate(child);
            
-               cell->child(child)->get_dof_indices (dof_indices_child);
+               cell->child(child)->get_mg_dof_indices (dof_indices_child);
 
                                                 // now tag the entries in the
                                                 // matrix which will be used
@@ -147,6 +162,7 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
                      };
              };
          };
+      prolongation_sparsities[level].compress ();
 
       prolongation_matrices.push_back (SparseMatrix<float>());
       prolongation_matrices[level].reinit (prolongation_sparsities[level]);
@@ -168,7 +184,7 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
                const FullMatrix<double> &prolongation
                  = mg_dof.get_fe().prolongate(child);
            
-               cell->child(child)->get_dof_indices (dof_indices_child);
+               cell->child(child)->get_mg_dof_indices (dof_indices_child);
 
                                                 // now set the entries in the
                                                 // matrix
index c51528c279fd89239b3eab39b92c543eee6d2015..835d134a7a29456398147a4cb080b1e7e4c4dbd4 100644 (file)
 #include <lac/vector.h>
 
 
+MultiGridBase::~MultiGridBase () 
+{};
+
+
+
 MultiGridBase::MultiGridBase(MGTransferBase& transfer,
                             unsigned maxlevel, unsigned minlevel,
                             unsigned pre_smooth, unsigned post_smooth)
@@ -116,6 +121,16 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
   for (unsigned int level=0; level<n_levels-1; ++level)
     {
       prolongation_sparsities.push_back (SparseMatrixStruct());
+                                      // reset the dimension of the structure.
+                                      // note that for the number of entries
+                                      // per row, the number of mother dofs
+                                      // coupling to a child dof is
+                                      // necessary. this, of course, is the
+                                      // number of degrees of freedom per
+                                      // cell
+      prolongation_sparsities.back().reinit (mg_dof.n_dofs(level+1),
+                                            mg_dof.n_dofs(level),
+                                            dofs_per_cell);
       
       for (typename MGDoFHandler<dim>::cell_iterator cell=mg_dof.begin(level);
           cell != mg_dof.end(level); ++cell)
@@ -132,7 +147,7 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
                const FullMatrix<double> &prolongation
                  = mg_dof.get_fe().prolongate(child);
            
-               cell->child(child)->get_dof_indices (dof_indices_child);
+               cell->child(child)->get_mg_dof_indices (dof_indices_child);
 
                                                 // now tag the entries in the
                                                 // matrix which will be used
@@ -147,6 +162,7 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
                      };
              };
          };
+      prolongation_sparsities[level].compress ();
 
       prolongation_matrices.push_back (SparseMatrix<float>());
       prolongation_matrices[level].reinit (prolongation_sparsities[level]);
@@ -168,7 +184,7 @@ void MGTransferPrebuilt::build_matrices (const MGDoFHandler<dim> &mg_dof)
                const FullMatrix<double> &prolongation
                  = mg_dof.get_fe().prolongate(child);
            
-               cell->child(child)->get_dof_indices (dof_indices_child);
+               cell->child(child)->get_mg_dof_indices (dof_indices_child);
 
                                                 // now set the entries in the
                                                 // matrix

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.