From: bangerth Date: Fri, 30 Aug 2013 12:30:40 +0000 (+0000) Subject: Make member variables of the levels objects private. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7ddf319ee051b2edf1708940956aed5e6365f5;p=dealii-svn.git Make member variables of the levels objects private. git-svn-id: https://svn.dealii.org/trunk@30536 0785d39b-7218-0410-832d-ea1e28bc413d --- 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 ef26c645c6..3b17b0fa52 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -2979,12 +2979,9 @@ namespace internal { Assert (static_cast(accessor.level()) < accessor.dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(accessor.present_index) < - accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size (), - ExcIndexRange (accessor.present_index, 0, - accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size ())); + return accessor.dof_handler->levels[accessor.level()] - ->active_fe_indices[accessor.present_index]; + ->active_fe_index(accessor.present_index); } @@ -3022,12 +3019,9 @@ namespace internal Assert (static_cast(accessor.level()) < accessor.dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - Assert (static_cast::size_type>(accessor.present_index) < - accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size (), - ExcIndexRange (accessor.present_index, 0, - accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size ())); + accessor.dof_handler->levels[accessor.level()] - ->active_fe_indices[accessor.present_index] = i; + ->set_active_fe_index (accessor.present_index, i); } diff --git a/deal.II/include/deal.II/hp/dof_levels.h b/deal.II/include/deal.II/hp/dof_levels.h index 3f6cf53f17..29d328a8bc 100644 --- a/deal.II/include/deal.II/hp/dof_levels.h +++ b/deal.II/include/deal.II/hp/dof_levels.h @@ -25,6 +25,24 @@ DEAL_II_NAMESPACE_OPEN +namespace hp +{ + template class DoFHandler; +} + + +namespace internal +{ + namespace hp + { + namespace DoFHandler + { + struct Implementation; + } + } +} + + namespace internal { namespace hp @@ -41,7 +59,7 @@ namespace internal template class DoFLevel { - public: + private: /** * Indices specifying the finite * element of hp::FECollection to use @@ -76,6 +94,8 @@ namespace internal */ std::vector dofs; + public: + /** * Set the global index of * the @p local_index-th @@ -136,7 +156,7 @@ namespace internal /** * Return the fe_index of the - * n-th active finite element + * active finite element * on this object. */ unsigned int @@ -152,12 +172,28 @@ namespace internal fe_index_is_active (const unsigned int obj_index, const unsigned int fe_index) const; + /** + * Set the fe_index of the + * active finite element + * on this object. + */ + void + set_active_fe_index (const unsigned int obj_index, + const unsigned int fe_index); + /** * Determine an estimate for the * memory consumption (in bytes) * of this object. */ std::size_t memory_consumption () const; + + /** + * Make hp::DoFHandler and its auxiliary class a friend since it + * is the class that needs to create these data structures. + */ + template friend class dealii::hp::DoFHandler; + friend class dealii::internal::hp::DoFHandler::Implementation; }; @@ -263,6 +299,28 @@ namespace internal return (fe_index == active_fe_indices[obj_index]); } + + template + inline + void + DoFLevel:: + set_active_fe_index (const unsigned int obj_index, + const unsigned int fe_index) + { + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + + active_fe_indices[obj_index] = fe_index; + } + } // namespace hp } // namespace internal diff --git a/deal.II/source/hp/dof_handler.cc b/deal.II/source/hp/dof_handler.cc index 5881e47859..2096c95a4f 100644 --- a/deal.II/source/hp/dof_handler.cc +++ b/deal.II/source/hp/dof_handler.cc @@ -542,7 +542,8 @@ namespace internal std::vector > active_fe_backup(dof_handler.levels.size ()); for (unsigned int level = 0; levelactive_fe_indices, active_fe_backup[level]); + std::swap (dof_handler.levels[level]->active_fe_indices, + active_fe_backup[level]); // delete all levels and set them up // newly, since vectors are