00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _MpmasWasimInterface_h
00021 #define _MpmasWasimInterface_h
00022
00023
00024 #include <string>
00025
00026 #include <stdio.h>
00027 #include <iostream>
00028 #include <fstream>
00029 using namespace std;
00030
00031 class ausgabe;
00032
00033 #ifdef AIX
00034 #include <unistd.h>
00035 #else
00036 #include <dos.h>
00037 #endif
00038
00039 class MatrixDouble;
00040 class Raster2D;
00041 class Raster3D;
00042 class classInputTable;
00043
00044
00045 enum enumActivityKeyNames
00046 {typeAKeyActivityID, typeAKeyLPCOL, typeAKeyPRICECOL, typeAKeyLPROW, typeAKeySOILCLASS, typeAKeyIPG,
00047 typeAKeyKRTYPE, typeAKeyKY, typeAKeyCROPTYPE, typeAKeyIRRMETHOD, typeAKeyYIELDMAX,
00048 typeAKeyIrrigEfficiency, typeAKeyLanduseMpmas, typeAKeyLanduseWasim, typeAKeyCropID,
00049 typeAKeyEND,
00050 matrixTypeAKeyMonthlyDemand, matrixTypeAKeyExpectations,
00051 finalAKey};
00052
00054
00055
00056
00057 void readActivityKey(ifstream& stream, string*& colNamesActivityKey, classInputTable& activityKey, MatrixDouble& matrixMonthlyWaterDemand, MatrixDouble& matrixMonthlyWaterExpectations);
00058 void readActivityKey(string fn, string*& colNamesActivityKey, classInputTable& activityKey, MatrixDouble& matrixMonthlyWaterDemand, MatrixDouble& matrixMonthlyWaterExpectations);
00059 void getKeyfileColumnNames(string*& colNamesActivityKey);
00060
00061 int readTable_ActivityKey_Lookup(MatrixDouble& lookup_CroppingActivity2WasimLanduse, string fnActivityKey);
00062 int readTable_CropKey_Lookup( MatrixDouble& lookupMatrix_LuMpmas_2_LuWASIM, string fnCropKey);
00063
00064 void addToLookup_CropKey(MatrixDouble& lookup_CroppingActivity2WasimLanduse, MatrixDouble& lookupMatrix_LuMpmas_2_LuWASIM);
00065
00066
00067 void translateIrrigQuant2WASIM(Raster2D& irrigIDs, Raster2D& gisCropAct,
00068
00069 Raster2D& gisIrrigQuant, MatrixDouble& MAT_IRRIGID, int maxExpansion);
00070
00071
00072
00073
00075
00076
00077
00078
00079
00080
00081
00082
00083 int rescale_CREATEMAP(
00084 Raster2D& C,
00085 Raster2D& f,
00086 Raster2D& gisLink_g2G,
00087 Raster2D& g,
00088 Raster2D& G,
00089 int& shift_f2g_row,
00090 int& shift_f2g_col
00091 );
00092
00093
00094 void rescale_G2f_old(
00095 Raster2D& G,
00096 Raster2D& gisLink_g2G,
00097 int shift_f2g_row,
00098 int shift_f2g_col,
00099 int ratio,
00100 Raster2D& gisTarget
00101 );
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 int rescale_CREATEMAP_f2G(
00114 Raster2D& C,
00115 Raster2D& f,
00116 Raster2D& G,
00117 Raster2D& gis_Link_f2G,
00118 MatrixDouble& mSHIFT
00119 );
00120
00121
00122 void rescale_C2f(
00123 Raster2D& C,
00124 Raster2D& gisLink_f2G,
00125 int Y_shift_C2G,
00126 int X_shift_C2G,
00127 Raster2D& gisTarget
00128 );
00129
00130 void rescale_f2G(Raster2D& gis_f, Raster2D& gis_L, Raster2D& gis_Gorig, Raster2D& gis_G);
00131
00132 void rescale_saveAll(string dirOut,
00133 Raster2D& gis_L,
00134 Raster2D& gis_G,
00135 Raster2D& gis_C,
00136 int Y_shift_C2G,
00137 int X_shift_C2G,
00138 int ratio
00139 );
00140
00141 void rescale_loadAll(string dirOut,
00142 Raster2D& gis_L,
00143 Raster2D& gis_G,
00144 int C_ycoord,
00145 int C_xcoord,
00146 int Y_shift_C2G,
00147 int X_shift_C2G,
00148 int ratio
00149 );
00150
00151 int ratio_getAndCheck(double nom, double div);
00152 int ratio_getAndCheck(int nom, int div);
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 void MAS_initCoupling();
00166
00167 int DOWASIM_loadKeyFile(string fn, MatrixDouble& keyMat);
00168
00169
00170 void initTDTvariables();
00171
00172
00173 void receiveInflowMat_andExtract(MatrixDouble& medianMat);
00174
00175
00176
00177
00178
00179 void receiveRaster3D_couplingData(Raster3D& gis3D, bool RECEIVE_TDT, bool doprocessing, bool isIrrig);
00180 void sendViaTDT_Raster3D_couplingData( bool RECEIVE_TDT, bool doprocessing, bool isIrrig);
00181
00182
00183 int receiveIntFromController(void);
00184 void sendIntToController(int val);
00185
00186
00187
00188
00189 string updateraster3D_filenames(Raster3D& gis3D, string irrigYN);
00190
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 void readMAS2WASIM_byKey(int expandFact, MatrixDouble& MAT_IRRIGID);
00204
00205 void readActivityKey(ifstream& stream, classInputTable& activityKey,
00206 MatrixDouble& matrixMonthlyWaterDemand,
00207 MatrixDouble& indexMonthlyWaterDemand,
00208 MatrixDouble& matrixMonthlyWaterExpectations,
00209 MatrixDouble& indexMonthlyWaterExpectations);
00210 void readActivityKey(string fn, classInputTable& activityKey,
00211 MatrixDouble& matrixMonthlyWaterDemand,
00212 MatrixDouble& indexMonthlyWaterDemand,
00213 MatrixDouble& matrixMonthlyWaterExpectations,
00214 MatrixDouble& indexMonthlyWaterExpectations);
00215
00216 string getKeyfileColumnNames(enumActivityKeyNames type);
00217 int readTable_ActivityKey_MAS2WASIM(MatrixDouble& MAS2WASIM, string fnActivityKey);
00218 int readTable_CropID2WasimLU(MatrixDouble& LUmas2Wasim, string fnCropKey);
00219
00220
00221 void addToMas2Wasim_LU_mas2wasim(MatrixDouble& MAS2WASIM, MatrixDouble& LUmas2Wasim);
00222
00223
00224
00225
00226
00227 #endif