Dune Core Modules (unstable)

entityseed.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_ALBERTA_ENTITYSEED_HH
6#define DUNE_ALBERTA_ENTITYSEED_HH
7
10
11namespace Dune
12{
13
14 // Internal Forward Declarations
15 // -----------------------------
16
17 template< int codim, class Grid >
18 class AlbertaGridEntitySeed;
19
20
21
22 // External Forward Declarations
23 // -----------------------------
24
25 template< int dim, int dimworld >
26 class AlbertaGrid;
27
28
29
30#if HAVE_ALBERTA
31
32 // AlbertaGridEntitySeed (for higher codimension)
33 // ----------------------------------------------
34
35 template< int codim, int dim, int dimworld >
36 class AlbertaGridEntitySeed< codim, const AlbertaGrid< dim, dimworld > >
37 {
38 public:
40
41 static const int codimension = codim;
42 static const int dimension = dim;
43 static const int mydimension = dimension - codimension;
44 static const int dimensionworld = dimworld;
45
46 typedef Alberta::MeshPointer< dimension > MeshPointer;
47 typedef Alberta::ElementInfo< dimension > ElementInfo;
48 typedef typename ElementInfo::Seed Seed;
49
50 typedef typename Grid::template Codim< codimension >::Entity Entity;
51
52 AlbertaGridEntitySeed ( )
53 {}
54
55 AlbertaGridEntitySeed ( const ElementInfo &elementInfo, int subEntity )
56 : seed_( elementInfo.seed() ),
57 subEntity_( subEntity )
58 {}
59
60 bool isValid () const
61 {
62 return seed_.isValid();
63 }
64
65 ElementInfo elementInfo ( const MeshPointer &mesh ) const { return ElementInfo( mesh, seed_ ); }
66 int subEntity () const { return subEntity_; }
67
68 private:
69 Seed seed_;
70 int subEntity_;
71 };
72
73
74
75 // AlbertaGridEntitySeed (for codimension 0)
76 // -----------------------------------------
77
78 template< int dim, int dimworld >
79 class AlbertaGridEntitySeed< 0, const AlbertaGrid< dim, dimworld > >
80 {
81 public:
83
84 static const int codimension = 0;
85 static const int dimension = dim;
86 static const int mydimension = dimension - codimension;
87 static const int dimensionworld = dimworld;
88
89 typedef Alberta::MeshPointer< dimension > MeshPointer;
90 typedef Alberta::ElementInfo< dimension > ElementInfo;
91 typedef typename ElementInfo::Seed Seed;
92
93 typedef typename Grid::template Codim< codimension >::Entity Entity;
94
95 AlbertaGridEntitySeed ( )
96 {}
97
98 explicit AlbertaGridEntitySeed ( const ElementInfo &elementInfo )
99 : seed_( elementInfo.seed() )
100 {}
101
102 bool isValid () const
103 {
104 return seed_.isValid();
105 }
106
107 ElementInfo elementInfo ( const MeshPointer &mesh ) const { return ElementInfo( mesh, seed_ ); }
108 int subEntity () const { return 0; }
109
110 private:
111 Seed seed_;
112 };
113
114#endif // #if HAVE_ALBERTA
115
116} // end namespace Dune
117
118#endif // #ifndef DUNE_ALBERTA_ENTITYSEED_HH
provides a wrapper for ALBERTA's el_info structure
provides a wrapper for ALBERTA's mesh structure
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)