This file is indexed.

/usr/include/dune/grid/alugrid/3d/geometry.hh 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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
#ifndef DUNE_ALU3DGRIDGEOMETRY_HH
#define DUNE_ALU3DGRIDGEOMETRY_HH

// System includes

// Dune includes
#include <dune/common/misc.hh>
#include <dune/grid/common/grid.hh>

// Local includes
#include "alu3dinclude.hh"
#include "topology.hh"
#include "mappings.hh"

namespace Dune
{

  // Forward declarations
  template<int cd, int dim, class GridImp> 
  class ALU3dGridEntity;
  template<int cd, class GridImp >
  class ALU3dGridEntityPointer;
  template<int mydim, int coorddim, class GridImp>
  class ALU3dGridGeometry;
  template< ALU3dGridElementType, class >
  class ALU3dGrid;
  class BilinearSurfaceMapping;
  class TrilinearMapping;

  template< class GridImp >
  class ALU3dGridIntersectionIterator;

  template <int cdim>
  class MyALUGridGeometryImplementation 
  {
  public:  
    typedef FieldVector<alu3d_ctype, cdim> CoordinateVectorType;

    static const signed char invalid      = -1; // means geometry is not meaningfull 
    static const signed char updated      =  0; // means the point values have been set
    static const signed char buildmapping =  1; // means updated and mapping was build 

    struct CoordVecCopy
    {

      // copy coordinate vector from field vector or alu3d_ctype[cdim] 
      template <class CoordPtrType>
      static inline void copy(const CoordPtrType& p,
                              CoordinateVectorType& c)
      { 
        assert( cdim == 3 );
        c[0] = p[0];
        c[1] = p[1];
        c[2] = p[2];
      }

      template <class CoordPtrType>
      void update(const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType& ) const 
      {
        DUNE_THROW(InvalidStateException,"This method should not be called!");
      } 

      template <class CoordPtrType>
      void update(const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType& ) const 
      {
        DUNE_THROW(InvalidStateException,"This method should not be called!");
      } 

      template <class CoordPtrType>
      void update(const CoordPtrType&, 
                  const CoordPtrType&, 
                  const CoordPtrType& ) const 
      {
        DUNE_THROW(InvalidStateException,"This method should not be called!");
      } 
    };

    //! general type of geometry implementation 
    template <int dummy, int dim, 
              ALU3dGridElementType eltype> class GeometryImpl;
  public:  
    // geometry implementation for edges and vertices 
    template <int dummy, int dim, ALU3dGridElementType eltype> 
    class GeometryImpl : public CoordVecCopy
    {
      using CoordVecCopy :: copy ;

      enum { corners_ = dim+1 };
      //! the vertex coordinates 
      typedef FieldMatrix<alu3d_ctype, corners_ , cdim>  CoordinateMatrixType;

      typedef LinearMapping<cdim, dim> MappingType;

      CoordinateMatrixType coord_;
      MappingType liMap_;
      signed char status_;

    public:
      using CoordVecCopy :: update ;

      GeometryImpl() : coord_() , liMap_() , status_( invalid ) {}
      GeometryImpl(const GeometryImpl& other) 
        : coord_(other.coord_), 
          liMap_(other.liMap_), 
          status_(other.status_)
      {}

      // return coordinate vector 
      inline const CoordinateVectorType& operator [] (const int i) const
      {
        assert( valid() );
        assert( i>=0 && i<corners_ );
        return coord_[i];
      }

      inline MappingType& mapping() 
      { 
        assert( valid() );
        if( status_ == buildmapping ) return liMap_;

        liMap_.buildMapping( coord_[0] );
        status_ = buildmapping ;
        return liMap_;
      }

      // update vertex 
      template <class CoordPtrType>
      inline void update(const CoordPtrType& p0)
      {
        assert( corners_ == 1 );
        copy( p0, coord_[0] );
        // we need to update the mapping 
        status_ = updated ;
      }

      // set status to invalid 
      void invalidate () { status_ = invalid ; }

