/usr/include/dune/grid/albertagrid/hierarchiciterator.hh is in libdune-grid-dev 2.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ALBERTA_HIERARCHICITERATOR_HH
#define DUNE_ALBERTA_HIERARCHICITERATOR_HH
#include <dune/grid/common/entityiterator.hh>
#include <dune/grid/albertagrid/entitypointer.hh>
#if HAVE_ALBERTA
namespace Dune
{
// AlbertaGridHierarchicIterator
// -----------------------------
/*!
Mesh entities of codimension 0 ("elements") allow to visit all entities of
codimension 0 obtained through nested, hierarchic refinement of the entity.
Iteration over this set of entities is provided by the HIerarchicIterator,
starting from a given entity.
This is redundant but important for memory efficient implementations of unstru
hierarchically refined meshes.
*/
template< class GridImp >
class AlbertaGridHierarchicIterator
: public AlbertaGridEntityPointer< 0, GridImp >
{
typedef AlbertaGridHierarchicIterator< GridImp > This;
typedef AlbertaGridEntityPointer< 0, GridImp > Base;
public:
typedef typename GridImp::template Codim<0>::Entity Entity;
typedef typename GridImp::ctype ctype;
typedef MakeableInterfaceObject< Entity > EntityObject;
typedef typename EntityObject::ImplementationType EntityImp;
typedef typename Base::ElementInfo ElementInfo;
AlbertaGridHierarchicIterator ()
{}
//! the normal Constructor
AlbertaGridHierarchicIterator ( const GridImp &grid,
const ElementInfo &elementInfo,
int maxLevel );
//! the default Constructor
AlbertaGridHierarchicIterator ( const GridImp &grid, int actLevel, int maxLevel );
//! copy onstructor
AlbertaGridHierarchicIterator ( const This &other );
//! assignment operator
This &operator= ( const This &other );
//! increment
void increment();
using Base::level;
protected:
using Base::entityImp;
private:
void increment ( ElementInfo elementInfo );
// level on which the iterator was started
int startLevel_;
// maximal level to go down to
int maxlevel_;
};
template< class GridImp >
inline AlbertaGridHierarchicIterator< GridImp >
::AlbertaGridHierarchicIterator( const GridImp &grid, int actLevel, int maxLevel )
: Base( grid ),
startLevel_( actLevel ),
maxlevel_( maxLevel )
{}
template< class GridImp >
inline AlbertaGridHierarchicIterator< GridImp >
::AlbertaGridHierarchicIterator ( const GridImp &grid,
const ElementInfo &elementInfo,
int maxLevel )
: Base( grid ),
startLevel_( elementInfo.level() ),
maxlevel_( maxLevel )
{
increment( elementInfo );
}
template< class GridImp >
inline AlbertaGridHierarchicIterator< GridImp >
::AlbertaGridHierarchicIterator( const This &other )
: Base( other ),
startLevel_( other.startLevel_ ),
maxlevel_( other.maxlevel_ )
{}
template< class GridImp >
inline typename AlbertaGridHierarchicIterator< GridImp >::This &
AlbertaGridHierarchicIterator< GridImp >::operator= ( const This &other )
{
Base::operator=( other );
startLevel_ = other.startLevel_;
maxlevel_ = other.maxlevel_;
return *this;
}
template< class GridImp >
inline void AlbertaGridHierarchicIterator< GridImp >::increment ()
{
increment( entityImp().elementInfo() );
}
template< class GridImp >
inline void AlbertaGridHierarchicIterator< GridImp >
::increment ( ElementInfo elementInfo )
{
assert( !elementInfo == false );
if( (elementInfo.level() >= maxlevel_) || elementInfo.isLeaf() )
{
while( (elementInfo.level() > startLevel_) && (elementInfo.indexInFather() == 1) )
elementInfo = elementInfo.father();
if( elementInfo.level() > startLevel_ )
entityImp().setElement( elementInfo.father().child( 1 ), 0 );
else
entityImp().clearElement();
}
else
entityImp().setElement( elementInfo.child( 0 ), 0 );
}
}
#endif // #if HAVE_ALBERTA
#endif // #ifndef DUNE_ALBERTA_HIERARCHICITERATOR_HH
|