ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
ALMaSS Landscape and Associated Classes MIDox Documentation

Created by:
Chris J. Topping(1) & Elżbieta Ziółkowska(1,2)
1 - Social Ecological Systems Simulation Centre, Department of Ecoscience, Aarhus University, Building 1110, 428 CF Møllers Alle 8, 8000 C Aarhuse, Denmark
2 - University Jagielloński, Krakow, Poland

Last updated 25th January 2023


Introduction

The Landscape Class is a large class with multiple functionalities, providing the interface to all environmental information required to run all ALMaSS agent-based and subpopulation models.
The landscape class is initialised at the start of any ALMaSS simulation. This process sets up many of the major data structures and classes used by the simulation and as such is a critical part of the ALMaSS simulation system. The main sections will be further detailed below but include creating the internal representation of the map and associated classes, setting up the FarmManager class and all farm information, simulation of habitat patch development including vegetation modelling, miscellaneous functions associated with implementing behaviour in species models, modifying the input data or generating output for subsequent use.
This documentation provides an entry point for navigating the C++ code and the Landscape and associated class functionality.

Aims & Purposes

The purpose of the classes described in this documentation is to provide a dynamic and as far as possible realistic landscape simulation to be used on its own or as an environment in which to run other ALMaSS models. The Landscape should provide information on the topographical structure of the physical landscape, and details of the management carried out on these areas, together with the vegetation structure and other environmental descriptors.

Model in brief

The landscape simulation is built around the Landscape class, see The Landscape Class which contains an interface to all environmental and management information. The Landscape class itself has minimal functionality but is dependent on a number of associated classes for the detailed function. Key blocks of classes related to:

  • Farms and farm management, including crops see Farms and farm management, including crops
  • Habitat patches see LE & Associated Classes
  • The landscape map see The Raster Map
  • Pesticides etc. see Pesticide and related classes
  • Classes for the weather and date management see Weather and Calendar

Scheduling

Landscape::TurnTheWorld is called once per day by the main model program loop. TurnTheWorld is a wrapper for Landscape::Tick, which is responsible for calling all associated class scheduling methods. These methods are Calendar::Tick, Weather::Tick, LE::Tick, FarmManager::FarmManagement, Pesticide::Tick, and RodenticideManager::Tick and are called in the order specified here. Each of these tick methods carries out the required behaviour for its class for that day.
Note that the map is assumed to be static during a simulation run, so that the information contained within a habitat patch may change, but the size, shape and location of that patch will be static during any simulation run.
Although the landscape works on a daily time step, species models may work on faster times e.g. bees work on 10-minute time steps. Therefore, the once exception to the daily time step rule for landscape classes is the calendar, which may require running at smaller than daily steps.

Implementation details

Weather and Calendar

The Weather and Calendar classes have only minimal behaviour in themselves. They are primarily data suppliers.

The Weather Class

The weather input file is specified by the configuration variable l_map_weather_file and accessed through the configuration file with the key MAP_WEATHER_FILE (string). The default value is "weather.pre". See IO below for details. The main scheduling is managed through the Tick method, but otherwise the Weather class has no functionality except for supplying the data on weather requested by the simulation.

Control and calculation methods

Weather::Tick is the daily updating method. Tick is responsible for calculating the following set of derived values:

Weather::DeriveSnowCover Calculates the snow cover if snow cover is not available as data input.

Weather::DeriveSoilTemp Calculates the soil temperature from air temperature if soil data is not available.

Weather::readWeatherFile is the standard weather file input method. This reads the daily values for all input fields. Temperature, rainfall and windspeed are compulsory values, but snowcover, humidity, soil temperature, twilight soil temperature, minimum and maximum temperature, and bee flying hours are optional inputs read in dependent on user defined flags in configuration variables: l_map_weather_file l_weather_minmaxtemp l_weather_radiation l_weather_soiltemp l_weather_snowcover l_weather_relhumidity l_weather_soiltemptwilight, and l_weather_flyinghours

Weather::readWeatherFileHourly In the case of models needing hourly weather then this method is used instead of the readWeatherFile method. Here the difference is that temperature, rainfall, windspeed and sunshine hours are all read in in 24 data points per day.

The Calendar Class

The calendar class manages dates and associated features for the simulation. This manages all time keeping for activities working on a daily basis, and tracks the progress of the simulation through simulated time.

The Main Tick method

The Calendar::Tick method controls the passage of time in days and is responsible to updating the day, month, and year. The calendar assumes that every year has 365 days, therefore the 29th February in leap years is ignored. It sets the following attributes, which are accessed through a set of interface functions:

Other Tick functions

These three methods allow for shorter than day time keeping. The returns value for the next three methods indicates whether the global Tick() should be called for the whole landscape model. Order matters here, so this cannot just be done internally within the Calendar class.
If a model needs a minute time step then Calendar::TickMinute is used to increment Calendar::m_minutes, if m_minutes becomes 60 it is reset to 0 and Calendar::TickHour is called. Similarly if Calendar::m_hours becomes 24, it is reset to 0 and the main Tick function called. TickMinute10 is provided to replace TickMinute when 10-minute time steps are used.

Daylength Calculation

Calendar::CreateDaylength is responsible for calculation of the day length based on the landscape input providing the latitude and longitude. This uses the calculator provided in the Sunset library Copyright (GPL) 2004 Mike Chirico mchir.nosp@m.ico@.nosp@m.comca.nosp@m.st.n.nosp@m.et. This provides the SunSet class, from which CreateDayLength draws its main functions. CreateDayLength is called at the start of the simulation and creates the daylength, sunrise and sunset times for each day of the year based on the location and the angle of the sun to calculate the time sunrise/set occurs.

Calendar Interface Functions

The interface functions are listed below preceded with their return type:
int Calendar::DayInYear( int a_day, int a_month ) returns the Julian day for a day & month combination
long Calendar::Date returns m_date
int Calendar::DayInYear returns m_day_in_year
long Calendar::OldDays returns m_olddays
long Calendar::GlobalDate returns the simulation global date for the day, month and year supplied
int Calendar::DayLength returns m_todayslength
int Calendar::DayLength(int a_day_in_year) returns the daylength for the day specified in a_day_in_year
int Calendar::SunRiseTime returns m_todayssunrise
int Calendar::SunSetTime returns m_todayssunset
int Calendar::SunRiseTime(int a_day_in_year) returns the sunrise time for a day in the year
int Calendar::SunSetTime(int a_day_in_year) returns the sunset time for a day in the year
int Calendar::GetFirstYear returns m_firstyear
int Calendar::GetLastYear returns m_lastyear
int Calendar::GetYear returns m_year
int Calendar::GetYearNumber returns m_simulationyear
int Calendar::GetMonth returns m_month + 1 (the calendar month)
int Calendar::GetMinute returns m_minutes
int Calendar::GetHour returns m_hours
int Calendar::GetDayInMonth returns m_day_in_month
double Calendar::GetDaylightProportion returns m_daylightproportion
bool Calendar::JanFirst returns m_janfirst
bool Calendar::MarchFirst returns m_marchfirst
void Calendar::SetFirstYear( int a_year ) Sets m_firstyear as a_year
void Calendar::SetLastYear( int a_year ) Sets m_lastyear a a_year
}
bool Calendar::ValidDate( int a_day, int a_month ) Checks whether a combination of day and month is a valid date

The Raster Map

Raster Map class

The class RasterMap holds the data and functionality associated with the topography. RasterMap has only one job and that is hold the physical map information in an accessible raster format. The elements of the raster are references to LE instances (see below). Each LE instance represents a habitat patch. RasterMap::Init reads a binary '.lsb' file into memory populating RasterMap::m_map with LE reference numbers in an array of integers RasterMap::m_width by RasterMap::m_height in size. It also reads an 12 character ID number RasterMap::m_id identifying the lsb map.

Interface Functions

RasterMap::MapWidth returns m_width
RasterMap::MapHeight returns m_height
RasterMap::GetID returns m_id
RasterMap::Get( int a_x, int a_y ) This is the main interface function, it returns the raster value (LE reference) at a_x, a_y coordinates
RasterMap::GetMagicP( int a_x, int a_y ) This returns a pointer to a location in the raster map given by a_x, a_y
RasterMap::Put( int a_x, int a_y, int a_elem ) This sets the raster value (LE reference a_elem) at a_x, a_y coordinates

Other functions

There are three other functions associated with manipulations of the input map. RasterMap::ellReplacementNeighbour replaces a cell location with the most common cell value from the surrounding 8 cells. MissingCellReplace removes missing polygon. RasterMap::MissingCellReplace and RasterMap::MissingCellReplaceWrap also fill in missing cells from neigbours, but will preferentially select field cells. MissingCellReplaceWrap is used when cells are on the edge of the map.

