From 1e05cb9df3d2454e7f3c2894724d49839b9c5db7 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@dune-project.org> Date: Thu, 22 Sep 2005 12:09:59 +0000 Subject: [PATCH] minor cleanup [[Imported from SVN: r2934]] --- grid/onedgrid/onedgrid.cc | 41 +++++++++++++++------------------------ 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/grid/onedgrid/onedgrid.cc b/grid/onedgrid/onedgrid.cc index 32b8e75b2..56b164ede 100644 --- a/grid/onedgrid/onedgrid.cc +++ b/grid/onedgrid/onedgrid.cc @@ -10,6 +10,7 @@ // specialization of member templates // // /////////////////////////////////////////////////////////////// + namespace Dune { template <int codim> @@ -18,41 +19,31 @@ namespace Dune { template <> struct OneDGridLevelIteratorFactory<1> { - template <PartitionIteratorType PiType> + template <Dune::PartitionIteratorType PiType> static Dune::OneDGridLevelIterator<1,PiType, const Dune::OneDGrid<1,1> > - lbegin(const Dune::OneDGrid<1,1> * g, int level); + lbegin(const Dune::OneDGrid<1,1> * g, int level) { + if (level<0 || level>g->maxlevel()) + DUNE_THROW(Dune::GridError, "LevelIterator in nonexisting level " << level << " requested!"); + + return Dune::OneDGridLevelIterator<1,Dune::All_Partition, const Dune::OneDGrid<1,1> >(g->vertices[level].begin); + } + }; template <> struct OneDGridLevelIteratorFactory<0> { - template <PartitionIteratorType PiType> + template <Dune::PartitionIteratorType PiType> static Dune::OneDGridLevelIterator<0,PiType, const Dune::OneDGrid<1,1> > - lbegin(const Dune::OneDGrid<1,1> * g, int level); - }; + lbegin(const Dune::OneDGrid<1,1> * g, int level) { + if (level<0 || level>g->maxlevel()) + DUNE_THROW(Dune::GridError, "LevelIterator in nonexisting level " << level << " requested!"); -} - -template <Dune::PartitionIteratorType PiType> -inline Dune::OneDGridLevelIterator<1,PiType, const Dune::OneDGrid<1,1> > -Dune::OneDGridLevelIteratorFactory<1>::lbegin (const OneDGrid<1,1> * g, int level) -{ - if (level<0 || level>g->maxlevel()) - DUNE_THROW(GridError, "LevelIterator in nonexisting level " << level << " requested!"); - - OneDGridLevelIterator<1,All_Partition, const Dune::OneDGrid<1,1> > it(g->vertices[level].begin); - return it; -} + return Dune::OneDGridLevelIterator<0,PiType, const Dune::OneDGrid<1,1> >(g->elements[level].begin); + } -template <Dune::PartitionIteratorType PiType> -inline Dune::OneDGridLevelIterator<0,PiType, const Dune::OneDGrid<1,1> > -Dune::OneDGridLevelIteratorFactory<0>::lbegin (const OneDGrid<1,1> * g, int level) -{ - if (level<0 || level>g->maxlevel()) - DUNE_THROW(GridError, "LevelIterator in nonexisting level " << level << " requested!"); + }; - OneDGridLevelIterator<0,PiType, const Dune::OneDGrid<1,1> > it(g->elements[level].begin); - return it; } -- GitLab