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