|
phdMesh Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* phdMesh : Parallel Heterogneous Dynamic unstructured Mesh */ 00003 /* Copyright (2007) Sandia Corporation */ 00004 /* */ 00005 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00006 /* license for use of this work by or on behalf of the U.S. Government. */ 00007 /* */ 00008 /* This library is free software; you can redistribute it and/or modify */ 00009 /* it under the terms of the GNU Lesser General Public License as */ 00010 /* published by the Free Software Foundation; either version 2.1 of the */ 00011 /* License, or (at your option) any later version. */ 00012 /* */ 00013 /* This library is distributed in the hope that it will be useful, */ 00014 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 00015 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ 00016 /* Lesser General Public License for more details. */ 00017 /* */ 00018 /* You should have received a copy of the GNU Lesser General Public */ 00019 /* License along with this library; if not, write to the Free Software */ 00020 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */ 00021 /* USA */ 00022 /*------------------------------------------------------------------------*/ 00023 00024 #ifndef util_Basics_hpp 00025 #define util_Basics_hpp 00026 00027 namespace phdmesh { 00028 00035 //---------------------------------------------------------------------- 00043 template< bool expression > struct StaticAssert {}; 00044 00045 template<> struct StaticAssert<true> { 00046 enum { OK = true }; 00047 static bool ok() { return true ; } 00048 }; 00049 00050 //---------------------------------------------------------------------- 00051 // Selection of an integer type based upon sign and size 00052 00053 #ifndef DOXYGEN_COMPILE 00054 00055 template< 00056 unsigned size_char = sizeof( unsigned char ) , 00057 unsigned size_short = sizeof( unsigned short ) , 00058 unsigned size_int = sizeof( unsigned int ) , 00059 unsigned size_long = sizeof( unsigned long ) , 00060 unsigned size_ptr = sizeof( void * ) > 00061 struct IntegerFundamentalTypes ; 00062 00063 template<> 00064 struct IntegerFundamentalTypes<1,2,4,8,4> { 00065 typedef signed char int8_type ; 00066 typedef unsigned char uint8_type ; 00067 typedef signed short int16_type ; 00068 typedef unsigned short uint16_type ; 00069 typedef signed int int32_type ; 00070 typedef unsigned int uint32_type ; 00071 typedef signed long int64_type ; 00072 typedef unsigned long uint64_type ; 00073 typedef signed int intptr_type ; 00074 typedef unsigned int uintptr_type ; 00075 }; 00076 00077 template<> 00078 struct IntegerFundamentalTypes<1,2,4,8,8> { 00079 typedef signed char int8_type ; 00080 typedef unsigned char uint8_type ; 00081 typedef signed short int16_type ; 00082 typedef unsigned short uint16_type ; 00083 typedef signed int int32_type ; 00084 typedef unsigned int uint32_type ; 00085 typedef signed long int64_type ; 00086 typedef unsigned long uint64_type ; 00087 typedef signed long intptr_type ; 00088 typedef unsigned long uintptr_type ; 00089 }; 00090 00091 template<> 00092 struct IntegerFundamentalTypes<1,2,4,4,4> { 00093 typedef signed char int8_type ; 00094 typedef unsigned char uint8_type ; 00095 typedef signed short int16_type ; 00096 typedef unsigned short uint16_type ; 00097 typedef signed int int32_type ; 00098 typedef unsigned int uint32_type ; 00099 typedef signed long long int64_type ; 00100 typedef unsigned long long uint64_type ; 00101 typedef signed long intptr_type ; 00102 typedef unsigned long uintptr_type ; 00103 }; 00104 00105 template<> 00106 struct IntegerFundamentalTypes<1,2,4,4,8> { 00107 typedef signed char int8_type ; 00108 typedef unsigned char uint8_type ; 00109 typedef signed short int16_type ; 00110 typedef unsigned short uint16_type ; 00111 typedef signed int int32_type ; 00112 typedef unsigned int uint32_type ; 00113 typedef signed long long int64_type ; 00114 typedef unsigned long long uint64_type ; 00115 typedef signed long long intptr_type ; 00116 typedef unsigned long long uintptr_type ; 00117 }; 00118 00119 #endif /* DOXYGEN_COMPILE */ 00120 00121 typedef IntegerFundamentalTypes<>::int8_type int8_type ; 00122 typedef IntegerFundamentalTypes<>::uint8_type uint8_type ; 00123 typedef IntegerFundamentalTypes<>::int16_type int16_type ; 00124 typedef IntegerFundamentalTypes<>::uint16_type uint16_type ; 00125 typedef IntegerFundamentalTypes<>::int32_type int32_type ; 00126 typedef IntegerFundamentalTypes<>::uint32_type uint32_type ; 00127 typedef IntegerFundamentalTypes<>::int64_type int64_type ; 00128 typedef IntegerFundamentalTypes<>::uint64_type uint64_type ; 00129 typedef IntegerFundamentalTypes<>::intptr_type intptr_type ; 00130 typedef IntegerFundamentalTypes<>::uintptr_type uintptr_type ; 00131 00134 } // namespace phdmesh 00135 00136 #endif 00137
1.7.4