Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] View of /trunk/gadget/selectfunc.cc
[mareframe] / trunk / gadget / selectfunc.cc Repository:
ViewVC logotype

View of /trunk/gadget/selectfunc.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Mon Feb 10 17:09:07 2014 UTC (10 years, 4 months ago) by agomez
File size: 1666 byte(s)
Initial version based on Gadget 2.2.00
#include "selectfunc.h"
#include "gadget.h"

// ********************************************************
// Functions for base selection function
// ********************************************************
void SelectFunc::readConstants(CommentStream& infile,
  const TimeClass* const TimeInfo, Keeper* const keeper) {

  coeff.read(infile, TimeInfo, keeper);
  coeff.Update(TimeInfo);
}

void SelectFunc::updateConstants(const TimeClass* const TimeInfo) {
  coeff.Update(TimeInfo);
}

int SelectFunc::didChange(const TimeClass* const TimeInfo) {
  return coeff.didChange(TimeInfo);
}

// ********************************************************
// Functions for ConstSelectFunc selection function
// ********************************************************
ConstSelectFunc::ConstSelectFunc() : SelectFunc("ConstantSelectFunc") {
  coeff.setsize(1);
}

double ConstSelectFunc::calculate(double len) {
  return coeff[0];
}

// ********************************************************
// Functions for ExpSelectFunc selection function
// ********************************************************
ExpSelectFunc::ExpSelectFunc() : SelectFunc("ExponentialSelectFunc") {
  coeff.setsize(2);
}

double ExpSelectFunc::calculate(double len) {
  return (1.0 / (1.0 + exp(coeff[0] * (len - coeff[1]))));
}

// ********************************************************
// Functions for StraightSelectFunc selection function
// ********************************************************
StraightSelectFunc::StraightSelectFunc() : SelectFunc("StraightLineSelectFunc") {
  coeff.setsize(2);
}

double StraightSelectFunc::calculate(double len) {
  return (coeff[0] * len + coeff[1]);
}

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge