Skip to content
Snippets Groups Projects
Commit fff8fbc6 authored by Martin Nolte's avatar Martin Nolte
Browse files

[bugfix] make subIndex method for OneDGrid compile for all codimension

The index sets of OneDGrid support the subIndex method for entities of
all codimensions. However, while the code was semantically correct for
the case "cc != 0", the compiler would try to compile the "cc == 0"
branch, too. This caused a compile-time error.

This patch fixes the issue by calling a separate method for each
codimension.
parent b076b05d
No related branches found
No related tags found
1 merge request!86[bugfix] make subIndex method for OneDGrid compile for all codimension
Pipeline #
......@@ -40,10 +40,7 @@ namespace Dune {
int i,
unsigned int codim) const
{
if( cc == 0 )
return grid_->getRealImplementation(e).subLevelIndex(i,codim);
else
return grid_->getRealImplementation(e).levelIndex();
return subIndexImpl(e,i,codim);
}
//! get number of entities of given type and on this level
......@@ -140,6 +137,16 @@ namespace Dune {
}
private:
unsigned int subIndexImpl (const typename GridImp::Traits::template Codim<0>::Entity &e, int i, unsigned int codim) const
{
return grid_->getRealImplementation(e).subLevelIndex(i,codim);
}
unsigned int subIndexImpl (const typename GridImp::Traits::template Codim<1>::Entity &e, int i, unsigned int codim) const
{
return grid_->getRealImplementation(e).levelIndex();
}
const GridImp* grid_;
int level_;
......@@ -176,10 +183,7 @@ namespace Dune {
int i,
unsigned int codim) const
{
if( cc == 0 )
return grid_.getRealImplementation(e).subLeafIndex(i,codim);
else
return grid_.getRealImplementation(e).leafIndex();
return subIndexImpl(e,i,codim);
}
//! get number of entities of given codim, type on the leaf level
......@@ -308,6 +312,15 @@ namespace Dune {
}
private:
unsigned int subIndexImpl (const typename GridImp::Traits::template Codim<0>::Entity &e, int i, unsigned int codim) const
{
return grid_.getRealImplementation(e).subLeafIndex(i,codim);
}
unsigned int subIndexImpl (const typename GridImp::Traits::template Codim<1>::Entity &e, int i, unsigned int codim) const
{
return grid_.getRealImplementation(e).leafIndex();
}
const GridImp& grid_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment