From: heister Date: Fri, 10 Aug 2012 15:26:10 +0000 (+0000) Subject: conversion to types::global_dof_index X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b4f2c27148bbc5a3c1718fbe7a5d57dafd52896;p=dealii-svn.git conversion to types::global_dof_index git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_3@25882 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/dofs/dof_accessor.h b/deal.II/include/deal.II/dofs/dof_accessor.h index a58ba09acc..2f3ac77cc6 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.h @@ -404,10 +404,10 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritancecell-@>active_fe_index * as last argument. */ - void get_dof_indices (std::vector &dof_indices, + void get_dof_indices (std::vector &dof_indices, const unsigned int fe_index = DH::default_fe_index) const; - void get_mg_dof_indices (const int level, std::vector& dof_indices, const unsigned int fe_index = DH::default_fe_index) const; + void get_mg_dof_indices (const int level, std::vector& dof_indices, const unsigned int fe_index = DH::default_fe_index) const; /** * Global DoF index of the i @@ -445,11 +445,11 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritanceith degree @@ -505,10 +505,10 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritancei @@ -738,10 +738,10 @@ class DoFAccessor : public dealii::internal::DoFAccessor::Inheritance > : public TriaAccessor<0,1,spacedim> * cell-@>active_fe_index * as last argument. */ - void get_dof_indices (std::vector &dof_indices, + void get_dof_indices (std::vector &dof_indices, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -1117,7 +1117,7 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * match the result of * active_fe_index(). */ - unsigned int vertex_dof_index (const unsigned int vertex, + types::global_dof_index vertex_dof_index (const unsigned int vertex, const unsigned int i, const unsigned int fe_index = AccessorData::default_fe_index) const; @@ -1175,7 +1175,7 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * degrees are defined in the interior of * the face. */ - unsigned int dof_index (const unsigned int i, + types::global_dof_index dof_index (const unsigned int i, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -1363,7 +1363,7 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> * active_fe_index(). */ void set_dof_index (const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -1404,7 +1404,7 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> */ void set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -2032,9 +2032,9 @@ class DoFCellAccessor : public DoFAccessor * degrees of freedom associated * with them at all. */ - void get_dof_indices (std::vector &dof_indices) const; + void get_dof_indices (std::vector &dof_indices) const; - void get_mg_dof_indices (std::vector& dof_indices) const; + void get_mg_dof_indices (std::vector& dof_indices) const; /** * @} @@ -2084,7 +2084,7 @@ class DoFCellAccessor : public DoFAccessor * cache, if one exists for the * given DoF handler class. */ - void set_dof_indices (const std::vector &dof_indices); + void set_dof_indices (const std::vector &dof_indices); /** * Update the cache in which we diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index d528221100..84621a8050 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -218,7 +218,7 @@ namespace internal */ template static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -243,7 +243,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<1>, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->lines. set_dof_index (dof_handler, @@ -256,7 +256,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -283,7 +283,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<1>, - const unsigned int global_index) + const types::global_dof_index global_index) { // faces have no levels Assert (obj_level == 0, ExcInternalError()); @@ -298,7 +298,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -323,7 +323,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<2>, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->quads. set_dof_index (dof_handler, @@ -336,7 +336,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -363,7 +363,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<1>, - const unsigned int global_index) + const types::global_dof_index global_index) { // faces have no levels Assert (obj_level == 0, ExcInternalError()); @@ -379,7 +379,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -406,7 +406,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<2>, - const unsigned int global_index) + const types::global_dof_index global_index) { // faces have no levels Assert (obj_level == 0, ExcInternalError()); @@ -422,7 +422,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -447,7 +447,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<3>, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->hexes. set_dof_index (dof_handler, @@ -460,7 +460,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -486,7 +486,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<1> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->lines. set_dof_index (dof_handler, @@ -500,7 +500,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -526,7 +526,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<1> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.faces->lines. set_dof_index (dof_handler, @@ -540,7 +540,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -566,7 +566,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<2> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->quads. set_dof_index (dof_handler, @@ -580,7 +580,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -606,7 +606,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<1> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.faces->lines. set_dof_index (dof_handler, @@ -620,7 +620,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -646,7 +646,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<2> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.faces->quads. set_dof_index (dof_handler, @@ -660,7 +660,7 @@ namespace internal template static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -686,7 +686,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<3> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->hexes. set_dof_index (dof_handler, @@ -1106,7 +1106,7 @@ namespace internal const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index) + const types::global_dof_index global_index) { Assert ((fe_index == dealii::DoFHandler::default_fe_index), ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); @@ -1131,7 +1131,7 @@ namespace internal const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index) + const types::global_dof_index global_index) { Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), ExcMessage ("You need to specify a FE index when working " @@ -1156,12 +1156,14 @@ namespace internal // we can't find a set for this // particular fe_index const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + // a fe index is always small + Assert((*pointer)::max(), ExcInternalError()); + const unsigned int this_fe_index = static_cast(*pointer); Assert (this_fe_index != numbers::invalid_unsigned_int, ExcInternalError()); @@ -1246,12 +1248,13 @@ namespace internal // we can't find a set for this // particular fe_index const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types:global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)::max(), ExcInternalError()); + const unsigned int this_fe_index = static_cast(*pointer); Assert (this_fe_index != numbers::invalid_unsigned_int, ExcInternalError()); @@ -1290,7 +1293,7 @@ namespace internal // sets and count the number of // hops const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; Assert (*pointer != numbers::invalid_unsigned_int, ExcInternalError()); @@ -1300,7 +1303,8 @@ namespace internal { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)::max(), ExcInternalError()); + const unsigned int this_fe_index = static_cast(*pointer); if (this_fe_index == numbers::invalid_unsigned_int) return counter; @@ -1342,7 +1346,7 @@ namespace internal // sets and count the number of // hops const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; Assert (*pointer != numbers::invalid_unsigned_int, ExcInternalError()); @@ -1352,7 +1356,8 @@ namespace internal { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)::max(), ExcInternalError()); + const unsigned int this_fe_index = static_cast(*pointer); Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1402,7 +1407,7 @@ namespace internal // sets and see whether we find // the given index const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; Assert (*pointer != numbers::invalid_unsigned_int, ExcInternalError()); @@ -1411,7 +1416,8 @@ namespace internal { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)::max(), ExcInternalError()); + const unsigned int this_fe_index = static_cast(*pointer); Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1450,7 +1456,7 @@ DoFAccessor::dof_index (const unsigned int i, template inline -unsigned int DoFAccessor::mg_dof_index (const int level, const unsigned int i) const { +types::global_dof_index DoFAccessor::mg_dof_index (const int level, const unsigned int i) const { return this->dof_handler->template get_dof_index (level, this->present_index, 0, i); } @@ -1459,7 +1465,7 @@ template inline void DoFAccessor::set_dof_index (const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index) const { // access the respective DoF @@ -1543,6 +1549,7 @@ DoFAccessor::vertex_dof_index (const unsigned int vertex, template inline unsigned +types::global_dof_index DoFAccessor::mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); @@ -1557,7 +1564,7 @@ inline void DoFAccessor::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index) const { dealii::internal::DoFAccessor::Implementation::set_vertex_dof_index @@ -1572,7 +1579,7 @@ DoFAccessor::set_vertex_dof_index (const unsigned int vertex, template inline void -DoFAccessor::set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int index, const unsigned int fe_index) const { +DoFAccessor::set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const types::global_dof_index index, const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); Assert (vertex < GeometryInfo::vertices_per_cell, ExcIndexRange (vertex, 0, GeometryInfo::vertices_per_cell)); @@ -1584,7 +1591,7 @@ DoFAccessor::set_mg_vertex_dof_index (const int level, const unsi template inline void -DoFAccessor::set_mg_dof_index (const int level, const unsigned int i, const unsigned int index) const { +DoFAccessor::set_mg_dof_index (const int level, const unsigned int i, const types::global_dof_index index) const { this->dof_handler->template set_dof_index (level, this->present_index, 0, i, index); } @@ -1635,12 +1642,12 @@ namespace internal { template void get_dof_indices (const dealii::DoFAccessor<1,DH> &accessor, - std::vector &dof_indices, + std::vector &dof_indices, const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, dofs_per_line = accessor.get_fe(fe_index).dofs_per_line; - std::vector::iterator next = dof_indices.begin(); + std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d void get_dof_indices (const dealii::DoFAccessor<2,DH> &accessor, - std::vector &dof_indices, + std::vector &dof_indices, const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad; - std::vector::iterator next = dof_indices.begin(); + std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; d void get_dof_indices (const dealii::DoFAccessor<3,DH> &accessor, - std::vector &dof_indices, + std::vector &dof_indices, const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad, dofs_per_hex = accessor.get_fe(fe_index).dofs_per_hex; - std::vector::iterator next = dof_indices.begin(); + std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; d - void get_mg_dof_indices (const dealii::DoFAccessor<1, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { + void get_mg_dof_indices (const dealii::DoFAccessor<1, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { const FiniteElement& fe = accessor.get_dof_handler ().get_fe ()[fe_index]; - std::vector::iterator next = dof_indices.begin (); + std::vector::iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1755,9 +1762,9 @@ namespace internal } template - void get_mg_dof_indices (const dealii::DoFAccessor<2, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { + void get_mg_dof_indices (const dealii::DoFAccessor<2, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { const FiniteElement& fe = accessor.get_dof_handler ().get_fe ()[fe_index]; - std::vector::iterator next = dof_indices.begin (); + std::vector::iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1774,9 +1781,9 @@ namespace internal } template - void get_mg_dof_indices (const dealii::DoFAccessor<3, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { + void get_mg_dof_indices (const dealii::DoFAccessor<3, DH>& accessor, const int level, std::vector& dof_indices, const unsigned int fe_index) { const FiniteElement& fe = accessor.get_dof_handler ().get_fe ()[fe_index]; - std::vector::iterator next = dof_indices.begin (); + std::vector::iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1802,7 +1809,7 @@ namespace internal template inline void -DoFAccessor::get_dof_indices (std::vector &dof_indices, +DoFAccessor::get_dof_indices (std::vector &dof_indices, const unsigned int fe_index) const { Assert (static_cast(this->level()) < this->dof_handler->levels.size(), @@ -1865,7 +1872,7 @@ DoFAccessor::get_dof_indices (std::vector &dof_indic template inline -void DoFAccessor::get_mg_dof_indices (const int level, std::vector& dof_indices, const unsigned int fe_index) const { +void DoFAccessor::get_mg_dof_indices (const int level, std::vector& dof_indices, const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); @@ -2018,7 +2025,7 @@ template