This file is indexed.

/usr/include/dune/grid/io/file/dgfparser/dgfug.hh is in libdune-grid-dev 2.3.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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GRID_IO_FILE_DGFPARSER_DGFUG_HH
#define DUNE_GRID_IO_FILE_DGFPARSER_DGFUG_HH

//- C++ includes
#include <fstream>
#include <istream>
#include <string>
#include <vector>

//- dune-common includes
#include <dune/common/exceptions.hh>
#include <dune/common/fvector.hh>
#include <dune/common/parallel/mpihelper.hh>

//- dune-grid includes
#include <dune/grid/common/intersection.hh>
#include <dune/grid/uggrid.hh>

//- local includes
#include "dgfparser.hh"
#include "blocks/gridparameter.hh"


namespace Dune
{

  namespace dgf
  {

    // UGGridParameterBlock
    // --------------------

    struct UGGridParameterBlock
      : public GridParameterBlock
    {
      /** \brief constructor taking istream */
      explicit UGGridParameterBlock ( std::istream &input );

      /** \brief returns true if no closure should be used for UGGrid */
      bool noClosure () const { return noClosure_; }
      /** \brief returns true if no copies are made for UGGrid elements */
      bool noCopy () const { return noCopy_; }
      /** \brief returns heap size used on construction of the grid */
      size_t heapSize () const { return heapSize_; }

    protected:
      bool noClosure_;  // no closure for UGGrid
      bool noCopy_;     // no copies  for UGGrid
      size_t heapSize_; // heap size  for UGGrid
    };

  } // namespace dgf



#if ENABLE_UG
  template< int dim >
  struct DGFGridInfo< UGGrid< dim > >
  {
    static int refineStepsForHalf ()
    {
      return 1;
    }

    static double refineWeight ()
    {
      return -1.;
    }
  };



  // DGFGridFactory< UGGrid< dim > >
  // -------------------------------

  template< int dim >
  struct DGFGridFactory< UGGrid< dim > >
  {
    /** \brief grid type */
    typedef UGGrid< dim > Grid;
    /** \brief grid dimension */
    static const int dimension = dim;
    /** \brief MPI communicator type */
    typedef MPIHelper::MPICommunicator MPICommunicatorType;

    /** \brief constructor taking istream */
    explicit DGFGridFactory ( std::istream &input,
                              MPICommunicatorType comm = MPIHelper::getCommunicator() )
      : grid_( 0 ),
        factory_(),
        dgf_( rank( comm ), size( comm ) )
    {
      generate( input );
    }

    /** \brief constructor taking filename */
    explicit DGFGridFactory ( const std::string &filename,
                              MPICommunicatorType comm = MPIHelper::getCommunicator() )
      : grid_( 0 ),
        factory_(),
        dgf_( rank( comm ), size( comm ) )
    {
      std::ifstream input( filename.c_str() );
      if ( !input )
        DUNE_THROW( DGFException, "Error: Macrofile " << filename << " not found" );
      generate( input );
    }

    /** \brief return grid */
    Grid *grid ()
    {
      return grid_;
    }

    /** \brief please doc me */
    template< class GG, class II >
    bool wasInserted ( const Dune::Intersection< GG, II > &intersection ) const
    {
      return factory_.wasInserted( intersection );
    }

    /** \brief will return boundary segment index */
    template< class GG, class II >
    int boundaryId ( const Dune::Intersection< GG, II > &intersection ) const
    {
      return intersection.boundarySegmentIndex();
    }

    /** \brief return number of parameters */
    template< int codim >
    int numParameters () const
    {
      if( codim == 0 )
        return dgf_.nofelparams;
      else if( codim == dimension )
        return dgf_.nofvtxparams;
      else
        return 0;
    }

    /** \brief return number of parameters */
    template< class Entity >
    int numParameters ( const Entity & ) const
    {
      return numParameters< Entity::codimension >();
    }

    /** \brief return parameter for codim 0 entity */
    std::vector< double > &parameter ( const typename Grid::template Codim< 0 >::Entity &element )
    {
      if( numParameters< 0 >() <= 0 )
      {
        DUNE_THROW( InvalidStateException,
                    "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
      }
      return dgf_.elParams[ factory_.insertionIndex( element ) ];
    }

    /** \brief return parameter for vertex */
    std::vector< double > &parameter ( const typename Grid::template Codim< dimension >::Entity &vertex )
    {
      if( numParameters< dimension >() <= 0 )
      {
        DUNE_THROW( InvalidStateException,
                    "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
      }
      return dgf_.vtxParams[ factory_.insertionIndex( vertex ) ];
    }

    /** \brief UGGrid does not support boundary parameters */
    bool haveBoundaryParameters () const
    {
      return dgf_.haveBndParameters;
    }

    /** \brief return invalid value */
    template< class GG, class II >
    const DGFBoundaryParameter::type &boundaryParameter ( const Dune::Intersection< GG, II > &intersection ) const
    {
      typedef Dune::Intersection< GG, II > Intersection;
      typename Intersection::EntityPointer inside = intersection.inside();
      const typename Intersection::Entity &entity = *inside;
      const int face = intersection.indexInInside();

      const ReferenceElement< double, dimension > &refElem
        = ReferenceElements< double, dimension >::general( entity.type() );
      int corners = refElem.size( face, 1, dimension );
      std::vector< unsigned int > bound( corners );
      for( int i = 0; i < corners; ++i )
      {
        const int k = refElem.subEntity( face, 1, i, dimension );
        bound[ i ] = factory_.insertionIndex( *entity.template subEntity< dimension >( k ) );
      }

      DuneGridFormatParser::facemap_t::key_type key( bound, false );
      const DuneGridFormatParser::facemap_t::const_iterator pos = dgf_.facemap.find( key );
      if( pos != dgf_.facemap.end() )
        return dgf_.facemap.find( key )->second.second;
      else
        return DGFBoundaryParameter::defaultValue();
    }

  private:
    // create grid
    void generate ( std::istream &input );

    // return rank
    static int rank( MPICommunicatorType MPICOMM )
    {
      int rank = 0;
#if HAVE_MPI
      MPI_Comm_rank( MPICOMM, &rank );
#endif
      return rank;
    }

    // return size
    static int size( MPICommunicatorType MPICOMM )
    {
      int size = 1;
#if HAVE_MPI
      MPI_Comm_size( MPICOMM, &size );
#endif
      return size;
    }

    Grid *grid_;
    GridFactory< UGGrid< dim > > factory_;
    DuneGridFormatParser dgf_;
  };
#endif // #if ENABLE_UG

} // namespace Dune

#endif // #ifndef DUNE_GRID_IO_FILE_DGFPARSER_DGFUG_HH