Dune Core Modules (2.3.1)

macroelement.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_ALBERTA_MACROELEMENT_HH
4#define DUNE_ALBERTA_MACROELEMENT_HH
5
6#include <dune/grid/albertagrid/misc.hh>
7
8#if HAVE_ALBERTA
9
10namespace Dune
11{
12
13 namespace Alberta
14 {
15
16 // MacroElement
17 // ------------
18
19 template< int dim >
20 struct MacroElement
21 : public ALBERTA MACRO_EL
22 {
23 const GlobalVector &coordinate ( const int vertex ) const;
24
25 int boundaryId ( const int face ) const;
26 bool isBoundary ( const int face ) const;
27 const MacroElement< dim > *neighbor ( const int face ) const;
28 };
29
30
31#if DUNE_ALBERTA_VERSION >= 0x300
32 template< int dim >
33 inline const GlobalVector &MacroElement< dim >::coordinate ( const int vertex ) const
34 {
35 assert( (vertex >= 0) && (vertex < N_VERTICES_MAX) );
36 return *coord[ vertex ];
37 }
38#endif // #if DUNE_ALBERTA_VERSION >= 0x300
39
40
41#if DUNE_ALBERTA_VERSION < 0x300
42 template< int dim >
43 inline const GlobalVector &MacroElement< dim >::coordinate ( const int vertex ) const
44 {
45 assert( (vertex >= 0) && (vertex < N_VERTICES_MAX) );
46 return *((const GlobalVector *)coord[ vertex ]);
47 }
48#endif // #if DUNE_ALBERTA_VERSION < 0x300
49
50
51 template< int dim >
52 inline bool MacroElement< dim >::isBoundary ( const int face ) const
53 {
54 return (boundaryId( face ) != InteriorBoundary);
55 }
56
57
58#if DUNE_ALBERTA_VERSION >= 0x300
59 template< int dim >
60 inline int MacroElement< dim >::boundaryId ( const int face ) const
61 {
62 return wall_bound[ face ];
63 }
64#endif // #if DUNE_ALBERTA_VERSION >= 0x300
65
66#if DUNE_ALBERTA_VERSION < 0x300
67 template< int dim >
68 inline int MacroElement< dim >::boundaryId ( const int face ) const
69 {
70 switch( dim )
71 {
72 case 1 :
73 assert( (face >= 0) && (face < N_VERTICES_MAX) );
74 return vertex_bound[ face ];
75 case 2 :
76 assert( (face >= 0) && (face < N_EDGES_MAX) );
77 return edge_bound[ face ];
78 case 3 :
79 assert( (face >= 0) && (face < N_FACES_MAX) );
80 return face_bound[ face ];
81 }
82 }
83#endif // #if DUNE_ALBERTA_VERSION < 0x300
84
85
86 template< int dim >
87 const MacroElement< dim > *MacroElement< dim >::neighbor ( const int face ) const
88 {
89 assert( (face >= 0) && (face < N_NEIGH_MAX) );
90 return static_cast< const MacroElement * >( neigh[ face ] );
91 }
92
93 }
94
95}
96
97#endif // #if HAVE_ALBERTA
98
99#endif // #ifndef DUNE_ALBERTA_MACROELEMENT_HH
Dune namespace.
Definition: alignment.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)