From: buerg Date: Fri, 10 Aug 2012 10:18:40 +0000 (+0000) Subject: Change unsigned int to types::global_dof_index. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cd35b34a545c02bcf251a5e9f43b626cd471ab1;p=dealii-svn.git Change unsigned int to types::global_dof_index. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_3@25870 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/hp/dof_handler.h b/deal.II/include/deal.II/hp/dof_handler.h index 46d232eb61..2ff8ec0811 100644 --- a/deal.II/include/deal.II/hp/dof_handler.h +++ b/deal.II/include/deal.II/hp/dof_handler.h @@ -249,7 +249,7 @@ namespace hp * number of the degree of * freedom referenced. */ - void renumber_dofs (const std::vector &new_numbers); + void renumber_dofs (const std::vector &new_numbers); /** * Return the maximum number of @@ -831,13 +831,13 @@ namespace hp * DoFs which are constrained by * hanging nodes, see @ref constraints. */ - unsigned int n_dofs () const; + types::global_dof_index n_dofs () const; /** * Return the number of degrees of freedom * located on the boundary. */ - unsigned int n_boundary_dofs () const; + types::global_dof_index n_boundary_dofs () const; /** * Return the number of degrees @@ -852,7 +852,7 @@ namespace hp * @p make_boundary_sparsity_pattern * function. */ - unsigned int + types::global_dof_index n_boundary_dofs (const FunctionMap &boundary_indicators) const; /** @@ -863,7 +863,7 @@ namespace hp * indicators under * consideration. */ - unsigned int + types::global_dof_index n_boundary_dofs (const std::set &boundary_indicators) const; /** @@ -1103,8 +1103,8 @@ namespace hp public: MGVertexDoFs (); ~MGVertexDoFs (); - unsigned int get_index (const unsigned int level, const unsigned int dof_number) const; - void set_index (const unsigned int level, const unsigned int dof_number, const unsigned int index); + types::global_dof_index get_index (const unsigned int level, const unsigned int dof_number) const; + void set_index (const unsigned int level, const unsigned int dof_number, const types::global_dof_index index); }; /** @@ -1113,10 +1113,10 @@ namespace hp void clear_space (); template - unsigned int get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const; + types::global_dof_index get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const; template - void set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index) const; + void set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index) const; /** * Create default tables for @@ -1157,7 +1157,7 @@ namespace hp * distribute_dofs(). */ void - compute_vertex_dof_identities (std::vector &new_dof_indices) const; + compute_vertex_dof_identities (std::vector &new_dof_indices) const; /** * Compute identities between @@ -1166,7 +1166,7 @@ namespace hp * distribute_dofs(). */ void - compute_line_dof_identities (std::vector &new_dof_indices) const; + compute_line_dof_identities (std::vector &new_dof_indices) const; /** * Compute identities between @@ -1175,7 +1175,7 @@ namespace hp * distribute_dofs(). */ void - compute_quad_dof_identities (std::vector &new_dof_indices) const; + compute_quad_dof_identities (std::vector &new_dof_indices) const; /** * Renumber the objects with @@ -1202,16 +1202,16 @@ namespace hp * co-located on the same * entity. */ - void renumber_dofs_internal (const std::vector &new_numbers, + void renumber_dofs_internal (const std::vector &new_numbers, dealii::internal::int2type<0>); - void renumber_dofs_internal (const std::vector &new_numbers, + void renumber_dofs_internal (const std::vector &new_numbers, dealii::internal::int2type<1>); - void renumber_dofs_internal (const std::vector &new_numbers, + void renumber_dofs_internal (const std::vector &new_numbers, dealii::internal::int2type<2>); - void renumber_dofs_internal (const std::vector &new_numbers, + void renumber_dofs_internal (const std::vector &new_numbers, dealii::internal::int2type<3>); /** @@ -1267,7 +1267,7 @@ namespace hp * actual data format used to * the present class. */ - std::vector vertex_dofs; + std::vector vertex_dofs; /** * For each vertex in the @@ -1341,7 +1341,7 @@ namespace hp template inline - unsigned int + types::global_dof_index DoFHandler::n_dofs () const { return number_cache.n_global_dofs; @@ -1403,14 +1403,14 @@ namespace hp template inline - unsigned int DoFHandler::MGVertexDoFs::get_index (const unsigned int level, const unsigned int dof_number) const { + types::global_dof_index DoFHandler::MGVertexDoFs::get_index (const unsigned int level, const unsigned int dof_number) const { Assert (false, ExcNotImplemented ()); return invalid_dof_index; } template inline - void DoFHandler::MGVertexDoFs::set_index (const unsigned int level, const unsigned int dof_number, const unsigned int index) { + void DoFHandler::MGVertexDoFs::set_index (const unsigned int level, const unsigned int dof_number, const types::global_dof_index index) { Assert (false, ExcNotImplemented ()); } diff --git a/deal.II/source/hp/dof_handler.cc b/deal.II/source/hp/dof_handler.cc index 6d1c147187..6362c78416 100644 --- a/deal.II/source/hp/dof_handler.cc +++ b/deal.II/source/hp/dof_handler.cc @@ -322,9 +322,9 @@ namespace internal */ template static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const typename dealii::hp::DoFHandler<1,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { const unsigned int dim = 1; @@ -367,9 +367,9 @@ namespace internal template static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const typename dealii::hp::DoFHandler<2,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { const unsigned int dim = 2; @@ -430,9 +430,9 @@ namespace internal template static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const typename dealii::hp::DoFHandler<3,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { const unsigned int dim = 3; @@ -577,7 +577,7 @@ namespace internal = std::vector (dof_handler.tria->n_raw_lines(level), DoFHandler::invalid_dof_index); - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; for (typename DoFHandler::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -588,7 +588,7 @@ namespace internal } dof_handler.levels[level]->lines.dofs - = std::vector (next_free_dof, + = std::vector (next_free_dof, DoFHandler::invalid_dof_index); } @@ -602,7 +602,7 @@ namespace internal #ifdef DEBUG for (unsigned int level=0; leveln_levels(); ++level) { - unsigned int counter = 0; + types::global_dof_index counter = 0; for (typename DoFHandler::cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -693,7 +693,7 @@ namespace internal = std::vector (dof_handler.tria->n_raw_quads(level), DoFHandler::invalid_dof_index); - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; for (typename DoFHandler::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -704,7 +704,7 @@ namespace internal } dof_handler.levels[level]->quads.dofs - = std::vector (next_free_dof, + = std::vector (next_free_dof, DoFHandler::invalid_dof_index); } @@ -718,7 +718,7 @@ namespace internal #ifdef DEBUG for (unsigned int level=0; leveln_levels(); ++level) { - unsigned int counter = 0; + types::global_dof_index counter = 0; for (typename DoFHandler::cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -844,7 +844,7 @@ namespace internal = std::vector (dof_handler.tria->n_raw_lines(), DoFHandler::invalid_dof_index); dof_handler.faces->lines.dofs - = std::vector (n_line_slots, + = std::vector (n_line_slots, DoFHandler::invalid_dof_index); // with the memory now @@ -1057,7 +1057,7 @@ namespace internal = std::vector (dof_handler.tria->n_raw_hexs(level), DoFHandler::invalid_dof_index); - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; for (typename DoFHandler::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -1068,8 +1068,8 @@ namespace internal } dof_handler.levels[level]->hexes.dofs - = std::vector (next_free_dof, - DoFHandler::invalid_dof_index); + = std::vector (next_free_dof, + DoFHandler::invalid_dof_index); } // safety check: make sure that @@ -1082,7 +1082,7 @@ namespace internal #ifdef DEBUG for (unsigned int level=0; leveln_levels(); ++level) { - unsigned int counter = 0; + types::global_dof_index counter = 0; for (typename DoFHandler::cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -1212,8 +1212,8 @@ namespace internal = std::vector (dof_handler.tria->n_raw_quads(), DoFHandler::invalid_dof_index); dof_handler.faces->quads.dofs - = std::vector (n_quad_slots, - DoFHandler::invalid_dof_index); + = std::vector (n_quad_slots, + DoFHandler::invalid_dof_index); } // with the memory now @@ -2681,12 +2681,12 @@ namespace hp template <> - unsigned int DoFHandler<1>::n_boundary_dofs () const + types::global_dof_index DoFHandler<1>::n_boundary_dofs () const { Assert (finite_elements != 0, ExcNoFESelected()); DoFHandler<1,1>::cell_iterator cell; - unsigned int n = 0; + types::global_dof_index n = 0; // search left-most cell cell = this->begin_active(); @@ -2706,7 +2706,7 @@ namespace hp template <> - unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const + types::global_dof_index DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -2719,7 +2719,7 @@ namespace hp ExcInvalidBoundaryIndicator()); DoFHandler<1,1>::active_cell_iterator cell; - unsigned int n = 0; + types::global_dof_index n = 0; // search left-most cell if (boundary_indicators.find (0) != boundary_indicators.end()) @@ -2745,7 +2745,7 @@ namespace hp template <> - unsigned int DoFHandler<1>::n_boundary_dofs (const std::set &boundary_indicators) const + types::global_dof_index DoFHandler<1>::n_boundary_dofs (const std::set &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -2758,7 +2758,7 @@ namespace hp ExcInvalidBoundaryIndicator()); DoFHandler<1,1>::active_cell_iterator cell; - unsigned int n = 0; + types::global_dof_index n = 0; // search left-most cell if (boundary_indicators.find (0) != boundary_indicators.end()) @@ -2783,21 +2783,21 @@ namespace hp template <> - unsigned int DoFHandler<1,2>::n_boundary_dofs () const + types::global_dof_index DoFHandler<1,2>::n_boundary_dofs () const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &) const + types::global_dof_index DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &) const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,2>::n_boundary_dofs (const std::set &) const + types::global_dof_index DoFHandler<1,2>::n_boundary_dofs (const std::set &) const { Assert(false,ExcNotImplemented()); return 0; @@ -2806,21 +2806,21 @@ namespace hp template <> - unsigned int DoFHandler<1,3>::n_boundary_dofs () const +types::global_dof_index DoFHandler<1,3>::n_boundary_dofs () const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,3>::n_boundary_dofs (const FunctionMap &) const + types::global_dof_index DoFHandler<1,3>::n_boundary_dofs (const FunctionMap &) const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,3>::n_boundary_dofs (const std::set &) const + types::global_dof_index DoFHandler<1,3>::n_boundary_dofs (const std::set &) const { Assert(false,ExcNotImplemented()); return 0; @@ -2828,12 +2828,12 @@ template <> template - unsigned int DoFHandler::n_boundary_dofs () const + types::global_dof_index DoFHandler::n_boundary_dofs () const { Assert (finite_elements != 0, ExcNoFESelected()); - std::set boundary_dofs; - std::vector dofs_on_face; + std::set boundary_dofs; + std::vector dofs_on_face; dofs_on_face.reserve (this->get_fe ().max_dofs_per_face()); // loop over all faces to check @@ -2866,7 +2866,7 @@ template <> template - unsigned int + types::global_dof_index DoFHandler::n_boundary_dofs (const FunctionMap &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -2876,8 +2876,8 @@ template <> // same as above, but with // additional checks for set of // boundary indicators - std::set boundary_dofs; - std::vector dofs_on_face; + std::set boundary_dofs; + std::vector dofs_on_face; dofs_on_face.reserve (this->get_fe ().max_dofs_per_face()); typename DoFHandler::active_cell_iterator cell = this->begin_active (), @@ -2902,7 +2902,7 @@ template <> template - unsigned int + types::global_dof_index DoFHandler::n_boundary_dofs (const std::set &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -2912,8 +2912,8 @@ template <> // same as above, but with // additional checks for set of // boundary indicators - std::set boundary_dofs; - std::vector dofs_on_face; + std::set boundary_dofs; + std::vector dofs_on_face; dofs_on_face.reserve (this->get_fe ().max_dofs_per_face()); typename DoFHandler::active_cell_iterator cell = this->begin_active (), @@ -2937,7 +2937,7 @@ template <> template <> - unsigned int DoFHandler<2,3>::n_boundary_dofs () const + types::global_dof_index DoFHandler<2,3>::n_boundary_dofs () const { Assert(false,ExcNotImplemented()); return 0; @@ -2946,7 +2946,7 @@ template <> template <> - unsigned int DoFHandler<2,3>::n_boundary_dofs (const FunctionMap &) const + types::global_dof_index DoFHandler<2,3>::n_boundary_dofs (const FunctionMap &) const { Assert(false,ExcNotImplemented()); return 0; @@ -2955,7 +2955,7 @@ template <> template <> - unsigned int DoFHandler<2,3>::n_boundary_dofs (const std::set &) const + types::global_dof_index DoFHandler<2,3>::n_boundary_dofs (const std::set &) const { Assert(false,ExcNotImplemented()); return 0; @@ -2988,7 +2988,7 @@ template <> template void DoFHandler:: - compute_vertex_dof_identities (std::vector &new_dof_indices) const + compute_vertex_dof_identities (std::vector &new_dof_indices) const { // Note: we may wish to have // something here similar to what @@ -3070,13 +3070,13 @@ template <> = *vertex_dof_identities[first_fe_index][other_fe_index]; for (unsigned int i=0; i template <> void DoFHandler<1,1>:: - compute_line_dof_identities (std::vector &) const + compute_line_dof_identities (std::vector &) const {} @@ -3110,20 +3110,20 @@ template <> template <> void DoFHandler<1,2>:: - compute_line_dof_identities (std::vector &) const + compute_line_dof_identities (std::vector &) const {} template <> void DoFHandler<1,3>:: - compute_line_dof_identities (std::vector &) const + compute_line_dof_identities (std::vector &) const {} template void DoFHandler:: - compute_line_dof_identities (std::vector &new_dof_indices) const + compute_line_dof_identities (std::vector &new_dof_indices) const { // An implementation of the // algorithm described in the hp @@ -3227,9 +3227,9 @@ template <> for (unsigned int j=0; j<(*finite_elements)[fe_index_1].dofs_per_line; ++j) { - const unsigned int master_dof_index + const types::global_dof_index master_dof_index = line->dof_index (j, fe_index_1); - const unsigned int slave_dof_index + const types::global_dof_index slave_dof_index = line->dof_index (j, fe_index_2); // if master dof @@ -3314,9 +3314,9 @@ template <> = *line_dof_identities[most_dominating_fe_index][other_fe_index]; for (unsigned int i=0; idof_index (identities[i].first, most_dominating_fe_index); - const unsigned int slave_dof_index + const types::global_dof_index slave_dof_index = line->dof_index (identities[i].second, other_fe_index); Assert ((new_dof_indices[master_dof_index] == @@ -3338,25 +3338,25 @@ template <> template <> void DoFHandler<1>:: - compute_quad_dof_identities (std::vector &) const + compute_quad_dof_identities (std::vector &) const {} template <> void DoFHandler<1,2>:: - compute_quad_dof_identities (std::vector &) const + compute_quad_dof_identities (std::vector &) const {} template <> void DoFHandler<1,3>:: - compute_quad_dof_identities (std::vector &) const + compute_quad_dof_identities (std::vector &) const {} template <> void DoFHandler<2>:: - compute_quad_dof_identities (std::vector &) const + compute_quad_dof_identities (std::vector &) const {} @@ -3364,7 +3364,7 @@ template <> template <> void DoFHandler<2,3>:: - compute_quad_dof_identities (std::vector &) const + compute_quad_dof_identities (std::vector &) const {} @@ -3372,7 +3372,7 @@ template <> template void DoFHandler:: - compute_quad_dof_identities (std::vector &new_dof_indices) const + compute_quad_dof_identities (std::vector &new_dof_indices) const { // An implementation of the // algorithm described in the hp @@ -3433,9 +3433,9 @@ template <> = *quad_dof_identities[most_dominating_fe_index][other_fe_index]; for (unsigned int i=0; idof_index (identities[i].first, most_dominating_fe_index); - const unsigned int slave_dof_index + const types::global_dof_index slave_dof_index = quad->dof_index (identities[i].second, other_fe_index); Assert ((new_dof_indices[master_dof_index] == @@ -3536,7 +3536,7 @@ template <> // Step 1: distribute DoFs on all // active entities { - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; active_cell_iterator cell = begin_active(), endc = end(); @@ -3558,7 +3558,7 @@ template <> // faces and other // lower-dimensional objects // where elements come together - std::vector + std::vector constrained_indices (number_cache.n_global_dofs, numbers::invalid_unsigned_int); compute_vertex_dof_identities (constrained_indices); compute_line_dof_identities (constrained_indices); @@ -3567,10 +3567,10 @@ template <> // loop over all dofs and assign // new numbers to those which are // not constrained - std::vector + std::vector new_dof_indices (number_cache.n_global_dofs, numbers::invalid_unsigned_int); - unsigned int next_free_dof = 0; - for (unsigned int i=0; i // then loop over all those that // are constrained and record the // new dof number for those: - for (unsigned int i=0; i new_dof_indices[i] = new_dof_indices[constrained_indices[i]]; } - for (unsigned int i=0; i = IndexSet (number_cache.n_global_dofs); number_cache.locally_owned_dofs.add_range (0, number_cache.n_global_dofs); - + Assert (number_cache.n_global_dofs < std::numeric_limits::max (), + ExcMessage ("Global number of degrees of freedom is too large.")); number_cache.n_locally_owned_dofs_per_processor = std::vector (1, - number_cache.n_global_dofs); + (unsigned int) number_cache.n_global_dofs); number_cache.locally_owned_dofs_per_processor = std::vector (1, @@ -3640,7 +3641,7 @@ template <> template - void DoFHandler::renumber_dofs (const std::vector &new_numbers) + void DoFHandler::renumber_dofs (const std::vector &new_numbers) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); #ifdef DEBUG @@ -3648,10 +3649,10 @@ template <> // consecutively numbered if (true) { - std::vector tmp(new_numbers); + std::vector tmp(new_numbers); std::sort (tmp.begin(), tmp.end()); - std::vector::const_iterator p = tmp.begin(); - unsigned int i = 0; + std::vector::const_iterator p = tmp.begin(); + types::global_dof_index i = 0; for (; p!=tmp.end(); ++p, ++i) Assert (*p == i, ExcNewNumbersNotConsecutive(i)); } @@ -3665,7 +3666,7 @@ template <> template void DoFHandler:: - renumber_dofs_internal (const std::vector &new_numbers, + renumber_dofs_internal (const std::vector &new_numbers, internal::int2type<0>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -3685,7 +3686,7 @@ template <> for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_vertex; ++d) { - const unsigned int vertex_dof_index + const types::global_dof_index vertex_dof_index = internal::DoFAccessor::Implementation:: get_vertex_dof_index(*this, vertex_index, @@ -3707,7 +3708,7 @@ template <> template void DoFHandler:: - renumber_dofs_internal (const std::vector &new_numbers, + renumber_dofs_internal (const std::vector &new_numbers, internal::int2type<1>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -3738,7 +3739,7 @@ template <> template<> void DoFHandler<2,2>:: - renumber_dofs_internal (const std::vector &new_numbers, + renumber_dofs_internal (const std::vector &new_numbers, internal::int2type<2>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -3768,7 +3769,7 @@ template <> template<> void DoFHandler<2,3>:: - renumber_dofs_internal (const std::vector &new_numbers, + renumber_dofs_internal (const std::vector &new_numbers, internal::int2type<2>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -3797,7 +3798,7 @@ template <> template<> void DoFHandler<3,3>:: - renumber_dofs_internal (const std::vector &new_numbers, + renumber_dofs_internal (const std::vector &new_numbers, internal::int2type<2>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -3826,7 +3827,7 @@ template <> template<> void DoFHandler<3,3>:: - renumber_dofs_internal (const std::vector &new_numbers, + renumber_dofs_internal (const std::vector &new_numbers, internal::int2type<3>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -4144,7 +4145,7 @@ template <> template template - unsigned int + types::global_dof_index DoFHandler::get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, @@ -4161,7 +4162,7 @@ template <> const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index) const + const types::global_dof_index global_index) const { } @@ -4177,7 +4178,7 @@ template <> faces = NULL; { - std::vector tmp; + std::vector tmp; std::swap (vertex_dofs, tmp); }