From f592bfb3ed2704980c30fe49b748e6325b7ed0e3 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 14 Oct 2017 14:28:59 +0200 Subject: [PATCH] Fix undefined behavior DoFHandler --- source/dofs/dof_handler.cc | 58 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 159fbb1a5f..5d4e831535 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -552,96 +552,96 @@ namespace internal types::global_dof_index get_dof_index ( const DoFHandler<1, spacedim> &dof_handler, - internal::DoFHandler::DoFLevel<1> &mg_level, - internal::DoFHandler::DoFFaces<1> &, + const std::unique_ptr > &mg_level, + const std::unique_ptr > &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) { - return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); + return mg_level->dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template static types::global_dof_index - get_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &, internal::DoFHandler::DoFFaces<2> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) + get_dof_index (const DoFHandler<2, spacedim> &dof_handler, const std::unique_ptr > &, const std::unique_ptr > &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) { - return mg_faces.lines.get_dof_index (dof_handler, obj_index, fe_index, local_index); + return mg_faces->lines.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template static types::global_dof_index - get_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &mg_level, internal::DoFHandler::DoFFaces<2> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) + get_dof_index (const DoFHandler<2, spacedim> &dof_handler, const std::unique_ptr > &mg_level, const std::unique_ptr > &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) { - return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); + return mg_level->dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template static types::global_dof_index - get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) + get_dof_index (const DoFHandler<3, spacedim> &dof_handler, const std::unique_ptr > &, const std::unique_ptr > &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) { - return mg_faces.lines.get_dof_index (dof_handler, obj_index, fe_index, local_index); + return mg_faces->lines.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template static types::global_dof_index - get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) + get_dof_index (const DoFHandler<3, spacedim> &dof_handler, const std::unique_ptr > &, const std::unique_ptr > &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) { - return mg_faces.quads.get_dof_index (dof_handler, obj_index, fe_index, local_index); + return mg_faces->quads.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template static types::global_dof_index - get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &mg_level, internal::DoFHandler::DoFFaces<3> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) + get_dof_index (const DoFHandler<3, spacedim> &dof_handler, const std::unique_ptr > &mg_level, const std::unique_ptr > &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const std::integral_constant) { - return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); + return mg_level->dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template static - void set_dof_index (const DoFHandler<1, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<1> &mg_level, internal::DoFHandler::DoFFaces<1> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) + void set_dof_index (const DoFHandler<1, spacedim> &dof_handler, const std::unique_ptr > &mg_level, const std::unique_ptr > &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) { - mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); + mg_level->dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template static - void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &, internal::DoFHandler::DoFFaces<2> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) + void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, const std::unique_ptr > &, const std::unique_ptr > &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) { - mg_faces.lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); + mg_faces->lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template static - void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &mg_level, internal::DoFHandler::DoFFaces<2> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) + void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, const std::unique_ptr > &mg_level, const std::unique_ptr > &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) { - mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); + mg_level->dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template static - void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) + void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, const std::unique_ptr > &, const std::unique_ptr > &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) { - mg_faces.lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); + mg_faces->lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template static - void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) + void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, const std::unique_ptr > &, const std::unique_ptr > &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) { - mg_faces.quads.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); + mg_faces->quads.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template static - void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &mg_level, internal::DoFHandler::DoFFaces<3> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) + void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, const std::unique_ptr > &mg_level, const std::unique_ptr > &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const std::integral_constant) { - mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); + mg_level->dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } }; } @@ -1215,8 +1215,8 @@ DoFHandler::get_dof_index (const unsigned int obj_level, const unsigned int fe_index, const unsigned int local_index) const { - return internal::DoFHandler::Implementation::get_dof_index (*this, *this->mg_levels[obj_level], - *this->mg_faces, obj_index, + return internal::DoFHandler::Implementation::get_dof_index (*this, this->mg_levels[obj_level], + this->mg_faces, obj_index, fe_index, local_index, std::integral_constant ()); } @@ -1232,8 +1232,8 @@ void DoFHandler::set_dof_index (const unsigned int obj_level, const types::global_dof_index global_index) const { internal::DoFHandler::Implementation::set_dof_index (*this, - *this->mg_levels[obj_level], - *this->mg_faces, + this->mg_levels[obj_level], + this->mg_faces, obj_index, fe_index, local_index, -- 2.39.5