This file is indexed.

/usr/include/dune/grid/albertagrid/geometry.cc is in libdune-grid-dev 2.5.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
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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ALBERTA_GEOMETRY_CC
#define DUNE_ALBERTA_GEOMETRY_CC

#include <dune/grid/albertagrid/algebra.hh>
#include <dune/grid/albertagrid/geometry.hh>
#include <dune/grid/albertagrid/refinement.hh>

namespace Dune
{

  // AlbertaGridGeometry
  // -------------------

  // print the GeometryInformation
  template <int mydim, int cdim, class GridImp>
  inline void AlbertaGridGeometry<mydim,cdim,GridImp>::print (std::ostream& ss) const
  {
    ss << "AlbertaGridGeometry<" << mydim << "," << cdim << "> = { \n";
    for(int i=0; i<corners(); i++)
    {
      ss << " corner " << i << " = ";
      ss << ((*this)[i]); ss << "\n";
    }
    ss << "} \n";
  }


  template< int mydim, int cdim, class GridImp >
  inline typename AlbertaGridGeometry< mydim, cdim, GridImp >::GlobalCoordinate
  AlbertaGridGeometry< mydim, cdim, GridImp >::global ( const LocalCoordinate &local ) const
  {
    GlobalCoordinate y = corner( 0 );
    jacobianTransposed().umtv( local, y );
    return y;
  }


  //local implementation for mydim < cdim
  template< int mydim, int cdim, class GridImp >
  inline typename AlbertaGridGeometry< mydim, cdim, GridImp >::LocalCoordinate
  AlbertaGridGeometry< mydim, cdim, GridImp >::local ( const GlobalCoordinate &global ) const
  {
    LocalCoordinate x;
    jacobianInverseTransposed().mtv( global - corner( 0 ), x );
    return x;
  }


  template< int mydim, int cdim, class GridImp >
  inline const typename AlbertaGridGeometry< mydim, cdim, GridImp >::JacobianTransposed &
  AlbertaGridGeometry< mydim, cdim, GridImp >::jacobianTransposed () const
  {
    if( !builtJT_ )
    {
      const FieldVector< ctype, coorddimension > &origin = coord_[ 0 ];
      for( int i = 0; i < mydimension; ++i )
      {
        jT_[ i ] = coord_[ i+1 ];
        jT_[ i ] -= origin;
      }
      builtJT_ = true;
    }
    return jT_;
  }


  template< int mydim, int cdim, class GridImp >
  inline const typename AlbertaGridGeometry< mydim, cdim, GridImp >::JacobianInverseTransposed &
  AlbertaGridGeometry< mydim, cdim, GridImp >::jacobianInverseTransposed () const
  {
    if( !builtJTInv_ )
    {
      elDet_ = std::abs( Alberta::invert( jacobianTransposed(), jTInv_ ) );
      assert( elDet_ > 1.0e-25 );
      calcedDet_ = true;
      builtJTInv_ = true;
    }
    return jTInv_;
  }


  // built Geometry
  template< int mydim, int cdim, class GridImp >
  template< class CoordReader >
  inline void AlbertaGridGeometry< mydim, cdim, GridImp >
  ::build ( const CoordReader &coordReader )
  {
    builtJT_ = false;
    builtJTInv_ = false;

    // copy corners
    for( int i = 0; i < numCorners; ++i )
      coordReader.coordinate( i, coord_[ i ] );

    // calculate centroid
    centroid_ = coord_[ 0 ];
    for( int i = 1; i < numCorners; ++i )
      centroid_ += coord_[ i ];
    centroid_ *= 1.0 / numCorners;

    elDet_ = (coordReader.hasDeterminant() ? coordReader.determinant() : elDeterminant());
    assert( std::abs( elDet_ ) > 0.0 );
    calcedDet_ = true;
  }


#if !DUNE_ALBERTA_CACHE_COORDINATES
  template< int dim, int cdim >
  inline typename AlbertaGridGlobalGeometry< dim, cdim, const AlbertaGrid< dim, cdim > >::GlobalCoordinate
  AlbertaGridGlobalGeometry< dim, cdim, const AlbertaGrid< dim, cdim > >::global ( const LocalCoordinate &local ) const
  {
    GlobalCoordinate y = corner( 0 );
    jacobianTransposed().umtv( local, y );
    return y;
  }


  //local implementation for mydim < cdim
  template< int dim, int cdim >
  inline typename AlbertaGridGlobalGeometry< dim, cdim, const AlbertaGrid< dim, cdim > >::LocalCoordinate
  AlbertaGridGlobalGeometry< dim, cdim, const AlbertaGrid< dim, cdim > >::local ( const GlobalCoordinate &global ) const
  {
    LocalCoordinate x;
    jacobianInverseTransposed().mtv( global - corner( 0 ), x );
    return x;
  }
#endif // #if !DUNE_ALBERTA_CACHE_COORDINATES



  // AlbertaGridLocalGeometryProvider
  // --------------------------------

  template< class Grid >
  void AlbertaGridLocalGeometryProvider< Grid >::buildGeometryInFather ()
  {
    for( int child = 0; child < numChildren; ++child )
    {
      for( int orientation = 0; orientation < 2; ++orientation )
      {
        const GeoInFatherCoordReader coordReader( child, orientation );
        geometryInFather_[ child ][ orientation ] = new LocalElementGeometry( coordReader );
      }
    }
  }


  template< class Grid >
  void AlbertaGridLocalGeometryProvider< Grid >::buildFaceGeometry ()
  {
    for( int face = 0; face < numFaces; ++face )
    {
      for( int twist = minFaceTwist; twist <= maxFaceTwist; ++twist )
      {
        const FaceCoordReader coordReader( face, twist );
        faceGeometry_[ face ][ twist - minFaceTwist ] = new LocalFaceGeometry( coordReader );
      }
    }
  }



  // AlbertaGridLocalGeometryProvider::GeoInFatherCoordReader
  // --------------------------------------------------------

  template< class Grid >
  struct AlbertaGridLocalGeometryProvider< Grid >::GeoInFatherCoordReader
  {
    typedef Alberta::Real ctype;

    typedef FieldVector< ctype, dimension > Coordinate;

  private:
    typedef Alberta::GeometryInFather< dimension > GeoInFather;

  public:
    GeoInFatherCoordReader ( int child, int orientation )
      : child_( child ),
        orientation_( orientation )
    {}

    void coordinate ( int i, Coordinate &x ) const
    {
      const typename GeoInFather::LocalVector &coord
        = GeoInFather::coordinate( child_, orientation_, i );
      for( int j = 0; j < dimension; ++j )
        x[ j ] = coord[ j ];
    }

    bool hasDeterminant () const
    {
      return false;
    }

    ctype determinant () const
    {
      return ctype( 0 );
    }

  private:
    const int child_;
    const int orientation_;
  };



  // AlbertaGridLocalGeometryProvider::FaceCoordReader
  // -------------------------------------------------

  template< class Grid >
  struct AlbertaGridLocalGeometryProvider< Grid >::FaceCoordReader
  {
    typedef Alberta::Real ctype;

    typedef FieldVector< ctype, dimension > Coordinate;

    FaceCoordReader ( const int face, const int twist = 0 )
      : face_( face ),
        twist_( twist )
    {}

    void coordinate ( const int i, Coordinate &x ) const
    {
      const int ti = Alberta::applyInverseTwist< dimension-1 >( twist_, i );
      const int j = mapVertices< 1 >( face_, ti );
      refCorner( j, x );
    }

    bool hasDeterminant () const
    {
      return false;
    }

    ctype determinant () const
    {
      return ctype( 0 );
    }

  private:
    static void refCorner ( const int i, Coordinate &x )
    {
      x = ctype( 0 );
      if( i > 0 )
        x[ i-1 ] = ctype( 1 );
    }

    int face_;
    int twist_;
  };

} // namespace Dune

#endif // #ifndef DUNE_ALBERTA_GEOMETRY_CC