Gadget
Public Member Functions | Protected Attributes | List of all members
Prey Class Referenceabstract

This is the base class used to model the consumption of a prey. More...

#include <prey.h>

Inheritance diagram for Prey:
Inheritance graph
Collaboration diagram for Prey:
Collaboration graph

Public Member Functions

 Prey (CommentStream &infile, const IntVector &areas, const char *givenname, const TimeClass *const TimeInfo, Keeper *const keeper)
 This is the Prey constructor to create a prey by reading data from a file. More...
 
 Prey (CommentStream &infile, const char *givenname, const IntVector &areas, const TimeClass *const TimeInfo, Keeper *const keeper)
 This is the Prey constructor for a prey with a given length group. More...
 
virtual ~Prey ()=0
 This is the default Prey destructor. More...
 
virtual void Sum (const AgeBandMatrix &Alkeys, int area)
 This will calculate the amount of prey that is consumed for a given area and timestep. More...
 
virtual void Sum (const PopInfoVector &NumberInArea, int area)
 This will calculate the amount of prey that is consumed for a given area and timestep. More...
 
virtual void Reset (const TimeClass *const TimeInfo)
 This will reset the consumption information for the current model run. More...
 
virtual void Print (ofstream &outfile) const
 This function will print the consumption data. More...
 
virtual void setCI (const LengthGroupDivision *const GivenLDiv)
 This will set the ConversionIndex required for to calculate the consumption. More...
 
virtual void Subtract (AgeBandMatrix &Alkeys, int area)
 This function will subtract the prey that is consumed from the stock. More...
 
void addBiomassConsumption (int area, const DoubleVector &predcons)
 This function will add predation (by biomass) to the amount of the prey that is consumed. More...
 
void addNumbersConsumption (int area, const DoubleVector &predcons)
 This function will add predation (by numbers) to the amount of the prey that is consumed. More...
 
virtual void checkConsumption (int area, const TimeClass *const TimeInfo)
 This function will check for overconsumption of the prey. More...
 
double getBiomass (int area, int length) const
 This will return the biomass of prey that is available for consumption by predators. More...
 
double getNumber (int area, int length) const
 This will return the number of prey that is available for consumption by predators. More...
 
double getTotalBiomass (int area) const
 This will return the total biomass of prey that is available for consumption. More...
 
int isOverConsumption (int area)
 This will return the flag that denotes if the prey has been overconsumed on a given area. More...
 
const DoubleVectorgetRatio (int area) const
 This will return the ratio of the prey that has been consumed on a given area. More...
 
const DoubleVectorgetUseRatio (int area) const
 This will return the ratio of the prey that has been consumed on a given area. More...
 
const DoubleVectorgetConsumption (int area) const
 This will return the amount of the prey that has been consumed on a given area. More...
 
const DoubleVectorgetOverConsumption (int area) const
 This will return the amount of the prey that has been overconsumed on a given area. More...
 
double getTotalOverConsumption (int area) const
 This will return the total amount of the prey that has been overconsumed on a given area. More...
 
const LengthGroupDivisiongetLengthGroupDiv () const
 This will return the length group information for the prey. More...
 
const PopInfoVectorgetConsumptionPopInfo (int area) const
 This will return the amount of prey on a given area prior to any consumption by the predators. More...
 
double getEnergy () const
 This will return the energy content of the prey. More...
 
int isPreyArea (int area)
 This will check if there is any prey to consume on a given area. More...
 
PreyType getType () const
 This will return the type of prey class. More...
 
- Public Member Functions inherited from HasName
 HasName ()
 This is the default HasName constructor. More...
 
virtual ~HasName ()
 This is the default HasName destructor. More...
 
 HasName (const char *givenname)
 This is the HasName constructor for a specified name. More...
 
const char * getName () const
 This will return a null terminated text string containing the name of the object. More...
 
- Public Member Functions inherited from LivesOnAreas
 LivesOnAreas ()
 This is the default LivesOnAreas constructor. More...
 
virtual ~LivesOnAreas ()
 This is the default LivesOnAreas destructor. More...
 
 LivesOnAreas (const IntVector &Areas)
 This is the LivesOnAreas constructor for a specified vector of areas. More...
 