The Landscape Class

The main class and linkage point for all other classes for the landscape simulation. This class contains a large number of interface functions, many of them are specialised for individual species e.g. Landscape::SupplyGooseGrazingForageH, however, it also contains the landscape simulation initialisation and main loops, as well as a number of manipulations of the landscape data. The main functionality is however provided by the associated classes, instances of which are created as attributes of this class. These key entities are:

The main data structure held by this class is related to holding the habitat patches information. The vector of integers Landscape::m_polymapping is a list of the mapping of the polygon numbers to their index in Landscape::m_elems which is the list of the LE instances representing the habitat patches in the landscape. In most optimised landscapes the m_elems index and polygon (LE) number are the same, but this is not compulsory.

Important methods

Landscape::Landscape The Landscape constructor. The landscape constructor sets up all the mapping, environment and management for the landscape simulation.
Landscape::~Landscape The Landscape destructor
Landscape::Tick The method that keeps landscape time, its called once per day to carry out all the daily activities
Landscape::TurnTheWorld Identical to Tick, just a wrapper for backwards compatibility
Landscape::ReadPolys1 Is used to take a look in the input file for polygons to figure out what the format is (since multiple formats are allowed).
Landscape::ReadPolys2 Based on the format of the file (since multiple formats are allowed), this reads the polygon information from an input file. This method sets up the Landscape::m_polymapping lookup table, checks validity of polygon and associated farm information and creates the LE instances to populate the Landscape::m_elems array, and if needed creates the links between unsprayed margins and the owner tole type.
Landscape::RunHiddenYear This is a short version of the landscape loop. It is used to run the first year from Jan 1st before any other models are run. This allows the landscape simulation to ‘burn-in’ and thus it should start the simulation properly at the beginning of the real model runs

Interface Functions

