Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

CatchmentSectorAuxiliary.h

Go to the documentation of this file.
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:       CatchmentSectorAuxiliary.h (formerly part of sector.h)
00012 //
00013 //  Contents:   Class for irrigation methods and canal efficiency (EDIC)
00014 //
00015 //
00016 //
00017 //------------------------------------------------------------------------------
00018 
00019 
00020 #ifndef _CatchmentSectorAuxiliary_h
00021 #define _CatchmentSectorAuxiliary_h
00022 
00023 
00024 #include"BasicData.h"
00025 #include"MatrixDouble.h"
00026 
00027 
00028 //----------------------------------------------------
00030 //----------------------------------------------------
00031 
00032 
00033 typedef struct
00034 {
00035    string methodName;
00036    double methodSurfaceRunoffsNight;
00037    double methodPlantWaterAvailability;
00038    double methodSurfaceRunoff;
00039    double methodLateralFlows;
00040    double methodDeepPercolation;
00041    double sum;
00042 }  irrigationMethodData;
00043 
00044 class IrrigationMethod
00045 {
00046    public:
00047         //----------------------------------------------------------------------------------
00049 
00050       virtual int readAllIrrigationMethods(int catchmentID_);
00051       virtual void writeIrrigationMethods(string filename);
00052       virtual void writeIrrigationMethods(ofstream& out);
00053       virtual void writeHeader(ofstream& out);
00054       virtual void writeLineToFile(int i, ofstream& out);
00055       
00057         //----------------------------------------------------------------------------------
00059 
00060       virtual irrigationMethodData getIrrigationMethodData(int numMethod);
00061       virtual double getFlowShareByType(int numMethod, TypeEdicFlow typeFlow);
00062       virtual double getPlantShare(int numMethod);
00063       virtual double getPlantShare(int numMethod) const;
00064       virtual void setFlowShareByType(int numMethod, TypeEdicFlow typeFlow, double val);
00065       virtual string getMethodName(int numMethod);
00066 
00067       // nothing in base class!
00068       virtual void setRestOfValues(int numMethod, TypeEdicFlow typeFlow, double val);
00069       virtual double getRestOfFlows(int numMethod, int typeFlow) ;
00070       
00071       int getNumMethods(){return numMethods;};
00072       int getCatchmentID(){return  catchmentID;};
00073       virtual int getMaxType();
00075         //----------------------------------------------------------------------------------
00077 
00078       virtual void printToScreen();
00079       virtual void printHeader();   
00080       virtual void printLineToScreen(int i);
00081 
00082             
00084         //----------------------------------------------------------------------------------
00085 
00086       IrrigationMethod();      
00087       IrrigationMethod(int catchmentID_, int numMethods);
00088       IrrigationMethod(IrrigationMethod& copyClass);
00089 
00090       virtual ~IrrigationMethod();
00091 
00092       void initialize(IrrigationMethod& copyClass);
00093       void allocate();
00094       void allocateSpecific(int catchmentID_, int numMethods_);
00095       virtual void deallocate();
00096 
00097    protected:
00098       irrigationMethodData* IMdata;
00099    private:
00100       int catchmentID;
00101       int numMethods;
00102 
00103 };
00104 
00105 class IrrigationMethodSector : public IrrigationMethod
00106 {
00107  public:
00108 
00109         //----------------------------------------------------------------------------------    
00111 
00112       virtual void printToScreen_Sector();
00113 
00114       virtual void appendToFile_Sector(string fn);
00115       virtual void writeToFile_Sector(string fn);
00116       virtual void writeIntoStream_Sector(ofstream& out);
00118         //----------------------------------------------------------------------------------
00120 
00121       virtual double getB(typeIrrigationMethod);
00122       virtual double getG(typeIrrigationMethod);
00123       virtual double getL(typeIrrigationMethod);
00124       virtual double getCanalLosses(int numMethod);
00125                 //Access plant water availability through base class, function:
00126                 //virtual double getPlantShare(int numMethod);
00128         //----------------------------------------------------------------------------------
00129 
00131 
00132          virtual void  computeShrinkedProportionalFlows(double canalEfficiency);
00133          virtual void  computeCoefficientsBGL();
00135 
00136         //----------------------------------------------------------------------------------
00137       virtual void setRestOfValues(int numMethod, TypeEdicFlow typeFlow, double val);
00138       virtual double getRestOfFlows(int numMethod, int typeFlow); // nothing in base class!
00139       virtual int getMaxType();
00140 
00141       IrrigationMethodSector();
00142       IrrigationMethodSector(IrrigationMethod& IMcatchmentLevel, double canalEfficiency_, double beta_share);
00143       virtual ~IrrigationMethodSector();
00144 
00145       // Pendant to constructor
00146       void initializeInherited(IrrigationMethod& IMcatchmentLevel, double canalEfficiency_, double beta_share);
00147       void deallocate();
00148 
00149  private:
00150        // Actual construction of inherited class (both constructor and inherited)
00151       void updateDuringInitialize(double canalEfficiency_, double beta_share);
00152       void allocateInherited();
00153 
00154       double canalSurfaceShare;
00155       double canalEfficiency;
00156       double canalLateralLoss;
00157       double canalDeepPercolation;
00158       MatrixDouble coeffB_surface;
00159       MatrixDouble coeffG_lateral;
00160       MatrixDouble coeffL_losses;
00161 };           
00162 
00163 void testIrrigationMethodAll(IrrigationMethod IM, double channelEfficiency, double betaShare, string fn);
00164 
00165 #endif

Generated on Thu Aug 28 12:38:44 2008 for MPMAS by  doxygen 1.3.9.1