Gadget
stomachcontent.h
Go to the documentation of this file.
1 #ifndef stomachcontent_h
2 #define stomachcontent_h
3 
4 #include "commentstream.h"
5 #include "lengthgroup.h"
6 #include "predatorptrvector.h"
7 #include "preyptrvector.h"
9 #include "intmatrix.h"
10 #include "formulamatrix.h"
11 #include "actionattimes.h"
12 #include "charptrmatrix.h"
13 #include "predatoraggregator.h"
14 #include "multinomial.h"
15 
21 class SC : public HasName {
22 public:
32  SC(CommentStream& infile, const AreaClass* const Area, const TimeClass* const TimeInfo,
33  Keeper* const keeper, const char* datafilename, const char* givenname);
37  virtual ~SC();
43  virtual double calcLikelihood(const TimeClass* const TimeInfo);
47  virtual void Reset();
52  virtual void Print(ofstream& outfile) const;
58  virtual void setPredatorsAndPreys(PredatorPtrVector& Predators, PreyPtrVector& Preys);
64  virtual void printSummary(ofstream& outfile, double weight);
70  virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo);
75  virtual void aggregate(int i);
76 protected:
81  virtual double calcLikelihood() = 0;
177  double epsilon;
182 };
183 
188 class SCNumbers : public SC {
189 public:
199  SCNumbers(CommentStream& infile, const AreaClass* const Area, const TimeClass* const TimeInfo,
200  Keeper* const keeper, const char* datafilename, const char* givenname);
204  virtual ~SCNumbers() {};
209  virtual void aggregate(int i);
210 protected:
216  void readStomachNumberContent(CommentStream& infile, const TimeClass* const TimeInfo);
221  virtual double calcLikelihood();
234 };
235 
240 class SCAmounts : public SC {
241 public:
252  SCAmounts(CommentStream& infile, const AreaClass* const Area,
253  const TimeClass* const TimeInfo, Keeper* const keeper,
254  const char* datafilename, const char* numfilename, const char* givenname);
258  virtual ~SCAmounts();
264  virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo);
265 protected:
271  void readStomachAmountContent(CommentStream& infile, const TimeClass* const TimeInfo);
277  void readStomachSampleContent(CommentStream& infile, const TimeClass* const TimeInfo);
282  virtual double calcLikelihood();
293 };
294 
299 class SCRatios : public SCAmounts {
300 public:
311  SCRatios(CommentStream& infile, const AreaClass* const Area,
312  const TimeClass* const TimeInfo, Keeper* const keeper,
313  const char* datafilename, const char* numfilename, const char* givenname)
314  : SCAmounts(infile, Area, TimeInfo, keeper, datafilename, numfilename, givenname) {};
318  virtual ~SCRatios() {};
324  virtual void setPredatorsAndPreys(PredatorPtrVector& Predators, PreyPtrVector& Preys);
325 protected:
330  virtual double calcLikelihood();
331 };
332 
337 class SCSimple : public SC {
338 public:
348  SCSimple(CommentStream& infile, const AreaClass* const Area, const TimeClass* const TimeInfo,
349  Keeper* const keeper, const char* datafilename, const char* givenname);
353  virtual ~SCSimple() {};
359  virtual void setPredatorsAndPreys(PredatorPtrVector& Predators, PreyPtrVector& Preys);
360 protected:
366  void readStomachSimpleContent(CommentStream& infile, const TimeClass* const TimeInfo);
371  virtual double calcLikelihood();
372 };
373 
382 class StomachContent : public Likelihood {
383 public:
393  StomachContent(CommentStream& infile, const AreaClass* const Area,
394  const TimeClass* const TimeInfo, Keeper* const keeper, double weight, const char* name);
398  virtual ~StomachContent();
403  virtual void addLikelihood(const TimeClass* const TimeInfo);
408  virtual void Reset(const Keeper* const keeper);
413  virtual void Print(ofstream& outfile) const;
420  { StomCont->setPredatorsAndPreys(Predators, Preys); };
425  virtual void printSummary(ofstream& outfile) {
426  StomCont->printSummary(outfile, weight); };
432  virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo) {
433  StomCont->printLikelihood(outfile, TimeInfo); };
434 private:
438  char* functionname;
442  SC* StomCont;
443 };
444 
445 #endif
446 
This is the class used to associate actions with specific timesteps within the model.
Definition: actionattimes.h:14
This is the class used to store information about the areas used for the current model.
Definition: areatime.h:18
This class implements a dynamic vector of CharPtrVector values.
Definition: charptrmatrix.h:11
This class implements a dynamic vector of char values.
Definition: charptrvector.h:8
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This class implements a dynamic vector of DoubleMatrixPtrVector values.
Definition: doublematrixptrmatrix.h:13
This class implements a dynamic vector of DoubleMatrix values.
Definition: doublematrixptrvector.h:10
This class implements a dynamic vector of DoubleVector values.
Definition: doublematrix.h:11
This class implements a dynamic vector of double values.
Definition: doublevector.h:11
This class implements a dynamic vector of FormulaVector values.
Definition: formulamatrix.h:11
This is the base class for any object that has a name.
Definition: hasname.h:10
This class implements a dynamic vector of IntVector values.
Definition: intmatrix.h:10
This class implements a dynamic vector of int values.
Definition: intvector.h:11
This is the class used to store information about the variables that are used in model simulation.
Definition: keeper.h:17
This is the class used to store information about the length groups of the modelled stock population.
Definition: lengthgroup.h:10
This is the base class used to calculate the likelihood scores used to compare the modelled data in t...
Definition: likelihood.h:24
double weight
This stores the weight to be applied to the likelihood component.
Definition: likelihood.h:112
This is the class that calculates a log likelihood score by comparing 2 vectors based on a multinomia...
Definition: multinomial.h:10
This is the class used to aggregate predation information.
Definition: predatoraggregator.h:15
This class implements a dynamic vector of Predator values.
Definition: predatorptrvector.h:10
This class implements a dynamic vector of Prey values.
Definition: preyptrvector.h:10
This is the class used to calculate the stomach content likelihood score based on a function of the a...
Definition: stomachcontent.h:240
DoubleMatrixPtrVector number
This is the DoubleMatrixPtrVector used to store the number of stomach samples specified in the input ...
Definition: stomachcontent.h:292
void readStomachAmountContent(CommentStream &infile, const TimeClass *const TimeInfo)
This function will read the StomachContent amount data from the input file.
Definition: stomachcontent.cc:670
DoubleMatrixPtrMatrix stddev
This is the DoubleMatrixPtrMatrix used to store the standard deviation values for the consumption inf...
Definition: stomachcontent.h:287
void readStomachSampleContent(CommentStream &infile, const TimeClass *const TimeInfo)
This function will read the StomachContent sample data from the input file.
Definition: stomachcontent.cc:778
virtual void printLikelihood(ofstream &outfile, const TimeClass *const TimeInfo)
This function will print information from each SCAmounts calculation.
Definition: stomachcontent.cc:866
virtual ~SCAmounts()
This is the default SCAmounts destructor.
Definition: stomachcontent.cc:856
virtual double calcLikelihood()
This function will calculate the likelihood score from the SCAmounts information.
Definition: stomachcontent.cc:900
SCAmounts(CommentStream &infile, const AreaClass *const Area, const TimeClass *const TimeInfo, Keeper *const keeper, const char *datafilename, const char *numfilename, const char *givenname)
This is the SCAmounts constructor.
Definition: stomachcontent.cc:644
This is the class used to calculate the stomach content likelihood score based on a function of the n...
Definition: stomachcontent.h:188
SCNumbers(CommentStream &infile, const AreaClass *const Area, const TimeClass *const TimeInfo, Keeper *const keeper, const char *datafilename, const char *givenname)
This is the SCNumbers constructor.
Definition: stomachcontent.cc:496
virtual ~SCNumbers()
This is the default SCNumbers destructor.
Definition: stomachcontent.h:204
virtual void aggregate(int i)
This function will aggregate consumption information for each StomachContent calculation.
Definition: stomachcontent.cc:637
DoubleVector mndist
This is the DoubleVector used to temporarily store the modelled consumption when calculating the like...
Definition: stomachcontent.h:233
virtual double calcLikelihood()
This function will calculate the likelihood score from the SCNumbers information.
Definition: stomachcontent.cc:621
Multinomial MN
This is the Multinomial that is used when calculating the likelihood score.
Definition: stomachcontent.h:225
DoubleVector mndata
This is the DoubleVector used to temporarily store the observed consumption when calculating the like...
Definition: stomachcontent.h:229
void readStomachNumberContent(CommentStream &infile, const TimeClass *const TimeInfo)
This function will read the StomachContent numbers data from the input file.
Definition: stomachcontent.cc:518
This is the class used to calculate the stomach content likelihood score based on a function of the r...
Definition: stomachcontent.h:299
SCRatios(CommentStream &infile, const AreaClass *const Area, const TimeClass *const TimeInfo, Keeper *const keeper, const char *datafilename, const char *numfilename, const char *givenname)
This is the SCRatios constructor.
Definition: stomachcontent.h:311
virtual double calcLikelihood()
This function will calculate the likelihood score from the SCRatios information.
Definition: stomachcontent.cc:951
virtual ~SCRatios()
This is the default SCRatios destructor.
Definition: stomachcontent.h:318
virtual void setPredatorsAndPreys(PredatorPtrVector &Predators, PreyPtrVector &Preys)
This will select the predators and preys required to calculate the SCRatios likelihood score.
Definition: stomachcontent.cc:929
This is the class used to calculate the stomach content likelihood score based on a simple function o...
Definition: stomachcontent.h:337
virtual double calcLikelihood()
This function will calculate the likelihood score from the SCSimple information.
Definition: stomachcontent.cc:1135
SCSimple(CommentStream &infile, const AreaClass *const Area, const TimeClass *const TimeInfo, Keeper *const keeper, const char *datafilename, const char *givenname)
This is the SCSimple constructor.
Definition: stomachcontent.cc:991
virtual void setPredatorsAndPreys(PredatorPtrVector &Predators, PreyPtrVector &Preys)
This will select the predators and preys required to calculate the SCSimple likelihood score.
Definition: stomachcontent.cc:1113
void readStomachSimpleContent(CommentStream &infile, const TimeClass *const TimeInfo)
This function will read the StomachContent amount data from the input file.
Definition: stomachcontent.cc:1008
virtual ~SCSimple()
This is the default SCSimple destructor.
Definition: stomachcontent.h:353
This is the base class used to calculate the stomach content likelihood score based on the consumptio...
Definition: stomachcontent.h:21
CharPtrVector predindex
This is the CharPtrVector of the names of the predator aggregation units (either age or length) that ...
Definition: stomachcontent.h:112
int timeindex
This is the index of the timesteps for the likelihood component data.
Definition: stomachcontent.h:161
virtual void Print(ofstream &outfile) const
This function will print the summary SC information.
Definition: stomachcontent.cc:457
DoubleVector predatorlengths
This is the DoubleVector used to store predator length information.
Definition: stomachcontent.h:128
FormulaMatrix digestioncoeff
This is the FormulaMatrix used to store the digestion parameters for the various predator prey pairs.
Definition: stomachcontent.h:169
LengthGroupDivision * predLgrpDiv
This is the LengthGroupDivision used to store prey length information.
Definition: stomachcontent.h:157
virtual double calcLikelihood()=0
This function will calculate the likelihood score from the SC information.
DoubleMatrix likelihoodValues
This is the DoubleMatrix used to store the calculated likelihood information.
Definition: stomachcontent.h:96
virtual ~SC()
This is the default SC destructor.
Definition: stomachcontent.cc:292
CharPtrVector areaindex
This is the CharPtrVector of the names of the areas.
Definition: stomachcontent.h:108
ActionAtTimes AAT
This ActionAtTimes stores information about when the likelihood score should be calculated.
Definition: stomachcontent.h:165
virtual void setPredatorsAndPreys(PredatorPtrVector &Predators, PreyPtrVector &Preys)
This will select the predators and preys required to calculate the SC likelihood score.
Definition: stomachcontent.cc:330
virtual void Reset()
This function will reset the SC information.
Definition: stomachcontent.cc:227
DoubleMatrix preylengths
This is the DoubleMatrix used to store prey length information.
Definition: stomachcontent.h:137
DoubleMatrix digestion
This is the DoubleMatrix used to store the calculated digestion coefficiants for the various predator...
Definition: stomachcontent.h:173
virtual void printLikelihood(ofstream &outfile, const TimeClass *const TimeInfo)
This function will print information from each StomachContent calculation.
Definition: stomachcontent.cc:261
CharPtrMatrix preynames
This is the CharPtrMatrix of the names of the preys that will be used to calculate the likelihood sco...
Definition: stomachcontent.h:104
IntMatrix predatorages
This is the IntMatrix used to store predator age information.
Definition: stomachcontent.h:132
CharPtrVector predatornames
This is the CharPtrVector of the names of the predators that will be used to calculate the likelihood...
Definition: stomachcontent.h:100
DoubleMatrixPtrMatrix modelConsumption
This is the DoubleMatrixPtrMatrix used to store consumption (stomach content) information calculated ...
Definition: stomachcontent.h:91
LengthGroupDivision ** preyLgrpDiv
This is the LengthGroupDivision used to store predator length information.
Definition: stomachcontent.h:153
DoubleMatrixPtrMatrix obsConsumption
This is the DoubleMatrixPtrMatrix used to store stomach content (consumption) information specified i...
Definition: stomachcontent.h:86
PredatorAggregator ** aggregator
This is the PredatorAggregator used to collect information about the predation.
Definition: stomachcontent.h:149
IntVector Steps
This is the IntVector used to store information about the steps when the likelihood score should be c...
Definition: stomachcontent.h:124
IntVector Years
This is the IntVector used to store information about the years when the likelihood score should be c...
Definition: stomachcontent.h:120
SC(CommentStream &infile, const AreaClass *const Area, const TimeClass *const TimeInfo, Keeper *const keeper, const char *datafilename, const char *givenname)
This is the SC constructor.
Definition: stomachcontent.cc:81
int usepredages
This is the flag used to denote whether the predators are specified using age groups or length groups...
Definition: stomachcontent.h:145
virtual void aggregate(int i)
This function will aggregate consumption information for each StomachContent calculation.
Definition: stomachcontent.cc:186
CharPtrVector preyindex
This is the CharPtrVector of the names of the prey aggregation units that will be read in from the in...
Definition: stomachcontent.h:116
double epsilon
This is the value of epsilon used when calculating the likelihood score.
Definition: stomachcontent.h:177
const DoubleMatrix * dptr
This is the DoubleMatrix used to temporarily store the information returned from the aggregatation fu...
Definition: stomachcontent.h:181
virtual void printSummary(ofstream &outfile, double weight)
This function will print summary information from each StomachContent likelihood calculation.
Definition: stomachcontent.cc:246
IntMatrix areas
This is the IntMatrix used to store area information.
Definition: stomachcontent.h:141
This is the class used to calculate a likelihood score based on data sampled from the stomach of stoc...
Definition: stomachcontent.h:382
virtual void Reset(const Keeper *const keeper)
This function will reset the StomachContent likelihood information.
Definition: stomachcontent.cc:65
virtual void Print(ofstream &outfile) const
This function will print the summary StomachContent likelihood information.
Definition: stomachcontent.cc:72
void setPredatorsAndPreys(PredatorPtrVector &Predators, PreyPtrVector &Preys)
This will select the predators and preys required to calculate the StomachContent likelihood score.
Definition: stomachcontent.h:419
virtual void printLikelihood(ofstream &outfile, const TimeClass *const TimeInfo)
This function will print information from each StomachContent calculation.
Definition: stomachcontent.h:432
virtual void addLikelihood(const TimeClass *const TimeInfo)
This function will calculate the likelihood score for the StomachContent component.
Definition: stomachcontent.cc:59
virtual void printSummary(ofstream &outfile)
This function will print summary information from each StomachContent likelihood calculation.
Definition: stomachcontent.h:425
StomachContent(CommentStream &infile, const AreaClass *const Area, const TimeClass *const TimeInfo, Keeper *const keeper, double weight, const char *name)
This is the StomachContent constructor.
Definition: stomachcontent.cc:18
virtual ~StomachContent()
This is the default StomachContent destructor.
Definition: stomachcontent.cc:54
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87