These are numerous, listed below with a short description of their use:
Landscape::SupplyPolyRef Get the in map polygon reference number from the x,y location
Landscape::SupplyUMRef Get the unsprayed margin reference number from the polygon at x,y
Landscape::SupplyPolyLEptr Get the pointer to the LE object associated with the polygon at x,y location or by using the polygon reference
Landscape::SupplyPolyRefIndex Get the index to the m_elems array for a polygon at location x,y
Landscape::SupplyPolyRefCC Get the in map polygon reference number from the x,y location, and correcting for possible wrap around coordinates
Landscape::SupplyPolyListPtr Returns the pointer to m_elemns
Landscape::SupplySimAreaWidth Gets the landscape width
Landscape::SupplySimAreaHeight Gets the landscape height
Landscape::SupplySimAreaMaxExtent Returns which ever is larger, height or width of landscape
Landscape::SupplySimAreaMinExtent Returns which ever is smaller, height or width of landscape
Landscape::SupplyNumberOfPolygons Returns the number of polygons in the landscape
Landscape::SupplyElementTypeFromVector Gets the TTypesOfVegetation type of a polygon using the m_elems index
Landscape::SupplyOwner_tole Gets the farm owner reference of a polygon, or -1 if not owned by a farmer
Landscape::SupplyPolyRefVector Gets the polygon reference number from the index to m_elems Landscape::SupplyVegPhase Returns the current vegetation growth phase for a polygon
Landscape::SupplyPestIncidenceFactor Returns Landscape::m_pestincidencefactor
Landscape::SetPolymapping Sets a an entry in the polymapping to a specific value
Landscape::GetPolymapping Returns the value of the m_polymapping array indexed by a_index
Landscape::SupplyMaxPoly Returns the size of the Landscape::m_elems vector.
Landscape::GetAllVegPolys Creates a vector containing a list of all the polygons that do not have tov_None as the vegetation type
Landscape::HowManyPonds Returns the number of ponds in the landscape
Landscape::SupplyRandomPondIndex Returns a random pond index
Landscape::SupplyRandomPondRef Returns a random pond polyref
Landscape::SupplyPondIndex Returns the index of a pond based on pondref or -1 if not found
Landscape::SupplyFarmPtr Get a pointer to a farm owned by a farmer with a specific farm reference number
Landscape::SupplyFarmManagerPtr Returns m_FarmManager, the pointer to the farm manager instance
Landscape::SupplyRasterMap Returns m_land a pointer to the raster map instance
Landscape::SupplyLargestPolyNumUsed Returns m_LargestPolyNumUsed
Landscape::SupplyShouldSpray Returns m_toxShouldSpray, a flag indicating whether pesticide should be sprayed
Landscape::SupplyCountryCode Returns m_countryCode e.g. “DK” for Denmark
Landscape::SupplyTimezone Returns the number of hours relative to GMT based on the country code
Landscape::SetCountryCode Sets m_countryCode
Landscape::SupplyLandscapeName Gets the current landscape name
Landscape::SetSpeciesFunctions This is the jumping off point for any landscape related species setup. It creates function pointers to these special functions
Landscape::SupplyLatitude Returns m_latitude
Landscape::SupplyLongitude Returns m_longitude, the longitude of the landscape location
Landscape::SetLatitude Sets the latitude of the landscape location
Landscape::SetLongitude Sets the longitude of the landscape location
Landscape::SupplyVegDigestibilityVector Gets the digestibility of the vegetation based on an index to the Landscape::m_elems array
Landscape::SupplyVegDigestibility Gets the digestibility of the vegetation for a polygon given by a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyVegHeightVector Returns the height of the vegetation using the index to Landscape::m_elems
Landscape::SupplyVegHeight Returns the height of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyVegBiomassVector Returns the biomass of the vegetation using the index a_index to Landscape::m_elems
Landscape::SupplyVegBiomass Returns the biomass of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyVegDensity Returns the density of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyWeedBiomass Returns the weed biomass of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyPollen Returns information on the pollen produced by the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyNectar Returns information on the nectar produced by the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplySugar Returns information on the sugar produced by the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyPollenQuantity Returns the pollen quantity produced by the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyNectarQuantity Returns the XXX of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyTotalNectar Returns the nectar quantity produced by the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyTotalPollen Returns the sugar quantity produced by of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyNecDD Returns the current day degree sum for nectar production of the vegetation using the polygon reference number a_polyref
Landscape::SupplySugDD Returns the current day degree sum for sugar production of the vegetation using the polygon reference number a_polyref
Landscape::SupplyPolDD Returns the current day degree sum for pollen production of the vegetation using the polygon reference number a_polyref
Landscape::SupplyGreenBiomass Returns the green biomass of the vegetation using the polygon reference number a_polyref
Landscape::SupplyGreenBiomassProp Returns the green biomass as a proportion of biomass of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyVegGrowthStage Returns the vegetation growth stage of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyDeadBiomass Returns the dead biomass of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyLAGreen Returns the green leaf area of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyLATotal Returns leaf area in total of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyVegCover Returns the vegetation cover proportion of the vegetation using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyVegCoverVector Returns the vegetation cover proportion of the vegetation using the polygon index to Landscape::m_elems
Landscape::SupplyLastSownVeg Returns the last type of vegetation sown on a field using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyLastSownVegVector Returns the last type of vegetation sown on a field using the polygon index to Landscape::m_elems
Landscape::SupplyInsects Returns the insect biomass on a polygon using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyOpenness Returns the openness measure for a polygon using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplySoilType Returns the soil type in ALMaSS types reference numbers. See # TTypesOfSoils
Landscape::SupplyCentroid Returns the centroid of a polygon using the polygon reference number a_polyref
Landscape::SupplyCentroidIndex Returns the centroid of a polygon using the polygon index in m_elems
Landscape::SupplyCentroidX Returns the centroid x-coordinate of a polygon using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyCentroidY Returns the centroid y-coordinate of a polygon using the polygon reference number a_polyref or based on the x,y coordinates given by a_x, a_y
Landscape::SupplyLargeOpenFieldsNearXY Returns a pointer to a list of polygonrefs to large open fields within a range of location x,y
Landscape::SupplyFarmIntensity Returns the farm intensity classification of the polygon using the polygon reference number a_polyref or coordinates a_x, a_y
Landscape::SupplyFarmIntensityI Returns the farm intensity classification of the polygon using the polygon index in m_elems
Landscape::SupplyElementType Returns the landscape type of the polygon using the polygon reference number a_polyref or coordinates a_x, a_y. Returns the value as a TTypesOfLandscapeElement
Landscape::SupplyElementTypeCC Returns the landscape type of the polygon using coordinates a_x, a_y, but allowing correction of coordinates for out of scope values. Returns the value as a TTypesOfLandscapeElement
Landscape::GetOwner_tole Returns the landscape type of the polygon owner (used in cases relating to e.g. unsprayed field margins) using coordinates a_x, a_y. Returns the value as a TTypesOfLandscapeElement
Landscape::SupplyCountryDesig Returns the designation of country or urban of the polygon using coordinates a_x, a_y
Landscape::SupplyElementSubType Returns the landscape element sub-type of the polygon using the polygon reference number a_polyref or coordinates a_x, a_y
Landscape::SupplyVegType Returns the vegetation type of the polygon using the polygon reference number a_polyref or coordinates a_x, a_y. Returns the value as a # TTypesOfVegetation
Landscape::SupplyVegTypeVector Returns the vegetation type of the polygon using the polygon index to m_elems. Returns the value as a # TTypesOfVegetation
Landscape::SupplyGrazingPressureVector Returns the grazing pressure of the polygon using the polygon index to m_elems.
Landscape::SupplyGrazingPressure Returns the grazing pressure of the polygon using the polygon reference number a_polyref or coordinates a_x, a_y
Landscape::SupplyPolyWithFlowers Returns m_poly_with_flowers, a list of polygons with flowering modelled
Landscape::SupplyVegPatchy Returns whether the polygon referenced by a_polyref or a_x, a_y has a vegetation type designated as patchy
Landscape::SupplyHasTramlines Returns whether the polygon referenced by a_polyref or a_x, a_y has a vegetation type with tramlines
Landscape::SupplyJustSprayedVector Returns whether the polygon referenced by an index to Landscape::m_elems has been sprayed in the last timestep
Landscape::SupplyJustSprayed Returns whether the polygon referenced by a_polyref or a_x, a_y has been sprayed in the last timestep
Landscape::SupplyTreeAge Returns the tree age for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyVegAge Returns the vegetation age for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyFarmOwner Returns the farm owner pointer for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyFarmOwnerIndex Returns the farm owner reference number for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyJustMownVector Returns the whether the vegetation was mown for the polygon referenced the index to Landscape::m_elems
Landscape::SupplyJustMown Returns the whether the vegetation was mown for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyFarmType Returns the farm type for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyNumberOfFarms Returns the number of farms in the current landscape
Landscape::SupplyFarmRotFilename Returns filename for the rotation file (if any) for the polygon referenced by a_polyref or a_x, a_y
Landscape::SupplyFarmArea Returns the farm area of a farm that owns a particular polygon
Landscape::SupplyPolygonAreaVector Returns the polygon area of a particular polygon using an index to m_elems
Landscape::SupplyPolygonArea(int a_polyref) Returns the polygon area of a particular polygon referenced by polygon number
Landscape::SupplyGrainDist Returns m_grain_dist, a binary condition for good or bad years of spilled grain
Landscape::SetGrainDist Sets m_grain_dist, a binary condition for good or bad years of spilled grain
Landscape::SupplyInStubble Returns whether the polygon is cereal in stubble
Landscape::GrazeVegetation Removes grazing forage from a poly per m2
Landscape::GrazeVegetationTotal Removes grazing forage from a poly and divides this out per m2
Landscape::Set_all_Att_UserDefinedBool Used to classify the user defined bool attribute and set it - this requires supplying the correct classification function. For example if the polygons should be classified as hare habitats a function needs to be passed that classifies TTypesOfLandscapeElement as true or false
Landscape::Set_all_Att_UserDefinedInt Used to classify the user defined integer attribute and set it - this requires supplying the correct classification function. For example if the polygons should be classified as hare habitats a function needs to be passed that classifies TTypesOfLandscapeElement as true or false
Landscape::SupplyValidX Returns an x-coordinate guaranteed to be within the polygon referenced
Landscape::SupplyValidY Returns an y-coordinate guaranteed to be within the polygon referenced
Landscape::Set_TOLE_Att Uses a point to an LE instance and sets all the attributes based on its tole type
Landscape::Set_TOV_Att Uses a point to an LE instance and sets all the attributes based on its tov type

This set of methods are all used to determine characteristics of a landscape polygon based on its vegetation type:
Landscape::ClassificationVegGrass Returns whether a vegetation type is classified as Grass
Landscape::ClassificationVegCereal Returns whether a vegetation type is classified as cereal
Landscape::ClassificationVegMatureCereal Returns whether a vegetation type is classified as cereal grown to maturity
Landscape::ClassificationVegGooseGrass Returns whether a vegetation type is classified as Goose Grass
Landscape::ClassificationVegMaize Returns whether a vegetation type is classified as maize
Landscape::ClassificationPermCrop Returns whether a vegetation type is classified as a permanent crop

Pesticide and Related Interface Functions

Landscape::SupplySeedCoating Gets total seed coating for the centroid of a polygen for a particular pesticide given for PlantProtectionProducts a_ppp
Landscape::SupplyPesticideDecay Returns true if there is any pesticide in the system at all at this polygon
Landscape::SupplyPesticide Gets total pesticide for a location for pesticide for PlantProtectionProducts a_ppp
Landscape::SupplyOverspray Returns the overspray flag for this location
Landscape::SupplyPesticideP Returns the pesticide amount on plant material for this location for PlantProtectionProducts a_ppp
Landscape::SupplyPesticideS Returns the pesticide amount in soil for this location for PlantProtectionProducts a_ppp
Landscape::SupplyPesticidePlantSurface Returns the pesticide amount on plant surfaces for this location for PlantProtectionProducts a_ppp
Landscape::SupplyPesticideInPlant Returns the pesticide amount in plant for this location for PlantProtectionProducts a_ppp
Landscape::SupplyPesticideNectar Returns the pesticide amount in nectar for this location for PlantProtectionProducts a_ppp
Landscape::SupplyPesticidePollen Returns the pesticide amount in nectar for this location for PlantProtectionProducts a_ppp
Landscape::SupplyRodenticide Gets total rodenticide for a location
Landscape::SupplyPesticideType Gets type of pesticide effect from a pesticide reference, see TTypesOfPesticide
Landscape::SupplyPesticideCell Gets the index to the cell used to store pesticide information from the coordinates x,y

