[Developers] Template functions and documentation

Mark Maunder mmaunder at iattc.org
Fri Jun 27 11:04:47 PDT 2014


Hi developers,

I am in the process or putting together a model that will be used to evaluate several growth equations so I thought I better try to use the ADMB project "approved" approach for writing the functions. Below is a template function and documentation for the von Bertalanffy growth equation. I would appreciate any advice on doing this "correctly".

Thanks,

Mark

/**
\defgroup CONTRIB Contributed libraries
*/

/**
\ingroup CONTRIB
\defgroup CAPAM CAPAM created functions
*/

#include <admodel.h>

/**  von Bertalanffy growth equation; constant objects.
  \ingroup CAPAM
  \brief Calculate the length from a given age based on the von Bertalanffy equation. Written by Mark Maunder.
  \param age age of individual, \f$a\f$.
  \param Linf asymptotic length, \f$L_inf\f$.
  \param K growth rate, \f$K\f$.
  \param t0 age at zero length, \f$t_0\f$.
  \return length predicted length of individual. \f$L_inf*(1-exp(-K*(a-t0)))\f$.
  */

template <typename type1, typename type1>
//can have multiple types so that they are used below in variable definitions, they can differ between function calls, but remain the same within a function call
//type1 is probably a long
//type2 is probably a dvariable (either a model parameter (Linf K t0) or a derived variable (length))
//may need a type3, which is a dvar_vector if age and length are vectors, where type 1 will be a vector
type1 vonB(const type1 &age, const type2 &Linf, const type2 &K, const type2 &t0)
{
  type2 length = Linf*(1.-mfexp(-K*(age-t0)));
  return (length);
}


//is length a bad word to use
//do we use ingroup for both groups and subgroups in doxygen documentation
//should we use mfexp?
//what if age and length are vectors, but age is a vector and length is a dvar_vector, do we need to overload the type with one with three variable types
//I couldn't work out how to put in the detailed description
//The equations did not work on my computer


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140627/713f631e/attachment.html>


More information about the Developers mailing list