ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
MRR_Data Class Reference

Class for running mark-release-recapture experiments. More...

#include <Hare_all.h>

Public Member Functions

void AddEntry (int a_RefNum)
 
void IncTrapping ()
 
 MRR_Data ()
 
void OutputToFile ()
 

Protected Attributes

int m_currenttrapping
 
vector< MRR_Entrym_Entries
 

Detailed Description

Class for running mark-release-recapture experiments.

Definition at line 118 of file Hare_all.h.

Constructor & Destructor Documentation

◆ MRR_Data()

MRR_Data::MRR_Data ( )

Constructor for MRR_Data

Definition at line 4290 of file Hare_all.cpp.

4290  {
4292  m_Entries.resize(0);
4293 }

References m_currenttrapping, and m_Entries.

Member Function Documentation

◆ AddEntry()

void MRR_Data::AddEntry ( int  a_RefNum)

Adds a new entry to the Mark Release Recapture data vector

Definition at line 4298 of file Hare_all.cpp.

4298  {
4299  // First do we have this RefNum in the vector?
4300  vector<MRR_Entry>::iterator current = m_Entries.begin();
4301  vector<MRR_Entry>::iterator found = m_Entries.end();
4302  bool flag=false;
4303  while (current != found)
4304  {
4305  if ( (*current).m_HareRefNum==a_RefNum ) {
4306  found=current;
4307  flag=true;
4308  } else current++;
4309  }
4310  MRR_Entry mre;
4311  if (flag) {
4312  // Get the entry out to mre
4313 // mre=(*found);
4314  if (m_currenttrapping<32) {
4315  unsigned int mask = 0x01 << m_currenttrapping;
4316  (*found).m_trappings1 += mask;
4317  } else {
4318  unsigned int mask = 0x01 << (m_currenttrapping-32);
4319  (*found).m_trappings2 += mask;
4320  }
4321  } else {
4322  mre.m_HareRefNum=a_RefNum;
4323  mre.m_trappings1=0;
4324  mre.m_trappings2=0;
4325  if (m_currenttrapping<32) {
4326  unsigned int mask = 0x01 << m_currenttrapping;
4327  mre.m_trappings1 += mask;
4328  } else {
4329  unsigned int mask = 0x01 << (m_currenttrapping-32);
4330  mre.m_trappings2 += mask;
4331  }
4332  m_Entries.insert(m_Entries.begin(),mre); // Put at the beginning because this is the one most likely found next time
4333  }
4334 }

References m_currenttrapping, m_Entries, MRR_Entry::m_HareRefNum, MRR_Entry::m_trappings1, and MRR_Entry::m_trappings2.

Referenced by THare_Population_Manager::MRROutputs().

◆ IncTrapping()

void MRR_Data::IncTrapping ( )
inline

Definition at line 123 of file Hare_all.h.

123 { m_currenttrapping++; }

References m_currenttrapping.

Referenced by THare_Population_Manager::MRROutputs().

◆ OutputToFile()

void MRR_Data::OutputToFile ( )

Produces a file output for the Mark Release Recapture data

Definition at line 4340 of file Hare_all.cpp.

4340  {
4341  FILE* MRROut = fopen("MRR_Hare.txt","w");
4342  if (!MRROut) {
4343  // something wrong if the program gets to here
4344  g_land->Warn("THare_Population_Manager::MRROutputs - MRR_Hare.txt can't be opened",NULL);
4345  exit(1);
4346  }
4347  vector<MRR_Entry>::iterator current = m_Entries.begin();
4348  MRR_Entry mre;
4349  for (vector<MRR_Entry>::iterator i = m_Entries.begin(); i< m_Entries.end(); i++) {
4350  mre=(*i);
4351  unsigned int mask= 0x01;
4352  for (int j=0; j<32; j++) {
4353  if ((mask & mre.m_trappings1) > 0 ) {
4354  fprintf(MRROut,"%d\t",1);
4355  } else fprintf(MRROut,"%d\t",0);
4356  mask = mask << 1;
4357  }
4358  mask=0;
4359  for (int j=0; j<32; j++) {
4360  if ((mask & mre.m_trappings2) > 0 ) {
4361  fprintf(MRROut,"%d\t",1);
4362  } else fprintf(MRROut,"%d\t",0);
4363  mask = mask << 1;
4364  }
4365  fprintf(MRROut,"%d\n",mre.m_HareRefNum);
4366  }
4367  fclose(MRROut);
4368 }

References g_land, m_Entries, MRR_Entry::m_HareRefNum, MRR_Entry::m_trappings1, MRR_Entry::m_trappings2, and Landscape::Warn().

Referenced by THare_Population_Manager::MRROutputs().

Member Data Documentation

◆ m_currenttrapping

int MRR_Data::m_currenttrapping
protected

Definition at line 126 of file Hare_all.h.

Referenced by AddEntry(), IncTrapping(), and MRR_Data().

◆ m_Entries

vector<MRR_Entry> MRR_Data::m_Entries
protected

Definition at line 127 of file Hare_all.h.

Referenced by AddEntry(), MRR_Data(), and OutputToFile().


The documentation for this class was generated from the following files:
g_land
Landscape * g_land
MRR_Entry::m_trappings2
int m_trappings2
Definition: Hare_all.h:111
MRR_Data::m_Entries
vector< MRR_Entry > m_Entries
Definition: Hare_all.h:127
MRR_Entry::m_HareRefNum
int m_HareRefNum
Definition: Hare_all.h:109
MRR_Data::m_currenttrapping
int m_currenttrapping
Definition: Hare_all.h:126
MRR_Entry
Data entry for mark release recapture data MRR_Data.
Definition: Hare_all.h:108
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: Landscape.h:1579
MRR_Entry::m_trappings1
int m_trappings1
Definition: Hare_all.h:110