From: Wolfgang Bangerth Date: Fri, 28 Apr 2006 14:23:44 +0000 (+0000) Subject: Move a few functions around to avoid the apparently troublesome anonymous namespace... X-Git-Tag: v8.0.0~11841 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7ab680852c19080578e54b2ab120512041f25f;p=dealii.git Move a few functions around to avoid the apparently troublesome anonymous namespace in a header file. git-svn-id: https://svn.dealii.org/trunk@12934 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_accessor.templates.h b/deal.II/deal.II/include/dofs/dof_accessor.templates.h index 2cbf59347c..df56233c56 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -24,56 +24,6 @@ #include - -namespace -{ - template - inline - void - set_hp_vertex_dof_index (const hp::FECollection &fe, - const unsigned int fe_index, - const unsigned int *start_of_list, - const unsigned int local_index, - const unsigned int global_index) - { - Assert (fe_index != hp::DoFHandler<1>::default_fe_index, - ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); - abort (); - } - - - template - inline - unsigned int - get_hp_vertex_dof_index (const hp::FECollection &fe, - const unsigned int fe_index, - const unsigned int *start_of_list, - const unsigned int local_index) - { - Assert (fe_index != hp::DoFHandler<1>::default_fe_index, - ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); - Assert (local_index < fe[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, fe[fe_index].dofs_per_vertex)); - // hop along the list of index - // sets until we find the one - // with the correct fe_index, and - // then poke into that - // part. trigger an exception if - // we can't find a set for this - // particular fe_index - const unsigned int *pointer = start_of_list; - while (true) - { - Assert (*pointer != deal_II_numbers::invalid_unsigned_int, - ExcInternalError()); - if (*pointer == fe_index) - return *(pointer + 1 + local_index); - else - pointer += fe[*pointer].dofs_per_vertex; - } - } -} - /*------------------------- Functions: DoFAccessor ---------------------------*/ @@ -1029,10 +979,11 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::vertex_dof_index (const unsigned int ve const unsigned int starting_offset = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)]; - return get_hp_vertex_dof_index (this->dof_handler->get_fe(), - fe_index, - &this->dof_handler->vertex_dofs[starting_offset], - i); + return internal::hp::DoFLevel<0>:: + get_hp_vertex_dof_index (this->dof_handler->get_fe(), + fe_index, + &this->dof_handler->vertex_dofs[starting_offset], + i); } @@ -1058,10 +1009,11 @@ DoFObjectAccessor<1,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int ve const unsigned int starting_offset = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)]; - return get_hp_vertex_dof_index (this->dof_handler->get_fe(), - fe_index, - &this->dof_handler->vertex_dofs[starting_offset], - i); + return internal::hp::DoFLevel<0>:: + get_hp_vertex_dof_index (this->dof_handler->get_fe(), + fe_index, + &this->dof_handler->vertex_dofs[starting_offset], + i); } @@ -1086,10 +1038,11 @@ DoFObjectAccessor<1,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve const unsigned int starting_offset = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)]; - return get_hp_vertex_dof_index (this->dof_handler->get_fe(), - fe_index, - &this->dof_handler->vertex_dofs[starting_offset], - i); + return internal::hp::DoFLevel<0>:: + get_hp_vertex_dof_index (this->dof_handler->get_fe(), + fe_index, + &this->dof_handler->vertex_dofs[starting_offset], + i); } @@ -1115,10 +1068,11 @@ DoFObjectAccessor<2,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int ve const unsigned int starting_offset = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)]; - return get_hp_vertex_dof_index (this->dof_handler->get_fe(), - fe_index, - &this->dof_handler->vertex_dofs[starting_offset], - i); + return internal::hp::DoFLevel<0>:: + get_hp_vertex_dof_index (this->dof_handler->get_fe(), + fe_index, + &this->dof_handler->vertex_dofs[starting_offset], + i); } @@ -1145,10 +1099,11 @@ DoFObjectAccessor<2,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve const unsigned int starting_offset = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)]; - return get_hp_vertex_dof_index (this->dof_handler->get_fe(), - fe_index, - &this->dof_handler->vertex_dofs[starting_offset], - i); + return internal::hp::DoFLevel<0>:: + get_hp_vertex_dof_index (this->dof_handler->get_fe(), + fe_index, + &this->dof_handler->vertex_dofs[starting_offset], + i); } @@ -1175,10 +1130,11 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve const unsigned int starting_offset = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)]; - return get_hp_vertex_dof_index (this->dof_handler->get_fe(), - fe_index, - &this->dof_handler->vertex_dofs[starting_offset], - i); + return internal::hp::DoFLevel<0>:: + get_hp_vertex_dof_index (this->dof_handler->get_fe(), + fe_index, + &this->dof_handler->vertex_dofs[starting_offset], + i); } diff --git a/deal.II/deal.II/include/dofs/hp_dof_levels.h b/deal.II/deal.II/include/dofs/hp_dof_levels.h index 8259f93a5b..fdc3da243b 100644 --- a/deal.II/deal.II/include/dofs/hp_dof_levels.h +++ b/deal.II/deal.II/include/dofs/hp_dof_levels.h @@ -15,9 +15,18 @@ #include +#include + #include +namespace hp +{ + template + class FECollection; +} + + namespace internal { namespace hp @@ -76,6 +85,23 @@ namespace internal */ std::vector active_fe_indices; + + template + static + unsigned int + get_hp_vertex_dof_index (const ::hp::FECollection &fe, + const unsigned int fe_index, + const unsigned int *start_of_list, + const unsigned int local_index); + + template + static + void + set_hp_vertex_dof_index (const ::hp::FECollection &fe, + const unsigned int fe_index, + const unsigned int *start_of_list, + const unsigned int local_index, + const unsigned int global_index); }; @@ -235,7 +261,12 @@ namespace internal */ unsigned int memory_consumption () const; }; - + + +// ------------------ inline and template functions + + + } // namespace hp } // namespace internal diff --git a/deal.II/deal.II/source/dofs/hp_dof_levels.cc b/deal.II/deal.II/source/dofs/hp_dof_levels.cc index 8df4c72598..e6b32b4ef6 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_levels.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_levels.cc @@ -46,5 +46,70 @@ namespace internal MemoryConsumption::memory_consumption (hex_dofs) + MemoryConsumption::memory_consumption (dof_hex_index_offset)); } + + template + void + DoFLevel<0>:: + set_hp_vertex_dof_index (const ::hp::FECollection &fe, + const unsigned int fe_index, + const unsigned int *start_of_list, + const unsigned int local_index, + const unsigned int global_index) + { + Assert (fe_index != hp::DoFHandler::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); + abort (); + } + + + template + unsigned int + DoFLevel<0>:: + get_hp_vertex_dof_index (const ::hp::FECollection &fe, + const unsigned int fe_index, + const unsigned int *start_of_list, + const unsigned int local_index) + { + Assert (fe_index != hp::DoFHandler::default_fe_index, + ExcMessage ("You need to specify a FE index when working with hp DoFHandlers")); + Assert (local_index < fe[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, fe[fe_index].dofs_per_vertex)); + // hop along the list of index + // sets until we find the one + // with the correct fe_index, and + // then poke into that + // part. trigger an exception if + // we can't find a set for this + // particular fe_index + const unsigned int *pointer = start_of_list; + while (true) + { + Assert (*pointer != deal_II_numbers::invalid_unsigned_int, + ExcInternalError()); + if (*pointer == fe_index) + return *(pointer + 1 + local_index); + else + pointer += fe[*pointer].dofs_per_vertex; + } + } + + +// explicit instantiations + template + void + DoFLevel<0>:: + set_hp_vertex_dof_index (const ::hp::FECollection &fe, + const unsigned int fe_index, + const unsigned int *start_of_list, + const unsigned int local_index, + const unsigned int global_index); + + template + unsigned int + DoFLevel<0>:: + get_hp_vertex_dof_index (const ::hp::FECollection &fe, + const unsigned int fe_index, + const unsigned int *start_of_list, + const unsigned int local_index); } }