/usr/include/dune/grid/io/file/dgfparser/dgfidentitygrid.hh 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 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_DGFPARSER_DGFIDENTITYGRID_HH
#define DUNE_DGFPARSER_DGFIDENTITYGRID_HH
#include <dune/common/typetraits.hh>
#include <dune/grid/identitygrid.hh>
#include <dune/grid/io/file/dgfparser/dgfparser.hh>
#include <dune/grid/utility/hostgridaccess.hh>
namespace Dune
{
// DGFGridFactory for IdentityGrid
// -------------------------------
template< class HostGrid >
struct DGFGridFactory< IdentityGrid< HostGrid > >
{
typedef IdentityGrid< HostGrid > Grid;
const static int dimension = Grid::dimension;
typedef MPIHelper::MPICommunicator MPICommunicator;
typedef typename Grid::template Codim<0>::Entity Element;
typedef typename Grid::template Codim<dimension>::Entity Vertex;
explicit DGFGridFactory ( std::istream &input,
MPICommunicator comm = MPIHelper::getCommunicator() )
: dgfHostFactory_( input, comm ),
grid_( 0 )
{
HostGrid *hostGrid = dgfHostFactory_.grid();
assert( hostGrid != 0 );
grid_ = new Grid( *hostGrid );
}
explicit DGFGridFactory ( const std::string &filename,
MPICommunicator comm = MPIHelper::getCommunicator() )
: dgfHostFactory_( filename, comm ),
grid_( 0 )
{
HostGrid *hostGrid = dgfHostFactory_.grid();
assert( hostGrid != 0 );
std::ifstream input( filename.c_str() );
grid_ = new Grid( *hostGrid );
}
Grid *grid () const
{
return grid_;
}
template< class Intersection >
bool wasInserted ( const Intersection &intersection ) const
{
return dgfHostFactory_.wasInserted( HostGridAccess< Grid >::hostIntersection( intersection ) );
}
template< class Intersection >
int boundaryId ( const Intersection &intersection ) const
{
return dgfHostFactory_.boundaryId( HostGridAccess< Grid >::hostIntersection( intersection ) );
}
template< int codim >
int numParameters () const
{
return dgfHostFactory_.template numParameters< codim >();
}
template< class Entity >
std::vector< double > ¶meter ( const Entity &entity )
{
return dgfHostFactory_.parameter( HostGridAccess< Grid >::hostEntity( entity ) );
}
private:
DGFGridFactory< HostGrid > dgfHostFactory_;
Grid *grid_;
};
// DGFGridInfo for IdGrid
// ----------------------
template< class HostGrid >
struct DGFGridInfo< IdentityGrid< HostGrid > >
{
static int refineStepsForHalf ()
{
return DGFGridInfo< HostGrid >::refineStepsForHalf();
}
static double refineWeight ()
{
return DGFGridInfo< HostGrid >::refineWeight();
}
};
}
#endif // #ifndef DUNE_DGFPARSER_DGFIDENTITYGRID_HH
|