Weather related wrappers

This list of functions simply passes a request on to the associated Weather class function.

Calendar related wrappers

These interface functions just pass the request to the associated calendar function

Species Related Interface Functions

Landscape::SupplySkScrapes Returns the presence of skyark scrapes in the vegetation using the polygon reference number a_polyref
Landscape::GetGooseFields Gets the list of suitable goose foraging fields today
Landscape::SupplyIsHumanDominated For the roe deer, determines the extent of human activity and returns true/false
Landscape::SupplySoilTypeR Returns the soil type in rabbit warren reference numbers for a location given by a_x, a_y
Landscape::SetBirdSeedForage Sets the grain forage resource as seen from a goose standpoint at a polygon
Landscape::SetBirdMaizeForage Sets the maize forage resource as seen from a goose standpoint at a polygon
Landscape::SupplyGooseGrazingForageH Returns the leaf forage resource as seen from a goose standpoint at a polygon based on the height only
Landscape::SupplyGooseGrazingForageH Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by number based on height only
Landscape::GetActualGooseGrazingForage Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by x,y location or a polygon ref
Landscape::SupplyBirdSeedForage Returns the grain forage resource for a polygon or coordinate location
Landscape::SupplyBirdMaizeForage Returns the maize forage resource for a polygon or coordinate location
Landscape::RecordGooseNumbers This records the number of geese of a particular species on the polygon the day before.
Landscape::RecordGooseSpNumbers This records the number of geese of each species on the polygon the day before
Landscape::RecordGooseNumbersTimed This records the number of geese on the polygon the day before at a predefined time
Landscape::RecordGooseSpNumbersTimed This records the number of geese of each species on the polygon the day before at a predefined time
Landscape::RecordGooseRoostDist Records the distance to the closest roost of a goose species
Landscape::GetGooseNumbers This returns the number of geese on the polygon or location the day before
Landscape::GetQuarryNumbers This returns the number of geese which are legal quarry on the polygon the day before
Landscape::SubtractPondLarvalFood Removes larval food from a pond and returns true if it was possible, otherwise false
Landscape::SetMaleNewtPresent Sets a male newt as being present in a pond
Landscape::SupplyMaleNewtPresent Determines if a male newt is present in a pond
Landscape::SkylarkEvaluation Runs through all polygons and passes them back to a skylark territory evaluation function

Methods related to mapping and map manipulations

