<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.14">
  <compounddef id="canopy_8cpp" kind="file" language="C++">
    <compoundname>canopy.cpp</compoundname>
    <includes refid="CisInterface_8hpp" local="yes">CisInterface.hpp</includes>
    <includes local="no">string</includes>
    <includes local="no">iostream</includes>
    <incdepgraph>
      <node id="442">
        <label>stdint.h</label>
        <link refid="stdint_8h_source"/>
        <childnode refid="443" relation="include">
        </childnode>
        <childnode refid="444" relation="include">
        </childnode>
      </node>
      <node id="464">
        <label>AsciiTableComm.h</label>
        <link refid="AsciiTableComm_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="450" relation="include">
        </childnode>
      </node>
      <node id="437">
        <label>stdarg.h</label>
      </node>
      <node id="450">
        <label>../dataio/AsciiTable.h</label>
        <link refid="AsciiTable_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="451" relation="include">
        </childnode>
      </node>
      <node id="436">
        <label>stdlib.h</label>
      </node>
      <node id="430">
        <label>/root/cis_interface/cis_interface/cis_interface/examples/fakeplant/src/canopy.cpp</label>
        <link refid="canopy_8cpp"/>
        <childnode refid="431" relation="include">
        </childnode>
        <childnode refid="465" relation="include">
        </childnode>
        <childnode refid="466" relation="include">
        </childnode>
      </node>
      <node id="438">
        <label>errno.h</label>
      </node>
      <node id="463">
        <label>AsciiFileComm.h</label>
        <link refid="AsciiFileComm_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="451" relation="include">
        </childnode>
        <childnode refid="450" relation="include">
        </childnode>
      </node>
      <node id="452">
        <label>AsciiTableSerialize.h</label>
        <link refid="AsciiTableSerialize_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="448" relation="include">
        </childnode>
        <childnode refid="450" relation="include">
        </childnode>
      </node>
      <node id="465">
        <label>string</label>
      </node>
      <node id="454">
        <label>ObjSerialize.h</label>
        <link refid="ObjSerialize_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
      </node>
      <node id="444">
        <label>stddef.h</label>
      </node>
      <node id="433">
        <label>../tools.h</label>
        <link refid="tools_8h_source"/>
        <childnode refid="434" relation="include">
        </childnode>
        <childnode refid="435" relation="include">
        </childnode>
        <childnode refid="436" relation="include">
        </childnode>
        <childnode refid="437" relation="include">
        </childnode>
        <childnode refid="438" relation="include">
        </childnode>
        <childnode refid="439" relation="include">
        </childnode>
        <childnode refid="440" relation="include">
        </childnode>
        <childnode refid="442" relation="include">
        </childnode>
        <childnode refid="445" relation="include">
        </childnode>
      </node>
      <node id="457">
        <label>IPCComm.h</label>
        <link refid="IPCComm_8h_source"/>
        <childnode refid="456" relation="include">
        </childnode>
      </node>
      <node id="449">
        <label>FormatSerialize.h</label>
        <link refid="FormatSerialize_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="448" relation="include">
        </childnode>
        <childnode refid="450" relation="include">
        </childnode>
      </node>
      <node id="461">
        <label>ServerComm.h</label>
        <link refid="ServerComm_8h_source"/>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="460" relation="include">
        </childnode>
        <childnode refid="455" relation="include">
        </childnode>
      </node>
      <node id="432">
        <label>CisInterface.h</label>
        <link refid="CisInterface_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="446" relation="include">
        </childnode>
        <childnode refid="451" relation="include">
        </childnode>
        <childnode refid="450" relation="include">
        </childnode>
      </node>
      <node id="447">
        <label>../serialize/serialize.h</label>
        <link refid="serialize_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="448" relation="include">
        </childnode>
        <childnode refid="449" relation="include">
        </childnode>
        <childnode refid="452" relation="include">
        </childnode>
        <childnode refid="453" relation="include">
        </childnode>
        <childnode refid="454" relation="include">
        </childnode>
      </node>
      <node id="451">
        <label>AsciiFile.h</label>
        <link refid="AsciiFile_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
      </node>
      <node id="453">
        <label>PlySerialize.h</label>
        <link refid="PlySerialize_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
      </node>
      <node id="455">
        <label>comm_header.h</label>
        <link refid="comm__header_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="450" relation="include">
        </childnode>
      </node>
      <node id="443">
        <label>wchar.h</label>
      </node>
      <node id="434">
        <label>string.h</label>
      </node>
      <node id="456">
        <label>CommBase.h</label>
        <link refid="CommBase_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
      </node>
      <node id="459">
        <label>RPCComm.h</label>
        <link refid="RPCComm_8h_source"/>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="460" relation="include">
        </childnode>
        <childnode refid="455" relation="include">
        </childnode>
      </node>
      <node id="445">
        <label>unistd.h</label>
      </node>
      <node id="458">
        <label>ZMQComm.h</label>
        <link refid="ZMQComm_8h_source"/>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="455" relation="include">
        </childnode>
      </node>
      <node id="431">
        <label>CisInterface.hpp</label>
        <link refid="CisInterface_8hpp_source"/>
        <childnode refid="432" relation="include">
        </childnode>
      </node>
      <node id="460">
        <label>DefaultComm.h</label>
        <link refid="DefaultComm_8h_source"/>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="458" relation="include">
        </childnode>
      </node>
      <node id="440">
        <label>regex_posix.h</label>
        <link refid="regex__posix_8h_source"/>
        <childnode refid="441" relation="include">
        </childnode>
        <childnode refid="442" relation="include">
        </childnode>
      </node>
      <node id="439">
        <label>time.h</label>
      </node>
      <node id="466">
        <label>iostream</label>
      </node>
      <node id="448">
        <label>SerializeBase.h</label>
        <link refid="SerializeBase_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
      </node>
      <node id="462">
        <label>ClientComm.h</label>
        <link refid="ClientComm_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="460" relation="include">
        </childnode>
        <childnode refid="455" relation="include">
        </childnode>
      </node>
      <node id="446">
        <label>../communication/communication.h</label>
        <link refid="communication_8h_source"/>
        <childnode refid="433" relation="include">
        </childnode>
        <childnode refid="447" relation="include">
        </childnode>
        <childnode refid="455" relation="include">
        </childnode>
        <childnode refid="456" relation="include">
        </childnode>
        <childnode refid="457" relation="include">
        </childnode>
        <childnode refid="458" relation="include">
        </childnode>
        <childnode refid="459" relation="include">
        </childnode>
        <childnode refid="461" relation="include">
        </childnode>
        <childnode refid="462" relation="include">
        </childnode>
        <childnode refid="463" relation="include">
        </childnode>
        <childnode refid="464" relation="include">
        </childnode>
        <childnode refid="460" relation="include">
        </childnode>
      </node>
      <node id="441">
        <label>regex.h</label>
      </node>
      <node id="435">
        <label>stdio.h</label>
      </node>
    </incdepgraph>
    <innernamespace refid="namespacestd">std</innernamespace>
      <sectiondef kind="func">
      <memberdef kind="function" id="canopy_8cpp_1a3b93d7a75d454e1e4f4a65247a0cff06" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void grow_canopy</definition>
        <argsstring>(double tstep, double *growth_rate, double *layout, int npatch, double **x1, double **x2, double **x3)</argsstring>
        <name>grow_canopy</name>
        <param>
          <type>double</type>
          <declname>tstep</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>growth_rate</declname>
        </param>
        <param>
          <type>double *</type>
          <declname>layout</declname>
        </param>
        <param>
          <type>int</type>
          <declname>npatch</declname>
        </param>
        <param>
          <type>double **</type>
          <declname>x1</declname>
        </param>
        <param>
          <type>double **</type>
          <declname>x2</declname>
        </param>
        <param>
          <type>double **</type>
          <declname>x3</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/examples/fakeplant/src/canopy.cpp" line="7" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/examples/fakeplant/src/canopy.cpp" bodystart="7" bodyend="18"/>
      </memberdef>
      <memberdef kind="function" id="canopy_8cpp_1a0ddf1224851353fc92bfbff6f499fa97" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int main</definition>
        <argsstring>(int argc, char *argv[])</argsstring>
        <name>main</name>
        <param>
          <type>int</type>
          <declname>argc</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>argv</declname>
          <array>[]</array>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/examples/fakeplant/src/canopy.cpp" line="21" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/examples/fakeplant/src/canopy.cpp" bodystart="21" bodyend="141"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&quot;CisInterface.hpp&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;string&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal"><ref refid="namespacestd" kindref="compound">std</ref>;</highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>grow_canopy(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>tstep,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*growth_rate,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*layout,</highlight></codeline>
<codeline lineno="8"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>npatch,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>**x1,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>**x2,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>**x3)<sp/>{</highlight></codeline>
<codeline lineno="9"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i,<sp/>j;</highlight></codeline>
<codeline lineno="10"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>npatch;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="11"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(j<sp/>=<sp/>0;<sp/>j<sp/>&lt;<sp/>3;<sp/>j++)<sp/>{</highlight></codeline>
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x1[j][i]<sp/>=<sp/>(1.0<sp/>+<sp/>growth_rate[i]<sp/>*<sp/>tstep<sp/>*<sp/>layout[j])<sp/>*<sp/>x1[j][i];</highlight></codeline>
<codeline lineno="13"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x2[j][i]<sp/>=<sp/>(1.0<sp/>+<sp/>growth_rate[i]<sp/>*<sp/>tstep<sp/>*<sp/>layout[j])<sp/>*<sp/>x2[j][i];</highlight></codeline>
<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x3[j][i]<sp/>=<sp/>(1.0<sp/>+<sp/>growth_rate[i]<sp/>*<sp/>tstep<sp/>*<sp/>layout[j])<sp/>*<sp/>x3[j][i];</highlight></codeline>
<codeline lineno="15"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="16"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><highlight class="normal">}</highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*argv[])<sp/>{</highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i,<sp/>j,<sp/>return_code<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="24"><highlight class="normal"><sp/><sp/><ref refid="classCisInput" kindref="compound">CisInput</ref><sp/>in_layout(</highlight><highlight class="stringliteral">&quot;plant_layout&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="25"><highlight class="normal"><sp/><sp/><ref refid="classCisAsciiArrayInput" kindref="compound">CisAsciiArrayInput</ref><sp/>in_struct(</highlight><highlight class="stringliteral">&quot;init_canopy_structure&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="26"><highlight class="normal"><sp/><sp/><ref refid="classCisInput" kindref="compound">CisInput</ref><sp/>in_time(</highlight><highlight class="stringliteral">&quot;time&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/><ref refid="classCisInput" kindref="compound">CisInput</ref><sp/>in_growth(</highlight><highlight class="stringliteral">&quot;growth_rate&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="28"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>struct_format[200]<sp/>=<sp/></highlight><highlight class="stringliteral">&quot;%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n&quot;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="29"><highlight class="normal"><sp/><sp/><ref refid="classCisAsciiArrayOutput" kindref="compound">CisAsciiArrayOutput</ref><sp/>out_struct(</highlight><highlight class="stringliteral">&quot;canopy_structure&quot;</highlight><highlight class="normal">,<sp/>struct_format);</highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>time_prev,<sp/>time_curr,<sp/>time_step;</highlight></codeline>
<codeline lineno="31"><highlight class="normal"><sp/><sp/>time_curr<sp/>=<sp/>0.0;</highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Malloc<sp/>arrays<sp/>for<sp/>use</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*layout<sp/>=<sp/>(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">*)malloc(3*</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="35"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>**x1<sp/>=<sp/>(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">**)malloc(3*</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">*));</highlight></codeline>
<codeline lineno="36"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>**x2<sp/>=<sp/>(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">**)malloc(3*</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">*));</highlight></codeline>
<codeline lineno="37"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>**x3<sp/>=<sp/>(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">**)malloc(3*</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">*));</highlight></codeline>
<codeline lineno="38"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>3;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="39"><highlight class="normal"><sp/><sp/><sp/><sp/>x1[i]<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/>x2[i]<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/>x3[i]<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Receive<sp/>layout<sp/>and<sp/>initial<sp/>structure</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>0,<sp/>npatch<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>in_layout.recv(3,<sp/>layout,<sp/>layout<sp/>+<sp/>1,<sp/>layout<sp/>+<sp/>2);</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>Error<sp/>receiving<sp/>layout.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/>free(layout);</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x1);</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x2);</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x3);</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>layout<sp/>=<sp/>%f,<sp/>%f,<sp/>%f\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>layout[0],<sp/>layout[1],<sp/>layout[2]);</highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/>npatch<sp/>=<sp/>in_struct.recv(9,<sp/>&amp;x1[0],<sp/>&amp;x1[1],<sp/>&amp;x1[2],</highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;x2[0],<sp/>&amp;x2[1],<sp/>&amp;x2[2],</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;x3[0],<sp/>&amp;x3[1],<sp/>&amp;x3[2]);</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(npatch<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>Error<sp/>receiving<sp/>structure\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/>free(layout);</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x1);</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x2);</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x3);</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>%d<sp/>patches<sp/>in<sp/>initial<sp/>structure:\n\t\t%f\t%f\t%f\n\t\t%f\t%f\t%f\n\t\t%f\t%f\t%f...\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>npatch,<sp/>x1[0][0],<sp/>x1[1][0],<sp/>x1[2][0],</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>x2[0][0],<sp/>x2[1][0],<sp/>x2[2][0],</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>x3[0][0],<sp/>x3[1][0],<sp/>x3[2][0]);</highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Send<sp/>canopy<sp/>to<sp/>output<sp/>and<sp/>get<sp/>growth<sp/>rate<sp/>for<sp/>it</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*growth_rate<sp/>=<sp/>(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">*)malloc(npatch*</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>out_struct.send(9,<sp/>npatch,</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x1[0],<sp/>x1[1],<sp/>x1[2],</highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x2[0],<sp/>x2[1],<sp/>x2[2],</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x3[0],<sp/>x3[1],<sp/>x3[2]);</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>Error<sp/>sending<sp/>initial<sp/>structure<sp/>to<sp/>output.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/>return_code<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>npatch;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>in_growth.recv(1,<sp/>growth_rate<sp/>+<sp/>i);</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>Failed<sp/>to<sp/>get<sp/>initial<sp/>growth<sp/>rate<sp/>for<sp/>patch<sp/>%d.\n&quot;</highlight><highlight class="normal">,<sp/>i);</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/>return_code<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="92"><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Loop<sp/>over<sp/>growth<sp/>rates<sp/>calculating<sp/>new<sp/>structure</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Check<sp/>for<sp/>next<sp/>time</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/>time_prev<sp/>=<sp/>time_curr;</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>in_time.recv(1,<sp/>&amp;time_curr);</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>No<sp/>more<sp/>input.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Update<sp/>structure<sp/>and<sp/>send<sp/>to<sp/>out</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/>grow_canopy(time_curr<sp/>-<sp/>time_prev,<sp/>growth_rate,<sp/>layout,<sp/>npatch,<sp/>x1,<sp/>x2,<sp/>x3);</highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>npatch;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>patch<sp/>%d:<sp/>growth<sp/>rate<sp/>=<sp/>%f<sp/>--&gt;<sp/>\t%f\t%f\t%f\n\t\t\t\t\t\t%f\t%f\t%f\n\t\t\t\t\t\t%f\t%f\t%f...\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i,<sp/>growth_rate[i],<sp/>x1[0][i],<sp/>x1[1][i],<sp/>x1[2][i],</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x2[0][i],<sp/>x2[1][i],<sp/>x2[2][i],</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x3[0][i],<sp/>x3[1][i],<sp/>x3[2][i]);</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>out_struct.send(9,<sp/>npatch,</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x1[0],<sp/>x1[1],<sp/>x1[2],</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x2[0],<sp/>x2[1],<sp/>x2[2],</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x3[0],<sp/>x3[1],<sp/>x3[2]);</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>Error<sp/>sending<sp/>structure<sp/>output.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>return_code<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Receive<sp/>growth<sp/>rate<sp/>for<sp/>each<sp/>patch</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>npatch;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>in_growth.recv(1,<sp/>growth_rate<sp/>+<sp/>i);</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/>printf(</highlight><highlight class="stringliteral">&quot;canopy:<sp/>Failed<sp/>to<sp/>get<sp/>growth<sp/>rate<sp/>for<sp/>patch<sp/>%d<sp/>during<sp/>time<sp/>frame<sp/>%f<sp/>to<sp/>%f\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i,<sp/>time_prev,<sp/>time_curr);</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/>return_code<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>3;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x1[i]<sp/>!=<sp/>NULL)<sp/>free(x1[i]);</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x2[i]<sp/>!=<sp/>NULL)<sp/>free(x2[i]);</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x3[i]<sp/>!=<sp/>NULL)<sp/>free(x3[i]);</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/>free(layout);</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/>free(x1);</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/>free(x2);</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/>free(x3);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>return_code;</highlight></codeline>
<codeline lineno="141"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="/root/cis_interface/cis_interface/cis_interface/examples/fakeplant/src/canopy.cpp"/>
  </compounddef>
</doxygen>
