00001 #ifndef DUNE_ALBERTAGRID_REFERENCETOPO_HH
00002 #define DUNE_ALBERTAGRID_REFERENCETOPO_HH
00003
00004 #if HAVE_ALBERTA
00005
00006 #include <cassert>
00007
00008 #include <dune/grid/albertagrid/albertaheader.hh>
00009
00010 #ifdef __ALBERTApp__
00011 namespace Albert {
00012 #endif
00013
00014 namespace AlbertHelp {
00015
00016
00017
00018
00019
00020
00021 static const int localTriangleFaceNumber [3][2] = { {1,2} , {2,0} , {0,1} };
00022
00023
00024
00025
00026
00027 static const int localEdgeNumber [6][2] =
00028 {
00029 {0,1} , {0,2} , {0,3} ,
00030 {1,2} , {1,3} , {2,3}
00031 };
00032
00033
00034
00035
00036
00037
00038 static const int tetraFace_0[3] = {1,3,2};
00039 static const int tetraFace_1[3] = {0,2,3};
00040 static const int tetraFace_2[3] = {0,3,1};
00041 static const int tetraFace_3[3] = {0,1,2};
00042
00043
00044 static const int localDuneTetraFaceNumber[4][3] =
00045 { {1,2,3},
00046 {0,3,2},
00047 {0,1,3},
00048 {0,2,1}
00049 };
00050
00051 static const int *const localAlbertaFaceNumber[ 4 ]
00052 = { tetraFace_0, tetraFace_1, tetraFace_2 , tetraFace_3 };
00053
00054
00055
00056
00057
00058
00059
00060 template <int md, int cd>
00061 struct MapVertices
00062 {
00063 static int mapVertices ( int subEntity, int i )
00064 {
00065 assert( subEntity == 0 );
00066 return i;
00067 }
00068 };
00069
00070
00071 template <>
00072 struct MapVertices<1,2>
00073 {
00074 static int mapVertices ( int subEntity, int i )
00075 {
00076 assert( (subEntity >= 0) && (subEntity < 3) );
00077 assert( (i >= 0) && (i < 2) );
00078 return ALBERTA AlbertHelp :: localTriangleFaceNumber[ subEntity ][ i ];
00079 }
00080 };
00081
00082
00083 template <>
00084 struct MapVertices<2,3>
00085 {
00086 static int mapVertices ( int subEntity, int i )
00087 {
00088 assert( (subEntity >= 0) && (subEntity < 4) );
00089 assert( (i >= 0) && (i < 3) );
00090 return ALBERTA AlbertHelp :: localDuneTetraFaceNumber[ subEntity ][ i ];
00091 }
00092 };
00093
00094
00095 template <>
00096 struct MapVertices<1,3>
00097 {
00098 static int mapVertices ( int subEntity, int i )
00099 {
00100 assert( (subEntity >= 0) && (subEntity < 6) );
00101 assert( (i >= 0) && (i < 2) );
00102 return ALBERTA AlbertHelp :: localEdgeNumber[ subEntity ][ i ];
00103 }
00104 };
00105
00106
00107 template <int cd>
00108 struct MapVertices<0,cd>
00109 {
00110 static int mapVertices ( int subEntity, int i )
00111 {
00112 assert( i == 0 );
00113 return subEntity;
00114 }
00115 };
00116
00117
00118 }
00119
00120 #ifdef __ALBERTApp__
00121 }
00122 #endif
00123
00124 #endif // HAVE_ALBERTA
00125
00126 #endif