      // return true if geometry is valid 
      bool valid () const { return status_ != invalid ; }
    };

    // geometry implementation for edges and vertices 
    template <int dummy, ALU3dGridElementType eltype> 
    class GeometryImpl<dummy,1,eltype> : public CoordVecCopy
    {
      using CoordVecCopy :: copy ;

      enum { dim = 1 };
      enum { corners_ = dim+1 };
      //! the vertex coordinates 
      typedef FieldMatrix<alu3d_ctype, corners_ , cdim>  CoordinateMatrixType;

      typedef LinearMapping<cdim, dim> MappingType;

      // for edges use LinearMapping<cdim, 1> here that has all features
      // implemented 

      CoordinateMatrixType coord_;
      MappingType liMap_;
      signed char status_;

    public:
      using CoordVecCopy :: update ;

      GeometryImpl() : coord_() , liMap_() , status_( invalid ) {}
      GeometryImpl(const GeometryImpl& other) 
        : coord_(other.coord_), 
          liMap_(other.liMap_), 
          status_(other.status_)
      {}

      // return coordinate vector 
      inline const CoordinateVectorType& operator [] (const int i) const
      {
        assert( valid() );
        assert( i>=0 && i<corners_ );
        return coord_[i];
      }

      inline MappingType& mapping() 
      { 
        assert( valid() );
        if( status_ == buildmapping ) return liMap_;

        liMap_.buildMapping( coord_[0], coord_[1] );
        status_ = buildmapping ;
        return liMap_;
      }

      // update edge  
      template <class CoordPtrType>
      inline void update(const CoordPtrType& p0,
                         const CoordPtrType& p1)
      {
        assert( corners_ == 2 );
        copy( p0, coord_[0] );
        copy( p1, coord_[1] );
        status_ = updated;
      }

      // set status to invalid 
      void invalidate () { status_ = invalid ; }

      // return true if geometry is valid 
      bool valid () const { return status_ != invalid ; }
    };

    // geom impl for simplex faces (triangles)
    template <int dummy>
    class GeometryImpl<dummy,2, tetra> : public CoordVecCopy
    {
      using CoordVecCopy :: copy ;

      enum { corners_ = 3 };

      //! the vertex coordinates 
      typedef FieldMatrix<alu3d_ctype, corners_ , cdim>  CoordinateMatrixType;
      typedef LinearMapping<cdim, 2>   MappingType;

      //! the coordinates (for dim = 3 only a pointer)
      CoordinateMatrixType coord_;

      MappingType liMap_;
      signed char status_;

    public:
      using CoordVecCopy :: update ;

      // constructor 
      GeometryImpl() : coord_(), liMap_(), status_( invalid ) {}
      // copy constructor 
      GeometryImpl(const GeometryImpl& other) :
        coord_(other.coord_),
        liMap_(other.liMap_),
        status_(other.status_)
      {}

      // return coordinate vector 
      inline const CoordinateVectorType& operator [] (const int i) const
      {
        assert( valid() );
        assert( i>=0 && i<corners_ );
        return coord_[i];
      }

      // update geometry coordinates 
      template <class CoordPtrType>
      inline void update(const CoordPtrType& p0,
                         const CoordPtrType& p1,
                         const CoordPtrType& p2)
      {
        copy(p0, coord_[0] );
        copy(p1, coord_[1] );
        copy(p2, coord_[2] );
        status_ = updated;
      }

      // return mapping (always up2date)
      inline MappingType& mapping()
      {
        assert( valid() );
        if( status_ == buildmapping ) return liMap_;

        liMap_.buildMapping( coord_[0], coord_[1], coord_[2] );
        status_ = buildmapping ;
        return liMap_;
      }

      // set status to invalid 
      void invalidate () { status_ = invalid ; }

      // return true if geometry is valid 
      bool valid () const { return status_ != invalid ; }
    };

    ///////////////////////////////////////////////////////////////
    //
    //  hexa specializations 
    //
    ///////////////////////////////////////////////////////////////

