From: wolf Date: Thu, 8 Apr 1999 17:33:02 +0000 (+0000) Subject: Fix several bugs in the multigrid classes. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41a17d5630bb5664f86aba39343faa9bd0568fac;p=dealii-svn.git Fix several bugs in the multigrid classes. git-svn-id: https://svn.dealii.org/trunk@1106 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/mg_dof_handler.h b/deal.II/deal.II/include/dofs/mg_dof_handler.h index 616d910b8e..edf50654ff 100644 --- a/deal.II/deal.II/include/dofs/mg_dof_handler.h +++ b/deal.II/deal.II/include/dofs/mg_dof_handler.h @@ -823,9 +823,13 @@ class MGDoFHandler : public DoFHandler { * #distribute_dofs# function since * it can not be implemented dimension * independent. + * + * Note that unlike for the usual dofs, + * here all cells and not only active + * ones are allowed. */ - unsigned int distribute_dofs_on_cell (active_cell_iterator &cell, - unsigned int next_free_dof); + unsigned int distribute_dofs_on_cell (cell_iterator &cell, + unsigned int next_free_dof); /** * Actually do the renumbering prepared diff --git a/deal.II/deal.II/include/multigrid/mg_dof_handler.h b/deal.II/deal.II/include/multigrid/mg_dof_handler.h index 616d910b8e..edf50654ff 100644 --- a/deal.II/deal.II/include/multigrid/mg_dof_handler.h +++ b/deal.II/deal.II/include/multigrid/mg_dof_handler.h @@ -823,9 +823,13 @@ class MGDoFHandler : public DoFHandler { * #distribute_dofs# function since * it can not be implemented dimension * independent. + * + * Note that unlike for the usual dofs, + * here all cells and not only active + * ones are allowed. */ - unsigned int distribute_dofs_on_cell (active_cell_iterator &cell, - unsigned int next_free_dof); + unsigned int distribute_dofs_on_cell (cell_iterator &cell, + unsigned int next_free_dof); /** * Actually do the renumbering prepared diff --git a/deal.II/deal.II/source/dofs/mg_dof_handler.cc b/deal.II/deal.II/source/dofs/mg_dof_handler.cc index 027864b203..2d6f4ffaf4 100644 --- a/deal.II/deal.II/source/dofs/mg_dof_handler.cc +++ b/deal.II/deal.II/source/dofs/mg_dof_handler.cc @@ -51,8 +51,6 @@ void MGDoFHandler::MGVertexDoFs::init (const unsigned int cl, template MGDoFHandler::MGVertexDoFs::~MGVertexDoFs () { - Assert (indices != 0, ExcInternalError ()); - delete[] indices; }; @@ -865,6 +863,7 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe) { // reserve space for the MG dof numbers reserve_space (); + mg_used_dofs.resize (tria->n_levels(), 0); // clear user flags because we will // need them @@ -875,8 +874,8 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe) { for (unsigned int level=0; leveln_levels(); ++level) { unsigned int next_free_dof = 0; - active_cell_iterator cell = begin(level), - endc = end(level); + cell_iterator cell = begin(level), + endc = end(level); for (; cell != endc; ++cell) next_free_dof = distribute_dofs_on_cell (cell, next_free_dof); @@ -891,8 +890,8 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe) { template <> unsigned int -MGDoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell, - unsigned int next_free_dof) { +MGDoFHandler<1>::distribute_dofs_on_cell (cell_iterator &cell, + unsigned int next_free_dof) { // distribute dofs of vertices if (selected_fe->dofs_per_vertex > 0) @@ -946,8 +945,8 @@ MGDoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell, template <> unsigned int -MGDoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell, - unsigned int next_free_dof) { +MGDoFHandler<2>::distribute_dofs_on_cell (cell_iterator &cell, + unsigned int next_free_dof) { if (selected_fe->dofs_per_vertex > 0) // number dofs on vertices for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) @@ -1374,12 +1373,12 @@ void MGDoFHandler<2>::reserve_space () { // their size for (unsigned int i=0; i::MGVertexDoFs::init (const unsigned int cl, template MGDoFHandler::MGVertexDoFs::~MGVertexDoFs () { - Assert (indices != 0, ExcInternalError ()); - delete[] indices; }; @@ -865,6 +863,7 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe) { // reserve space for the MG dof numbers reserve_space (); + mg_used_dofs.resize (tria->n_levels(), 0); // clear user flags because we will // need them @@ -875,8 +874,8 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe) { for (unsigned int level=0; leveln_levels(); ++level) { unsigned int next_free_dof = 0; - active_cell_iterator cell = begin(level), - endc = end(level); + cell_iterator cell = begin(level), + endc = end(level); for (; cell != endc; ++cell) next_free_dof = distribute_dofs_on_cell (cell, next_free_dof); @@ -891,8 +890,8 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe) { template <> unsigned int -MGDoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell, - unsigned int next_free_dof) { +MGDoFHandler<1>::distribute_dofs_on_cell (cell_iterator &cell, + unsigned int next_free_dof) { // distribute dofs of vertices if (selected_fe->dofs_per_vertex > 0) @@ -946,8 +945,8 @@ MGDoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell, template <> unsigned int -MGDoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell, - unsigned int next_free_dof) { +MGDoFHandler<2>::distribute_dofs_on_cell (cell_iterator &cell, + unsigned int next_free_dof) { if (selected_fe->dofs_per_vertex > 0) // number dofs on vertices for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) @@ -1374,12 +1373,12 @@ void MGDoFHandler<2>::reserve_space () { // their size for (unsigned int i=0; i