/usr/include/dune/grid/albertagrid/entity.cc is in libdune-grid-dev 2.2.1-2.
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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | #ifndef DUNE_ALBERTA_ENTITY_CC
#define DUNE_ALBERTA_ENTITY_CC
namespace Dune
{
// AlbertaGridEntity (for codim > 0)
// ---------------------------------
template<int codim, int dim, class GridImp>
inline AlbertaGridEntity< codim, dim, GridImp >
::AlbertaGridEntity ( const GridImp &grid, const ElementInfo &elementInfo, int subEntity )
: grid_( &grid ),
elementInfo_( elementInfo ),
subEntity_( subEntity )
{}
template<int codim, int dim, class GridImp>
inline AlbertaGridEntity< codim, dim, GridImp >
::AlbertaGridEntity ( const GridImp &grid )
: grid_( &grid ),
elementInfo_(),
subEntity_( -1 )
{}
template<int codim, int dim, class GridImp>
inline PartitionType AlbertaGridEntity <codim,dim,GridImp>::
partitionType () const
{
return InteriorEntity;
}
template< int codim, int dim, class GridImp >
inline bool
AlbertaGridEntity< codim, dim, GridImp >::equals ( const This &other ) const
{
const Alberta::Element *e1 = elementInfo().el();
const Alberta::Element *e2 = other.elementInfo().el();
// if both element null then they are equal
if( (e1 == NULL) && (e2 == NULL) )
return true;
return ((e1 == e2) && (subEntity_ == other.subEntity_));
}
template<int codim, int dim, class GridImp>
inline ALBERTA EL_INFO *
AlbertaGridEntity< codim, dim, GridImp >::getElInfo () const
{
return &(elementInfo_.elInfo());
}
template< int codim, int dim, class GridImp >
inline void
AlbertaGridEntity< codim, dim, GridImp >::clearElement ()
{
elementInfo_ = ElementInfo();
}
template< int codim, int dim, class GridImp >
inline void AlbertaGridEntity< codim, dim, GridImp >
::setElement ( const ElementInfo &elementInfo, int subEntity )
{
elementInfo_ = elementInfo;
subEntity_ = subEntity;
}
template< int codim, int dim, class GridImp >
inline void
AlbertaGridEntity< codim, dim, GridImp >::setEntity ( const This &other )
{
setElement( other.elementInfo_, other.subEntity_ );
}
template<int codim, int dim, class GridImp>
inline int AlbertaGridEntity<codim,dim,GridImp>::level() const
{
assert( elementInfo_.level() == grid().levelProvider()( elementInfo_ ) );
return elementInfo_.level();
}
template< int codim, int dim, class GridImp >
inline typename AlbertaGridEntity< codim, dim, GridImp >::Geometry
AlbertaGridEntity< codim, dim, GridImp >::geometry () const
{
typedef AlbertaGridCoordinateReader< codim, GridImp > CoordReader;
assert( elementInfo_ );
const CoordReader coordReader( grid(), elementInfo_, subEntity_ );
return Geometry( GeometryImpl( coordReader ) );
}
template< int codim, int dim, class GridImp >
inline GeometryType AlbertaGridEntity< codim, dim, GridImp >::type () const
{
typedef typename GenericGeometry::SimplexTopology< mydimension >::type Topology;
return GeometryType( Topology() );
}
// AlbertaGridEntity (for codim = 0)
// ---------------------------------
template< int dim, class GridImp >
inline AlbertaGridEntity< 0, dim, GridImp >
::AlbertaGridEntity ( const GridImp &grid, const ElementInfo &elementInfo, int subEntity )
: grid_( &grid ),
elementInfo_( elementInfo )
{
assert( subEntity == 0 );
}
template< int dim, class GridImp >
inline AlbertaGridEntity< 0, dim, GridImp >
::AlbertaGridEntity( const GridImp &grid )
: grid_( &grid ),
elementInfo_()
{}
template< int dim, class GridImp >
inline int AlbertaGridEntity< 0, dim, GridImp >::boundaryId() const
{
// elements are always inside of our Domain
return 0;
}
template< int dim, class GridImp >
inline bool AlbertaGridEntity< 0, dim,GridImp >::isNew () const
{
return grid().levelProvider().isNew( elementInfo_ );
}
template< int dim, class GridImp >
inline bool AlbertaGridEntity< 0, dim, GridImp>::mightVanish () const
{
return elementInfo_.mightVanish();
}
template< int dim, class GridImp >
inline bool
AlbertaGridEntity< 0, dim, GridImp >::hasBoundaryIntersections () const
{
assert( elementInfo_ );
bool isBoundary = false;
for( int i = 0; i < dim+1; ++i )
isBoundary |= elementInfo_.isBoundary( i );
return isBoundary;
}
template< int dim, class GridImp >
inline PartitionType
AlbertaGridEntity< 0, dim, GridImp >::partitionType () const
{
return InteriorEntity;
}
template< int dim, class GridImp >
inline bool AlbertaGridEntity< 0, dim,GridImp >::isLeaf () const
{
return elementInfo_.isLeaf();
}
template< int dim, class GridImp >
inline bool
AlbertaGridEntity< 0, dim, GridImp >::equals ( const This &other ) const
{
// element pointers are unique
return (elementInfo().el() == other.elementInfo().el());
}
template< int dim, class GridImp >
template< int codim >
inline typename AlbertaGridEntity< 0, dim, GridImp >::template Codim< codim >::EntityPointer
AlbertaGridEntity< 0, dim, GridImp >::subEntity ( int i ) const
{
typedef AlbertaGridEntityPointer< codim, GridImp > EntityPointerImpl;
return EntityPointerImpl( grid(), elementInfo_, grid().generic2alberta( codim, i ) );
}
template< int dim, class GridImp >
inline ALBERTA EL_INFO *
AlbertaGridEntity< 0, dim, GridImp >::getElInfo () const
{
return &(elementInfo_.elInfo());
}
template< int dim, class GridImp >
inline int AlbertaGridEntity< 0, dim, GridImp >::level () const
{
assert( elementInfo_.level() == grid().levelProvider()( elementInfo_ ) );
return elementInfo_.level();
}
template< int dim, class GridImp >
inline void
AlbertaGridEntity< 0, dim, GridImp >::clearElement ()
{
elementInfo_ = ElementInfo();
}
template< int dim, class GridImp >
inline void AlbertaGridEntity< 0, dim, GridImp >
::setElement ( const ElementInfo &elementInfo, int subEntity )
{
elementInfo_ = elementInfo;
}
template< int dim, class GridImp >
inline void
AlbertaGridEntity< 0, dim, GridImp >::setEntity( const This &other )
{
setElement( other.elementInfo_, 0 );
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::Geometry
AlbertaGridEntity< 0, dim, GridImp >::geometry () const
{
typedef AlbertaGridCoordinateReader< 0, GridImp > CoordReader;
assert( elementInfo_ );
const CoordReader coordReader( grid(), elementInfo_, 0 );
return Geometry( GeometryImpl( coordReader ) );
}
template< int dim, class GridImp >
inline GeometryType AlbertaGridEntity< 0, dim, GridImp>::type () const
{
typedef typename GenericGeometry::SimplexTopology< mydimension >::type Topology;
return GeometryType( Topology() );
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::EntityPointer
AlbertaGridEntity< 0, dim, GridImp >::father () const
{
typedef AlbertaGridEntityPointer< 0, GridImp > EntityPointerImpl;
assert( elementInfo_ );
const ElementInfo fatherInfo = elementInfo_.father();
return EntityPointerImpl( grid(), fatherInfo, 0 );
}
template< int dim, class GridImp >
inline int AlbertaGridEntity< 0, dim, GridImp >::nChild () const
{
return elementInfo_.indexInFather();
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::LocalGeometry
AlbertaGridEntity< 0, dim, GridImp >::geometryInFather() const
{
typedef AlbertaGridLocalGeometryProvider< GridImp > LocalGeoProvider;
const int indexInFather = elementInfo_.indexInFather();
const int orientation = (elementInfo_.type() == 1 ? -1 : 1);
return LocalGeometry( LocalGeoProvider::instance().geometryInFather( indexInFather, orientation ) );
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::HierarchicIterator
AlbertaGridEntity< 0, dim, GridImp >::hbegin( int maxlevel ) const
{
assert( elementInfo_ );
typedef AlbertaGridHierarchicIterator< GridImp > IteratorImp;
return IteratorImp( grid(), elementInfo_, maxlevel );
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::HierarchicIterator
AlbertaGridEntity< 0, dim, GridImp>::hend( int maxlevel ) const
{
assert( elementInfo_ );
typedef AlbertaGridHierarchicIterator< GridImp > IteratorImp;
return IteratorImp( grid(), level(), maxlevel );
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::AlbertaGridLeafIntersectionIterator
AlbertaGridEntity< 0, dim, GridImp >::ileafbegin() const
{
assert( elementInfo_ );
#ifndef NDEBUG
for( int i = 0; i <= dimension; ++i )
{
// std::cout << "Opposite vertex " << i << ": "
// << (int)(getElInfo()->opp_vertex[ i ]) << std::endl;
if( getElInfo()->opp_vertex[ i ] == 127 )
{
assert( false );
DUNE_THROW( NotImplemented, "AlbertaGrid: Intersections on outside "
"entities are not fully implemented, yet." );
}
}
#endif // #ifndef NDEBUG
typename AlbertaGridLeafIntersectionIterator::Begin begin;
return AlbertaGridLeafIntersectionIterator( *this, begin );
}
template< int dim, class GridImp >
inline typename AlbertaGridEntity< 0, dim, GridImp >::AlbertaGridLeafIntersectionIterator
AlbertaGridEntity< 0, dim, GridImp >::ileafend() const
{
assert( elementInfo_ );
typename AlbertaGridLeafIntersectionIterator::End end;
return AlbertaGridLeafIntersectionIterator( *this, end );
}
} // namespace Dune
#endif // #ifndef DUNE_ALBERTA_ENTITY_CC
|