    // geom impl for cube faces (quadrilaterals)
    template <int dummy>
    class GeometryImpl<dummy,2, hexa> : public CoordVecCopy 
    {
      using CoordVecCopy :: copy ;

      enum { corners_ = 4 };

      //! the vertex coordinates 
      typedef FieldMatrix<alu3d_ctype, corners_ , cdim>  CoordinateMatrixType;
      typedef BilinearSurfaceMapping  MappingType;

      //! the coordinates (for dim = 3 only a pointer)
      CoordinateMatrixType coord_;

      MappingType biMap_;
      signed char status_;

    public:
      using CoordVecCopy :: update ;

      // constructor 
      GeometryImpl() : coord_(), biMap_(), status_( invalid ) {}
      // copy constructor 
      GeometryImpl(const GeometryImpl& other) :
        coord_(other.coord_),
        biMap_(other.biMap_),
        status_(other.status_)
      {}

      // return coordinate vector 
      inline const CoordinateVectorType& operator [] (const int i) const
      {
        assert( valid() );
        assert( i>=0 && i<corners_ );
        return coord_[i];
      }

      // update geometry coordinates 
      template <class CoordPtrType>
      inline void update(const CoordPtrType& p0,
                  const CoordPtrType& p1,
                  const CoordPtrType& p2,
                  const CoordPtrType& p3)
      {
        copy(p0, coord_[0] );
        copy(p1, coord_[1] );
        copy(p2, coord_[2] );
        copy(p3, coord_[3] );
        status_ = updated;
      }

      // return mapping (always up2date)
      inline MappingType& mapping()
      {
        assert( valid() );
        if( status_ == buildmapping ) return biMap_;

        biMap_.buildMapping( coord_[0], coord_[1], coord_[2], coord_[3] );
        status_ = buildmapping ;
        return biMap_;
      }

      // set status to invalid 
      void invalidate () { status_ = invalid ; }

      // return true if geometry is valid 
      bool valid () const { return status_ != invalid ; }
    };

    // geometry impl for hexahedrons 
    template <int dummy>
    class GeometryImpl<dummy,3, hexa> : public CoordVecCopy
    {
      enum { corners_ = 8 };

      //! the vertex coordinates 
      typedef alu3d_ctype CoordPtrType[cdim];

      //! the vertex coordinates 
      typedef FieldMatrix<alu3d_ctype, corners_ , cdim>  CoordinateMatrixType;

      typedef TrilinearMapping MappingType;

      // coordinate pointer vector  
      const alu3d_ctype* coordPtr_[ corners_ ];
      MappingType triMap_;
      CoordinateMatrixType* fatherCoord_;
      signed char status_;

    public:
      using CoordVecCopy :: update ;
      using CoordVecCopy :: copy ;

      //! constructor creating geo impl 
      GeometryImpl() : triMap_(),
                       fatherCoord_(0),
                       status_( invalid )
      {
        // set initialize coord pointers
        for( int i=0; i<corners_; ++i )
          coordPtr_[ i ] = 0;
      }

      
      //! conpy constructor 
      GeometryImpl(const GeometryImpl& other) :
        triMap_(other.triMap_),
        fatherCoord_(0),
        status_(other.status_)
      {
        // copy coord pointers 
        for( int i=0; i<corners_; ++i )
          coordPtr_[ i ] = other.coordPtr_[ i ];

        // if father coords are set, then reset coordPtr
        if( other.fatherCoord_ )
        {
          fatherCoord_ = new CoordinateMatrixType(*other.fatherCoord_);
          CoordinateMatrixType& coord = *fatherCoord_;
          for(int i=0; i<corners_; ++i) 
          {
            coordPtr_[i] = (&(coord[i][0]));
          }
        }
      }                
                       
      // desctructor 
      ~GeometryImpl()
      {
        if( fatherCoord_ ) delete fatherCoord_;
      } 

