Changeset - dcd49517f90b
[Not reviewed]
default
0 5 0
Roeland Merks - 15 years ago 2010-11-29 11:48:52
roeland.merks@cwi.nl
Two last corrections:
- Viewport was not written during automatic export of XML files, because Virtualization of XMLSettingsTree did not work due to inconsistent function definition (const vs. non-const)
- Some of the default parameter-file had "Start saving movie frames" switched on by default, dramatically slowing down the example runs. Now it is switched off in all example XML files.

user: Roeland Merks <roeland.merks@cwi.nl>
branch 'default'
changed data/leaves/auxin_growth.xml
changed data/leaves/tutorial5_init.xml
changed src/VirtualLeaf.cpp
changed src/mainbase.cpp
changed src/mainbase.h
4 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
data/leaves/auxin_growth.xml
Show inline comments
 
<?xml version="1.0" encoding="UTF-8"?>
 
<leaf name="/ufs/merks/VLeaf1.0/V1.0/data/leaves/auxin_growth.xml" date="Thu Nov 25 13:13:31 2010" simtime="11660">
 
<leaf name="/ufs/merks/VLeaf1.0/V1.0/data/leaves/auxin_growth.xml" date="Mon Nov 29 11:43:46 2010" simtime="11660">
 
  <parameter>
 
    <par name="arrowcolor" val="white"/>
 
    <par name="arrowsize" val="10"/>
 
    <par name="textcolor" val="red"/>
 
    <par name="cellnumsize" val="1"/>
 
    <par name="nodenumsize" val="1"/>
 
    <par name="node_mag" val="1"/>
 
    <par name="outlinewidth" val="1"/>
 
    <par name="cell_outline_color" val="forestgreen"/>
 
    <par name="resize_stride" val="10"/>
 
    <par name="export_interval" val="0"/>
 
    <par name="export_fn_prefix" val="cell."/>
 
    <par name="storage_stride" val="100"/>
 
    <par name="xml_storage_stride" val="500"/>
 
    <par name="datadir" val="auxin_growth"/>
 
    <par name="T" val="1"/>
 
    <par name="lambda_length" val="100"/>
 
    <par name="yielding_threshold" val="4"/>
 
    <par name="lambda_celllength" val="0"/>
 
    <par name="target_length" val="60"/>
 
    <par name="cell_expansion_rate" val="10"/>
 
    <par name="cell_div_expansion_rate" val="10"/>
 
    <par name="auxin_dependent_growth" val="true"/>
 
    <par name="ode_accuracy" val="0.0001"/>
 
    <par name="mc_stepsize" val="0.4"/>
 
    <par name="mc_cell_stepsize" val="0.2"/>
 
    <par name="energy_threshold" val="1000"/>
 
    <par name="bend_lambda" val="0"/>
 
    <par name="alignment_lambda" val="0"/>
 
    <par name="rel_cell_div_threshold" val="2"/>
 
    <par name="rel_perimeter_stiffness" val="2"/>
 
    <par name="collapse_node_threshold" val="0.05"/>
 
    <par name="morphogen_div_threshold" val="0.2"/>
 
    <par name="morphogen_expansion_threshold" val="0.01"/>
 
    <par name="copy_wall" val="true"/>
 
    <par name="source" val="0"/>
 
    <par name="D">
 
      <valarray>
 
        <val v="1e-06"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </valarray>
 
    </par>
 
    <par name="initval">
 
      <valarray>
 
        <val v="0"/>
 
        <val v="1"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </valarray>
 
    </par>
 
    <par name="k1" val="1"/>
 
    <par name="k2" val="0.3"/>
 
    <par name="r" val="1"/>
 
    <par name="kr" val="1"/>
 
    <par name="km" val="1"/>
 
    <par name="Pi_tot" val="1"/>
 
    <par name="transport" val="0.36"/>
 
    <par name="ka" val="1"/>
 
    <par name="pin_prod" val="0"/>
 
    <par name="pin_prod_in_epidermis" val="0"/>
 
    <par name="pin_breakdown" val="0"/>
 
    <par name="pin_breakdown_internal" val="0.001"/>
 
    <par name="aux1prod" val="0.001"/>
 
    <par name="aux1prodmeso" val="0"/>
 
    <par name="aux1decay" val="0.001"/>
 
    <par name="aux1decaymeso" val="0.1"/>
 
    <par name="aux1transport" val="0.036"/>
 
    <par name="aux_cons" val="0"/>
 
    <par name="aux_breakdown" val="0.0001"/>
 
    <par name="kaux1" val="1"/>
 
    <par name="kap" val="1"/>
 
    <par name="leaf_tip_source" val="0.0001"/>
 
    <par name="sam_efflux" val="0.0001"/>
 
    <par name="sam_auxin" val="10"/>
 
    <par name="sam_auxin_breakdown" val="0"/>
 
    <par name="van3prod" val="0.002"/>
 
    <par name="van3autokat" val="0.1"/>
 
    <par name="van3sat" val="10"/>
 
    <par name="k2van3" val="0.3"/>
 
    <par name="dt" val="0.1"/>
 
    <par name="rd_dt" val="10"/>
 
    <par name="datadir" val="auxin_growth"/>
 
    <par name="movie" val="true"/>
 
    <par name="nit" val="100000"/>
 
    <par name="maxt" val="1e+06"/>
 
    <par name="rseed" val="-1"/>
 
    <par name="constituous_expansion_limit" val="16"/>
 
    <par name="vessel_inh_level" val="1"/>
 
    <par name="vessel_expansion_rate" val="0.25"/>
 
    <par name="d" val="0"/>
 
    <par name="e" val="0"/>
 
    <par name="f" val="0"/>
 
    <par name="c" val="0"/>
 
    <par name="mu" val="0"/>
 
    <par name="nu" val="0"/>
 
    <par name="rho0" val="0"/>
 
    <par name="rho1" val="0"/>
 
    <par name="c0" val="0"/>
 
    <par name="gamma" val="0"/>
 
    <par name="eps" val="0"/>
 
    <par name="k">
 
      <valarray>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </valarray>
 
    </par>
 
    <par name="i1" val="0"/>
 
    <par name="i2" val="0"/>
 
    <par name="i3" val="0"/>
 
    <par name="i4" val="0"/>
 
    <par name="i5" val="0"/>
 
    <par name="s1" val=""/>
 
    <par name="s2" val=""/>
 
    <par name="s3" val=""/>
 
    <par name="b1" val="false"/>
 
    <par name="b2" val="false"/>
 
    <par name="b3" val="false"/>
 
    <par name="b4" val="false"/>
 
    <par name="dir1" val="."/>
 
    <par name="dir2" val="."/>
 
  </parameter>
 
  <nodes n="22" target_length="3.09017">
 
    <node x="22.9634" y="-2.37264" fixed="false" boundary="true" sam="false"/>
 
    <node x="14.6882" y="17.9118" fixed="false" boundary="true" sam="false"/>
 
    <node x="1.57936" y="25.1246" fixed="false" boundary="true" sam="false"/>
 
    <node x="-9.0893" y="22.8165" fixed="false" boundary="true" sam="false"/>
 
    <node x="-19.7055" y="16.962" fixed="false" boundary="true" sam="false"/>
 
    <node x="-22.6839" y="5.00143" fixed="false" boundary="true" sam="false"/>
 
    <node x="-14.7271" y="-15.2131" fixed="false" boundary="true" sam="false"/>
 
    <node x="-6.78413" y="-23.4002" fixed="false" boundary="true" sam="false"/>
 
    <node x="3.60766" y="-25.1355" fixed="false" boundary="true" sam="false"/>
 
    <node x="21.3032" y="-13.6899" fixed="false" boundary="true" sam="false"/>
 
    <node x="17.4704" y="7.41573" fixed="false" boundary="true" sam="false"/>
 
    <node x="-17.5799" y="-5.20265" fixed="false" boundary="true" sam="false"/>
 
    <node x="9.86837" y="4.69636" fixed="false" boundary="false" sam="false"/>
 
    <node x="-9.28449" y="-3.92969" fixed="false" boundary="false" sam="false"/>
 
    <node x="12.5597" y="-20.5161" fixed="false" boundary="true" sam="false"/>
 
    <node x="-1.62187" y="-3.10623" fixed="false" boundary="false" sam="false"/>
 
    <node x="7.55765" y="-14.4922" fixed="false" boundary="false" sam="false"/>
 
    <node x="2.97596" y="-8.80653" fixed="false" boundary="false" sam="false"/>
 
    <node x="1.95125" y="3.2756" fixed="false" boundary="false" sam="false"/>
 
    <node x="-6.54614" y="15.4702" fixed="false" boundary="false" sam="false"/>
 
    <node x="-2.72983" y="8.96705" fixed="false" boundary="false" sam="false"/>
 
    <node x="9.33552" y="23.0046" fixed="false" boundary="true" sam="false"/>
 
  </nodes>
 
  <cells n="4" offsetx="0" offsety="0" magnification="1" base_area="293.893" nchem="2">
 
    <cell index="0" area="405.845" target_area="548.609" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="13"/>
 
      <node n="11"/>
 
      <node n="6"/>
 
      <node n="7"/>
 
      <node n="8"/>
 
      <node n="14"/>
 
      <node n="16"/>
 
      <node n="17"/>
 
      <node n="15"/>
 
      <wall w="6"/>
 
      <wall w="0"/>
 
      <wall w="1"/>
 
      <chem n="2">
 
        <val v="0.251808"/>
 
        <val v="0.481961"/>
 
      </chem>
 
    </cell>
 
    <cell index="1" area="385.557" target_area="547.081" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="12"/>
 
      <node n="10"/>
 
      <node n="1"/>
 
      <node n="21"/>
 
      <node n="2"/>
 
      <node n="3"/>
 
      <node n="19"/>
 
      <node n="20"/>
 
      <node n="18"/>
 
      <wall w="3"/>
 
      <wall w="4"/>
 
      <wall w="5"/>
 
      <chem n="2">
 
        <val v="0.250735"/>
 
        <val v="0.481961"/>
 
      </chem>
 
    </cell>
 
    <cell index="2" area="422.94" target_area="565.987" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="9"/>
 
      <node n="0"/>
 
      <node n="10"/>
 
      <node n="12"/>
 
      <node n="18"/>
 
      <node n="15"/>
 
      <node n="17"/>
 
      <node n="16"/>
 
      <node n="14"/>
 
      <wall w="1"/>
 
      <wall w="2"/>
 
      <wall w="8"/>
 
      <wall w="4"/>
 
      <chem n="2">
 
        <val v="0.307348"/>
 
        <val v="0.481245"/>
 
      </chem>
 
    </cell>
 
    <cell index="3" area="432.871" target_area="573.317" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="4"/>
 
      <node n="5"/>
 
      <node n="11"/>
 
      <node n="13"/>
 
      <node n="15"/>
 
      <node n="18"/>
 
      <node n="20"/>
 
      <node n="19"/>
 
      <node n="3"/>
 
      <wall w="5"/>
 
      <wall w="6"/>
 
      <wall w="7"/>
 
      <wall w="8"/>
 
      <chem n="2">
 
        <val v="0.321108"/>
 
        <val v="0.481222"/>
 
      </chem>
 
    </cell>
 
    <boundary_polygon index="-1" area="1647.21" target_area="1" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="false" dead="false" source="false" boundary="None" div_counter="0" cell_type="0">
 
      <node n="0"/>
 
      <node n="10"/>
 
      <node n="1"/>
 
      <node n="21"/>
 
      <node n="2"/>
 
      <node n="3"/>
 
      <node n="4"/>
 
      <node n="5"/>
 
      <node n="11"/>
 
      <node n="6"/>
 
      <node n="7"/>
 
      <node n="8"/>
 
      <node n="14"/>
 
      <node n="9"/>
 
      <wall w="2"/>
 
      <wall w="7"/>
 
      <wall w="0"/>
 
      <wall w="3"/>
 
      <chem n="2">
 
        <val v="0"/>
 
        <val v="0"/>
 
      </chem>
 
    </boundary_polygon>
 
  </cells>
 
  <walls n="9">
 
    <wall index="0" c1="0" c2="-1" n1="11" n2="14" length="42.4253" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="1" c1="0" c2="2" n1="14" n2="15" length="22.4554" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.254701"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.21777"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="2" c1="2" c2="-1" n1="14" n2="10" length="33.7553" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="3" c1="1" c2="-1" n1="10" n2="3" length="37.203" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="4" c1="2" c2="1" n1="10" n2="18" length="16.1174" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.217027"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.254701"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="5" c1="1" c2="3" n1="3" n2="18" length="22.6835" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.263338"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.217021"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="6" c1="0" c2="3" n1="15" n2="11" length="16.0993" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.263338"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.217763"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="7" c1="3" c2="-1" n1="3" n2="11" length="35.8587" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="8" c1="2" c2="3" n1="18" n2="15" length="7.31402" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.263073"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.254437"/>
 
      </transporters2>
 
    </wall>
 
  </walls>
 
  <nodesets n="0"/>
 
  <settings>
 
    <setting name="show_cell_centers" val="false"/>
 
    <setting name="show_nodes" val="false"/>
 
    <setting name="show_node_numbers" val="false"/>
 
    <setting name="show_cell_numbers" val="false"/>
 
    <setting name="show_border_cells" val="false"/>
 
    <setting name="show_cell_axes" val="false"/>
 
    <setting name="show_cell_strain" val="false"/>
 
    <setting name="show_fluxes" val="true"/>
 
    <setting name="show_walls" val="true"/>
 
    <setting name="save_movie_frames" val="true"/>
 
    <setting name="save_movie_frames" val="false"/>
 
    <setting name="show_only_leaf_boundary" val="false"/>
 
    <setting name="cell_growth" val="true"/>
 
    <setting name="hide_cells" val="false"/>
 
    <viewport m11="8.83883" m12="0" m21="0" m22="8.83883" dx="0" dy="0"/>
 
  </settings>
 
</leaf>
data/leaves/tutorial5_init.xml
Show inline comments
 
<?xml version="1.0" encoding="UTF-8"?>
 
<leaf name="/ufs/merks/VLeaf1.0/V1.0/data/leaves/tutorial5_init.xml" date="Thu Nov 25 14:30:29 2010" simtime="11660">
 
<leaf name="/ufs/merks/VLeaf1.0/V1.0/data/leaves/tutorial5_init.xml" date="Mon Nov 29 11:45:07 2010" simtime="11660">
 
  <parameter>
 
    <par name="arrowcolor" val="white"/>
 
    <par name="arrowsize" val="10"/>
 
    <par name="textcolor" val="red"/>
 
    <par name="cellnumsize" val="1"/>
 
    <par name="nodenumsize" val="1"/>
 
    <par name="node_mag" val="1"/>
 
    <par name="outlinewidth" val="1"/>
 
    <par name="cell_outline_color" val="forestgreen"/>
 
    <par name="resize_stride" val="10"/>
 
    <par name="export_interval" val="0"/>
 
    <par name="export_fn_prefix" val="cell."/>
 
    <par name="storage_stride" val="10"/>
 
    <par name="xml_storage_stride" val="500"/>
 
    <par name="datadir" val="tutorial5_data"/>
 
    <par name="T" val="1"/>
 
    <par name="lambda_length" val="100"/>
 
    <par name="yielding_threshold" val="4"/>
 
    <par name="lambda_celllength" val="0"/>
 
    <par name="target_length" val="60"/>
 
    <par name="cell_expansion_rate" val="10"/>
 
    <par name="cell_div_expansion_rate" val="10"/>
 
    <par name="auxin_dependent_growth" val="true"/>
 
    <par name="ode_accuracy" val="0.0001"/>
 
    <par name="mc_stepsize" val="0.4"/>
 
    <par name="mc_cell_stepsize" val="0.2"/>
 
    <par name="energy_threshold" val="1000"/>
 
    <par name="bend_lambda" val="0"/>
 
    <par name="alignment_lambda" val="0"/>
 
    <par name="rel_cell_div_threshold" val="2"/>
 
    <par name="rel_perimeter_stiffness" val="2"/>
 
    <par name="collapse_node_threshold" val="0.05"/>
 
    <par name="morphogen_div_threshold" val="0.2"/>
 
    <par name="morphogen_expansion_threshold" val="0.01"/>
 
    <par name="copy_wall" val="true"/>
 
    <par name="source" val="0"/>
 
    <par name="D">
 
      <valarray>
 
        <val v="1e-06"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </valarray>
 
    </par>
 
    <par name="initval">
 
      <valarray>
 
        <val v="0"/>
 
        <val v="1"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </valarray>
 
    </par>
 
    <par name="k1" val="1"/>
 
    <par name="k2" val="0.3"/>
 
    <par name="r" val="1"/>
 
    <par name="kr" val="1"/>
 
    <par name="km" val="1"/>
 
    <par name="Pi_tot" val="1"/>
 
    <par name="transport" val="0.36"/>
 
    <par name="ka" val="1"/>
 
    <par name="pin_prod" val="0"/>
 
    <par name="pin_prod_in_epidermis" val="0"/>
 
    <par name="pin_breakdown" val="0"/>
 
    <par name="pin_breakdown_internal" val="0.001"/>
 
    <par name="aux1prod" val="0.001"/>
 
    <par name="aux1prodmeso" val="0"/>
 
    <par name="aux1decay" val="0.001"/>
 
    <par name="aux1decaymeso" val="0.1"/>
 
    <par name="aux1transport" val="0.036"/>
 
    <par name="aux_cons" val="0"/>
 
    <par name="aux_breakdown" val="0.005"/>
 
    <par name="kaux1" val="1"/>
 
    <par name="kap" val="1"/>
 
    <par name="leaf_tip_source" val="0.001"/>
 
    <par name="sam_efflux" val="0.0001"/>
 
    <par name="sam_auxin" val="10"/>
 
    <par name="sam_auxin_breakdown" val="0"/>
 
    <par name="van3prod" val="0.002"/>
 
    <par name="van3autokat" val="0.1"/>
 
    <par name="van3sat" val="10"/>
 
    <par name="k2van3" val="0.3"/>
 
    <par name="dt" val="0.1"/>
 
    <par name="rd_dt" val="10"/>
 
    <par name="movie" val="true"/>
 
    <par name="nit" val="100000"/>
 
    <par name="maxt" val="1e+06"/>
 
    <par name="rseed" val="-1"/>
 
    <par name="constituous_expansion_limit" val="16"/>
 
    <par name="vessel_inh_level" val="1"/>
 
    <par name="vessel_expansion_rate" val="0.25"/>
 
    <par name="d" val="0"/>
 
    <par name="e" val="0"/>
 
    <par name="f" val="0"/>
 
    <par name="c" val="0"/>
 
    <par name="mu" val="0"/>
 
    <par name="nu" val="0"/>
 
    <par name="rho0" val="0"/>
 
    <par name="rho1" val="0"/>
 
    <par name="c0" val="0"/>
 
    <par name="gamma" val="0"/>
 
    <par name="eps" val="0"/>
 
    <par name="k">
 
      <valarray>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </valarray>
 
    </par>
 
    <par name="i1" val="0"/>
 
    <par name="i2" val="0"/>
 
    <par name="i3" val="0"/>
 
    <par name="i4" val="0"/>
 
    <par name="i5" val="0"/>
 
    <par name="s1" val=""/>
 
    <par name="s2" val=""/>
 
    <par name="s3" val=""/>
 
    <par name="b1" val="false"/>
 
    <par name="b2" val="false"/>
 
    <par name="b3" val="false"/>
 
    <par name="b4" val="false"/>
 
    <par name="dir1" val="."/>
 
    <par name="dir2" val="."/>
 
  </parameter>
 
  <nodes n="22" target_length="3.09017">
 
    <node x="22.9634" y="-2.37264" fixed="false" boundary="true" sam="false"/>
 
    <node x="14.6882" y="17.9118" fixed="false" boundary="true" sam="false"/>
 
    <node x="1.57936" y="25.1246" fixed="false" boundary="true" sam="false"/>
 
    <node x="-9.0893" y="22.8165" fixed="false" boundary="true" sam="false"/>
 
    <node x="-19.7055" y="16.962" fixed="false" boundary="true" sam="false"/>
 
    <node x="-22.6839" y="5.00143" fixed="false" boundary="true" sam="false"/>
 
    <node x="-14.7271" y="-15.2131" fixed="false" boundary="true" sam="false"/>
 
    <node x="-6.78413" y="-23.4002" fixed="false" boundary="true" sam="false"/>
 
    <node x="3.60766" y="-25.1355" fixed="false" boundary="true" sam="false"/>
 
    <node x="21.3032" y="-13.6899" fixed="false" boundary="true" sam="false"/>
 
    <node x="17.4704" y="7.41573" fixed="false" boundary="true" sam="false"/>
 
    <node x="-17.5799" y="-5.20265" fixed="false" boundary="true" sam="false"/>
 
    <node x="9.86837" y="4.69636" fixed="false" boundary="false" sam="false"/>
 
    <node x="-9.28449" y="-3.92969" fixed="false" boundary="false" sam="false"/>
 
    <node x="12.5597" y="-20.5161" fixed="false" boundary="true" sam="false"/>
 
    <node x="-1.62187" y="-3.10623" fixed="false" boundary="false" sam="false"/>
 
    <node x="7.55765" y="-14.4922" fixed="false" boundary="false" sam="false"/>
 
    <node x="2.97596" y="-8.80653" fixed="false" boundary="false" sam="false"/>
 
    <node x="1.95125" y="3.2756" fixed="false" boundary="false" sam="false"/>
 
    <node x="-6.54614" y="15.4702" fixed="false" boundary="false" sam="false"/>
 
    <node x="-2.72983" y="8.96705" fixed="false" boundary="false" sam="false"/>
 
    <node x="9.33552" y="23.0046" fixed="false" boundary="true" sam="false"/>
 
  </nodes>
 
  <cells n="4" offsetx="0" offsety="0" magnification="1" base_area="293.893" nchem="2">
 
    <cell index="0" area="405.845" target_area="548.609" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="13"/>
 
      <node n="11"/>
 
      <node n="6"/>
 
      <node n="7"/>
 
      <node n="8"/>
 
      <node n="14"/>
 
      <node n="16"/>
 
      <node n="17"/>
 
      <node n="15"/>
 
      <wall w="6"/>
 
      <wall w="0"/>
 
      <wall w="1"/>
 
      <chem n="2">
 
        <val v="0.251808"/>
 
        <val v="0.481961"/>
 
      </chem>
 
    </cell>
 
    <cell index="1" area="385.557" target_area="547.081" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="12"/>
 
      <node n="10"/>
 
      <node n="1"/>
 
      <node n="21"/>
 
      <node n="2"/>
 
      <node n="3"/>
 
      <node n="19"/>
 
      <node n="20"/>
 
      <node n="18"/>
 
      <wall w="3"/>
 
      <wall w="4"/>
 
      <wall w="5"/>
 
      <chem n="2">
 
        <val v="0.250735"/>
 
        <val v="0.481961"/>
 
      </chem>
 
    </cell>
 
    <cell index="2" area="422.94" target_area="565.987" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="9"/>
 
      <node n="0"/>
 
      <node n="10"/>
 
      <node n="12"/>
 
      <node n="18"/>
 
      <node n="15"/>
 
      <node n="17"/>
 
      <node n="16"/>
 
      <node n="14"/>
 
      <wall w="1"/>
 
      <wall w="2"/>
 
      <wall w="8"/>
 
      <wall w="4"/>
 
      <chem n="2">
 
        <val v="0.307348"/>
 
        <val v="0.481245"/>
 
      </chem>
 
    </cell>
 
    <cell index="3" area="432.871" target_area="573.317" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="true" dead="false" source="false" boundary="None" div_counter="2" cell_type="0">
 
      <node n="4"/>
 
      <node n="5"/>
 
      <node n="11"/>
 
      <node n="13"/>
 
      <node n="15"/>
 
      <node n="18"/>
 
      <node n="20"/>
 
      <node n="19"/>
 
      <node n="3"/>
 
      <wall w="5"/>
 
      <wall w="6"/>
 
      <wall w="7"/>
 
      <wall w="8"/>
 
      <chem n="2">
 
        <val v="0.321108"/>
 
        <val v="0.481222"/>
 
      </chem>
 
    </cell>
 
    <boundary_polygon index="-1" area="1647.21" target_area="1" target_length="60" lambda_celllength="0" stiffness="0" fixed="false" pin_fixed="false" at_boundary="false" dead="false" source="false" boundary="None" div_counter="0" cell_type="0">
 
      <node n="0"/>
 
      <node n="10"/>
 
      <node n="1"/>
 
      <node n="21"/>
 
      <node n="2"/>
 
      <node n="3"/>
 
      <node n="4"/>
 
      <node n="5"/>
 
      <node n="11"/>
 
      <node n="6"/>
 
      <node n="7"/>
 
      <node n="8"/>
 
      <node n="14"/>
 
      <node n="9"/>
 
      <wall w="2"/>
 
      <wall w="7"/>
 
      <wall w="0"/>
 
      <wall w="3"/>
 
      <chem n="2">
 
        <val v="0"/>
 
        <val v="0"/>
 
      </chem>
 
    </boundary_polygon>
 
  </cells>
 
  <walls n="9">
 
    <wall index="0" c1="0" c2="-1" n1="11" n2="14" length="42.4253" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="1" c1="0" c2="2" n1="14" n2="15" length="22.4554" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.254701"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.21777"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="2" c1="2" c2="-1" n1="14" n2="10" length="33.7553" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="3" c1="1" c2="-1" n1="10" n2="3" length="37.203" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="4" c1="2" c2="1" n1="10" n2="18" length="16.1174" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.217027"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.254701"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="5" c1="1" c2="3" n1="3" n2="18" length="22.6835" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.263338"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.217021"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="6" c1="0" c2="3" n1="15" n2="11" length="16.0993" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.263338"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.217763"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="7" c1="3" c2="-1" n1="3" n2="11" length="35.8587" viz_flux="0" wall_type="aux_source">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0"/>
 
      </transporters2>
 
    </wall>
 
    <wall index="8" c1="2" c2="3" n1="18" n2="15" length="7.31402" viz_flux="0" wall_type="normal">
 
      <transporters1>
 
        <val v="0"/>
 
        <val v="0.263073"/>
 
      </transporters1>
 
      <transporters2>
 
        <val v="0"/>
 
        <val v="0.254437"/>
 
      </transporters2>
 
    </wall>
 
  </walls>
 
  <nodesets n="0"/>
 
  <settings>
 
    <setting name="show_cell_centers" val="false"/>
 
    <setting name="show_nodes" val="false"/>
 
    <setting name="show_node_numbers" val="false"/>
 
    <setting name="show_cell_numbers" val="false"/>
 
    <setting name="show_border_cells" val="false"/>
 
    <setting name="show_cell_axes" val="false"/>
 
    <setting name="show_cell_strain" val="false"/>
 
    <setting name="show_fluxes" val="true"/>
 
    <setting name="show_walls" val="true"/>
 
    <setting name="save_movie_frames" val="true"/>
 
    <setting name="save_movie_frames" val="false"/>
 
    <setting name="show_only_leaf_boundary" val="false"/>
 
    <setting name="cell_growth" val="true"/>
 
    <setting name="hide_cells" val="false"/>
 
    <viewport m11="2.20971" m12="0" m21="0" m22="2.20971" dx="0" dy="0"/>
 
  </settings>
 
