DUNE-FEM (unstable)

idset.hh
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_GEOGRID_IDSET_HH
6#define DUNE_GEOGRID_IDSET_HH
7
9
10namespace Dune
11{
12
13 namespace GeoGrid
14 {
15
16 // IdSet
17 // -----
18
19 template< class Grid, class HostIdSet >
20 class IdSet
21 : public Dune::IdSet< Grid, IdSet< Grid, HostIdSet >, typename HostIdSet::IdType >
22 {
23 typedef IdSet< Grid, HostIdSet > This;
25
26 typedef typename std::remove_const< Grid >::type::Traits Traits;
27
28 public:
29 typedef typename HostIdSet::IdType IdType;
30
31 using Base::subId;
32
33 IdSet ()
34 : hostIdSet_( 0 )
35 {}
36
37 explicit IdSet ( const HostIdSet &hostIdSet )
38 : hostIdSet_( &hostIdSet )
39 {}
40
41 IdSet ( const This &other )
42 : hostIdSet_( other.hostIdSet_ )
43 {}
44
45 const This &operator= ( const This &other )
46 {
47 hostIdSet_ = other.hostIdSet_;
48 return *this;
49 }
50
51 template< int codim >
52 IdType id ( const typename Traits::template Codim< codim >::Entity &entity ) const
53 {
54 return entity.impl().id( hostIdSet() );
55 }
56
57 template< class Entity >
58 IdType id ( const Entity &entity ) const
59 {
60 return id< Entity::codimension >( entity );
61 }
62
63 IdType subId ( const typename Traits::template Codim< 0 >::Entity &entity, int i, unsigned int codim ) const
64 {
65 return hostIdSet().subId( Grid::template getHostEntity< 0 >( entity ), i, codim );
66 }
67
68 explicit operator bool () const { return bool( hostIdSet_ ); }
69
70 private:
71 const HostIdSet &hostIdSet () const
72 {
73 assert( *this );
74 return *hostIdSet_;
75 }
76
77 const HostIdSet *hostIdSet_;
78 };
79
80 } // namespace GeoGrid
81
82} // namespace Dune
83
84#endif // #ifndef DUNE_GEOGRID_IDSET_HH
Id Set Interface.
Definition: indexidset.hh:447
IdType subId(const typename Codim< 0 >::Entity &e, int i, unsigned int codim) const
Get id of subentity i of co-dimension codim of a co-dimension 0 entity.
Definition: indexidset.hh:481
IdSet(const IdSet &)=delete
Forbid the copy constructor.
IdType id(const Entity &e) const
Get id of an entity. This method is simpler to use than the one below.
Definition: indexidset.hh:466
Provides base classes for index and id sets.
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)