      const alu3d_ctype* point( const int i ) const 
      {
        assert( valid() );
        assert( i>=0 && i<corners_ );
        assert( coordPtr_[i] );
        return coordPtr_[ i ];
      }
        
      // return coordinates 
      inline CoordinateVectorType operator [] (const int i) const
      { 
        CoordinateVectorType coord ;
        copy( point( i ), coord );
        return coord ;
      }

      // update geometry coordinates 
      inline void update(const CoordPtrType& p0,
                         const CoordPtrType& p1,
                         const CoordPtrType& p2,
                         const CoordPtrType& p3,
                         const CoordPtrType& p4,
                         const CoordPtrType& p5,
                         const CoordPtrType& p6,
                         const CoordPtrType& p7)
      {
        coordPtr_[0] = &p0[ 0 ];
        coordPtr_[1] = &p1[ 0 ];
        coordPtr_[2] = &p2[ 0 ];
        coordPtr_[3] = &p3[ 0 ];
        coordPtr_[4] = &p4[ 0 ];
        coordPtr_[5] = &p5[ 0 ];
        coordPtr_[6] = &p6[ 0 ];
        coordPtr_[7] = &p7[ 0 ];
        status_ = updated;
      }

      // update geometry in father coordinates 
      template <class GeometryImp>
      inline void updateInFather(const GeometryImp &fatherGeom ,
                                 const GeometryImp &myGeom)
      {
        if( fatherCoord_ == 0 )
        {
          fatherCoord_ = new CoordinateMatrixType();
        }

        CoordinateMatrixType& coord = *fatherCoord_;
        // compute the local coordinates in father refelem
        for(int i=0; i < myGeom.corners() ; ++i)
        {
          // calculate coordinate 
          coord[i] = fatherGeom.local( myGeom.corner( i ) );

          // set pointer 
          coordPtr_[i] = (&(coord[i][0]));

          // to avoid rounding errors
          for(int j=0; j<cdim; ++j)
          {
            if ( coord[i][j] < 1e-16) coord[i][j] = 0.0;
          }
        }

        status_ = updated ;
      }

      // return mapping (always up2date)
      inline MappingType& mapping()
      {
        assert( valid() );
        if( status_ == buildmapping ) return triMap_;

        triMap_.buildMapping( point( 0 ), point( 1 ), point( 2 ), point( 3 ),
                              point( 4 ), point( 5 ), point( 6 ), point( 7 ) );

        status_ = buildmapping;
        return triMap_;
      }

      // set status to invalid 
      void invalidate () { status_ = invalid ; }

      // return true if geometry is valid 
      bool valid () const { return status_ != invalid ; }
    };


    // geometry impl for hexahedrons 
    template <int dummy>
    class GeometryImpl<dummy,3, tetra> : public CoordVecCopy 
    {
      enum { corners_ = 4 };

      //! the vertex coordinates 
      typedef alu3d_ctype CoordPtrType[cdim];

      //! the vertex coordinates 
      typedef FieldMatrix<alu3d_ctype, corners_ , cdim>  CoordinateMatrixType;

      typedef LinearMapping<cdim, cdim> MappingType;

      // coordinate pointer vector  
      const alu3d_ctype* coordPtr_[ corners_ ];
      MappingType liMap_;
      CoordinateMatrixType* fatherCoord_;
      signed char status_;

    public:
      using CoordVecCopy :: update ;
      using CoordVecCopy :: copy ;

      // default constructor 
      GeometryImpl() : liMap_(),
                       fatherCoord_(0),
                       status_( invalid )
      {
        // set initialize coord pointers
        for( int i=0; i<corners_; ++i )
          coordPtr_[ i ] = 0;
      }

      // copy constructor 
      GeometryImpl(const GeometryImpl& other) :
        liMap_(other.liMap_),
        fatherCoord_(0),
        status_(other.status_)
      {
        // copy coord pointers 
        for( int i=0; i<corners_; ++i )
          coordPtr_[ i ] = other.coordPtr_[ i ];

        // if father coords are set, then reset coordPtr
        if( other.fatherCoord_ )
        {
          fatherCoord_ = new CoordinateMatrixType(*other.fatherCoord_);
          CoordinateMatrixType& coord = *fatherCoord_;
          for(int i=0; i<corners_; ++i) 
          {
            coordPtr_[i] = (&(coord[i][0]));
          }
        }
      }                
                       
      // destructor  
      ~GeometryImpl()
      {
        if( fatherCoord_ ) delete fatherCoord_;
      } 

      const alu3d_ctype* point( const int i ) const
      {
        assert( valid() );
        assert( i>=0 && i<corners_ );
        assert( coordPtr_[ i ] );
        return coordPtr_[ i ];
      }
        
      // return coordinate vector 
      inline CoordinateVectorType operator [] (const int i) const
      { 
        CoordinateVectorType coord ;
        copy( point( i ), coord );
        return coord ;
      }

      // update geometry coordinates 
      inline void update(const CoordPtrType& p0,
                         const CoordPtrType& p1,
                         const CoordPtrType& p2,
                         const CoordPtrType& p3)
      {
        coordPtr_[0] = &p0[ 0 ];
        coordPtr_[1] = &p1[ 0 ];
        coordPtr_[2] = &p2[ 0 ];
        coordPtr_[3] = &p3[ 0 ];
        status_ = updated;
      }

      // update geometry in father coordinates 
      template <class GeometryImp>
      inline void updateInFather(const GeometryImp &fatherGeom ,
                          const GeometryImp & myGeom)
      {
        if( fatherCoord_ == 0 )
        {
          fatherCoord_ = new CoordinateMatrixType();
        }

        CoordinateMatrixType& coord = *fatherCoord_;
        // compute the local coordinates in father refelem
        for(int i=0; i < myGeom.corners() ; ++i)
        {
          // calculate coordinate 
          coord[i] = fatherGeom.local( myGeom.corner( i ) );

          // set pointer 
          coordPtr_[i] = (&(coord[i][0]));

          // to avoid rounding errors
          for(int j=0; j<cdim; ++j)
          {
            if ( coord[i][j] < 1e-16) coord[i][j] = 0.0;
          }
        }

        status_ = updated;
      }

      // return mapping (always up2date)
      inline MappingType& mapping()
      {
        assert( valid() );
        if( status_ == buildmapping ) return liMap_;

        liMap_.buildMapping( point( 0 ), point( 1 ), point( 2 ), point( 3 ) );

        status_ = buildmapping;
        return liMap_;
      }

      // set status to invalid 
      void invalidate () { status_ = invalid ; }

      // return true if geometry is valid 
      bool valid () const { return status_ != invalid ; }
    };
  }; // end of class ALUGridGeometryImplementation