</leaf>
src/mainbase.cpp
Show inline comments
 
/*
 
 *
 
 *  This file is part of the Virtual Leaf.
 
 *
 
 *  VirtualLeaf is free software: you can redistribute it and/or modify
 
 *  it under the terms of the GNU General Public License as published by
 
 *  the Free Software Foundation, either version 3 of the License, or
 
 *  (at your option) any later version.
 
 *
 
 *  VirtualLeaf is distributed in the hope that it will be useful,
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

	
 
#include <libxml/xpath.h>
 
#include <libxml/xmlreader.h>
 

	
 
#include "mainbase.h"
 
#include "xmlwrite.h"
 

	
 
#include <sstream>
 
#include <string>
 

	
 
#include <QLocale>
 
#include <QDir>
 
#include <QDebug>
 

	
 
static const std::string _module_id("$Id$");
 

	
 
xmlNode *MainBase::XMLViewportTree(QTransform &transform) const {
 
  
 
  QLocale standardlocale(QLocale::C);
 
  
 

	
 
  xmlNode *xmlviewport = xmlNewNode(NULL, BAD_CAST "viewport");
 
  {
 
    xmlNewProp(xmlviewport, BAD_CAST "m11", BAD_CAST standardlocale.toString(transform.m11()).toStdString().c_str() );
 
    xmlNewProp(xmlviewport, BAD_CAST "m12", BAD_CAST standardlocale.toString(transform.m12()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "m21", BAD_CAST standardlocale.toString(transform.m21()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "m22", BAD_CAST standardlocale.toString(transform.m22()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "dx", BAD_CAST standardlocale.toString(transform.dx()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "dy", BAD_CAST standardlocale.toString(transform.dy()).toStdString().c_str() );    
 
 }
 
  
 
  return xmlviewport;
 
}
 

	
 
xmlNode *MainBase::XMLSettingsTree(void) const {
 
xmlNode *MainBase::XMLSettingsTree(void) {
 

	
 
  xmlNode *xmlsettings = xmlNewNode(NULL, BAD_CAST "settings");
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_cell_centers");
 
    ostringstream text;
 
    text << bool_name(showcentersp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_nodes");
 
    ostringstream text;
 
    text << bool_name(showmeshp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_node_numbers");
 
    ostringstream text;
 
    text << bool_name(shownodenumbersp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_cell_numbers");
 
    ostringstream text;
 
    text << bool_name(showcellnumbersp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_border_cells");
 
    ostringstream text;
 
    text << bool_name(showbordercellp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_cell_axes");
 
    ostringstream text;
 
    text << bool_name(showcellsaxesp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_cell_strain");
 
    ostringstream text;
 
    text << bool_name(showcellstrainp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_fluxes");
 
    ostringstream text;
 
    text << bool_name(showfluxesp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_walls");
 
    ostringstream text;
 
    text << bool_name(showwallsp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
 /* {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_apoplasts");
 
    ostringstream text;
 
    text << bool_name(showapoplastsp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }*/
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "save_movie_frames");
 
    ostringstream text;
 
    text << bool_name(movieframesp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "show_only_leaf_boundary");
 
    ostringstream text;
 
    text << bool_name(showboundaryonlyp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "cell_growth");
 
    ostringstream text;
 
    text << bool_name(dynamicscellsp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmloption = xmlNewChild(xmlsettings, NULL, BAD_CAST "setting", NULL);
 
    xmlNewProp(xmloption, BAD_CAST "name", BAD_CAST "hide_cells");
 
    ostringstream text;
 
    text << bool_name(hidecellsp);
 
    xmlNewProp(xmloption, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  return xmlsettings;
 
}
 

	
 
void MainBase::XMLReadViewport(xmlNode *settings) {
 

	
 
  if (settings == 0) {
 
    return;
 
  }
 

	
 
  qreal m11=25,m12=0,m21=0,m22=25,dx=0,dy=0;
 
  QLocale standardlocale(QLocale::C);
 
  xmlNode *cur = settings->xmlChildrenNode;
 

	
 
  while (cur!=NULL) {
 
    
 
    if (!xmlStrcmp(cur->name,(const xmlChar *)"viewport")) {
 
      bool ok;
 
      {
 
	xmlChar *v_str = xmlGetProp(cur, BAD_CAST "m11");
 
	
 
	if (v_str==0) {
 
	  MyWarning::unique_warning("Error reading viewport in mainbase.cpp");
 
	}
 
	if (v_str != NULL) {
 
	  m11=standardlocale.toDouble((char *)v_str, &ok);
 
	  if (!ok) MyWarning::error("Could Not Convert \"%S\" To Double In XMLRead.",(char *)v_str);
 
	  xmlFree(v_str);
 
	}
 
      }
 
      {
 
	xmlChar *v_str = xmlGetProp(cur, BAD_CAST "m12");
 
	
 
	if (v_str==0) {
 
	  MyWarning::unique_warning("Error reading viewport in mainbase.cpp");
 
	}
 
	if (v_str != NULL) {
 
	  m12=standardlocale.toDouble((char *)v_str, &ok);
 
	  if (!ok) MyWarning::error("Could Not Convert \"%S\" To Double In XMLRead.",(char *)v_str);
 
	  xmlFree(v_str);
 
	}
 
      }
 
      { 
 
	xmlChar *v_str = xmlGetProp(cur, BAD_CAST "m21");
 
	
 
	if (v_str==0) {
 
	  MyWarning::unique_warning("Error reading viewport in mainbase.cpp");
 
	}
 
	if (v_str != NULL) {
 
	  m21=standardlocale.toDouble((char *)v_str, &ok);
 
	  if (!ok) MyWarning::error("Could Not Convert \"%S\" To Double In XMLRead.",(char *)v_str);
 
	  xmlFree(v_str);
 
	}
 
      }
 
      {
 
	xmlChar *v_str = xmlGetProp(cur, BAD_CAST "m22");
 
	
 
	if (v_str==0) {
 
	  MyWarning::unique_warning("Error reading viewport in mainbase.cpp");
 
	}
 
	if (v_str != NULL) {
 
	  m22=standardlocale.toDouble((char *)v_str, &ok);
 
	  if (!ok) MyWarning::error("Could Not Convert \"%S\" To Double In XMLRead.",(char *)v_str);
 
	  xmlFree(v_str);
 
	}
 
      }
 
      {
 
	xmlChar *v_str = xmlGetProp(cur, BAD_CAST "dx");
 
	
 
	if (v_str==0) {
 
	  MyWarning::unique_warning("Error reading viewport in mainbase.cpp");
 
	}
 
	if (v_str != NULL) {
 
	  dx=standardlocale.toDouble((char *)v_str, &ok);
 
	  if (!ok) MyWarning::error("Could Not Convert \"%S\" To Double In XMLRead.",(char *)v_str);
 
	  xmlFree(v_str);
 
	}
 
      }
 
      {
 
	xmlChar *v_str = xmlGetProp(cur, BAD_CAST "dy");
 
	
 
	if (v_str==0) {
 
	  MyWarning::unique_warning("Error reading viewport in mainbase.cpp");
 
	}
 
	if (v_str != NULL) {
 
	  dy=standardlocale.toDouble((char *)v_str, &ok);
 
	  if (!ok) MyWarning::error("Could Not Convert \"%S\" To Double In XMLRead.",(char *)v_str);
 
	  xmlFree(v_str);
 
	}
 
      }
 
    }
 
    cur=cur->next;
 
  }
 
  viewport = QTransform(m11,m12,m21,m22,dx,dy);
 
}
 

	
 
void MainBase::XMLReadSettings(xmlNode *settings)
 
{
 

	
 
  // Many files have no settings section, so don't complain about it.
 
  // Defaults will be used instead.
 
  if (settings == 0) {
 
    return;
 
  }
 

	
 
  XMLReadViewport(settings);
 
  xmlNode *cur = settings->xmlChildrenNode;
 

	
 
  while (cur!=NULL) {
 

	
 
    if ((!xmlStrcmp(cur->name, (const xmlChar *)"setting"))){
 

	
 
      xmlChar *name = xmlGetProp(cur, BAD_CAST "name");
 
    
 
      xmlChar *val = xmlGetProp(cur, BAD_CAST "val");
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_cell_centers")) {
 
	showcentersp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_nodes")) {
 
	showmeshp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_node_numbers")) {
 
	shownodenumbersp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_cell_numbers")) {
 
	showcellnumbersp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_border_cells")) {
 
	showbordercellp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_cell_axes")) {
 
	showcellsaxesp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_cell_strain")) {
 
	showcellstrainp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_fluxes")) {
 
	showfluxesp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_walls")) {
 
	showwallsp = strtobool( (const char *)val );
 
      }
 
     /* if (!xmlStrcmp(name, (const xmlChar *)"show_apoplasts")) {
 
	showapoplastsp = strtobool( (const char *)val );
 
      }*/
 
      if (!xmlStrcmp(name, (const xmlChar *)"save_movie_frames")) {
 
	movieframesp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"show_only_leaf_boundary")) {
 
	showboundaryonlyp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name, (const xmlChar *)"cell_growth")) {
 
	dynamicscellsp = strtobool( (const char *)val );
 
      }
 
      if (!xmlStrcmp(name,(const xmlChar *)"hide_cells")) {
 
	hidecellsp = strtobool( (const char *)val ); 
 
      }
 
    
 
	
 
  
 
      xmlFree(name);
 
      xmlFree(val);
 
    }
 
    cur=cur->next;
 
  }
 
}
 

	
 
