Skip to content
Snippets Groups Projects
Commit fde4cb07 authored by Carsten Gräser's avatar Carsten Gräser Committed by Ansgar Burchardt
Browse files

Merge branch 'feature/fix-uggrid-subindex' into 'master'

Fix subIndex method for UGGrid

When using Hygrid::ifElse always keep in mind that some types in
the functions given as "if" and "else" branch are fixed, such that
compilation may fail altough the template is not instanciated.

To avoid this, those functions have one templated parameter which
is instanciated with the identity for the selected branch. Passing
objects through this branch will delay resolution of their type
until instantiation which does only happen for the selected branch.

By passing the entity through `id` we use this to make subIndex
compile for clang. It seems that gcc is less picky here.

See merge request !101
parent 6c73a496
No related branches found
No related tags found
2 merge requests!113Do not force grids to subclass Entity or Geometry,!106Merge branch 'feature/fix-uggrid-subindex' into 'master'
Pipeline #
......@@ -83,15 +83,15 @@ namespace Dune {
{
auto a=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,0,dim);
auto b=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,1,dim);
result = UG_NS<dim>::levelIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_->getRealImplementation(e).getTarget(),
result = UG_NS<dim>::levelIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(a,e.type())),
UG_NS<dim>::Corner(grid_->getRealImplementation(e).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(b,e.type()))));
UG_NS<dim>::Corner(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(b,id(e).type()))));
}
// Vertex indices
if (codim==dim)
result = UG_NS<dim>::levelIndex(UG_NS<dim>::Corner(grid_->getRealImplementation(e).getTarget(),
result = UG_NS<dim>::levelIndex(UG_NS<dim>::Corner(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(i,e.type())));
});
......@@ -110,11 +110,11 @@ namespace Dune {
{
// Element indices
if (codim==0)
result = UG_NS<dim>::levelIndex(grid_->getRealImplementation(e).getTarget());
result = UG_NS<dim>::levelIndex(grid_->getRealImplementation(id(e)).getTarget());
// Face indices
if (codim==1)
result = UG_NS<dim>::levelIndex(UG_NS<dim>::SideVector(grid_->getRealImplementation(e).getTarget(),
result = UG_NS<dim>::levelIndex(UG_NS<dim>::SideVector(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::facesDUNEtoUG(i,e.type())));
// Edge indices
......@@ -122,15 +122,15 @@ namespace Dune {
{
auto a=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,0,dim);
auto b=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,1,dim);
result = UG_NS<dim>::levelIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_->getRealImplementation(e).getTarget(),
result = UG_NS<dim>::levelIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(a,e.type())),
UG_NS<dim>::Corner(grid_->getRealImplementation(e).getTarget(),
UG_NS<dim>::Corner(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(b,e.type()))));
}
// Vertex indices
if (codim==3)
result = UG_NS<dim>::levelIndex(UG_NS<dim>::Corner(grid_->getRealImplementation(e).getTarget(),
result = UG_NS<dim>::levelIndex(UG_NS<dim>::Corner(grid_->getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(i,e.type())));
});
......@@ -294,22 +294,22 @@ namespace Dune {
{
// Element indices
if (codim==0)
result = UG_NS<dim>::leafIndex(grid_.getRealImplementation(e).getTarget());
result = UG_NS<dim>::leafIndex(grid_.getRealImplementation(id(e)).getTarget());
// Edge indices
if (codim==1)
{
auto a=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,0,dim);
auto b=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,1,dim);
result = UG_NS<dim>::leafIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_.getRealImplementation(e).getTarget(),
result = UG_NS<dim>::leafIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(a,e.type())),
UG_NS<dim>::Corner(grid_.getRealImplementation(e).getTarget(),
UG_NS<dim>::Corner(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(b,e.type()))));
}
// Vertex indices
if (codim==dim)
result = UG_NS<dim>::leafIndex(UG_NS<dim>::Corner(grid_.getRealImplementation(e).getTarget(),
result = UG_NS<dim>::leafIndex(UG_NS<dim>::Corner(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(i,e.type())));
});
......@@ -328,11 +328,11 @@ namespace Dune {
{
// Element indices
if (codim==0)
result = UG_NS<dim>::leafIndex(grid_.getRealImplementation(e).getTarget());
result = UG_NS<dim>::leafIndex(grid_.getRealImplementation(id(e)).getTarget());
// Face indices
if (codim==1)
result = UG_NS<dim>::leafIndex(UG_NS<dim>::SideVector(grid_.getRealImplementation(e).getTarget(),
result = UG_NS<dim>::leafIndex(UG_NS<dim>::SideVector(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::facesDUNEtoUG(i,e.type())));
// Edge indices
......@@ -340,15 +340,15 @@ namespace Dune {
{
auto a=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,0,dim);
auto b=ReferenceElements<double,dim>::general(e.type()).subEntity(i,dim-1,1,dim);
result = UG_NS<dim>::leafIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_.getRealImplementation(e).getTarget(),
result = UG_NS<dim>::leafIndex(UG_NS<dim>::GetEdge(UG_NS<dim>::Corner(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(a,e.type())),
UG_NS<dim>::Corner(grid_.getRealImplementation(e).getTarget(),
UG_NS<dim>::Corner(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(b,e.type()))));
}
// Vertex indices
if (codim==3)
result = UG_NS<dim>::leafIndex(UG_NS<dim>::Corner(grid_.getRealImplementation(e).getTarget(),
result = UG_NS<dim>::leafIndex(UG_NS<dim>::Corner(grid_.getRealImplementation(id(e)).getTarget(),
UGGridRenumberer<dim>::verticesDUNEtoUG(i,e.type())));
});
......@@ -359,7 +359,7 @@ namespace Dune {
});
// The entity is an edge
Hybrid::ifElse(Std::bool_constant<cc==1>(), [&](auto id)
Hybrid::ifElse(Std::bool_constant<cc==2>(), [&](auto id)
{
DUNE_THROW(NotImplemented, "Subindices of an element edge");
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment