|
Nemo
2.2.0
|
StatHandler class for the LCE_Selection class. More...
#include <LCEselection.h>
Inheritance diagram for LCE_SelectionSH:
Collaboration diagram for LCE_SelectionSH:Public Member Functions | |
| LCE_SelectionSH (LCE_Selection_base *event) | |
| virtual | ~LCE_SelectionSH () |
| virtual bool | setStatRecorders (string &token) |
| double | getMeanFitness () |
| double | getFitness (unsigned int i) |
| double | getSurvival (unsigned int i) |
| double | getPedProp (unsigned int i) |
| double | getPatchFitness (unsigned int i) |
StatHandler class for the LCE_Selection class.
Records the fitness stats.
Definition at line 233 of file LCEselection.h.
| LCE_SelectionSH::LCE_SelectionSH | ( | LCE_Selection_base * | event | ) | [inline] |
Definition at line 238 of file LCEselection.h.
| virtual LCE_SelectionSH::~LCE_SelectionSH | ( | ) | [inline, virtual] |
Definition at line 239 of file LCEselection.h.
{}
| double LCE_SelectionSH::getFitness | ( | unsigned int | i | ) | [inline] |
Definition at line 243 of file LCEselection.h.
References LCE_Selection_base::_fitness, and EventStatHandler< LCE_Selection_base, LCE_SelectionSH >::_SHLinkedEvent.
Referenced by setStatRecorders().
{return _SHLinkedEvent->_fitness[i];}
| double LCE_SelectionSH::getMeanFitness | ( | ) | [inline] |
Definition at line 242 of file LCEselection.h.
References LCE_Selection_base::_mean_fitness, and EventStatHandler< LCE_Selection_base, LCE_SelectionSH >::_SHLinkedEvent.
Referenced by setStatRecorders().
{return _SHLinkedEvent->_mean_fitness;}
| double LCE_SelectionSH::getPatchFitness | ( | unsigned int | i | ) |
Definition at line 646 of file LCEselection.cc.
References LCE_Selection_base::_is_absolute, LCE_Selection_base::_is_local, StatHandlerBase::_pop, EventStatHandler< LCE_Selection_base, LCE_SelectionSH >::_SHLinkedEvent, FEM, Patch::get(), LCE_Selection_base::getFitness(), Metapop::getPatchPtr(), MAL, OFFSPRG, OFFSx, LCE_Selection_base::setScalingFactorGlobal(), LCE_Selection_base::setScalingFactorLocal(), and Patch::size().
Referenced by setStatRecorders().
{
double mean = 0;
Patch* patch = _pop->getPatchPtr(i);
if( !_SHLinkedEvent->_is_absolute )
if(_SHLinkedEvent->_is_local)
_SHLinkedEvent->setScalingFactorLocal(OFFSPRG, i);
else
_SHLinkedEvent->setScalingFactorGlobal(OFFSPRG, i);
for(unsigned int j = 0, size = patch->size(FEM,OFFSx); j < size; j++)
mean += _SHLinkedEvent->getFitness( patch->get(FEM,OFFSx,j), i);
for(unsigned int j = 0, size = patch->size(MAL,OFFSx); j < size; j++)
mean += _SHLinkedEvent->getFitness( patch->get(MAL,OFFSx,j), i);
return (patch->size(OFFSx) != 0 ? mean / patch->size(OFFSx) : nanf("NULL"));
}
| double LCE_SelectionSH::getPedProp | ( | unsigned int | i | ) | [inline] |
Definition at line 245 of file LCEselection.h.
References LCE_Selection_base::_ind_cntr, and EventStatHandler< LCE_Selection_base, LCE_SelectionSH >::_SHLinkedEvent.
Referenced by setStatRecorders().
{return _SHLinkedEvent->_ind_cntr[i];}
| double LCE_SelectionSH::getSurvival | ( | unsigned int | i | ) | [inline] |
Definition at line 244 of file LCEselection.h.
References EventStatHandler< LCE_Selection_base, LCE_SelectionSH >::_SHLinkedEvent, and LCE_Selection_base::_survival.
Referenced by setStatRecorders().
{return _SHLinkedEvent->_survival[i];}
| bool LCE_SelectionSH::setStatRecorders | ( | string & | token | ) | [virtual] |
Definition at line 608 of file LCEselection.cc.
References StatHandlerBase::_pop, StatHandler< LCE_SelectionSH >::add(), ALL, getFitness(), getMeanFitness(), getPatchFitness(), Metapop::getPatchNbr(), getPedProp(), and getSurvival().
{
if(token.compare("fitness") == 0) {
add("Mean population fitness","fitness.mean",ALL,0,0,&LCE_SelectionSH::getMeanFitness,0,0,0);
add("Mean population fitness","fitness.outb",ALL,0,0,0,&LCE_SelectionSH::getFitness,0,0);
add("Mean population fitness","fitness.outw",ALL,1,0,0,&LCE_SelectionSH::getFitness,0,0);
add("Mean population fitness","fitness.hsib",ALL,2,0,0,&LCE_SelectionSH::getFitness,0,0);
add("Mean population fitness","fitness.fsib",ALL,3,0,0,&LCE_SelectionSH::getFitness,0,0);
add("Mean population fitness","fitness.self",ALL,4,0,0,&LCE_SelectionSH::getFitness,0,0);
} else if(token.compare("survival") == 0) {
add("Mean offspring survival","survival.outb",ALL,0,0,0,&LCE_SelectionSH::getSurvival,0,0);
add("Mean offspring survival","survival.outw",ALL,1,0,0,&LCE_SelectionSH::getSurvival,0,0);
add("Mean offspring survival","survival.hsib",ALL,2,0,0,&LCE_SelectionSH::getSurvival,0,0);
add("Mean offspring survival","survival.fsib",ALL,3,0,0,&LCE_SelectionSH::getSurvival,0,0);
add("Mean offspring survival","survival.self",ALL,4,0,0,&LCE_SelectionSH::getSurvival,0,0);
} else if(token.compare("fitness.prop") == 0) {
add("Proportion of b/n demes outbreds","prop.outb",ALL,0,0,0,&LCE_SelectionSH::getPedProp,0,0);
add("Proportion of w/n demes outbreds","prop.outw",ALL,1,0,0,&LCE_SelectionSH::getPedProp,0,0);
add("Proportion of half-sib crossings","prop.hsib",ALL,2,0,0,&LCE_SelectionSH::getPedProp,0,0);
add("Proportion of full-sib crossings","prop.fsib",ALL,3,0,0,&LCE_SelectionSH::getPedProp,0,0);
add("Proportion of selfed progeny","prop.self",ALL,4,0,0,&LCE_SelectionSH::getPedProp,0,0);
} else if(token.compare("fitness.patch") == 0) {
unsigned int patchNbr = _pop->getPatchNbr();
std::ostringstream name, sub_name;
for(unsigned int p = 0; p < patchNbr; p++) {
name<<"Mean fitness patch "<<p+1;
sub_name<<"fitness.p"<<p+1;
add(name.str(),sub_name.str(),ALL,p,0,0,&LCE_SelectionSH::getPatchFitness,0,0);
name.str(""); sub_name.str("");
}
} else return false;
return true;
}
1.7.5.1 -- Nemo is hosted by