int isInArea (int area) const
 This function will check whether the object is defined on a specified area. More...
 
IntVectorgetAreas ()
 This function will return the internal areas that the object is defined on. More...
 
int areaNum (int area) const
 This function will return the area associated with an internal area. More...
 

Protected Attributes

ConversionIndexCI
 This is the ConversionIndex used to convert from the stock LengthGroupDivision to the LengthGroupDivision used for the consumption calculation. More...
 
LengthGroupDivisionLgrpDiv
 This is the LengthGroupDivision used to store length information. More...
 
PopInfoMatrix preynumber
 This is the PopInfoMatrix used to store information on the number of preys for the current timestep. More...
 
ModelVariable energy
 This is the ModelVariable used to store the energy content of the prey (in kilojoules per kilogramme) More...
 
DoubleMatrix biomass
 This is the DoubleMatrix used to store information on the biomass of the prey that is available for the predators to consume on the current timestep. More...
 
DoubleVector total
 This is the DoubleVector used to store information on the total biomass of the prey that is available for the predators to consume on the current timestep. More...
 
DoubleMatrix ratio
 This is the DoubleMatrix used to store information on the ratio of the available biomass of the prey that is available for the predators to consume has been consumed on the current timestep. More...
 
DoubleMatrix useratio
 This is the DoubleMatrix used to store information on the ratio of the available biomass of the prey that is available for the predators to consume has been consumed on the current timestep, adjusted to MaxRatio whenever overconsumption has occured. More...
 
DoubleMatrix consumption
 This is the DoubleMatrix used to store information on the consumption of the prey on the current timestep. More...
 
DoubleMatrix cons
 This is the DoubleMatrix used to store information on the consumption of the prey on the current substep of the current timestep. More...
 
DoubleMatrix overconsumption
 This is the DoubleMatrix used to store information on the overconsumption of the prey on the current timestep. More...
 
IntVector isoverconsumption
 This is the IntVector used to store information on whether any overconsumption has occured on the current timestep. More...
 
DoubleMatrix consratio
 This is the DoubleMatrix used to store information on the ratio of the prey to subtract on the current timestep. More...
 
PreyType type
 This denotes what type of prey class has been created. More...
 
- Protected Attributes inherited from LivesOnAreas
IntVector areas
 This is the IntVector of internal areas that the object is defined on. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LivesOnAreas
void storeAreas (const IntVector &Areas)
 This function will store the internal areas to be used. More...
 

Detailed Description

This is the base class used to model the consumption of a prey.

This class is used to remove fish from the model due to predation, either by a fleet or through consumption by another stock. The proportion of the fish that are to be removed is calculated, based on the required consumption by all the various predators that will consume the prey. This ''target consumption'' is then checked to ensure that no more than 95% of the prey species is to be consumed, and the consumption is adjusted if this is the case. The population of the prey species is then reduced by the total amount that the various predators consume.

Note
This will be overridden by the derived classes that actually calculate the consumption

Constructor & Destructor Documentation

◆ Prey() [1/2]

Prey::Prey ( CommentStream infile,
const IntVector areas,
const char *  givenname,
const TimeClass *const  TimeInfo,
Keeper *const  keeper 
)

This is the Prey constructor to create a prey by reading data from a file.

Parameters
infileis the CommentStream to read the Prey data from
areasis the IntVector of areas that the prey lives on
givennameis the name of the prey
TimeInfois the TimeClass for the current model
keeperis the Keeper for the current model
Note
This constructor is used when creating dynamic prey (ie. StockPrey class)

◆ Prey() [2/2]

Prey::Prey ( CommentStream infile,
const char *  givenname,
const IntVector areas,
const TimeClass *const  TimeInfo,
Keeper *const  keeper 
)

This is the Prey constructor for a prey with a given length group.

Parameters
infileis the CommentStream to read the Prey data from
givennameis the name of the prey
areasis the IntVector of areas that the prey lives on
TimeInfois the TimeClass for the current model
keeperis the Keeper for the current model
Note
This constructor is used when creating non-dynamic prey (ie. OtherFood class)

◆ ~Prey()

