00001
00002
00003
00004
00005
00006
00007 #ifndef _FV_DEFS_h__
00008 #define _FV_DEFS_h__
00009
00010
00011 #define FV_STRING(str) #str
00012 #define FV_STR(str) FV_STRING(str)
00013
00014 #define FV_SIZEOF_ARR(arr) (sizeof(arr)/sizeof((arr)[0]))
00015
00016
00017 #define COUNT_BITS(w) (sizeof(w) << 3)
00018 #define BOUNDARY_BIT_POS(w) (COUNT_BITS(w) -1)
00019 #define ACTIVE_BIT_POS(w) (COUNT_BITS(w) -2)
00020 #define STFACE_BIT_POS(w) (COUNT_BITS(w) -7)
00021 #define ELTYPE_BIT_POS(w) (COUNT_BITS(w) -8)
00022 #define EL_ID_BIT_COUNT(w) (COUNT_BITS(w) -9)
00023
00024
00025 #define FACE_TYPE_POS(w) (COUNT_BITS(w) -1)
00026
00027
00028 #define IS_BIT_SET(w, b) ((w) & (1U << (b)))
00029
00030
00031 #define SET_BIT(w, b) ((w) |= (1U << (b)))
00032
00033
00034 #define RESET_BIT(w, b) ((w) &= ~(1U << (b)))
00035
00036
00037 #define SET_OFFSET_BIT(w, b, o) SET_BIT(w,(b + o))
00038 #define USET_OFFSET_BIT(w, b, o) RSET_BIT(w,(b + o))
00039
00040
00041 #define SET_ACTIVE(w) SET_BIT(w, ACTIVE_BIT_POS(w))
00042 #define UNSET_ACTIVE(w) RESET_BIT(w, ACTIVE_BIT_POS(w))
00043 #define IS_ACTIVE(w) IS_BIT_SET(w, ACTIVE_BIT_POS(w))
00044
00045
00046 #define SET_BOUND(w) SET_BIT(w, BOUNDARY_BIT_POS(w))
00047 #define UNSET_BOUND(w) RESET_BIT(w, BOUNDARY_BIT_POS(w))
00048 #define IS_BOUND(w) IS_BIT_SET(w, BOUNDARY_BIT_POS(w))
00049
00050
00051 #define SET_STFACE0(w) SET_OFFSET_BIT(w, STFACE_BIT_POS(w), 0)
00052 #define SET_STFACE1(w) SET_OFFSET_BIT(w, STFACE_BIT_POS(w), 1)
00053 #define SET_STFACE2(w) SET_OFFSET_BIT(w, STFACE_BIT_POS(w), 2)
00054 #define SET_STFACE3(w) SET_OFFSET_BIT(w, STFACE_BIT_POS(w), 3)
00055 #define SET_STFACE4(w) SET_OFFSET_BIT(w, STFACE_BIT_POS(w), 4)
00056 #define SET_STFACEN(w, n) SET_OFFSET_BIT(w, STFACE_BIT_POS(w), n)
00057
00058
00059 #define UNSET_STFACE0(w) USET_OFFSET_BIT(w, STFACE_BIT_POS(w), 0)
00060 #define UNSET_STFACE1(w) USET_OFFSET_BIT(w, STFACE_BIT_POS(w), 1)
00061 #define UNSET_STFACE2(w) USET_OFFSET_BIT(w, STFACE_BIT_POS(w), 2)
00062 #define UNSET_STFACE3(w) USET_OFFSET_BIT(w, STFACE_BIT_POS(w), 3)
00063 #define UNSET_STFACE4(w) USET_OFFSET_BIT(w, STFACE_BIT_POS(w), 4)
00064
00065 #define IS_SET_FACEN(w, n) IS_BIT_SET(w, STFACE_BIT_POS(w) + (n))
00066
00067
00068 #define SET_TETRA(w) RESET_BIT(w, ELTYPE_BIT_POS(w))
00069 #define SET_PRISM(w) SET_BIT(w, ELTYPE_BIT_POS(w))
00070 #define IS_PRISM(w) IS_BIT_SET(w, ELTYPE_BIT_POS(w))
00071
00072
00073 #define ATTRIB_MASK 0xFF
00074
00075
00076 #define ELEM_ID(w) (w & ~(ATTRIB_MASK << EL_ID_BIT_COUNT(w)))
00077
00078
00079 #define ATTRIBS(w) (w >> EL_ID_BIT_COUNT(w))
00080
00081 #define MIN(a,b) ((a) < (b)) ? (a) : (b)
00082 #define MAX(a,b) ((a) > (b)) ? (a) : (b)
00083
00084 #define INVALID_LOCATION 0xFFFFFFFF
00085 #define FV_SMALL 1e-10
00086 #define FV_LARGE 10e10
00087 #define FV_LARGE_FLOAT FV_LARGE##f
00088
00089
00090
00091
00092
00093
00094 template<typename T>
00095 inline const T& fv_min(const T& lh,const T& rh) {
00096 return (lh < rh ? lh : rh );
00097 }
00098
00099 template<typename T>
00100 inline const T& fv_max(const T& lh,const T& rh) {
00101 return (lh > rh ? lh : rh );
00102 }
00103
00104 #ifndef fv_abs
00105 # define fv_abs(x) ((x) < 0) ? -(x) : (x)
00106 #endif
00107
00108
00109 #ifndef NULL
00110 #define NULL (void *)0
00111 #endif
00112
00113 template<typename T>
00114 inline void FV_FREE_ARR(T* ptr) {
00115 if(ptr) { delete [] ptr; ptr = 0; }
00116 }
00117
00118 template<typename T>
00119 inline void FV_FREE_PTR(T*& ptr){
00120 if(ptr) { delete ptr; ptr = 0; }
00121 }
00122
00123 template<typename T>
00124 inline void FV_FREE_MALOC(T*& ptr) {
00125 free(ptr); ptr = NULL;
00126 }
00127
00128 typedef struct {
00129 int curr_mesh_type;
00130 int curr_approx_type;
00131 } nodule_params;
00132
00133 #define LARGE_F 10e10
00134 #define MAX_ISO_VALUES 32
00135
00136
00137
00138
00139 #endif
00140