00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MSL_DEFS_H
00019 #define MSL_DEFS_H
00020
00021 #ifndef PI
00022 #define PI 3.1415926535897932385
00023 #endif
00024 #ifndef INFINITY
00025 #define INFINITY 1.0e40
00026 #endif
00027 #ifndef sqr
00028 #define sqr(x) ((x)*(x))
00029 #endif
00030 #ifndef min
00031 #define min(x,y) ((x<y) ? x : y)
00032 #endif
00033 #ifndef max
00034 #define max(x,y) ((x>y) ? x : y)
00035 #endif
00036
00037 #ifndef MSL_GLOBAL_VARS
00038 #define MSL_GLOBAL_VARS
00039
00040 #include <fstream>
00041 #include <iostream>
00042 using namespace std;
00043
00044
00045 static std::ifstream _msl_fin;
00046 #endif
00047
00048 #define READ_OPTIONAL_PARAMETER(F)\
00049 _msl_fin.clear();\
00050 _msl_fin.open((FilePath+""#F"").c_str());\
00051 if (_msl_fin) {_msl_fin >> F;}\
00052 _msl_fin.close();\
00053
00054 #define READ_PARAMETER_OR_DEFAULT(F,D)\
00055 _msl_fin.clear();\
00056 _msl_fin.open((FilePath+""#F"").c_str());\
00057 if (_msl_fin) {_msl_fin >> F;}\
00058 else F = D;\
00059 _msl_fin.close();\
00060
00061 #define READ_PARAMETER_OR_ERROR(F)\
00062 _msl_fin.clear();\
00063 _msl_fin.open((FilePath+""#F"").c_str());\
00064 if (_msl_fin) {_msl_fin >> F; _msl_fin.close();}\
00065 else {cerr << "Error reading "#F"\n"; exit(-1);}\
00066 _msl_fin.close();\
00067
00068
00069 #define forall(x,S)\
00070 for (x = S.begin(); x != S.end(); x++)\
00071
00072 #endif
00073
00074
00075