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

This is the base class used to model the consumption by a predator. More...

#include <predator.h>

Inheritance diagram for Predator:
Inheritance graph
Collaboration diagram for Predator:
Collaboration graph

Public Member Functions

 Predator (const char *givenname, const IntVector &Areas)
 This is the Predator constructor. More...
 
virtual ~Predator ()
 This is the default Predator destructor. More...
 
virtual void Eat (int area, const AreaClass *const Area, const TimeClass *const TimeInfo)=0
 This will calculate the amount the predator consumes on a given area. More...
 
void setPrey (PreyPtrVector &preyvec, Keeper *const keeper)
 This will select the preys that will be consumed by the predator. More...
 
int doesEat (const char *preyname) const
 This function will check to see if the predator will consume a specified prey. More...
 
virtual void adjustConsumption (int area, const TimeClass *const TimeInfo)=0
 This will adjust the amount the predator consumes on a given area to take any overconsumption into account. More...
 
virtual void Print (ofstream &outfile) const
 This function will print the predation data. More...
 
virtual void Reset (const TimeClass *const TimeInfo)
 This will reset the predation information for the current model run. More...
 
virtual const DoubleMatrixgetConsumption (int area, const char *preyname) const =0
 This will return the amount the predator consumes of a given prey on a given area. More...
 
virtual int hasOverConsumption (int area) const =0
 This will return the flag that denotes if the predator has overconsumed on a given area. More...
 
virtual const DoubleVectorgetOverConsumption (int area) const =0
 This will return the amount the predator overconsumes on a given area. More...
 
virtual double getTotalOverConsumption (int area) const =0
 This will return the total amount the predator overconsumes on a given area. More...
 
virtual double getConsumptionBiomass (int prey, int area) const =0
 This will return the biomass the predator consumes of a given prey on a given area. More...
 
virtual double getConsumptionRatio (int area, int prey, int len) const =0
 This will return the ratio used to split the predation between the areas and length groups. More...
 
virtual const PopInfoVectorgetConsumptionPopInfo (int area, const char *preyname) const =0
 This will return the amount of a given prey on a given area prior to any consumption by the predator. More...
 
virtual const LengthGroupDivisiongetLengthGroupDiv () const =0
 This will return the length group information for the predator. More...
 
virtual void setTimeMultiplier (const TimeClass *const TimeInfo, int quotastep, double value)
 This is a multiplier set in lengthpredator.
More...
 
virtual void Initialise ()
 This will return the number of prey stocks that the predator will consume. More...
 
int numPreys () const
 
PreygetPrey (int i) const
 This will return a given prey. More...
 
const char * getPreyName (int i) const
 This will return the name of a given prey. More...
 
int didChange (int i, const TimeClass *const TimeInfo)
 This function will check to see if the suitability parameters for a given prey have changed on the current timestep. More...
 
const DoubleMatrixgetSuitability (int i) const
 This will return the suitability values for a given prey. More...
 
double getPreference (int i) const
 This will return the preference for a given prey. More...
 
PredatorType getType () const
 This will return the type of predator 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 Member Functions

void readSuitability (CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper)
 This function will read the suitability data from the input file. More...
 
- Protected Member Functions inherited from LivesOnAreas
void storeAreas (const IntVector &Areas)
 This function will store the internal areas to be used. More...
 

Protected Attributes

FormulaVector preference
 This is the FormulaVector used to store the prey preference parameters. More...
 
PredatorType type
 This denotes what type of predator 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...
 

Detailed Description

This is the base class used to model the consumption by a predator.

This class is used to calculate the predation of prey species by a predator, either by a fleet or by a modelled stock in the simulation. The amount of the various prey species that the predator wants to consume is calculated, based on the suitability functions defined for each prey. This ''target consumption'' is then checked to ensure that no more than 95% of each the prey species is to be consumed (by all the predators of that prey), 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 predators consume.

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

Constructor & Destructor Documentation

◆ Predator()

Predator::Predator ( const char *  givenname,
const IntVector Areas 
)

This is the Predator constructor.

Parameters
givennameis the name of the predator
Areasis the IntVector of areas that the predator lives on

◆ ~Predator()

Predator::~Predator ( )
virtual

This is the default Predator destructor.

Member Function Documentation

◆ adjustConsumption()

virtual void Predator::adjustConsumption ( int  area,
const TimeClass *const  TimeInfo 
)
pure virtual

This will adjust the amount the predator consumes on a given area to take any overconsumption into account.

Parameters
areais the area that the prey consumption is being calculated on
TimeInfois the TimeClass for the current model
Note
This will be overridden by the derived classes that actually calculate the consumption

Implemented in TotalPredator, StockPredator, QuotaPredator, NumberPredator, LinearPredator, and EffortPredator.

◆ didChange()

int Predator::didChange ( int  i,
const TimeClass *const  TimeInfo 
)
inline

This function will check to see if the suitability parameters for a given prey have changed on the current timestep.

Parameters
iis the index of the prey
TimeInfois the TimeClass for the current model
Returns
1 if the values have changed, 0 otherwise

◆ doesEat()

int Predator::doesEat ( const char *  preyname) const

This function will check to see if the predator will consume a specified prey.

Parameters
preynameis the name of the prey
Returns
1 if the predator does consume the prey, 0 otherwise

◆ Eat()

virtual void Predator::Eat ( int  area,
const AreaClass *const  Area,
const TimeClass *const  TimeInfo 
)
pure virtual

This will calculate the amount the predator consumes on a given area.

Parameters
areais the area that the prey consumption is being calculated on
Areais the AreaClass for the current model
TimeInfois the TimeClass for the current model
Note
This will be overridden by the derived classes that actually calculate the consumption

Implemented in TotalPredator, StockPredator, QuotaPredator, NumberPredator, LinearPredator, and EffortPredator.

◆ getConsumption()

virtual const DoubleMatrix& Predator::getConsumption ( int  area,
const char *  preyname 
) const
pure virtual

This will return the amount the predator consumes of a given prey on a given area.

Parameters
areais the area that the consumption is being calculated on
preynameis the name of the prey that is being consumed
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getConsumptionBiomass()

virtual double Predator::getConsumptionBiomass ( int  prey,
int  area 
) const
pure virtual

This will return the biomass the predator consumes of a given prey on a given area.

Parameters
preyis the index for the prey
areais the area that the consumption is being calculated on
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getConsumptionPopInfo()

virtual const PopInfoVector& Predator::getConsumptionPopInfo ( int  area,
const char *  preyname 
) const
pure virtual

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

Parameters
areais the area that the consumption is being calculated on
preynameis the name of the prey that is being consumed
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getConsumptionRatio()

virtual double Predator::getConsumptionRatio ( int  area,
int  prey,
int  len 
) const
pure virtual

This will return the ratio used to split the predation between the areas and length groups.

Parameters
areais the area that the consumption is being calculated on
preyis the index for the prey
lenis the length group of the predator
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getLengthGroupDiv()

virtual const LengthGroupDivision* Predator::getLengthGroupDiv ( ) const
pure virtual

This will return the length group information for the predator.

Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getOverConsumption()

virtual const DoubleVector& Predator::getOverConsumption ( int  area) const
pure virtual

This will return the amount the predator overconsumes on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getPreference()

double Predator::getPreference ( int  i) const
inline

This will return the preference for a given prey.

Parameters
iis the index of the prey
Returns
preference

◆ getPrey()

Prey* Predator::getPrey ( int  i) const
inline

This will return a given prey.

Parameters
iis the index of the prey
Returns
prey

◆ getPreyName()

const char* Predator::getPreyName ( int  i) const
inline

This will return the name of a given prey.

Parameters
iis the index of the prey
Returns
name of the prey

◆ getSuitability()

const DoubleMatrix& Predator::getSuitability ( int  i) const
inline

This will return the suitability values for a given prey.

Parameters
iis the index of the prey
Returns
suitability matrix for the prey

◆ getTotalOverConsumption()

virtual double Predator::getTotalOverConsumption ( int  area) const
pure virtual

This will return the total amount the predator overconsumes on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ getType()

PredatorType Predator::getType ( ) const
inline

This will return the type of predator class.

Returns
type

◆ hasOverConsumption()

virtual int Predator::hasOverConsumption ( int  area) const
pure virtual

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

Parameters
areais the area that the consumption is being calculated on
Returns
0 (will be overridden by the derived classes)

Implemented in PopPredator.

◆ Initialise()

virtual void Predator::Initialise ( )
inlinevirtual

This will return the number of prey stocks that the predator will consume.

Returns
number of preys

This will initialise the preys that will be consumed by the predator

◆ numPreys()

int Predator::numPreys ( ) const
inline

◆ Print()

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

This function will print the predation data.

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

Reimplemented in TotalPredator, StockPredator, QuotaPredator, PopPredator, NumberPredator, LinearPredator, and EffortPredator.

◆ readSuitability()

void Predator::readSuitability ( CommentStream infile,
const TimeClass *const  TimeInfo,
Keeper *const  keeper 
)
protected

This function will read the suitability data from the input file.

Parameters
infileis the CommentStream to read the suitabiltiy data from
TimeInfois the TimeClass for the current model
keeperis the Keeper for the current model

◆ Reset()

virtual void Predator::Reset ( const TimeClass *const  TimeInfo)
inlinevirtual

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

Parameters
TimeInfois the TimeClass for the current model

Reimplemented in StockPredator, PopPredator, and LengthPredator.

◆ setPrey()

void Predator::setPrey ( PreyPtrVector preyvec,
Keeper *const  keeper 
)

This will select the preys that will be consumed by the predator.

Parameters
preyvecis the PreyPtrVector of all the available preys
keeperis the Keeper for the current model

◆ setTimeMultiplier()

virtual void Predator::setTimeMultiplier ( const TimeClass *const  TimeInfo,
int  quotastep,
double  value 
)
inlinevirtual

This is a multiplier set in lengthpredator.

Reimplemented in LengthPredator.

Member Data Documentation

◆ preference

FormulaVector Predator::preference
protected

This is the FormulaVector used to store the prey preference parameters.

◆ type

PredatorType Predator::type
protected

This denotes what type of predator class has been created.


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