[Dune] Intersection iterator problem

Aleksejs Fomins Aleksejs.Fomins at psi.ch
Tue Aug 4 15:48:02 CEST 2009


Dear Christian,

Sorry, I shall try to be more specific.

The grid contains 2 tetrahedrons with coordinates (0,0,0) (0,0,1) 
(0,1,0) (1,0,0) and (0,0,0) (0,0,1) (0,1,0) (-1,0,0)
The intersection iterator does indeed iterate through intersections 
(which are faces), so I obtain the face local numbers using 
indexInInside() method.

The results obtained are

Tetrahedron 1
Local 3 Global 3 Is neighbor 0
Local 2 Global 2 Is neighbor 0
Local 1 Global 1 Is neighbor 0
Local 0 Global 0 Is neighbor 1

Tetrahedron 2
Local 3 Global 6 Is neighbor 0
Local 2 Global 3 Is neighbor 0
Local 1 Global 5 Is neighbor 1
Local 0 Global 4 Is neighbor 0

This is not what was expected as common sense tells me that the 
neighboring faces are the ones with global number 3.

Here is a piece of the code

    /** Define the mappers */
    
Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType,Hades3d::P0Layout>
        elementMapper(*alusimplexgrid);
    
Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType,Hades3d::P1Layout>
        faceMapper(*alusimplexgrid);
    
Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType,Hades3d::P2Layout>
        edgeMapper(*alusimplexgrid);
    
Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType,Hades3d::P3Layout>
        nodeMapper(*alusimplexgrid);

GridType::Codim<0>::LeafIterator endIterator = alusimplexgrid->leafend<0>();
for (GridType::Codim<0>::LeafIterator elementIter = 
alusimplexgrid->leafbegin<0>();
        elementIter!=endIterator; ++elementIter)
    {
        std::cout << "Tetrahedron" << std::endl;

        GridType::Codim<codimofelement>::LeafIntersectionIterator 
faceIntersIter = elementIter->ileafbegin();
        while (faceIntersIter != elementIter->ileafend())
        {
            std::cout << "Local " << faceIntersIter->indexInInside() << 
std::endl;
            std::cout << "Global " <<  
faceMapper.map<codimofface>(*elementIter,faceIntersIter->indexInInside()) 
<< std::endl;
            std::cout << "Is neighbor " << faceIntersIter->neighbor() << 
std::endl;
            ++faceIntersIter;
        }
    }

Thanks again
Aleksejs




More information about the Dune mailing list