Prey::~Prey ( )
pure virtual

This is the default Prey destructor.

Member Function Documentation

◆ addBiomassConsumption()

void Prey::addBiomassConsumption ( int  area,
const DoubleVector predcons 
)

This function will add predation (by biomass) to the amount of the prey that is consumed.

Parameters
areais the area that the consumption is being calculated on
predconsis the DoubleVector containing the predation data

◆ addNumbersConsumption()

void Prey::addNumbersConsumption ( int  area,
const DoubleVector predcons 
)

This function will add predation (by numbers) to the amount of the prey that is consumed.

Parameters
areais the area that the consumption is being calculated on
predconsis the DoubleVector containing the predation data

◆ checkConsumption()

void Prey::checkConsumption ( int  area,
const TimeClass *const  TimeInfo 
)
virtual

This function will check for overconsumption of the prey.

Parameters
areais the area that the consumption is being calculated on
TimeInfois the TimeClass for the current model

◆ getBiomass()

double Prey::getBiomass ( int  area,
int  length 
) const
inline

This will return the biomass of prey that is available for consumption by predators.

Parameters
areais the area that the consumption is being calculated on
lengthis the length group of the prey
Returns
biomass

◆ getConsumption()

const DoubleVector& Prey::getConsumption ( int  area) const
inline

This will return the amount of the prey that has been consumed on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
consumption, a DoubleVector containing the consumption of the prey

◆ getConsumptionPopInfo()

const PopInfoVector& Prey::getConsumptionPopInfo ( int  area) const
inline

This will return the amount of prey on a given area prior to any consumption by the predators.

Parameters
areais the area that the consumption is being calculated on
Returns
preynumber, a PopInfoVector containing information about the prey population

◆ getEnergy()

double Prey::getEnergy ( ) const
inline

This will return the energy content of the prey.

Returns
energy

◆ getLengthGroupDiv()

const LengthGroupDivision* Prey::getLengthGroupDiv ( ) const
inline

This will return the length group information for the prey.

Returns
LgrpDiv

◆ getNumber()

double Prey::getNumber ( int  area,
int  length 
) const
inline

This will return the number of prey that is available for consumption by predators.

Parameters
areais the area that the consumption is being calculated on
lengthis the length group of the prey
Returns
number

◆ getOverConsumption()

const DoubleVector& Prey::getOverConsumption ( int  area) const
inline

This will return the amount of the prey that has been overconsumed on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
overconsumption, a DoubleVector containing the overconsumption of the prey

◆ getRatio()

const DoubleVector& Prey::getRatio ( int  area) const
inline

This will return the ratio of the prey that has been consumed on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
ratio, a DoubleVector containing the ratio of the prey that is consumed

◆ getTotalBiomass()

double Prey::getTotalBiomass ( int  area) const
inline

This will return the total biomass of prey that is available for consumption.

Parameters
areais the area that the consumption is being calculated on
Returns
total biomass

◆ getTotalOverConsumption()

double Prey::getTotalOverConsumption ( int  area) const

This will return the total amount of the prey that has been overconsumed on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
total overconsumption of the prey

◆ getType()

PreyType Prey::getType ( ) const
inline

This will return the type of prey class.

Returns
type

◆ getUseRatio()

const DoubleVector& Prey::getUseRatio ( int  area) const
inline

This will return the ratio of the prey that has been consumed on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
ratio, a DoubleVector containing the ratio of the prey that is consumed

◆ isOverConsumption()

int Prey::isOverConsumption ( int  area)

This will return the flag that denotes if the prey has been overconsumed on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
1 if the prey has been overconsumed, 0 otherwise

◆ isPreyArea()

int Prey::isPreyArea ( int  area)

This will check if there is any prey to consume on a given area.

Parameters
areais the area that the prey will be consumed on
Returns
1 if there is prey to consume, 0 otherwise

◆ Print()

void Prey::Print ( ofstream &  outfile) const
virtual

This function will print the consumption data.

Parameters
outfileis the ofstream that all the model information gets sent to

Reimplemented in StockPrey.

◆ Reset()

void Prey::Reset ( const TimeClass *const  TimeInfo)
virtual

