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

« back to all changes in this revision

Viewing changes to dune/grid/albertagrid/indexsets.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_ALBERTAGRIDINDEXSETS_HH
2
4
#define DUNE_ALBERTAGRIDINDEXSETS_HH
3
5
 
32
34
 
33
35
  template< int dim, int dimworld >
34
36
  class AlbertaGridHierarchicIndexSet
35
 
  : public IndexSet< AlbertaGridFamily< dim, dimworld >, AlbertaGridHierarchicIndexSet< dim,dimworld >, int >
 
37
    : public IndexSet< AlbertaGridFamily< dim, dimworld >, AlbertaGridHierarchicIndexSet< dim,dimworld >, int >
36
38
  {
37
39
    typedef AlbertaGridHierarchicIndexSet< dim, dimworld > This;
38
40
    typedef IndexSet< AlbertaGridFamily< dim, dimworld >, This, int > Base;
75
77
    template< class Entity >
76
78
    bool contains ( const Entity & ) const
77
79
    {
78
 
      return true; 
 
80
      return true;
79
81
    }
80
82
 
81
83
    using Base::index;
100
102
      int k = i;
101
103
      if( cc > 0 )
102
104
      {
103
 
        const GenericReferenceElement< Alberta::Real, dimension > &refElement
104
 
          = GenericReferenceElements< Alberta::Real, dimension >::simplex();
 
105
        const ReferenceElement< Alberta::Real, dimension > &refElement
 
106
          = ReferenceElements< Alberta::Real, dimension >::simplex();
105
107
        k = refElement.subEntity( entityImp.subEntity(), cc, i, codim );
106
108
      }
107
109
 
109
111
      return subIndex( entityImp.elementInfo(), j, codim );
110
112
    }
111
113
 
112
 
    //! return size of set for given GeometryType 
 
114
    //! return size of set for given GeometryType
113
115
    IndexType size ( const GeometryType &type ) const
114
116
    {
115
117
      return (type.isSimplex() ? size( dimension - type.dim() ) : 0);
116
118
    }
117
119
 
118
 
    //! return size of set 
 
120
    //! return size of set
119
121
    IndexType size ( int codim ) const
120
122
    {
121
123
      assert( (codim >= 0) && (codim <= dimension) );
122
124
      return indexStack_[ codim ].size();
123
125
    }
124
126
 
125
 
    //! return geometry types this set has indices for 
 
127
    //! return geometry types this set has indices for
126
128
    const std::vector< GeometryType > &geomTypes( int codim ) const
127
129
    {
128
130
      assert( (codim >= 0) && (codim <= dimension) );
203
205
  };
204
206
 
205
207
 
206
 
 
 
208
 
207
209
  // AlbertaGridHierarchicIndexSet::InitEntityNumber
208
210
  // -----------------------------------------------
209
211
 
214
216
 
215
217
  public:
216
218
    InitEntityNumber ( IndexStack &indexStack )
217
 
    : indexStack_( indexStack )
 
219
      : indexStack_( indexStack )
218
220
    {}
219
221
 
220
222
    void operator() ( int &dof )
258
260
    typedef Alberta::DofAccess< dimension, codimension > DofAccess;
259
261
 
260
262
    explicit RefineNumbering ( const IndexVectorPointer &dofVector )
261
 
    : indexStack_( getIndexStack< codimension >( dofVector ) ),
262
 
      dofVector_( dofVector ),
263
 
      dofAccess_( dofVector.dofSpace() )
 
263
      : indexStack_( getIndexStack< codimension >( dofVector ) ),
 
264
        dofVector_( dofVector ),
 
265
        dofAccess_( dofVector.dofSpace() )
264
266
    {}
265
267
 
266
268
  public:
292
294
    typedef Alberta::DofAccess< dimension, codimension > DofAccess;
293
295
 
294
296
    explicit CoarsenNumbering ( const IndexVectorPointer &dofVector )
295
 
    : indexStack_( getIndexStack< codimension >( dofVector ) ),
296
 
      dofVector_( dofVector ),
297
 
      dofAccess_( dofVector.dofSpace() )
 
297
      : indexStack_( getIndexStack< codimension >( dofVector ) ),
 
298
        dofVector_( dofVector ),
 
299
        dofAccess_( dofVector.dofSpace() )
298
300
    {}
299
301
 
300
302
  public:
316
318
 
317
319
  template< int dim, int dimworld >
318
320
  class AlbertaGridIndexSet
319
 
  : public IndexSet< AlbertaGrid< dim, dimworld >, AlbertaGridIndexSet< dim, dimworld >, int >
 
321
    : public IndexSet< AlbertaGrid< dim, dimworld >, AlbertaGridIndexSet< dim, dimworld >, int >
320
322
  {
321
323
    typedef AlbertaGridIndexSet< dim, dimworld > This;
322
324
    typedef IndexSet< AlbertaGrid< dim, dimworld >, This, int > Base;
339
341
 
340
342
  public:
341
343
    explicit AlbertaGridIndexSet ( const DofNumbering &dofNumbering )
342
 
    : dofNumbering_( dofNumbering )
 
344
      : dofNumbering_( dofNumbering )
343
345
    {
344
346
      for( int codim = 0; codim <= dimension; ++codim )
345
347
      {
393
395
      int k = i;
394
396
      if( cc > 0 )
395
397
      {
396
 
        const GenericReferenceElement< Alberta::Real, dimension > &refElement
397
 
          = GenericReferenceElements< Alberta::Real, dimension >::simplex();
 
398
        const ReferenceElement< Alberta::Real, dimension > &refElement
 
399
          = ReferenceElements< Alberta::Real, dimension >::simplex();
398
400
        k = refElement.subEntity( entityImp.subEntity(), cc, i, codim );
399
401
      }
400
402
 
506
508
  // AlbertaGridIdSet
507
509
  // ----------------
508
510
 
509
 
  //! hierarchic index set of AlbertaGrid 
 
511
  //! hierarchic index set of AlbertaGrid
510
512
  template< int dim, int dimworld >
511
513
  class AlbertaGridIdSet
512
 
  : public IdSet< AlbertaGrid< dim, dimworld >, AlbertaGridIdSet< dim, dimworld >, unsigned int >
 
514
    : public IdSet< AlbertaGrid< dim, dimworld >, AlbertaGridIdSet< dim, dimworld >, unsigned int >
513
515
  {
514
516
    typedef AlbertaGridIdSet< dim, dimworld > This;
515
517
    typedef IdSet< AlbertaGrid< dim, dimworld >, This, unsigned int > Base;
517
519
    friend class AlbertaGrid< dim, dimworld >;
518
520
 
519
521
  public:
520
 
    //! export type of id 
 
522
    //! export type of id
521
523
    typedef typename Base::IdType IdType;
522
524
 
523
525
  private:
527
529
 
528
530
    typedef typename Grid::HierarchicIndexSet HierarchicIndexSet;
529
531
 
530
 
    // create id set, only allowed for AlbertaGrid 
 
532
    // create id set, only allowed for AlbertaGrid
531
533
    AlbertaGridIdSet ( const HierarchicIndexSet &hIndexSet )
532
 
    : hIndexSet_( hIndexSet )
 
534
      : hIndexSet_( hIndexSet )
533
535
    {}
534
536
 
535
537
  public: