Gadget
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
PopPredator Class Reference

This is the class used to model the predation of a population. More...

#include <poppredator.h>

Inheritance diagram for PopPredator:
Inheritance graph
Collaboration diagram for PopPredator:
Collaboration graph

Public Member Functions

 PopPredator (const char *givenname, const IntVector &areas, const LengthGroupDivision *const OtherLgrpDiv, const LengthGroupDivision *const GivenLgrpDiv)
 This is the PopPredator constructor to create a predator with a specified length group. More...
 
 PopPredator (const char *givenname, const IntVector &areas)
 This is the PopPredator constructor to create a predator without a specified length group. More...
 
virtual ~PopPredator ()
 This is the default PopPredator destructor. More...
 
virtual void Print (ofstream &outfile) const
 This function will print the predation data. More...
 
virtual const PopInfoVectorgetConsumptionPopInfo (int area, const char *preyname) const
 This function will return the number of a prey on a specified area before the consumption calculation takes place. More...
 
virtual const PopInfoVectorgetPredatorNumber (int area) const
 This function will return the population number of the predator on a given area. More...
 
virtual const DoubleMatrixgetConsumption (int area, const char *preyname) const
 This will return the amount the predator consumes of a given prey on a given area. More...
 
virtual int hasOverConsumption (int area) const
 This will return the flag that denotes if the predator has overconsumed on a given area. More...
 
virtual const DoubleVectorgetOverConsumption (int area) const
 This will return the amount the predator overconsumes on a given area. More...
 
virtual double getTotalOverConsumption (int area) const
 This will return the total amount the predator overconsumes on a given area. More...
 
virtual const LengthGroupDivisiongetLengthGroupDiv () const
 This will return the length group information for the predator. More...
 
virtual void Reset (const TimeClass *const TimeInfo)
 This function will reset the predation information for the current model run. More...
 
virtual double getConsumptionBiomass (int prey, int area) const
 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
 This will return the ratio used to split the predation between the areas and length groups. More...
 
const DoubleMatrixgetUseSuitability (int area, int prey) const
 This will return the suitability used by the predator for a given prey on a given area, adjusted to take any overconsumption into account. More...
 
void setPrey (PreyPtrVector &preyvec, Keeper *const keeper)
 This will select the preys that will be consumed by the predator. More...
 
- Public Member Functions inherited from Predator
 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 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 Attributes

LengthGroupDivisionLgrpDiv
 This is the LengthGroupDivision used to store length information. More...
 
ConversionIndexCI
 This is the ConversionIndexPtrVector used to convert to the lengths groups for the length-based predator. More...
 
PopInfoMatrix prednumber
 This is the PopInfoMatrix used to store information on the number of predators for the current timestep. More...
 
DoubleMatrix overconsumption
 This is the DoubleMatrix used to store information on the overconsumption by the predators on the current timestep. More...
 
DoubleMatrixPtrMatrix consumption
 This is the DoubleMatrixPtrMatrix used to store information on the consumption by the predators on the current timestep. More...
 
DoubleMatrix totalconsumption
 This is the DoubleMatrix used to store information on the total consumption by the predators on the current timestep. More...
 
DoubleMatrix overcons
 This is the DoubleMatrix used to store information on the overconsumption by the predators on the current substep of the current timestep. More...
 
DoubleMatrixPtrMatrix cons
 This is the DoubleMatrixPtrMatrix used to store information on the consumption by the predators on the current substep of the current timestep. More...
 
DoubleMatrix totalcons
 This is the DoubleMatrix used to store information on the total consumption by the predators on the current substep of the current timestep. More...
 
DoubleMatrixPtrVector predratio
 This is the DoubleMatrixPtrVector used to store the ratio used to split the predation between the areas and length groups. More...
 
DoubleMatrixPtrMatrix usesuit
 This is the DoubleMatrixPtrMatrix used to store suitability information for the predators on the current timestep, adjusted to take account of any overconsumption. More...
 
IntVector hasoverconsumption
 This is the IntVector used to store information on whether any overconsumption has occured on the current timestep. More...
 
- Protected Attributes inherited from Predator
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...
 

Additional Inherited Members

- Protected Member Functions inherited from Predator
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...
 

Detailed Description

This is the class used to model the predation of a population.

Constructor & Destructor Documentation

◆ PopPredator() [1/2]

PopPredator::PopPredator ( const char *  givenname,
const IntVector areas,
const LengthGroupDivision *const  OtherLgrpDiv,
const LengthGroupDivision *const  GivenLgrpDiv 
)

This is the PopPredator constructor to create a predator with a specified length group.

Parameters
givennameis the name of the predator
areasis the IntVector of the areas that the predator will live on
OtherLgrpDivis the LengthGroupDivision of the predator
GivenLgrpDivis the LengthGroupDivision that the predation will be calculated on
Note
This constructor is used when creating a dynamic predator (ie. StockPredator class)

◆ PopPredator() [2/2]

PopPredator::PopPredator ( const char *  givenname,
const IntVector areas 
)

This is the PopPredator constructor to create a predator without a specified length group.

Parameters
givennameis the name of the predator
areasis the IntVector of the areas that the predator will live on
Note
This constructor is used when creating a non-dynamic predator (ie. LengthPredator class)

◆ ~PopPredator()

PopPredator::~PopPredator ( )
virtual

This is the default PopPredator destructor.

Member Function Documentation

◆ getConsumption()

const DoubleMatrix & PopPredator::getConsumption ( int  area,
const char *  preyname 
) const
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
DoubleMatrix containing the amount the predator consumes

Implements Predator.

◆ getConsumptionBiomass()

double PopPredator::getConsumptionBiomass ( int  prey,
int  area 
) const
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
amount consumed by the predator of the prey

Implements Predator.

◆ getConsumptionPopInfo()

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

This function will return the number of a prey on a specified area before the consumption calculation takes place.

Parameters
areais the area that the prey consumption is being calculated on
preynameis the name of the prey
Returns
PopInfoVector containing the number of prey before the consumption takes place

Implements Predator.

◆ getConsumptionRatio()

virtual double PopPredator::getConsumptionRatio ( int  area,
int  prey,
int  len 
) const
inlinevirtual

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
ratio used to split the predation between the various areas and length groups

Implements Predator.

◆ getLengthGroupDiv()

virtual const LengthGroupDivision* PopPredator::getLengthGroupDiv ( ) const
inlinevirtual

This will return the length group information for the predator.

Returns
LgrpDiv

Implements Predator.

◆ getOverConsumption()

virtual const DoubleVector& PopPredator::getOverConsumption ( int  area) const
inlinevirtual

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

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

Implements Predator.

◆ getPredatorNumber()

virtual const PopInfoVector& PopPredator::getPredatorNumber ( int  area) const
inlinevirtual

This function will return the population number of the predator on a given area.

Parameters
areais the area that the consumption is being calculated on
Returns
PopInfoVector containing the population number of the predator

◆ getTotalOverConsumption()

double PopPredator::getTotalOverConsumption ( int  area) const
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
total overconsumption by of the predator

Implements Predator.

◆ getUseSuitability()

const DoubleMatrix& PopPredator::getUseSuitability ( int  area,
int  prey 
) const
inline

This will return the suitability used by the predator for a given prey on a given area, adjusted to take any overconsumption into account.

Parameters
areais the area that the consumption is being calculated on
preyis the index for the prey
Returns
usesuit, a DoubleMatrix containing the suitability by the predator

◆ hasOverConsumption()

virtual int PopPredator::hasOverConsumption ( int  area) const
inlinevirtual

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
1 if the predator has been overconsumed, 0 otherwise

Implements Predator.

◆ Print()

void PopPredator::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 from Predator.

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

◆ Reset()

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

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

Parameters
TimeInfois the TimeClass for the current model

Reimplemented from Predator.

Reimplemented in StockPredator, and LengthPredator.

◆ setPrey()

void PopPredator::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

Member Data Documentation

◆ CI

ConversionIndex* PopPredator::CI
protected

This is the ConversionIndexPtrVector used to convert to the lengths groups for the length-based predator.

◆ cons

DoubleMatrixPtrMatrix PopPredator::cons
protected

This is the DoubleMatrixPtrMatrix used to store information on the consumption by the predators on the current substep of the current timestep.

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

◆ consumption

DoubleMatrixPtrMatrix PopPredator::consumption
protected

This is the DoubleMatrixPtrMatrix used to store information on the consumption by the predators on the current timestep.

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

◆ hasoverconsumption

IntVector PopPredator::hasoverconsumption
protected

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

◆ LgrpDiv

LengthGroupDivision* PopPredator::LgrpDiv
protected

This is the LengthGroupDivision used to store length information.

◆ overcons

DoubleMatrix PopPredator::overcons
protected

This is the DoubleMatrix used to store information on the overconsumption by the predators on the current substep of the current timestep.

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

◆ overconsumption

DoubleMatrix PopPredator::overconsumption
protected

This is the DoubleMatrix used to store information on the overconsumption by the predators on the current timestep.

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

◆ prednumber

PopInfoMatrix PopPredator::prednumber
protected

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

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

◆ predratio

DoubleMatrixPtrVector PopPredator::predratio
protected

This is the DoubleMatrixPtrVector used to store the ratio used to split the predation between the areas and length groups.

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

◆ totalcons

DoubleMatrix PopPredator::totalcons
protected

This is the DoubleMatrix used to store information on the total consumption by the predators on the current substep of the current timestep.

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

◆ totalconsumption

DoubleMatrix PopPredator::totalconsumption
protected

This is the DoubleMatrix used to store information on the total consumption by the predators on the current timestep.

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

◆ usesuit

DoubleMatrixPtrMatrix PopPredator::usesuit
protected

This is the DoubleMatrixPtrMatrix used to store suitability information for the predators on the current timestep, adjusted to take account of any overconsumption.

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

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