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

AgentParcelList.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:       AgentParcelList.h (formerly pliste.h)
00012 //
00013 //  Contents:   Manages linked list of all parcels held by one agent
00014 //
00015 //
00016 //
00017 //------------------------------------------------------------------------------
00018 
00019 
00020 #ifndef _AgentParcelList_h
00021 #define _AgentParcelList_h
00022 
00023 
00024 
00025 #include "AgentParcel.h"
00026 #include "MarketNonTradablesBid.h"
00027 //Arnold2006_42
00028 #include "GridCellHandler.h"
00029 
00030 
00031 class p_liste
00032 {       protected:
00033         int sc_nr;      //Subcatchment-Nummer
00034         int b_nr;       //Betriebsnummer
00035 
00036         int panzahl;
00037         int letzte_p_nr;
00038 
00039         int*    MainTypeInNRU;  //neu 2004 TSPC model
00040         int**   NumPlotsInNRU;  //neu 2004 TSPC model
00041         double* avgSlNRU;       //neu 2004 TSPC model
00042         double* avgSeNRU;       //neu 2004 TSPC model
00043 
00044         parzelle* firstParzelle;
00045         parzelle* lastParzelle;
00046         parzelle* merkeParzelle;//wird für suche_naechsten() gebraucht
00047 
00048         virtual void initialize(void);
00049 
00050         public:
00051         p_liste(int, int);
00052         //Arnold2006_45
00053         p_liste();
00054 
00055         virtual ~p_liste()
00056         {  liste_loeschen();
00057         }
00058 
00059         //Initialisierungsliste
00060         //      virtual void b_und_sc_nummer(int, int);//teilt Liste ihre Nummern zu
00061 
00062         //Übergabe: x, y, Bodentyp, Betriebsnr., Sc-, Sek-nr., Zustand, Entf.
00063         virtual void parzelle_anlegen(int,int,int,int,int,int, int = 1,double = 0.0);
00064         virtual void deallokieren(parzelle*);//deallokiert eine Parzelle
00065         virtual void einfuegen(parzelle*);//fügt ein Parzelle ein
00066         virtual int get_anzahl(void);//liefert Anzahl aller Eigentumsparzellen
00067         virtual int get_anz_typ(int soilType);//Anzahl der Eigentumsparzellen eines Typs
00068         virtual int get_nummer(void);//liefert zuletzt vergebene Parzellennummer
00069         virtual int get_hofx();//x-Koordinate der Hofstelle
00070         virtual int get_hofy();//y-Koordinate der Hofstelle
00071 
00072         virtual parzelle* parzelle_suchen(int z, int s);
00073         virtual parzelle* erste_suchen(int);//übergeben wird der Bodentyp
00074         virtual parzelle* naechste_suchen(int);//übergeben wird der Bodentyp
00075         virtual parzelle* letzte_suchen(int);//übergeben wird der Bodentyp
00076         virtual parzelle* vorherige_suchen(int);//übergeben wird der Bodentyp
00077         virtual parzelle* fernste_belegt(int);//übergeben wird Bodenklasse
00078         virtual parzelle* getFirst();//liefert Listenerste
00079         virtual parzelle* getLast();//liefert Listenletzte
00080 
00081 
00082         //die folgenden Funktionen belegen bzw. geben Parzellen mit Dauerkulturen
00083         //einer Bodenklasse frei. Übergabe: jeweilige Gesamt-Dauerkulturfläche,
00084         //zu verändernde Dauerkulturfläche
00085         virtual void obst_parzellen_belegen(double, double); //substitute ## soil
00086         virtual void forst_parzellen_belegen(double, double); //substitute ## soil
00087         virtual void blockHectaresInParcelsForPermanentCrops(int soilType, double existingHa, double deltaHa, string outputStr);
00088 
00089         virtual double typ_parzellen_belegen(int, double); //substitute ## soil
00090         virtual double blockParcels(int soilType, double sizeHa);
00091 
00092         virtual void obst_parzellen_freigeben(double, double); //substitute ## soil
00093         virtual void forst_parzellen_freigeben(double, double);//substitute ## soil
00094         virtual void freeHectaresInParcelsForPermanentCrops(int soilType, double totalHa, double reductionHa);
00095 
00096         //übergeben wird bei den folgenden Elementfunktionen der Bodentyp
00097         virtual parzelle* verpachtbare_suchen(int);//sucht die hoffernste Parzelle
00098         virtual double get_maxTK(int);
00099 
00100         virtual parzelle* parzelle_herausnehmen(parzelle*);
00101         virtual double freie_parzelle_verkaufen(int, w_rechte*, double, int);
00102         virtual double belegte_parzelle_verkaufen(int, w_rechte*, double,int); //## soil
00103         virtual double hofparzelle_verkaufen(w_rechte*, double, int);
00104 
00105         //bildet ein Pachtgebot und leitet es an den Sektor-Pachtmarkt weiter
00106         //Übergabe: Sektornr, Typ, zu transferierende monatliche Wasservolumina bzw.
00107         //Übergabe: Sektornr, Typ, Maximalentfernung
00108         virtual void verpachten(int, int, w_jahr*);            //neu 2003
00109         virtual void zupachten(int, int, double, w_jahr*);      //neu 2003
00110         virtual void alles_verpachten(int, w_jahr*);//verpachtet alle Parzellen
00111         virtual void verpachtet_belegen(int z, int s);
00112         virtual void verpachtungen_aufloesen();
00113         virtual double entfernungskosten_aktualisieren();
00114 
00115         //neu 2004 TSPC crop-soil model
00116         virtual void makeConvVector(void);
00117         virtual void makeConvMatrix(void);
00118         virtual void makeAvSlVector(void);
00119         virtual void makeAvSeVector(void);
00120         virtual void makeMTypesInNRUs(void);
00121         virtual int getMTypeForNRU(int nru);//returns main soil type in NRU
00122         virtual int getNRUForMType(int typ);//returns NRU of main soil type
00123         virtual int getNumPlotsInNRU(int nru);
00124         virtual int getNRUForType(int typ);
00125         virtual int getFreeNRU(void);
00126         virtual double getAvSlNRU(int nru);
00127         virtual double getAvSeNRU(int nru);
00128         virtual void assignPlotsToNRUs(int*& sTypes);
00129         virtual void mergeSoilTypes(int& numTypes, int*& sTypes, int*& typToTyp);
00130         virtual void assignNRUsToPlots(void);
00131         virtual void initValuesNRUs(int sk_nr);
00132         virtual parzelle* searchFirstNRU(int nru);
00133         virtual parzelle* searchNextNRU(int nru);
00134         virtual sProc* getSProcNRU(int nru);
00135         virtual lUseH getLUseHNRU(int nru);
00136         virtual void calcYields(int kID, int fID, int nru, crpMixNRU*& cmNRU);
00137 
00138         //Arnold2008_08 ERASE 11.08.2008 20:13:43
00139         //virtual void updateAllParcelsToGrid(void);
00140         //updates (some) data to GRID-Cells
00141         
00142         //Arnold2008_08 NEW 11.08.2008 20:13:49
00143    // update parcels -> cells
00144    virtual void copyContent_Parcels2Landscape(Content cont);
00145    virtual void copyContent_Parcels2Landscape_monthly(Content cont, int m);
00146    // update cells -> parcels
00147    
00148         virtual void copyContent_Landscape2Parcels(Content cont); 
00149         virtual void copyContent_Landscape2Parcels(Content cont, bool flag_fixCopyToCell); 
00150    virtual void copyContent_Landscape2Parcels_monthly(Content cont, int m);
00151 
00152    // ... currently only for testing
00153    virtual double getMeanOfAllParcels(Content cont);    
00154         
00155         
00156         virtual void printToScreen(parzelle*);
00157         virtual void printOnScreen_list(void);
00158         //erases all Parzellen
00159         virtual void liste_loeschen(void);
00160 
00161         virtual void writeParcelDataInStrm(FILE* stream0,
00162                 int agID,
00163                 int scID,
00164                 int skID,
00165                 int fsID,
00166                 int poID,
00167                 int clID,
00168                 int nwID,
00169                 int sgID,
00170                 int expT,
00171                 int colr,
00172                 int numP);
00173         //Arnold2006_12
00174         virtual void writeAllParcelsToFile(ofstream& out);
00175         //Arnold2006_12
00176         virtual void writeAllParcelsToFileBackwards(ofstream& out);
00177 
00178         //Agent2006_37
00179 //   virtual rcCoord allocateOneHaToActivity(int crA);
00180         virtual parzelle* allocateOneHaToActivityPP(int crA);
00181 
00182         //Arnold2006_46
00183         //leaves parzellen, only advisable if just including pointers!
00184         virtual void clearList(void);
00185 
00186         //Arnold2006_53
00187         // find position of a parcel "searchParcel" in list p_liste, accordiong to row/col position
00188         virtual int getPosInList(parzelle* searchParcel);//returns position (from beginning) of parcelle in List
00189         //Arnold2006_53
00190         //Append one parcel to end of list, returns new length of list
00191         virtual int append(parzelle* newParcel);
00192         //Arnold2006_54
00193         virtual int get_len(void);//returns length of list in memory
00194 
00195         //Agent2006_52
00196         // p_liste is NOT the list from agentF ("bflaech"), but rather
00197         // the list in crpMixClass.p_liste* "ParcelList"
00198 //   virtual void updateIrrigWaterCropMixClass2Parcels(double iQ, int m);
00199 
00200 
00201 };
00202 
00203 
00204 #endif
00205 

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