  template <int mydim, int cdim, class GridImp>
  class ALU3dGridGeometry : 
    public GeometryDefaultImplementation<mydim, cdim, GridImp, ALU3dGridGeometry> 
  {
    static const ALU3dGridElementType elementType = GridImp::elementType;

    typedef typename GridImp::MPICommunicatorType Comm;

    friend class ALU3dGridIntersectionIterator<GridImp>;

    typedef typename ALU3dImplTraits< elementType, Comm >::IMPLElementType IMPLElementType;
    typedef typename ALU3dImplTraits< elementType, Comm >::GEOFaceType     GEOFaceType;
    typedef typename ALU3dImplTraits< elementType, Comm >::GEOEdgeType     GEOEdgeType;
    typedef typename ALU3dImplTraits< elementType, Comm >::GEOVertexType   GEOVertexType;

    // interface types 
    typedef typename ALU3dImplTraits< elementType, Comm >::HFaceType   HFaceType;
    typedef typename ALU3dImplTraits< elementType, Comm >::HEdgeType   HEdgeType; 
    typedef typename ALU3dImplTraits< elementType, Comm >::VertexType  VertexType; 

    typedef ElementTopologyMapping<elementType> ElementTopo;
    typedef FaceTopologyMapping<elementType> FaceTopo;

    enum { corners_      = (elementType == hexa) ? Power_m_p<2,mydim>::power : mydim+1 };
      
    // type of specialized geometry implementation 
    typedef typename MyALUGridGeometryImplementation<cdim> ::
      template GeometryImpl<0, mydim, elementType > GeometryImplType;

  public:
    typedef typename GridImp :: ctype ctype;

    //! type of local coordinates
    typedef FieldVector<ctype, mydim> LocalCoordinate;

    //! type of the global coordinates
    typedef FieldVector<ctype, cdim > GlobalCoordinate;

    //! type of jacobian (also of jacobian inverse transposed)
    typedef FieldMatrix<ctype,cdim,mydim> Jacobian;

    //! type of jacobian transposed
    typedef FieldMatrix< ctype, mydim, cdim > JacobianTransposed;

    // type of coordinate matrix for faces 
    typedef FieldMatrix<ctype, 
            EntityCount< elementType > :: numVerticesPerFace , 3> FaceCoordinatesType;

    //! for makeRefGeometry == true a Geometry with the coordinates of the 
    //! reference element is made 
    ALU3dGridGeometry();

    //! return the element type identifier
    //! line , triangle or tetrahedron, depends on dim 
    GeometryType type () const;

    //! return the number of corners of this element. Corners are numbered 0..n-1
    int corners () const;
  
    //! access to coordinates of corners. Index is the number of the corner 
    const GlobalCoordinate& operator[] (int i) const;

    //! access to coordinates of corners. Index is the number of the corner 
    GlobalCoordinate corner (int i) const;

    //! maps a local coordinate within reference element to 
    //! global coordinate in element 
    GlobalCoordinate global (const LocalCoordinate& local) const;
  
    //! maps a global coordinate within the element to a 
    //! local coordinate in its reference element
    LocalCoordinate local (const GlobalCoordinate& global) const;

    //! A(l) , see grid.hh 
    ctype integrationElement (const LocalCoordinate& local) const;

    //! can only be called for dim=dimworld! (Trivially true, since there is no
    //! other specialization...)
    const Jacobian& jacobianInverseTransposed (const LocalCoordinate& local) const;

    //! jacobian transposed 
    const JacobianTransposed& jacobianTransposed (const LocalCoordinate& local) const;

    //! returns true if mapping is affine 
    inline bool affine () const;

    //! returns volume of geometry 
    ctype volume () const;

    //***********************************************************************
    //!  Methods that not belong to the Interface, but have to be public
    //***********************************************************************
    //! generate the geometry out of a given ALU3dGridElement  
    bool buildGeom(const IMPLElementType & item);
    bool buildGeom(const HFaceType & item, int twist, int faceNum);
    bool buildGeom(const HEdgeType & item, int twist, int);
    bool buildGeom(const VertexType & item, int twist, int);
 
    // this method is used by the intersection iterator 
    bool buildGeom(const FaceCoordinatesType& coords);

    // this method is used by the intersection iterator 
    template <class coord_t>
    bool buildGeom(const coord_t& p0,
                   const coord_t& p1,
                   const coord_t& p2,
                   const coord_t& p3);

    // this method is used by the intersection iterator 
    template <class coord_t>
    bool buildGeom(const coord_t& p0,
                   const coord_t& p1,
                   const coord_t& p2);

    //! build geometry of local coordinates relative to father 
    template <class GeometryType>
    bool buildGeomInFather(const GeometryType &fatherGeom , const GeometryType & myGeom);
        
    //! print internal data
    //! no interface method
    void print (std::ostream& ss) const;

    //! invalidate geometry implementation to avoid errors 
    void invalidate () ;

    //! invalidate geometry implementation to avoid errors 
    bool valid () const ;

  private:
    // implementation of coord and mapping 
    mutable GeometryImplType geoImpl_;
    // volume 
    mutable ctype volume_;
  };

} // end namespace Dune

#include "geometry_imp.cc"

#endif