int MainBase::Save(const char *fname, const char *format, int sizex, int sizey)
 
{
 

	
 
  Vector ll,ur;
 
  mesh.BoundingBox(ll, ur);
 

	
 
  if (QString(fname).isEmpty()) {
 
    MyWarning::warning("No output filename given. Saving nothing.\n");
 
    return 1;
 
  }
 

	
 
  ll*=Cell::Magnification(); ur*=Cell::Magnification();
 

	
 
  // give the leaf some space
 
  Vector border = ((ur-ll)/5.);
 
  
 
  if (!QString(format).contains("PDF", Qt::CaseInsensitive)) {
 

	
 
    QImage *image = new QImage(QSize(sizex, sizey), QImage::Format_RGB32);
 
    image->fill(QColor(Qt::white).rgb());
 
    QPainter *painter=new QPainter(image);
 
    canvas.render(painter);
 
#ifdef QDEBUG
 
    qDebug() << "Native Image Filename: " << QDir::toNativeSeparators(QString(fname)) << endl;
 
#endif
 
    if (!image->save(QDir::toNativeSeparators(QString(fname)))) { // please do not add "format" here! It is much better to have the system guess the file format from the extension. That prevents loads of cross-platform problems.
 
      MyWarning::warning("Image '%s' not saved successfully. Is the disk full or the extension not recognized?",fname);
 
      delete painter;
 
      delete image;
 
      return 1;
 
    } 
 
    delete painter;
 
    delete image;
 
  } else {
 
    QPrinter pdf(QPrinter::HighResolution);
 
    pdf.setOutputFileName(fname);
 
    pdf.setOutputFormat(QPrinter::PdfFormat);
 
    QPainter painter(&pdf);
 
    canvas.render(&painter, QRectF(), QRectF(-5000,-5000, 10000, 10000));
 
    
 
    cerr << "Rendering to printer\n";
 
  }
 
  return 0;
 
}
 

	
 
void MainBase::CutSAM()
 
{
 
  mesh.CutAwaySAM();
 
}
 

	
 
/* finis */
src/mainbase.h
Show inline comments
 
/*
 
 *
 
 *  $Id$
 
 *
 
 *  This file is part of the Virtual Leaf.
 
 *
 
 *  VirtualLeaf is free software: you can redistribute it and/or modify
 
 *  it under the terms of the GNU General Public License as published by
 
 *  the Free Software Foundation, either version 3 of the License, or
 
 *  (at your option) any later version.
 
 *
 
 *  VirtualLeaf is distributed in the hope that it will be useful,
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

	
 

	
 
#ifndef _MAINBASE_H_
 
#define _MAINBASE_H_
 

	
 
#include <QGraphicsScene>
 
#include <qpixmap.h>
 
#include <q3picture.h>
 
#include <qpainter.h>
 
#include <qwidget.h>
 
#include <iostream>
 
#include <QGraphicsItem>
 
#include <QPrinter>
 
#include "mesh.h"
 
#include "warning.h"
 

	
 
using namespace std;
 

	
 
/*! Implement these functions in your main application */
 
class MainBase  {
 

	
 
 public:
 
 MainBase(QGraphicsScene &c, Mesh &m) : mesh(m), canvas(c) {
 

	
 
    // Standard options for batch version
 
    showcentersp =  false;
 
    showmeshp =  false;
 
    showbordercellp =  false;
 
    shownodenumbersp =  false;
 
    showcellnumbersp =  false;
 
    showcellsaxesp = false;
 
    showcellstrainp =  false;
 
    movieframesp = true;
 
    showboundaryonlyp =  false;
 
    showwallsp =  false;
 
    showfluxesp = false;
 
    dynamicscellsp = true;
 
    showtooltipsp = false;
 
    hidecellsp = false;
 
  }
 
