Gadget
Public Member Functions | Protected Attributes | List of all members
Grower Class Reference

This is the class used to calculate, and implement, the affect of growth on the stock. More...

#include <grower.h>

Inheritance diagram for Grower:
Inheritance graph
Collaboration diagram for Grower:
Collaboration graph

Public Member Functions

 Grower (CommentStream &infile, const LengthGroupDivision *const OtherLgrpDiv, const LengthGroupDivision *const GivenLgrpDiv, const IntVector &Areas, const TimeClass *const TimeInfo, Keeper *const keeper, const char *refWeight, const char *givenname, const AreaClass *const Area, const CharPtrVector &lenindex)
 This is the Grower constructor. More...
 
 ~Grower ()
 This is the default Grower destructor. More...
 
void calcGrowth (int area, const AreaClass *const Area, const TimeClass *const TimeInfo, const DoubleVector &FeedingLevel, const DoubleVector &Consumption)
 This will calculate the growth of the stock for the current timestep on a given area. More...
 
void calcGrowth (int area, const AreaClass *const Area, const TimeClass *const TimeInfo)
 This will calculate the growth of the stock for the current timestep on a given area. More...
 
void implementGrowth (int area, const PopInfoVector &NumberInArea, const LengthGroupDivision *const Lengths)
 This will implement the calculated changes due to growth of the stock. More...
 
void implementGrowth (int area, const LengthGroupDivision *const Lengths)
 This will implement the calculated changes due to growth of the stock. More...
 
void Sum (const PopInfoVector &NumberInArea, int area)
 This will calculate the amount of the stock that is on a given area and timestep. More...
 
void Reset ()
 This will reset the growth information for the current model run. More...
 
void Print (ofstream &outfile) const
 This function will print the growth data. More...
 
const DoubleMatrixgetLengthIncrease (int area) const
 This function will return the calculated length increase due to growth on an area. More...
 
const DoubleMatrixgetWeightIncrease (int area) const
 This function will return the calculated weight increase due to growth on an area. More...
 
const DoubleVectorgetWeight (int area) const
 This function will return the fixed weight increase due to growth on an area. More...
 
int getFixedWeights ()
 This will return the flag used to denote whether the weights have been fixed or not. 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...
 

Protected Attributes

PopInfoMatrix numGrow
 This is the PopInfoMatrix used to store information about the current population of the stock that is to grow according to the growth calculations. More...
 
LengthGroupDivisionLgrpDiv
 This is the LengthGroupDivision used to store length information. More...
 
ConversionIndexCI
 This is the ConversionIndex used to convert from the stock LengthGroupDivision to the LengthGroupDivision used for the growth calculation. More...
 
DoubleMatrix interpLengthGrowth
 This is the DoubleMatrix used to store the increase in length on the current timestep. More...
 
DoubleMatrix interpWeightGrowth
 This is the DoubleMatrix used to store the increase in weight on the current timestep. More...
 
DoubleMatrix calcLengthGrowth
 This is the DoubleMatrix used to store the calculated increase in length on the current timestep. More...
 
DoubleMatrix calcWeightGrowth
 This is the DoubleMatrix used to store the calculated increase in weight on the current timestep. More...
 
DoubleMatrixPtrVector lgrowth
 This is the DoubleMatrixPtrVector used to store the calculated increase in length for each length group on the current timestep. More...
 
DoubleMatrixPtrVector wgrowth
 This is the DoubleMatrixPtrVector used to store the calculated increase in weight for each length group on the current timestep. More...
 
DoubleVector dummyfphi
 This is the dummy DoubleVector used during the growth calculation. More...
 
GrowthCalcBasegrowthcalc
 This is the GrowthCalcBase used to calculate the growth information. More...
 
int functionnumber
 This is the identifier of the function to be used to calculate the growth. More...
 
int fixedweights
 This is the flag used to denote whether the change is weight is to be calculated, or fixed to values specified in the input files. More...
 
int maxlengthgroupgrowth
 This is the maximum number of length groups that an individual fish from the stock can grow on one timestep. More...
 
double growth
 This is the mean growth, as calculated for this length group by the GrowthCalc function. More...
 
double alpha
 This is the value of alpha in the beta binomial distribution. More...
 
Formula beta
 This is the value of beta in the beta binomial distribution. More...
 
DoubleVector part1
 This is a DoubleVector used when calculating the beta binomial distribution. More...
 
DoubleVector part2
 This is a DoubleVector used when calculating the beta binomial distribution. More...
 
double part3
 This is a double used when calculating the beta binomial distribution. More...
 
DoubleVector part4
 This is a DoubleVector used when calculating the beta binomial distribution. 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...
 
 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...
 

Detailed Description

This is the class used to calculate, and implement, the affect of growth on the stock.

This class calculates the growth of the stock, according to the different growth functions derived from the GrowthCalcBase class. Since the growth calculations can take place on a coarser scale than the stock is defined on, the calculated growth is then interpolated to take the length group of the stock into account. This growth is then implemented by moving the fish up from the old length groups to the new length groups, taking care to ensure that the fish that would move to beyond the largest length group are kept in the plus group.

Constructor & Destructor Documentation

◆ Grower()

Grower::Grower ( CommentStream infile,
const LengthGroupDivision *const  OtherLgrpDiv,
const LengthGroupDivision *const  GivenLgrpDiv,
const IntVector Areas,
const TimeClass *const  TimeInfo,
Keeper *const  keeper,
const char *  refWeight,
const char *  givenname,
const AreaClass *const  Area,
const CharPtrVector lenindex 
)

This is the Grower constructor.

Parameters
infileis the CommentStream to read the growth data from
OtherLgrpDivis the LengthGroupDivision of the stock
GivenLgrpDivis the LengthGroupDivision that the growth will be calculated on
Areasis the IntVector of areas that the stock lives on
TimeInfois the TimeClass for the current model
keeperis the Keeper for the current model
refWeightis the name of the file containing the reference weight information for the stock
givennameis the name of the stock for this Grower class
Areais the AreaClass for the current model
lenindexis the CharPtrVector of the lengths used for the growth of the stock

◆ ~Grower()

Grower::~Grower ( )

This is the default Grower destructor.

Member Function Documentation

◆ calcGrowth() [1/2]

void Grower::calcGrowth ( int  area,
const AreaClass *const  Area,
const TimeClass *const  TimeInfo 
)

This will calculate the growth of the stock for the current timestep on a given area.

Parameters
areais the area that the growth is being calculated on
Areais the AreaClass for the current model
TimeInfois the TimeClass for the current model

◆ calcGrowth() [2/2]

void Grower::calcGrowth ( int  area,
const AreaClass *const  Area,
const TimeClass *const  TimeInfo,
const DoubleVector FeedingLevel,
const DoubleVector Consumption 
)

This will calculate the growth of the stock for the current timestep on a given area.

Parameters
areais the area that the growth is being calculated on
Areais the AreaClass for the current model
TimeInfois the TimeClass for the current model
FeedingLevelis the DoubleVector of the feeding level of the stock
Consumptionis the DoubleVector of the maximum consumption of the stock

◆ getFixedWeights()

int Grower::getFixedWeights ( )
inline

This will return the flag used to denote whether the weights have been fixed or not.

Returns
fixedweights

◆ getLengthIncrease()

const DoubleMatrix& Grower::getLengthIncrease ( int  area) const
inline

This function will return the calculated length increase due to growth on an area.

Parameters
areais the area that the growth is being calculated on
Returns
lgrowth, a DoubleMatrix containing the length increase

◆ getWeight()

const DoubleVector& Grower::getWeight ( int  area) const
inline

This function will return the fixed weight increase due to growth on an area.

Parameters
areais the area that the growth is being calculated on
Returns
interpWeightGrowth, a DoubleVector containing the weight increase

◆ getWeightIncrease()

const DoubleMatrix& Grower::getWeightIncrease ( int  area) const
inline

This function will return the calculated weight increase due to growth on an area.

Parameters
areais the area that the growth is being calculated on
Returns
wgrowth, a DoubleMatrix containing the weight increase

◆ implementGrowth() [1/2]

void Grower::implementGrowth ( int  area,
const LengthGroupDivision *const  Lengths 
)

This will implement the calculated changes due to growth of the stock.

Parameters
areais the area that the growth is being calculated on
Lengthsis the LengthGroupDivision of the stock

◆ implementGrowth() [2/2]