Landscape::NewElement Creates a new LE instance and where possible it will create the highest level in the class hierarchy e.g. tole_Portarea has no behaviour so can be created as a NonVegElement (LE->NonVegElement), removing the need to have a Portarea class
Landscape::RemoveMissingValues A method for replacing missing values in the map with corrected ones
Landscape::PolysValidate Checks for internal consistency in the polygon information, e.g. being sure that all polygons mentioned are actually in the map
Landscape::PolysRemoveInvalid Checks whether all polygons are in the map, removing those that are not
Landscape::ConsolidatePolys Used to replace polygons or combine them when there is no special management associated with them. This just reduces the number of polygon entries and saves time and space.
Landscape::CountMapSquares Calculates the area for each polygon in the map and stores it in LE::m_squares_in_map Landscape::PolysRenumber Renumbers the polygons from 0 to the number of LE instances -1. This saves space, and also means that the polygon number becomes the same as the index in Landscape::m_elems, allowing quicker lookup (reduces indirection by 1)
Landscape::ForceArea Is a check on polygon areas. Each polygon should be present in the map with the correct area recorded, otherwise this method raises an error
Landscape::ChangeMapMapping Maps the polygon numbers directly to the indices in m_elems
Landscape::RebuildPolyMapping Called if there is any change in the polygons and loops through all polygons resetting the Landscape::m_polymapping value
Landscape::BorderNeed Currently unused test for adding borders
Landscape::BorderAdd Adds a border around a field of the specified type
Landscape::BorderRemoval Removes field boundaries, hedgebanks and hedges if they are adjacent to a field
Landscape::RemoveSmallPolygons Removes single cell small polygons from the map
Landscape::BorderScan Scans around the edge of a field adding border cells until the specified width is achieved. Uses Landscape::BorderStep
Landscape::BorderStep Steps around the edge of a polygon adding a new border
Landscape::UnsprayedMarginAdd Adds an unsprayed margin of specified width around a field
Landscape::UnsprayedMarginScan Used by Landscape::UnsprayedMarginAdd to add a unsprayed margin 1m border around a field
Landscape::BorderTest Used to decide if a coordinate location should become a border
Landscape::UMarginTest Used to decide if a coordinate location should become an unsprayed marginr
Landscape::FindValidXY Finds a valid coordinate for the polygon referenced by the polygon number
Landscape::StepOneValid Unused. Checks that a location has all valid polygon references (9 cells)
Landscape::AddBeetleBanks The starting point for adding beetlebanks to a field (can be used to add ‘banks’ of any tole_type
Landscape::BeetleBankPossible Determines whether a beetlebank can be added to the field depending on physical characteristics
Landscape::BeetleBankAdd Adds a beetlebank to the field
Landscape::FindFieldCenter Finds a location in the middle of a field to ‘seed a beetlebank’
Landscape::FindLongestAxis From a central location finds the longest axis of a field
Landscape::AxisLoop Tests the length of a vector to find when we step outside a given polygon
Landscape::AxisLoopLtd Same as Landscape::AxisLoop, but with a test for the edge of the landscape map
Landscape::hb_Add The entry point for adding hedgebanks. Hedgebanks are created by replacing part of hedge polygons with the tole_HedgeBank If the hedge is wide this will be with a border on each side, if narrow then by inserting hedgebank between trees
Landscape::hb_AddNewHedgebanks(int a_orig_poly_num)
Landscape::hb_StripingDist(void)
Landscape::hb_GenerateHBPolys Creates the necessary new hedgebank polygons in Landscape::m_elems
Landscape::hb_FindHedges Generate a list of polygon numbers for new hedgebank addition
Landscape::hb_FindBoundingBox Finds a rectangle that encloses the hedge to be manipulated
Landscape::hb_UpPolyNumbers Adds a big number to all polygon refs in the map to create space to safely manipulate the hedge pixels
Landscape::hb_ClearPolygon Replaces all values in the map for a polygon with a temporary value ready for manipulation
Landscape::hb_PaintBorder Identifies all border hedge pixels
Landscape::hb_MapBorder Checks for out of bounds hedgebank coordinates
Landscape::hb_HasOtherNeighbour Checks if a pixel has any non hedge neighbour cell
Landscape::hb_PaintWhoHasNeighbourColor Pushes a value to a pixel cell that denotes that is has a neighbour that is not hedge
Landscape::hb_HasNeighbourColor Tests for an already process neighbour cell
Landscape::hb_MarkTopFromLocalMax Used to identify the distance a cell is from the centre of a hedge
Landscape::hb_MarkTheBresenhamWay ‘Paints’ the core of a hedge with a negative number for use in deciding what becomes hedgebank later
Landscape::hb_MaxUnpaintedNegNeighbour Determines the width from centre to edge of hedge
Landscape::hb_ResetColorBits Remove high number colour bits from the map
Landscape::hb_RestoreHedgeCore(int a_orig_poly_number)
Landscape::hb_DownPolyNumbers Reverses the process carried out by Landscape::hb_UpPolyNumbers
Landscape::DumpMapGraphics(const char* a_filename)
Landscape::hb_dump_map Debug to save the hb map
Landscape::hb_dump_color Debug to save the hb intermediate map

Other Methods

These methods miscellaneous methods Landscape::CorrectCoords Function to prevent wrap around errors with co-ordinates using x/y pair
Landscape::CreatePondList Creates a list of pond polygon refs/indexes for easy look up
Landscape::CheckForPesticideRecord Check if needed and record pesticide application
Landscape::ResetGrainAndMaize Resets all grain and maize values for polygons<bZ> Landscape::CalculateOpenness Causes openness to be calculated and stored for all polygons
Landscape::CalculateFieldOpennessCentroid Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles are encountered at both ends. Searches from centroid outwards
Landscape::CalculateFieldOpennessAllCells Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles are encountered at both ends. Checks all field 1m2
Landscape::LineHighTest Provides a measure of the shortest distance in using a vector from a_cx,a_cy unitl tall obstacles are encountered in both +ve & -ve directions
Landscape::GetAllVegPolys Returns a list of all the polygons that have LE types derived from VegElement
Landscape::SimulationClosingActions Things to do when closing the simulation. Currently unused
Landscape::IncTreatCounter Records that a farm treatment of the type specified has occurred
Landscape::FillVegAreaData Runs through all polygons and records the area of each vegetation type
Landscape::GetVegArea Returnthe area covered by the specified vegetation
Landscape::SupplyRodenticidePredatoryManager Returns the pointer to the RodenticidePredators_Population_Manager Landscape::m_RodenticidePreds
Landscape::RodenticidePredatorsEvaluation Runs through all polygons and passes them back to a rodenticide predators evaluation function
Landscape::SupplyThePopManagerList Get the pointer to the list of active population managers
Landscape::SetThePopManagerList Set the pointer to the list of active population managers
Landscape::DistanceToP Returns the distance in m between two points
Landscape::DistanceToPSquared Returns the distance in meters squared between two points

This set of methods are all used to determine characteristics of a landscape polygon based on its element type:

This set of methods are all used to determine characteristics of a landscape polygon based on individual characteristics set using attributes:

I/O

Landscape::PolysDump Called if the landscape is manipulated to save the new version of the polyref input file
Landscape::DumpMap Called if the landscape is manipulated to save the new version of the .lsb input file (i.e. the topographical map)
Landscape::Warn A wrapper for the g_msg Warn function. Used to pass program warnings for debug
Landscape::WriteOpenness Stores openness for all polygons to a standard file
Landscape::ReadOpenness Reads openness values from a standard input file for all polygons
Landscape::VegDump Records vegetation charateristics for the x,y location
Landscape::RecordEvent Optional method which can be turned on through a #define __RECORDFARMEVENTS to record details of farm events carried out.
Landscape::EventDump Records farm events carried out on the x,y locations
Landscape::EventDumpPesticides Records pesticide application farm events carried out on the x,y location
Landscape::DegreesDump brief Prints the sum of day degrees. See FarmManager::daydegrees Landscape::GISASCII_Output Saves the landscape map as a GIS readable ASCII file
Landscape::GrainDump Records total amount of grain/seed/maize available as forage for each polygon
Landscape::DumpVegAreaData Saves the information on vegetation types and areas
Landscape::DumpTreatCounters When the simulation is closed this method saves the number of each farm management that has been carried out

\anchors _lsm3

LE & Associated Classes

\anchors _lsm2

Farms and farm management, including crops

\anchors _lsm4

Pesticide and related classes

Interconnections

I/O, Parameters and Scales

Inputs

Outputs

State variables

Scales

Discussion of implementation

References