dune-grid
2.1.1
|
00001 #ifndef DUNE_ALBERTA_MACROELEMENT_HH 00002 #define DUNE_ALBERTA_MACROELEMENT_HH 00003 00004 #include <dune/grid/albertagrid/misc.hh> 00005 00006 #if HAVE_ALBERTA 00007 00008 namespace Dune 00009 { 00010 00011 namespace Alberta 00012 { 00013 00014 // MacroElement 00015 // ------------ 00016 00017 template< int dim > 00018 struct MacroElement 00019 : public ALBERTA MACRO_EL 00020 { 00021 const GlobalVector &coordinate ( const int vertex ) const; 00022 00023 int boundaryId ( const int face ) const; 00024 bool isBoundary ( const int face ) const; 00025 const MacroElement< dim > *neighbor ( const int face ) const; 00026 }; 00027 00028 00029 #if DUNE_ALBERTA_VERSION >= 0x300 00030 template< int dim > 00031 inline const GlobalVector &MacroElement< dim >::coordinate ( const int vertex ) const 00032 { 00033 assert( (vertex >= 0) && (vertex < N_VERTICES_MAX) ); 00034 return *coord[ vertex ]; 00035 } 00036 #endif // #if DUNE_ALBERTA_VERSION >= 0x300 00037 00038 00039 #if DUNE_ALBERTA_VERSION < 0x300 00040 template< int dim > 00041 inline const GlobalVector &MacroElement< dim >::coordinate ( const int vertex ) const 00042 { 00043 assert( (vertex >= 0) && (vertex < N_VERTICES_MAX) ); 00044 return *((const GlobalVector *)coord[ vertex ]); 00045 } 00046 #endif // #if DUNE_ALBERTA_VERSION < 0x300 00047 00048 00049 template< int dim > 00050 inline bool MacroElement< dim >::isBoundary ( const int face ) const 00051 { 00052 return (boundaryId( face ) != InteriorBoundary); 00053 } 00054 00055 00056 #if DUNE_ALBERTA_VERSION >= 0x300 00057 template< int dim > 00058 inline int MacroElement< dim >::boundaryId ( const int face ) const 00059 { 00060 return wall_bound[ face ]; 00061 } 00062 #endif // #if DUNE_ALBERTA_VERSION >= 0x300 00063 00064 #if DUNE_ALBERTA_VERSION < 0x300 00065 template< int dim > 00066 inline int MacroElement< dim >::boundaryId ( const int face ) const 00067 { 00068 switch( dim ) 00069 { 00070 case 1: 00071 assert( (face >= 0) && (face < N_VERTICES_MAX) ); 00072 return vertex_bound[ face ]; 00073 case 2: 00074 assert( (face >= 0) && (face < N_EDGES_MAX) ); 00075 return edge_bound[ face ]; 00076 case 3: 00077 assert( (face >= 0) && (face < N_FACES_MAX) ); 00078 return face_bound[ face ]; 00079 } 00080 } 00081 #endif // #if DUNE_ALBERTA_VERSION < 0x300 00082 00083 00084 template< int dim > 00085 const MacroElement< dim > *MacroElement< dim >::neighbor ( const int face ) const 00086 { 00087 assert( (face >= 0) && (face < N_NEIGH_MAX) ); 00088 return static_cast< const MacroElement * >( neigh[ face ] ); 00089 } 00090 00091 } 00092 00093 } 00094 00095 #endif // #if HAVE_ALBERTA 00096 00097 #endif // #ifndef DUNE_ALBERTA_MACROELEMENT_HH