  virtual ~MainBase() {};
 

	
 
  virtual double TimeStep();
 
  virtual void Init(const char *leaffile=0);
 

	
 
  virtual bool ShowCentersP(void) {return showcentersp;}
 
  virtual bool ShowMeshP(void) {return showmeshp; }
 
  virtual bool ShowBorderCellsP(void) {return showbordercellp; }
 
  virtual bool PausedP(void) {return false; }
 
  virtual bool ShowNodeNumbersP(void) {return shownodenumbersp; }
 
  virtual bool ShowCellNumbersP(void) {return showcellnumbersp;}
 
  virtual bool ShowCellAxesP(void) {return showcellsaxesp;}
 
  virtual bool ShowCellStrainP(void) {return showcellstrainp;}
 
  virtual bool MovieFramesP(void) {return movieframesp;}
 
  virtual bool ShowBoundaryOnlyP(void) {return showboundaryonlyp;}
 
  virtual bool ShowToolTipsP(void) {return showtooltipsp;}
 
  virtual bool ShowWallsP(void) {return showwallsp;}
 
 // virtual bool ShowApoplastsP(void) { return showapoplastsp;}
 
  virtual bool ShowFluxesP(void) { return showfluxesp; }
 
  virtual bool DynamicCellsP(void) { return dynamicscellsp; }
 
