<div dir="ltr">I don't think your suggestion will work, Steve (he said without having tried it). If I understand things correctly (going out on a looong limb here), "FUNCTION" is an identifier to the tpl2cpp translator that what follows is a function that 1) whose signature should be added to the model_parameters class declaration in tpl_name.htp and 2) whose implementation should be added to tpl_name.cpp.<div>
<br></div><div>A nice (but probably tough to implement) feature in tpl2cpp would be the ability to put the following:</div><div><br></div><div><div>FUNCTION dvariable model_parameters::Richards(const dvariable &age, const dvariable &Linf, const dvariable &K, const dvariable &t0, const dvariable &p)</div>
<div>    dvariable Length=Linf*pow((1+(1/p)*exp(-K*(age-t0))),-p);<br></div><div>    return(Length);</div><div><br></div></div><div>into a file (functions.cxx, say) and be able to "include" that text in the tpl you're converting to cpp at a stage in the process before FUNCTIONs get converted to cpp equivalents. If such a feature is currently available, I haven't found it.</div>
<div><br></div><div style="min-height:100%"><div class="" style="width:1600px"><div class=""><div class=""><div class=""><div class="" style="width:1398px"><div class=""><div class=""><div class=""><div class=""><div id=":4" class="" style="height:934px">
<div id=":2" class="" style="min-height:744px"><div class=""><div class=""><div class="">Buck</div><div class="">On Mon, Aug 11, 2014 at 3:59 PM, Steve Martell <span dir="ltr"><<a href="mailto:martell.steve@gmail.com" target="_blank">martell.steve@gmail.com</a>></span> wrote:<br>
</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Try:<div><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple"><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">FUNCTION dvariable model_parameters::Richards(const dvariable &age, const dvariable &Linf, const dvariable &K, const dvariable &t0, const dvariable &p)<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">{<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">  {<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
    dvariable Length=Linf*pow((1+(1/p)*exp(-K*(age-t0))),-p);<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">    return(Length);<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
  }<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">}</div></div></div></blockquote></div><div><br><div><div>On Aug 11, 2014, at 3:49 PM, Mark Maunder <<a href="mailto:mmaunder@iattc.org" target="_blank">mmaunder@iattc.org</a>> wrote:</div>
<br><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family:Helvetica;font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Why do I get an error if I put the following function in the file CAPAM_Growth.hpp and include it using #include<CAPAM_Growth.hpp> but if I put it in the tpl using the FUNCTION section I do not? The translator appears to just put it in the cpp with no changes<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">dvariable model_parameters::Richards(const dvariable &age, const dvariable &Linf, const dvariable &K, const dvariable &t0, const dvariable &p)<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">{<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">  {<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
    dvariable Length=Linf*pow((1+(1/p)*exp(-K*(age-t0))),-p);<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">    return(Length);<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
  }<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">}<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">The errors I get are<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">In file included from igm.cpp:3:0:<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">./CAPAM_Growth.hpp:130:142: error: invalid use of incomplete type 'struct model_parameters'<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">c:/ADMB/admb101-gcc452-win32\include/admodel.h:107:9: error: forward declaration of 'struct model_parameters'<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
igm.cpp: In member function 'virtual void model_parameters::userfunction()':<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">igm.cpp:127:46: error: no matching function for call to 'Richards(prevariable, named_dvariable&, named_dvariable&, param_init_number&, named_dvariable&)'<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">igm.cpp:128:58: error: no matching function for call to 'Richards(prevariable&, named_dvariable&, named_dvariable&, param_init_number&, named_dvariable&)'<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">igm.cpp:139:49: error: no matching function for call to 'Richards(double&, named_dvariable&, named_dvariable&, param_init_number&, named_dvariable&)'<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">The selectivity<span> </span><span>special issue of the journal Fisheries Research is now published</span><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><a href="http://www.sciencedirect.com/science/journal/01657836/158/supp/C" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">http://www.sciencedirect.com/science/journal/01657836/158/supp/C</span></a><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><p class="MsoNormal" style="margin:0in 0in 6pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:white;background-repeat:initial initial">
<span>The Stock Synthesis special issue of the journal Fisheries Research<u></u><u></u></span></p><p class="MsoNormal" style="margin:0in 0in 6pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:white;background-repeat:initial initial">
<span><a href="http://www.sciencedirect.com/science/journal/01657836/142" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">http://www.sciencedirect.com/science/journal/01657836/142</span></a><u></u><u></u></span></p>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Mark Maunder         <u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Head of the Stock Assessment Program                                          <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="ES-PE">Inter-American  Tropical Tuna Commission                                     <u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="ES-TRAD">8901 La Jolla Shores Dr.<u></u><u></u></span></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="ES-TRAD">La Jolla, CA  92037-1508, USA<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="ES-PE">  <u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Tel: <a href="tel:%28858%29%20546-7027" value="+18585467027" target="_blank">(858) 546-7027</a><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Fax: <a href="tel:%28858%29%20546-7133" value="+18585467133" target="_blank">(858) 546-7133</a><u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<a href="mailto:mmaunder@iattc.org" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">mmaunder@iattc.org</span></a><u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<a href="http://www.fisheriesstockassessment.com/TikiWiki/tiki-index.php?page=Mark+Maunder" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">http://www.fisheriesstockassessment.com/TikiWiki/tiki-index.php?page=Mark+Maunder</span></a><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Visit the Center for the Advancement of Population Assessment Methodology at<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><a href="http://www.capamresearch.org/" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">http://www.capamresearch.org/</span></a><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Visit the AD Model Builder project at<u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <a href="http://admb-project.org/" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">http://admb-project.org/</span></a><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">See the following website for information on fisheries stock assessment<span> </span><a href="http://www.fisheriesstockassessment.com/" style="color:purple;text-decoration:underline" target="_blank"><span style="color:blue">http://www.fisheriesstockassessment.com/</span></a><u></u><u></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <span class="HOEnZb"><font color="#888888"><u></u></font></span></div>
</div><span class="HOEnZb"><font color="#888888"><div><br></div>--<span> </span><br>You received this message because you are subscribed to the Google Groups "admb-users" group.<br>To unsubscribe from this group and stop receiving emails from it, send an email to<span> </span><a href="mailto:admb-users+unsubscribe@googlegroups.com" style="color:purple;text-decoration:underline" target="_blank">admb-users+unsubscribe@googlegroups.com</a>.<br>
To post to this group, send email to<span> </span><a href="mailto:admb-users@googlegroups.com" style="color:purple;text-decoration:underline" target="_blank">admb-users@googlegroups.com</a>.<br>Visit this group at<span> </span><a href="http://groups.google.com/group/admb-users" style="color:purple;text-decoration:underline" target="_blank">http://groups.google.com/group/admb-users</a>.<br>
For more options, visit<span> </span><a href="https://groups.google.com/d/optout" style="color:purple;text-decoration:underline" target="_blank">https://groups.google.com/d/optout</a>.</font></span></div></blockquote></div>
<br></div></div><br>_______________________________________________<br>
Developers mailing list<br>
<a href="mailto:Developers@admb-project.org">Developers@admb-project.org</a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/developers" target="_blank">http://lists.admb-project.org/mailman/listinfo/developers</a><br>
<br></blockquote></div><br></div></div>