From d5878b754883f0ce7699b15391eded7d430ba39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?= <robertk@dune-project.org> Date: Wed, 5 Oct 2005 14:16:31 +0000 Subject: [PATCH] return 0 for other geom tpyes. [[Imported from SVN: r3022]] --- grid/albertagrid.hh | 2 ++ grid/common/leafindexset.hh | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/grid/albertagrid.hh b/grid/albertagrid.hh index d40fa0166..090edcc8d 100644 --- a/grid/albertagrid.hh +++ b/grid/albertagrid.hh @@ -1474,12 +1474,14 @@ namespace Dune //! number of entities per level, codim and geometry type in this process int size (int level, int codim, GeometryType type) const { + if( type != simplex) return 0; return this->levelIndexSet(level).size(codim,type); } //! number of leaf entities per codim and geometry type in this process int size (int codim, GeometryType type) const { + if( type != simplex) return 0; return this->leafIndexSet().size(codim,type); } diff --git a/grid/common/leafindexset.hh b/grid/common/leafindexset.hh index f6432e7f3..57238cb3d 100644 --- a/grid/common/leafindexset.hh +++ b/grid/common/leafindexset.hh @@ -488,12 +488,16 @@ namespace Dune { markAllUsed (); } + /** @brief Iterator to first entity of given codimension and partition type. + */ template<int cd, PartitionIteratorType pitype> typename LeafIteratorTypes<GridType>::template Codim<cd>::template Partition<pitype>::Iterator end () const { return this->grid_.template leafend<cd,pitype> (); } + /** @brief Iterator to one past the last entity of given codim for partition type + */ template<int cd, PartitionIteratorType pitype> typename LeafIteratorTypes<GridType>::template Codim<cd>::template Partition<pitype>::Iterator begin () const { @@ -644,8 +648,9 @@ namespace Dune { //! return size of grid entities per level and codim int size ( int codim , GeometryType type = unknown ) const { - if(codim == 0) return codimLeafSet_[codim].size(); - return hIndexSet_.size(codim); + //if(codim == 0) return codimLeafSet_[codim].size(); + //return hIndexSet_.size(codim); + return codimLeafSet_[codim].size(); } //! return global index @@ -663,9 +668,8 @@ namespace Dune { int index (const EntityType & en) const { enum { codim = EntityType::codimension }; - //assert(codimLeafSet_[codim].index( hIndexSet_.index(en) ) >= 0 ); - if (codim == 0) return codimLeafSet_[codim].index( hIndexSet_.index(en) ); - return hIndexSet_.index(en); + assert(codimLeafSet_[codim].index( hIndexSet_.index(en) ) >= 0 ); + return codimLeafSet_[codim].index( hIndexSet_.index(en) ); } //! return size of grid entities per level and codim -- GitLab