00001
00011 #ifndef __MACROSES_H__
00012 #define __MACROSES_H__
00013
00014 #include "memory_macroses.h"
00015 #include "debug_macroses.h"
00016
00018 #define CALC_VECTOR(N_S,N_E,V) (V)[0] = (N_E).array[0] - (N_S).array[0];(V)[2] = (N_E).array[2] - (N_S).array[2];(V)[1] = (N_E).array[1] - (N_S).array[1];
00019
00021 #define CALC_TRIANGLE_AREA(V1,V2) (0.5 * fabs((V1)[1] * (V2)[2] - (V1)[2] * (V2)[1] + (V1)[2] * (V2)[0] - (V1)[0] * (V2)[2] + (V1)[0] * (V2)[1] - (V1)[1] * (V2)[0]))
00022
00024 #define CALC_VECT_MULT(V1,V2,R) \
00025 R[0] = (V1)[1] * (V2)[2] - (V1)[2] * (V2)[1]; \
00026 R[1] = (V1)[2] * (V2)[0] - (V1)[0] * (V2)[2]; \
00027 R[2] = (V1)[0] * (V2)[1] - (V1)[1] * (V2)[0];
00028
00030 #define CALC_VECT_NORM(V) sqrt((V)[0] * (V)[0] + (V)[1] * (V)[1] + (V)[2] * (V)[2])
00032 #define CALC_GEOM_AVERAGE(D1,D2) ((D1) * (D2) / ((D1) + (D2)))
00033
00035 #define CALC_IJK_FROM_INDEX(IND,NX,NY,NZ,I,J,K) \
00036 (K) = (int)((IND) / ((NX) * (NY))); \
00037 (IND) -= (K) * (NX) * (NY); \
00038 (J) = (int)((IND) / (NX)); \
00039 (I) = (IND) - (J) * (NX);
00040
00042
00043 #define CALC_INDEX_FROM_IJK(IND,NX,NY,NZ,I,J,K) \
00044 IND = I + J * NX + K * NX * NY \
00045
00046
00048 #if defined(_UFASOLVER_DEMO_VERSION_) || defined(_SGM_KERNEL_DEMO_)
00050 #define DEMO_MAX_NUMBER_OF_ELEMENTS 1000
00052 #define DEMO_MAX_NUMBER_OF_WELLS 10
00054 #define CHECK_DEMO_VERSION(N) \
00055 if ((N) > DEMO_MAX_NUMBER_OF_ELEMENTS) \
00056 { \
00057 rep->print (LOG_INIT_SECTION, LOG_CRIT, \
00058 GET_TEXT ("\nSorry, but this DEMO version not support meshes larger than %d grid blocks.\n"), DEMO_MAX_NUMBER_OF_ELEMENTS); \
00059 rep->print (LOG_INIT_SECTION, LOG_CRIT, \
00060 GET_TEXT ("For purchase full version please email on bos@ngt.ru \nor see http://www.ngt.ru/soft/bos.html for more information.\n")); \
00061 return -13; \
00062 }
00064 #define CHECK_DEMO_WELLS(OBJECT,RET) \
00065 if ((OBJECT)->demo_well_count > DEMO_MAX_NUMBER_OF_WELLS) \
00066 { \
00067 rep->print (LOG_INIT_SECTION, LOG_CRIT, \
00068 GET_TEXT ("\nSorry, but this DEMO version not support number of wells greater than %d.\n"), DEMO_MAX_NUMBER_OF_WELLS); \
00069 rep->print (LOG_INIT_SECTION, LOG_CRIT, \
00070 GET_TEXT ("For purchase full version please email on bos@ngt.ru \nor see http://www.ngt.ru/soft/bos.html for more information.\n")); \
00071 return (RET); \
00072 }
00073 #endif // _UFASOLVER_DEMO_VERSION_
00074
00076 #define MIN(a,b) ((a)<(b)?(a):(b))
00078 #define MAX(a,b) ((a)<(b)?(b):(a))
00079
00080 #endif //__MACROSES_H__