void Grower::implementGrowth ( int  area,
const PopInfoVector NumberInArea,
const LengthGroupDivision *const  Lengths 
)

This will implement the calculated changes due to growth of the stock.

Parameters
areais the area that the growth is being calculated on
NumberInAreais the PopInfoVector giving the current population of the stock
Lengthsis the LengthGroupDivision of the stock

◆ Print()

void Grower::Print ( ofstream &  outfile) const

This function will print the growth data.

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

◆ Reset()

void Grower::Reset ( )

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

◆ Sum()

void Grower::Sum ( const PopInfoVector NumberInArea,
int  area 
)

This will calculate the amount of the stock that is on a given area and timestep.

Parameters
NumberInAreais the PopInfoVector giving the amount of the stock in the area
areais the area that the growth is being calculated on

Member Data Documentation

◆ alpha

double Grower::alpha
protected

This is the value of alpha in the beta binomial distribution.

◆ beta

Formula Grower::beta
protected

This is the value of beta in the beta binomial distribution.

◆ calcLengthGrowth

DoubleMatrix Grower::calcLengthGrowth
protected

This is the DoubleMatrix used to store the calculated increase in length on the current timestep.

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

◆ calcWeightGrowth

DoubleMatrix Grower::calcWeightGrowth
protected

This is the DoubleMatrix used to store the calculated increase in weight on the current timestep.

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

◆ CI

ConversionIndex* Grower::CI
protected

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

◆ dummyfphi

DoubleVector Grower::dummyfphi
protected

This is the dummy DoubleVector used during the growth calculation.

Note
The values of this vector are set to zero, and never used, unless the growth function depends on the feeding level of the stock (ie. growth is based on consumption of preys)

◆ fixedweights

int Grower::fixedweights
protected

This is the flag used to denote whether the change is weight is to be calculated, or fixed to values specified in the input files.

◆ functionnumber

int Grower::functionnumber
protected

This is the identifier of the function to be used to calculate the growth.

◆ growth

double Grower::growth
protected

This is the mean growth, as calculated for this length group by the GrowthCalc function.

◆ growthcalc

GrowthCalcBase* Grower::growthcalc
protected

This is the GrowthCalcBase used to calculate the growth information.

◆ interpLengthGrowth

DoubleMatrix Grower::interpLengthGrowth
protected

This is the DoubleMatrix used to store the increase in length on the current timestep.

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

◆ interpWeightGrowth

DoubleMatrix Grower::interpWeightGrowth
protected

This is the DoubleMatrix used to store the increase in weight on the current timestep.

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

◆ lgrowth

DoubleMatrixPtrVector Grower::lgrowth
protected

This is the DoubleMatrixPtrVector used to store the calculated increase in length for each length group on the current timestep.

Note
The indices for this object are [area][change in length][stock length]

◆ LgrpDiv

LengthGroupDivision* Grower::LgrpDiv
protected

This is the LengthGroupDivision used to store length information.

◆ maxlengthgroupgrowth

int Grower::maxlengthgroupgrowth
protected

This is the maximum number of length groups that an individual fish from the stock can grow on one timestep.

◆ numGrow

PopInfoMatrix Grower::numGrow
protected

This is the PopInfoMatrix used to store information about the current population of the stock that is to grow according to the growth calculations.

◆ part1

DoubleVector Grower::part1
protected

This is a DoubleVector used when calculating the beta binomial distribution.

Note
This stores the value of n*(n-1)*....(n-x+1)/x!

◆ part2

DoubleVector Grower::part2
protected

This is a DoubleVector used when calculating the beta binomial distribution.

Note
This stores the value of gamma(n-x+beta)/gamma(beta)

◆ part3

double Grower::part3
protected

This is a double used when calculating the beta binomial distribution.

Note
This stores the value of gamma(alpha+beta)/gamma(n+alpha+beta)

◆ part4

DoubleVector Grower::part4
protected

This is a DoubleVector used when calculating the beta binomial distribution.

Note
This stores the value of gamma(x+alpha)/gamma(x)

◆ wgrowth

DoubleMatrixPtrVector Grower::wgrowth
protected

This is the DoubleMatrixPtrVector used to store the calculated increase in weight for each length group on the current timestep.

Note
The indices for this object are [area][change in length][stock length]

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