This will reset the consumption information for the current model run.

Parameters
TimeInfois the TimeClass for the current model

◆ setCI()

void Prey::setCI ( const LengthGroupDivision *const  GivenLDiv)
virtual

This will set the ConversionIndex required for to calculate the consumption.

Parameters
GivenLDivis the LengthGroupDivision for the stock

◆ Subtract()

void Prey::Subtract ( AgeBandMatrix Alkeys,
int  area 
)
virtual

This function will subtract the prey that is consumed from the stock.

Parameters
Alkeysis the AgeBandMatrix containing the population of the stock
areais the area that the consumption is being calculated on

◆ Sum() [1/2]

virtual void Prey::Sum ( const AgeBandMatrix Alkeys,
int  area 
)
inlinevirtual

This will calculate the amount of prey that is consumed for a given area and timestep.

Parameters
Alkeysis the AgeBandMatrix giving the amount of prey in the area
areais the area that the prey consumption is being calculated on
Note
This will be overridden by the derived classes that actually calculate the consumption

Reimplemented in StockPrey.

◆ Sum() [2/2]

virtual void Prey::Sum ( const PopInfoVector NumberInArea,
int  area 
)
inlinevirtual

This will calculate the amount of prey that is consumed for a given area and timestep.

Parameters
NumberInAreais the PopInfoVector giving the amount of prey in the area
areais the area that the prey consumption is being calculated on
Note
This will be overridden by the derived classes that actually calculate the consumption

Reimplemented in LengthPrey.

Member Data Documentation

◆ biomass

DoubleMatrix Prey::biomass
protected

This is the DoubleMatrix used to store information on the biomass of the prey that is available for the predators to consume on the current timestep.

Note
The indices for this object are [area][prey length]

◆ CI

ConversionIndex* Prey::CI
protected

This is the ConversionIndex used to convert from the stock LengthGroupDivision to the LengthGroupDivision used for the consumption calculation.

◆ cons

DoubleMatrix Prey::cons
protected

This is the DoubleMatrix used to store information on the consumption of the prey on the current substep of the current timestep.

Note
The indices for this object are [area][prey length]

◆ consratio

DoubleMatrix Prey::consratio
protected

This is the DoubleMatrix used to store information on the ratio of the prey to subtract on the current timestep.

Note
The indices for this object are [area][prey length]

◆ consumption

DoubleMatrix Prey::consumption
protected

This is the DoubleMatrix used to store information on the consumption of the prey on the current timestep.

Note
The indices for this object are [area][prey length]

◆ energy

ModelVariable Prey::energy
protected

This is the ModelVariable used to store the energy content of the prey (in kilojoules per kilogramme)

◆ isoverconsumption

IntVector Prey::isoverconsumption
protected

This is the IntVector used to store information on whether any overconsumption has occured on the current timestep.

◆ LgrpDiv

LengthGroupDivision* Prey::LgrpDiv
protected

This is the LengthGroupDivision used to store length information.

◆ overconsumption

DoubleMatrix Prey::overconsumption
protected

This is the DoubleMatrix used to store information on the overconsumption of the prey on the current timestep.

Note
The indices for this object are [area][prey length]

◆ preynumber

PopInfoMatrix Prey::preynumber
protected

This is the PopInfoMatrix used to store information on the number of preys for the current timestep.

Note
The indices for this object are [area][prey length]

◆ ratio

DoubleMatrix Prey::ratio
protected

This is the DoubleMatrix used to store information on the ratio of the available biomass of the prey that is available for the predators to consume has been consumed on the current timestep.

Note
The indices for this object are [area][prey length]

◆ total

DoubleVector Prey::total
protected

This is the DoubleVector used to store information on the total biomass of the prey that is available for the predators to consume on the current timestep.

◆ type

PreyType Prey::type
protected

This denotes what type of prey class has been created.

◆ useratio

DoubleMatrix Prey::useratio
protected

This is the DoubleMatrix used to store information on the ratio of the available biomass of the prey that is available for the predators to consume has been consumed on the current timestep, adjusted to MaxRatio whenever overconsumption has occured.

Note
The indices for this object are [area][prey length]

The documentation for this class was generated from the following files: