00001 //------------------------------------------------------------------------------ 00002 // 00003 // Thomas Berger (main author), Pepijn Schreinemachers, and Thorsten Arnold 00004 // 00005 // 00006 // Hohenheim University (490d) 00007 // Professorship for Land Use Economics in the Tropics and Subtropics 00008 // 00009 // May not be distributed without permission by main author 00010 // 00011 // File: MpmasWasimCouplingFunctions.h 00012 // 00013 // Contents: Contains some functions outsourced from MAIN that are only relevant 00014 // for WASIM couplng, which are NOT used outside of WASIM 00015 // 00016 // This file can contain MPMAS-specific classes 00017 //------------------------------------------------------------------------------ 00018 00019 //#include"MpmasWasimCouplingFunctions.h" 00020 #ifndef _MpmasWasimCouplingFunctions_h 00021 #define _MpmasWasimCouplingFunctions_h 00022 00023 #include <string> 00024 using namespace std; // fuer C++-Compiler, damit cin nicht als std::cin eingelesen werden muss 00025 00026 class Raster2D; 00027 class Raster3D; 00028 class MatrixDouble; 00029 class ausgabe; 00030 00031 // For testing 00032 void testUpdatingToParcelsAndGrids(); 00033 00034 // ------------------------------------------------------------ 00035 // Functions around COUPLING 00036 // --> start 00037 // ------------------------------------------------------------ 00038 00039 void MAS_initCoupling(); 00040 void MAS_couplingPrepareFile(); 00041 00042 // ===================================================================== 00044 // Link WASIM area to MPMAS area 00045 // 00046 // Read in Raster2D from filename, 00047 // then allocate all non-NODATA values, then determine MatrixDouble: 00048 // 00049 // minmax [ minRow, maxRow ] with first and last row with values 00050 // [ minCol, maxCol ] with first and last COL with values 00051 // 00052 // --> 00053 00054 void setCOUPLINGMINMAX(string fn); 00055 void setCOUPLINGMINMAX(MatrixDouble& minmax); 00056 // Copies global MatrixDouble to local copy 'minmax' 00057 void getCOUPLINGMINMAX(MatrixDouble& minmax); 00058 MatrixDouble& getCOUPLINGMINMAX(void); 00059 00060 // Returns first row 00061 int COUPLING_minRow(); 00062 // Returns first col 00063 int COUPLING_minCol(); 00064 // <-- 00065 00066 00067 00068 void DOWASIMCONTROLL(); 00069 void DOWASIM_createIrrigMap(int mTot, Raster2D& gisLU, Raster2D& gisQuant, MatrixDouble& keyMAT, int posIRR); 00070 int DOWASIM_loadKeyFile(string fn, MatrixDouble& keyMat); 00071 00072 00073 void initTDTvariables(); 00074 00075 //void receiveInflowMat_andExtract2(MatrixDouble& target); 00076 void receiveInflowMat_andExtract(MatrixDouble& medianMat); 00077 void writeInflowToFile(MatrixDouble& infl1, char* filename); 00078 00079 // Both Functions call COMMUNICATE_ALL_DATA, to ensure mirror order of data exchange 00080 // flag_SENDorRECEIVE == true : SEND 00081 // flag_SENDorRECEIVE == false : RECEIVE 00082 00083 void receiveRaster3D_couplingData(Raster3D& gis3D, bool RECEIVE_TDT, bool doprocessing, bool isIrrig); 00084 //void sendViaTDT_Raster3D_couplingData( bool RECEIVE_TDT, bool doprocessing, bool isIrrig); 00085 00086 00087 int receiveIntFromController(void); 00088 void sendIntToController(int val); 00089 00090 string updateGis3D_filenames(Raster3D& gis3D, string irrigYN); 00091 00092 // ------------------------------------------------------------ 00093 // Functions around COUPLING 00094 // <-- end 00095 // ------------------------------------------------------------ 00096 00097 // Function returns number of irriagion types 00098 void sendIrrigationQuantities_Raster(Raster2D& rasterIrrigationQuantity_mm, int numIrrigationActivities); 00099 00100 #endif 00101 00102