Dune Core Modules (2.6.0)

dgfidentitygrid.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_DGFPARSER_DGFIDENTITYGRID_HH
4#define DUNE_DGFPARSER_DGFIDENTITYGRID_HH
5
7
9#include <dune/grid/io/file/dgfparser/dgfparser.hh>
10#include <dune/grid/utility/hostgridaccess.hh>
11
12namespace Dune
13{
14
15 // DGFGridFactory for IdentityGrid
16 // -------------------------------
17
18 template< class HostGrid >
19 struct DGFGridFactory< IdentityGrid< HostGrid > >
20 {
21 typedef IdentityGrid< HostGrid > Grid;
22
23 const static int dimension = Grid::dimension;
24 typedef MPIHelper::MPICommunicator MPICommunicator;
25 typedef typename Grid::template Codim<0>::Entity Element;
26 typedef typename Grid::template Codim<dimension>::Entity Vertex;
27
28 explicit DGFGridFactory ( std::istream &input,
29 MPICommunicator comm = MPIHelper::getCommunicator() )
30 : dgfHostFactory_( input, comm ),
31 grid_( 0 )
32 {
33 HostGrid *hostGrid = dgfHostFactory_.grid();
34 assert( hostGrid != 0 );
35 grid_ = new Grid( *hostGrid );
36 }
37
38 explicit DGFGridFactory ( const std::string &filename,
39 MPICommunicator comm = MPIHelper::getCommunicator() )
40 : dgfHostFactory_( filename, comm ),
41 grid_( 0 )
42 {
43 HostGrid *hostGrid = dgfHostFactory_.grid();
44 assert( hostGrid != 0 );
45 std::ifstream input( filename.c_str() );
46 grid_ = new Grid( *hostGrid );
47 }
48
49 Grid *grid () const
50 {
51 return grid_;
52 }
53
54 template< class Intersection >
55 bool wasInserted ( const Intersection &intersection ) const
56 {
57 return dgfHostFactory_.wasInserted( HostGridAccess< Grid >::hostIntersection( intersection ) );
58 }
59
60 template< class Intersection >
61 int boundaryId ( const Intersection &intersection ) const
62 {
63 return dgfHostFactory_.boundaryId( HostGridAccess< Grid >::hostIntersection( intersection ) );
64 }
65
66 template< int codim >
67 int numParameters () const
68 {
69 return dgfHostFactory_.template numParameters< codim >();
70 }
71
72 template< class Entity >
73 std::vector< double > &parameter ( const Entity &entity )
74 {
75 return dgfHostFactory_.parameter( HostGridAccess< Grid >::hostEntity( entity ) );
76 }
77
78 private:
79 DGFGridFactory< HostGrid > dgfHostFactory_;
80 Grid *grid_;
81 };
82
83
84
85 // DGFGridInfo for IdGrid
86 // ----------------------
87
88 template< class HostGrid >
89 struct DGFGridInfo< IdentityGrid< HostGrid > >
90 {
91 static int refineStepsForHalf ()
92 {
94 }
95
96 static double refineWeight ()
97 {
99 }
100 };
101
102}
103
104#endif // #ifndef DUNE_DGFPARSER_DGFIDENTITYGRID_HH
@ dimension
The dimension of the grid.
Definition: grid.hh:387
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:178
static MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:186
The IdentityGrid class.
Dune namespace.
Definition: alignedallocator.hh:10
static double refineWeight()
static int refineStepsForHalf()
number of globalRefine steps needed to refuce h by 0.5
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 28, 23:30, 2024)