  virtual void FitCanvasToWindow() {};
 
  virtual void FitLeafToCanvas() {};
 
  virtual bool HideCellsP(void) { return hidecellsp; }
 
  virtual void clear(void) {
 
    QList<QGraphicsItem *> list = canvas.items();
 
    QList<QGraphicsItem *>::Iterator it = list.begin();
 
    for (; it != list.end(); ++it) {
 
      if ( *it )
 
	delete *it;
 
    }
 
  };
 
  virtual void XMLReadSettings(xmlNode *settings);
 
  virtual void XMLReadViewport(xmlNode *viewport);
 

	
 
  virtual double getFluxArrowsize(void) { return 10.;}
 

	
 
  int Save(const char *fname, const char *format, int sizex=640, int sizey=480);
 
  void CutSAM(void);
 

	
 
  void Plot(int resize_stride=10);
 

	
 
  virtual void UserMessage(QString message, int timeout = 0) {
 
    cerr << message.toAscii().constData() << endl;
 
  }
 

	
 
  Mesh &mesh;
 
  QTransform viewport;
 

	
 

	
 
 protected:
 
  QGraphicsScene &canvas;
 
  virtual xmlNode *XMLSettingsTree(void) const;
 
  virtual xmlNode *XMLSettingsTree(void);
 
  virtual xmlNode *XMLViewportTree(QTransform &transform) const;
 

	
 

	
 
  
 
 protected:
 
  bool showcentersp;
 
  bool showmeshp;
 
  bool showbordercellp;
 
  bool shownodenumbersp;
 
  bool showcellnumbersp;
 
  bool showcellsaxesp;
 
  bool showcellstrainp;
 
  bool movieframesp;
 
  bool showboundaryonlyp;
 
  bool showwallsp;
 
//  bool showapoplastsp;
 
  bool showfluxesp;
 
  bool dynamicscellsp;
 
  bool showtooltipsp;
 
  bool hidecellsp;
 
};
 

	
 
//#include <qapplication.h>
 
#define TIMESTEP double MainBase::TimeStep(void)
 
#define INIT void MainBase::Init(const char *leaffile)
 

	
 
#endif
 

	
 
/* finis */
0 comments (0 inline, 0 general)