~ubuntu-branches/ubuntu/utopic/dune-grid/utopic-proposed

« back to all changes in this revision

Viewing changes to dune/grid/io/file/dgfparser/dgfug.hh

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2014-02-14 10:49:16 UTC
  • mfrom: (1.3.1) (5.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20140214104916-2clchnny3eu7ks4w
Tags: 2.3.0-2
InstallĀ /usr/share/dune-grid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 
2
// vi: set et ts=4 sw=2 sts=2:
1
3
#ifndef DUNE_GRID_IO_FILE_DGFPARSER_DGFUG_HH
2
4
#define DUNE_GRID_IO_FILE_DGFPARSER_DGFUG_HH
3
5
 
10
12
//- dune-common includes
11
13
#include <dune/common/exceptions.hh>
12
14
#include <dune/common/fvector.hh>
13
 
#include <dune/common/mpihelper.hh>
 
15
#include <dune/common/parallel/mpihelper.hh>
14
16
 
15
17
//- dune-grid includes
16
18
#include <dune/grid/common/intersection.hh>
31
33
    // --------------------
32
34
 
33
35
    struct UGGridParameterBlock
34
 
    : public GridParameterBlock
 
36
      : public GridParameterBlock
35
37
    {
36
38
      /** \brief constructor taking istream */
37
39
      explicit UGGridParameterBlock ( std::istream &input );
44
46
      size_t heapSize () const { return heapSize_; }
45
47
 
46
48
    protected:
47
 
      bool noClosure_;  // no closure for UGGrid 
 
49
      bool noClosure_;  // no closure for UGGrid
48
50
      bool noCopy_;     // no copies  for UGGrid
49
 
      size_t heapSize_; // heap size  for UGGrid 
 
51
      size_t heapSize_; // heap size  for UGGrid
50
52
    };
51
53
 
52
54
  } // namespace dgf
53
55
 
54
56
 
55
57
 
56
 
#if ENABLE_UG 
 
58
#if ENABLE_UG
57
59
  template< int dim >
58
60
  struct DGFGridInfo< UGGrid< dim > >
59
61
  {
86
88
    /** \brief constructor taking istream */
87
89
    explicit DGFGridFactory ( std::istream &input,
88
90
                              MPICommunicatorType comm = MPIHelper::getCommunicator() )
89
 
    : grid_( 0 ),
90
 
      factory_(),
91
 
      dgf_( rank( comm ), size( comm ) )
92
 
    { 
 
91
      : grid_( 0 ),
 
92
        factory_(),
 
93
        dgf_( rank( comm ), size( comm ) )
 
94
    {
93
95
      generate( input );
94
96
    }
95
97
 
96
98
    /** \brief constructor taking filename */
97
99
    explicit DGFGridFactory ( const std::string &filename,
98
100
                              MPICommunicatorType comm = MPIHelper::getCommunicator() )
99
 
    : grid_( 0 ),
100
 
      factory_(),
101
 
      dgf_( rank( comm ), size( comm ) )
102
 
    { 
 
101
      : grid_( 0 ),
 
102
        factory_(),
 
103
        dgf_( rank( comm ), size( comm ) )
 
104
    {
103
105
      std::ifstream input( filename.c_str() );
104
106
      if ( !input )
105
107
        DUNE_THROW( DGFException, "Error: Macrofile " << filename << " not found" );
113
115
    }
114
116
 
115
117
    /** \brief please doc me */
116
 
    template< class GG, template< class > class II >
 
118
    template< class GG, class II >
117
119
    bool wasInserted ( const Dune::Intersection< GG, II > &intersection ) const
118
120
    {
119
121
      return factory_.wasInserted( intersection );
120
122
    }
121
123
 
122
124
    /** \brief will return boundary segment index */
123
 
    template < class GG, template< class > class II >
 
125
    template< class GG, class II >
124
126
    int boundaryId ( const Dune::Intersection< GG, II > &intersection ) const
125
127
    {
126
128
      return intersection.boundarySegmentIndex();
174
176
    }
175
177
 
176
178
    /** \brief return invalid value */
177
 
    template < class GG, template< class > class II >
 
179
    template< class GG, class II >
178
180
    const DGFBoundaryParameter::type &boundaryParameter ( const Dune::Intersection< GG, II > &intersection ) const
179
181
    {
180
182
      typedef Dune::Intersection< GG, II > Intersection;
182
184
      const typename Intersection::Entity &entity = *inside;
183
185
      const int face = intersection.indexInInside();
184
186
 
185
 
      const GenericReferenceElement< double, dimension > &refElem 
186
 
        = GenericReferenceElements< double, dimension >::general( entity.type() );
 
187
      const ReferenceElement< double, dimension > &refElem
 
188
        = ReferenceElements< double, dimension >::general( entity.type() );
187
189
      int corners = refElem.size( face, 1, dimension );
188
190
      std::vector< unsigned int > bound( corners );
189
191
      for( int i = 0; i < corners; ++i )
228
230
    GridFactory< UGGrid< dim > > factory_;
229
231
    DuneGridFormatParser dgf_;
230
232
  };
231
 
#endif // #if ENABLE_UG 
 
233
#endif // #if ENABLE_UG
232
234
 
233
235
} // namespace Dune
234
236