Changeset - 5ec450ff7c49
[Not reviewed]
default
0 5 0
Michael Guravage - 15 years ago 2010-10-19 12:56:46
michael.guravage@cwi.nl
Render PNGs instead of JPGs. See ChangeLogs for details.

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/TutorialCode/Tutorial3/ChangeLog
changed src/TutorialCode/Tutorial3/tutorial3_init.xml
changed src/VirtualLeaf.cpp
changed src/mainbase.cpp
5 files changed with 25 insertions and 29 deletions:
0 comments (0 inline, 0 general)
src/ChangeLog
Show inline comments
 
2010-10-19    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mainbase.cpp (Save): Use format specified in function prototype.
 

	
 
	* VirtualLeaf.cpp (Plot): Render PNG instead of JPEG. Write image
 
	and XML files dependent only on getTime().
 

	
 
2010-10-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mainbase.cpp (Save): QDir::toNativeSeparators(fname). Invoke
 
	save with format argument set to zero to force QImage to guess the
 
	format by looking at fileName's suffix.
 

	
 
	* VirtualLeaf-install.nsi: Put uninstaller in top directory.
 

	
 
	* modelcatalogue.cpp (InstallModel): For all OS-es. Move from "bin" directory to root application folder.
 

	
 
	* VirtualLeaf.pro: MAXOSX, look for gpl3.txt in the ../doc directory.
 

	
 
	* Makefile (Makefile.libplugin): Removed -makefile qmake option.
 

	
 
	* VirtualLeaf.cpp (TIMESTEP): Removed getIterations().
 

	
 
	* mesh.h (Mesh): Removed {increment,get}Iterations().
 

	
 
	* canvas.cpp (TimeStepWrap): Replaced getIterations() with getTime().
 

	
 
2010-10-15    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mesh.h (Mesh): Added iterations. incrementIterations() and
 
	getIterations().
 

	
 
	* VirtualLeaf.cpp (Plot): Replaced local frame counter with
 
	mesh.incrementIterations().
 

	
 
	* canvas.cpp (TimeStepWrap): Replaced local counter with
 
	mesh.incrementIterations().
 

	
 
2010-10-14    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeaf.pro: Turned debug off to make all profiles must be
 
	consistant.
 

	
 
	* VirtualLeaf-install.nsi: Tweaked paths to coincide with UNIX
 
	distribution, i.e. VirtualLeaf.exe, its libraries, models, and the
 
	uninstaller all go in the bin directory. And leaves directory
 
	placed under data directory.
 

	
 
	* canvas.cpp (exportCellData): Added a check to inquire before
 
	overwritting an existing file.
 

	
 

	
 
2010-10-14    <merks@cwi.nl>
 

	
 
	* mesh.cpp: In response to referees' comments, added new parameter
 
	"yield_threshold" instead of fixed parameter '4' for yield
 
	threshold.
 

	
 
	* wallitem.cpp: when clicking a wall, both the wall type was
 
	cycled and the transporterdialog popped up. Corrected this - for
 
	wall type cycling, hold the Control button while left
 
	clicking. TransporterDialog only pops up for left click. Also made
 
	sure the wall is redrawn after changing the transporter values.
 

	
 
	* cell.cpp (DivideWalls): accomodated for rename of Circumference -> WallCircumference
 

	
 
	* hull.h: added an operator< to sort Points
 

	
 
	* hull.cpp: added an operator< to sort Points
 

	
 
	* cellbase.cpp (ExactCircumference): I added a new function
 
	ExactCircumference, yielding the circumference of the cell along
 
	its wall_elements
 

	
 
	* VirtualLeaf.cpp: adjust info_string to accomodate for new name
 
	of function CellBase::Circumference -> CellBase::WallCircumference
 

	
 
	* mesh.cpp: corrected Mesh::Compactness, the boundary coordinates
 
	need to be sorted in x,y order for the convex hull algorithm
 
	(thanks Margriet!). I updated CSVExportCellData so it exports the
 
	circumferences of hull and boundary_polygon.
 

	
 

	
 
2010-10-14    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeafpar.tmpl (export_fn_prefix): changed to 'cell.'
 

	
 
	* canvas.cpp (TimeStepWrap): Removed TimeStamp(). Cell data
 
	filename now incorporates iteration number.
 

	
 
	* canvas.h (MainBase): Removed TimeStamp().
 

	
 

	
 
2010-10-08    <guravage@caterpie.sen.cwi.nl>
 

	
 

	
 
	* pardialog.h:
 
	* pardialog.cpp:
 
	* parameter.h:
 
	* parameter.cpp: Regenerated to include export_interval and export_fn_prefix.
 

	
 
	* VirtualLeafpar.tmpl: Appended export_interval and export_fn_prefix.
 

	
 
	* canvas.h (MainBase): Declared polymorphic exportCellData() functions.
 

	
 
	* canvas.cpp:
 
	(TimeStamp): New private TimeStamp() function.
 
	(TimeStepWrap): Added invocation of exportCellData().
 
	(exportCellData): Created two polymorphic functions: one with a
 
	single QString argument, the other with no argument. The former is
 
	called from TimeStepWrap() while the latter is called from the
 
	"Export cell areas" item in the file menu.
 

	
 

	
 
2010-10-07    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* canvas.cpp (exportCellData): Added a Q3FileDialog to inquire
 
	where to write the exportCellData.
 

	
 
2010-06-28    <guravage@caterpie.sen.cwi.nl>
 

	
 

	
 
	* VirtualLeaf-install.nsi: Grab gpl3.txt from doc directory.
 

	
 
	* canvas.cpp (gpl): gpl3.txt can be either in an ancestor doc
 
	directory (Linux) or a decedent doc directory (Windows, via the
 
	binary installer).
 

	
 
	* VirtualLeaf-install.nsi: Add VirtualLeaf doc directory.
 

	
 
2010-06-25    <guravage@caterpie.sen.cwi.nl>
 

	
 

	
 
	* gpl3.txt: Moved gpl3.txt from doc to src directory.
 

	
 
	* VirtualLeaf.pro: Added -Wno-write-strings and -Wno-unused-parameter to QMAKE_CXXFLAGS.
 

	
 
	* libplugin.pro: Ditto.
 

	
 
	* parameter.cpp: Result of adding datadir changes to make_parameter_source.pl.
 
	* parameter.h: Ditto.
 

	
 
	* output.h: Declared new function (AppendHomeDirIfPathRelative).
 

	
 
	* output.cpp (AppendHomeDirIfPathRelative): Added new function.
 

	
 
	* canvas.cpp (gpl): Moving gpl3.txt from doc to src obviates the need to docDir.cd("../doc").
 

	
 
	* VirtualLeaf-install.nsi: Grab gpl3.txt from src directory.
 
	Add missing libiconv/bin, libxml2bin and libz/bin directories.
 
	Copy libiconv-2.dll, libxml2.dll and zlib1.dll from relative paths.
 

	
 
	* VirtualLeaf.pro: copy gpl3.txt as part of QMAKE_POST_LINK.
 

	
 
2010-06-24    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* libplugin.pro: Use correct library path.
 
	* VirtualLeaf.pro: Ditto.
 

	
 
	* VirtualLeaf.cpp (DrawCell): Iterate over NChem to construct info_string.
 

	
 
2010-06-23    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* simitembase.cpp: Removed NULL assignments to unused variables.
 
	* VirtualLeaf.cpp: Ditto.
 
	* apoplastitem.cpp: Ditto.
 
	* canvas.cpp: Ditto.
 
	* cell.cpp: Ditto.
 
	* cellbase.h: Ditto.
 
	* forwardeuler.cpp: Ditto.
 
	* mainbase.h: Ditto.
 
	* nodeitem.cpp: Ditto.
 
	* qcanvasarrow.h: Ditto.
 
	* simitembase.cpp: Ditto.
 

	
 

	
 
	* Makefile (clean): Add -f Makefile argument to each make invocation.
 

	
 
	* VirtualLeaf-install.nsi: New gpl license text.
 

	
 
	* VirtualLeaf.pro: Disabled console mode.
 

	
 
	* mesh.cpp (Clear): Added parentheses to qDebug statments.
 
	(TestIllegalWalls): Replaced qDebug().
 

	
 
	* canvas.cpp (mouseReleaseEvent): Replaced qDebug() with cerr since qDebug complains about *node_set.
 

	
 
	* wall.cpp (CorrectWall): Rplaced gDebug() with cerr in transform call and when printing *this.
 

	
 
2010-06-22    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* Makefile (tutorials): Add tutorials target.
 

	
 
2010-06-21    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* parameter.cpp: Added particular reassignment of datadir.
 

	
 
	* canvas.cpp (gpl): Added GPL3 License text. Display detail text only if the source text file exists.
 

	
 
2010-06-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* canvas.cpp (gpl): Added gpl slot to display GPL license.
 

	
 
	* VirtualLeaf.pro: Changed default LIBXML2DIR, LIBICONVDIR and LIBZDIR to corresponding distribution lib directories.
 
	* libplugin.pro: Ditto.
 

	
 
	* Makefile (clean): add if stmt not to `touch` on windows.
 

	
 
2010-06-17    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeaf.pro: Removed perl references.
 
	* libplugin.pro: Ditto.
 

	
 
2010-06-15    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeaf.pro: Removed xmlwritecode.cpp from SOURCES list.
 

	
 
	* xmlwrite.cpp (XMLSave): Removed references to XMLWriteLeafSourceCode and XMLWriteReactionsCode.
 
	* xmlwrite.h (XMLIO): Ditto!
 

	
 
	* mesh.cpp (findNextBoundaryNode): Initialize Node *next_boundary_node = NULL;
 

	
 
	* xmlwrite.cpp (XMLReadSimtime): Removed unused variable cur
 
	(XMLReadWalls): viz_flux need not be declared twice; default value of 0.0.
 
	(XMLReadCells): Removed unused count variable.
 
	(XMLReadSimtime): Removed unused cur variable.
 
	(XMLRead): Removed unused v_str variable.
 

	
 
	* simitembase.cpp (userMove): Use assignment merely to obviate compilation warning.
 
	(SimItemBase) Ditto.
 

	
 
	* qcanvasarrow.h (QGraphicsLineItem): Use assignment merely to obviate compilation warning.
 

	
 
	* output.cpp (OpenWriteFile): Removed unused par variable.
 

	
 
	* nodeitem.cpp (paint): Use assignment merely to obviate compilation warning.
 

	
 
	* forwardeuler.cpp (odeint): Use assignment merely to obviate compilation warning.
 

	
 
	* cell.cpp (DivideOverGivenLine): Use assignment merely to obviate compilation warning.
 

	
 
	* canvas.cpp (FigureEditor): Use assignments merely to obviate compilation errors.
 
	(mousePressEvent): Removed unused item variable.
 

	
 
	* apoplastitem.cpp
 
	(ApoplastItem): Removed unused par variable.
 
	(OnClick): Use NULL assignment merely to obviate compilation warning.
 

	
 
	* mainbase.h (MainBase): Use assignment merely to obviate compilation warning.
 

	
 
	* cellbase.h (CellsStaticDatamembers): Use assignment merely to obviate compilation warning.
 

	
 

	
 
	* cell.cpp: Wrapped diagnostic output in QDEBUG blocks.
 
	* VirtualLeaf.cpp ditto.
 
	* canvas.cpp ditto.
 
	* cell.cpp ditto.
 
	* data_plot.cpp ditto.
 
	* forwardeuler.cpp ditto.
 
	* mesh.cpp ditto.
 
	* mesh.h
 
	* random.cpp ditto.
 
	* wall.cpp ditto.
 
	* wallbase.cpp ditto.
 
	* wallitem.cpp ditto.
 

	
 

	
 
2010-06-07    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeaf.pro: Removed explicit perl invocation to regerenerate parameter files.
 
	* libplugin.pro: ditto.
 

	
 
2010-06-03    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* pardialog.h: Added default versions of this automatically generated file.
 
	* pardialog.cpp: ditto.
 
	* parameter.h: ditto.
 
	* parameter.cpp: ditto.
 

	
 
	* VirtualLeaf.pro: delete/generate  parameter.{h,cpp}and pardialog.{h,cpp} only if perl is installed.
 
 	* libplugin.pro: dito.
 

	
 
	* Makefile: Added top-level Makefile
 

	
 
2010-05-10    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeaf.pro: Added -fPIC option to QMAKE_CXXFLAGS.
 

	
src/TutorialCode/Tutorial3/ChangeLog
Show inline comments
 
2010-10-19    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* tutorial3_init.xml (public): Render PNG instead of JPEG.
 

	
 
2010-10-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* Makefile (Makefile.tutorial3): Removed -makefile qmake option.
 

	
 
2010-10-14    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* tutorial3.h (SimPluginInterface): Added default LeafML file.
 

	
 
2010-06-25    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* tutorial3.pro: Added -Wno-write-strings and -Wno-unused-parameter to QMAKE_CXXFLAGS.
 

	
 
2010-06-23    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* tutorial3.pro: Corrected windows library path.
 

	
src/TutorialCode/Tutorial3/tutorial3_init.xml
Show inline comments
 
<?xml version="1.0" encoding="UTF-8"?>
 
<leaf name="/Users/roel/VLeaf1.0/V1.0/bin/auxinfluxinit.xml" date="Mon Jun  7 15:40:43 2010" simtime="0">
 
  <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="20"/>
 
    <par name="outlinewidth" val="2"/>
 
    <par name="cell_outline_color" val="forestgreen"/>
 
    <par name="resize_stride" val="10"/>
 
    <par name="T" val="1"/>
 
    <par name="lambda_length" val="100"/>
 
    <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="0.0001"/>
 
        <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="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"/>
 
        <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"/>
 
    <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="datadir" val="."/>
 
    <par name="movie" val="false"/>
 
    <par name="nit" val="100000"/>
 
    <par name="maxt" val="1000"/>
 
    <par name="storage_stride" val="10"/>
 
    <par name="xml_storage_stride" val="500"/>
 
    <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>
 
  <code name="VirtualLeaf.cpp">#include &lt;fstream&gt;
 
#include &lt;sstream&gt;
 
#include &lt;cstring&gt;
 
#include &lt;functional&gt; 
 
#include &lt;getopt.h&gt;
 
#include &lt;cerrno&gt;
 
#include "mesh.h"
 
#include "parameter.h"
 
#include "random.h"
 
#include "pi.h"
 
#include "cellitem.h"
 
#include "canvas.h"
 
#include "cell.h"
 
#include "output.h"
 
#include &lt;qwidget.h&gt;
 
#include &lt;q3process.h&gt;
 
#include &lt;qapplication.h&gt;
 
#include &lt;QDesktopWidget&gt;
 
#include &lt;QGraphicsScene&gt;
 
#include &lt;QMessageBox&gt;
 
//Added by qt3to4:
 
#include &lt;QMouseEvent&gt;
 

	
 
#include &lt;unistd.h&gt;
 
#include &lt;q3textstream.h&gt; 
 

	
 

	
 
#ifdef HAVE_QWT
 
#include "data_plot.h"
 
#endif
 
#include &lt;QPalette&gt;
 
#include &lt;QBrush&gt;
 
#include &lt;QToolTip&gt;
 
#include "simplugin.h"
 
#include "testplugin.h"
 

	
 
/* #define _xstr_(s) _str_(s)
 
#define _str_(s) #s
 
#include _xstr_(REACTIONS_HEADER)
 
*/
 
extern Parameter par;
 

	
 
MainBase *main_window = 0;
 
double auxin_account = 0.;
 

	
 

	
 

	
 
TestPlugin *plugin = new TestPlugin();
 

	
 
#ifdef XFIGGRAPHICS
 
#define TIMESTEP double Graphics::TimeStep(void)
 
#endif
 

	
 
class PrintNode {
 
public:
 
  void operator() (const Node &amp;n) const 
 
  {
 
    cerr &lt;&lt; n.Index() &lt;&lt; ": " &lt;&lt; n &lt;&lt;  endl;
 
  }
 
};
 

	
 

	
 
class EdgeSource {
 
	
 
public:
 
  void operator() (Cell &amp;c) {
 
		
 
    if (c.AtBoundaryP()) {
 
      cerr &lt;&lt; "Cell " &lt;&lt; c.Index() &lt;&lt; " is a source cell.\n";
 
      c.SetSource(0,par.source);
 
    } else {
 
      cerr &lt;&lt; "Cell " &lt;&lt; c.Index() &lt;&lt; " is _not_ a source cell.\n";
 
    }
 
  }
 
	
 
};
 

	
 

	
 

	
 
class CellInfo {
 
public:
 
  void operator() (Cell &amp;c,std::ostream &amp;os) const {
 
    os &lt;&lt; "Cell " &lt;&lt; c.index &lt;&lt; " says: " &lt;&lt; endl;
 
    os &lt;&lt; "c.nodes.size() = " &lt;&lt; c.nodes.size() &lt;&lt; endl;
 
    for (list&lt;Node *&gt;::iterator i=c.nodes.begin();
 
	 i!=c.nodes.end();
 
	 i++) {
 
      cerr &lt;&lt; (*i)-&gt;Index() &lt;&lt; " ";
 
    }
 
    cerr &lt;&lt; endl;
 
  }
 
};
 

	
 
double PINSum(Cell &amp;c) {
 
	
 
	return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls&lt;double&gt;( complex_PijAj );
 
	
 
}
 

	
 

	
 
class DrawCell {
 
public:
 
  void operator() (Cell &amp;c,QGraphicsScene &amp;canvas, MainBase &amp;m) const {
 
    if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) {
 
      if (!m.ShowBoundaryOnlyP() &amp;&amp; !m.HideCellsP()) 
 
	if (m.ShowToolTipsP()) {
 
	  QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr());
 
					
 
	  info_string += "\n" + c.printednodelist();
 
					
 
	  c.Draw(&amp;canvas, info_string);
 
	} else {
 
	  c.Draw(&amp;canvas);
 
	}
 
      if (m.ShowCentersP())
 
	c.DrawCenter(&amp;canvas);
 
    if (m.ShowFluxesP())
 
	c.DrawFluxes(&amp;canvas, par.arrowsize);
 
			
 
       }
 
 
 
  }
 
	
 
};
 

	
 
Mesh mesh;
 
bool batch=false;
 

	
 

	
 
void MainBase::Plot(int resize_stride) {
 
	
 
  clear();
 
    
 
	
 
  static int count=0;
 
  if (resize_stride) {
 
    if ( !((++count)%resize_stride) ) {
 
      FitLeafToCanvas();
 
    }
 
  }
 
  mesh.LoopCells(DrawCell(),canvas,*this);
 
	
 
  if (ShowNodeNumbersP()) 
 
    mesh.LoopNodes( bind2nd (mem_fun_ref ( &amp;Node::DrawIndex), &amp;canvas ) ) ;
 
  if (ShowCellNumbersP()) 
 
    mesh.LoopCells( bind2nd (mem_fun_ref ( &amp;Cell::DrawIndex), &amp;canvas ) ) ;
 
	
 
  if (ShowCellAxesP()) 
 
    mesh.LoopCells( bind2nd (mem_fun_ref ( &amp;Cell::DrawAxis), &amp;canvas ) );
 
	
 
  if (ShowCellStrainP()) 
 
    mesh.LoopCells( bind2nd (mem_fun_ref ( &amp;Cell::DrawStrain), &amp;canvas ) );
 
	
 
  if (ShowWallsP())
 
  
 
    mesh.LoopWalls( bind2nd( mem_fun_ref( &amp;Wall::Draw ), &amp;canvas ) );
 
	
 
	if (ShowApoplastsP()) 
 
		mesh.LoopWalls( bind2nd( mem_fun_ref( &amp;Wall::DrawApoplast ), &amp;canvas ) );
 
 
 
	if (ShowMeshP()) 
 
    mesh.DrawNodes(&amp;canvas);
 
	
 
  if (ShowBoundaryOnlyP()) 
 
    mesh.DrawBoundary(&amp;canvas);
 

	
 
  
 
	if ( ( batch || MovieFramesP() )) {
 
		
 
		static int frame = 0;
 
		// frame numbers are sequential for the most frequently written file type.
 
		// for the less frequently written file type they match the other type
 
		if (!(count%par.storage_stride) )  {
 
		
 
			stringstream fname;
 
			fname &lt;&lt; par.datadir &lt;&lt; "/leaf.";
 
			fname.fill('0');
 
			fname.width(6);
 
	
 
			/* 
 
			 fname &lt;&lt; frame &lt;&lt; ".pdf";
 
			if (par.storage_stride &lt;= par.xml_storage_stride) {
 
				frame++;
 
			}
 
			
 
			// Write high-res JPG snapshot every plot step
 
			// Write high-res PDF snapshot every plot step
 
			Save(fname.str().c_str(), "PDF");
 
			*/
 
			
 
			fname &lt;&lt; frame &lt;&lt; ".jpg";
 
			fname &lt;&lt; frame &lt;&lt; ".png";
 
			if (par.storage_stride &lt;= par.xml_storage_stride) {
 
				frame++;
 
			}
 
			
 
			// Write high-res JPG snapshot every plot step
 
			Save(fname.str().c_str(), "JPEG",1024,768);
 
			// Write high-res PNG snapshot every plot step
 
			Save(fname.str().c_str(), "PNG",1024,768);
 
			
 
		}
 
	
 
		if (!(count%par.xml_storage_stride)) {
 
			stringstream fname;
 
			fname &lt;&lt; par.datadir &lt;&lt; "/leaf.";
 
			fname.fill('0');
 
			fname.width(6);
 
			fname &lt;&lt; frame &lt;&lt; ".xml";
 
	
 
			if (par.xml_storage_stride &lt; par.storage_stride) {
 
				frame++;
 
			}
 
			// Write XML file every ten plot steps
 
			mesh.XMLSave(fname.str().c_str(), XMLSettingsTree());
 
		}
 
		
 
	}
 
}
 

	
 

	
 
void Cell::Flux(double *flux, double *D)  {
 
	
 

	
 
  // loop over cell edges
 
	
 
  for (int c=0;c&lt;Cell::nchem;c++) flux[c]=0.;
 
	
 
  for (list&lt;Wall *&gt;::iterator i=walls.begin();
 
       i!=walls.end();
 
       i++) {
 
		
 
		
 
    // leaf cannot take up chemicals from environment ("no flux boundary")
 
    if ((*i)-&gt;c2-&gt;BoundaryPolP()) continue;
 
		
 
  	
 
    // flux depends on edge length and concentration difference
 
    for (int c=0;c&lt;Cell::nchem;c++) {
 
      double phi = (*i)-&gt;length * ( D[c] ) * ( (*i)-&gt;c2-&gt;chem[c] - chem[c] );
 
			
 
      if ((*i)-&gt;c1!=this) {
 
	cerr &lt;&lt; "Warning, bad cells boundary: " &lt;&lt; (*i)-&gt;c1-&gt;index &lt;&lt; ", " &lt;&lt; index &lt;&lt; endl;
 
      }
 
			
 
      flux[c] += phi;
 
    }    
 
  }
 
	
 
}
 

	
 
INIT {
 
	
 
	if (leaffile) { 
 
    xmlNode *settings;
 
    mesh.XMLRead(leaffile, &amp;settings);
 
    main_window-&gt;XMLReadSettings(settings);
 
    xmlFree(settings);
 
    main_window-&gt;UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str()));
 
		
 
  } else {
 
		
 
	  Cell &amp;circle=mesh.CircularCell(0,0,10,10);
 
    		
 
    circle.SetTargetArea(circle.CalcArea());
 
	  mesh.SetBaseArea();
 
	// clean up chemicals 
 
	  for (int c=0; c&lt;Cell::NChem(); c++) {
 
		  circle.SetChemical(c, 0.);
 
      }
 
  }
 
}
 

	
 
TIMESTEP {
 
	
 
  static int i=0;
 
  static int t=0;
 
  static int ncells;
 
	
 
  if (!batch) {
 
    UserMessage(QString("Time: %1").arg(mesh.getTimeHours().c_str()),0);
 
  }
 
			 
 
  ncells=mesh.NCells();
 
		
 
				
 
  double dh;
 
  		
 
  if(DynamicCellsP()) {
 
    dh = mesh.DisplaceNodes();
 
			
 
    // Only allow for node insertion, cell division and cell growth
 
    // if the system has equillibrized
 
    // i.e. cell wall tension equillibrization is much faster
 
    // than biological processes, including division, cell wall yielding
 
    // and cell expansion
 
    mesh.InsertNodes(); // (this amounts to cell wall yielding)
 
			
 
    if ( (-dh) &lt; par.energy_threshold) {
 
				
 
      mesh.IncreaseCellCapacityIfNecessary();
 
		mesh.LoopCurrentCells(&amp;TestPlugin::CellHouseKeeping); // this includes cell division
 
				
 
      // Reaction diffusion	
 
		/*CelltoCellTransport *transport_f = &amp;TestPlugin::CelltoCellTransport;
 
      CellReaction *cellreaction_f = new plugin-&gt;CellDynamics();
 
      WallReaction *wall_f = new WallDynamics();*/
 
				
 
      mesh.ReactDiffuse(plugin, par.rd_dt);
 
		
 
				
 
      t++;
 
				
 
      Plot(par.resize_stride);
 
		
 
		/*QVector&lt; QPair&lt;double, int&gt; &gt; angles=mesh.VertexAnglesValues();
 
		QString afname=QString("Angles/anglesvalues%1.dat").arg(t,6,10,QChar('0'));
 
		ofstream af(afname.toStdString().c_str());
 
		*/
 
		
 
		/*for (QVector&lt; QPair&lt;qreal, int&gt; &gt;::const_iterator v=angles.begin();
 
			 v!=angles.end();
 
			 v++) {
 
			af &lt;&lt; v-&gt;first &lt;&lt; " " &lt;&lt; v-&gt;second &lt;&lt; endl;
 
			}
 
			*/
 
			}
 
		
 
			} else {
 
			
 
  /*  TransportFunction *transport_f = new CelltoCellTransport();
 
    CellReaction *cellreaction_f = new CellDynamics();
 
    WallReaction *wall_f = new WallDynamics();
 
			
 
    mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt);*/
 
				mesh.ReactDiffuse(plugin, par.rd_dt);
 
		
 
    Plot(par.resize_stride);
 
			
 
  }
 
	
 
	
 

	
 
		
 
		
 
  i++;
 
  return mesh.getTime();
 
		
 
}
 
		
 
		
 
				
 
/* Called if a cell is clicked */
 
void Cell::OnClick(QMouseEvent *e) {
 
					
 
}
 
				
 
				
 

	
 
void Wall::OnWallInsert(void) {
 
				  
 

	
 
}
 

	
 
				
 
				
 
				
 
int main(int argc,char **argv) {
 
					
 
  try {
 
						
 

	
 
    int c;
 

	
 
						
 
    char *leaffile=0;
 

	
 
						
 
    while (1) {
 
							
 
      //int this_option_optind = optind ? optind : 1;
 
      int option_index = 0;
 
      static struct option long_options[] = {
 
	{"batch", 0, 0, 0},
 
	{"leaffile", 2, 0, 0}
 
      };
 
		
 
      // short option 'p' creates trouble for non-commandline usage on MacOSX. Option -p changed to -P (capital)
 
      static char *short_options = "bl";
 
      c = getopt_long (argc, argv, "bl:",
 
		       long_options, &amp;option_index);
 
      if (c == -1)
 
	break;
 
		
 
		
 
      if (c==0) {
 
	printf ("option %s", long_options[option_index].name);
 
	if (optarg)
 
	  printf (" with arg %s", optarg);
 
	printf ("\n");
 
			
 
	c = short_options[option_index];
 
      }
 
		
 
      switch (c) {
 
      case 'b':
 
	cerr &lt;&lt; "Running in batch mode\n";
 
	batch=true;
 
	break;
 
				
 
      case 'l':
 
	leaffile=strdup(optarg);
 
	if (!leaffile) {
 
	  throw("Out of memory");
 
	}
 
	printf("Reading leaf state file '%s'\n", leaffile);
 
	break;
 
				
 
      case '?':
 
	break;
 
				
 
      default:
 
	printf ("?? getopt returned character code 0%o ??\n", c);
 
      }
 
    }
 
	  
 
	  
 
    if (optind &lt; argc) {
 
      printf ("non-option ARGV-elements: ");
 
      while (optind &lt; argc)
 
	printf ("%s ", argv[optind++]);
 
      printf ("\n");
 
    }
 
	  
 
	  MakeDir("Angles");
 
    bool useGUI = !batch;
 
    QApplication app(argc,argv,useGUI);
 
						
 

	
 
    
 
    QPalette tooltippalette = QToolTip::palette();
 
    QColor transparentcolor = QColor(tooltippalette.brush(QPalette::Window).color());
 

	
 
    tooltippalette.setBrush (QPalette::Window, QBrush (transparentcolor) );
 
    QToolTip::setPalette( tooltippalette );
 

	
 
    QGraphicsScene canvas(0,0,8000,6000);
 

	
 
    if (useGUI) {
 
         main_window=new Main(canvas, mesh);
 
      if ( QApplication::desktop()-&gt;width() &gt; ((Main *)main_window)-&gt;width() + 10
 
	   &amp;&amp; QApplication::desktop()-&gt;height() &gt; ((Main *)main_window)-&gt;height() +30 ) {
 

	
 
	((Main *)main_window)-&gt;show();
 
	((Main *)main_window)-&gt;resize( ((Main *)main_window)-&gt;sizeHint());
 
    } else {
 
        ((Main *)main_window)-&gt;showMaximized();
 
    }
 
  } else {
 
        main_window=new MainBase(canvas, mesh);
 

	
 
 }
 

	
 
    
 
	  
 
    canvas.setSceneRect(QRectF());
 
    if (!batch) {
 
      QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) );
 
    }
 

	
 
						
 
 		
 
    main_window-&gt;Init(leaffile);
 
	  
 
    Cell::SetMagnification(1);
 
    Cell::setOffset(0,0);
 
						
 
    main_window-&gt;FitLeafToCanvas();
 
						
 
				
 
						
 
    main_window-&gt;Plot();
 

	
 
						
 

	
 
    if (batch) {
 
      double t=0.;
 
      do {
 
	t = main_window-&gt;TimeStep();
 
      } while (t &lt; par.maxt);
 
							
 
    } else
 
      return app.exec();
 
	  
 
						
 
  } catch (const char *message) {
 
    if (batch) { 
 
      cerr &lt;&lt; "Exception caught:" &lt;&lt; endl;
 
      cerr &lt;&lt; message &lt;&lt; endl;
 
      abort();
 
    } else {
 
      QString qmess=QString("Exception caught: %1").arg(message);
 
      QMessageBox::critical(0, "Critical Error", qmess);
 
      abort();
 
    }
 
  } catch (ios_base::failure) {
 
    stringstream error_message;
 
    error_message &lt;&lt; "I/O failure: " &lt;&lt; strerror(errno);
 
    if (batch) {
 
      cerr &lt;&lt; error_message.str() &lt;&lt;endl;
 
      abort();
 
    } else {
 
      QString qmess(error_message.str().c_str());
 
      QMessageBox::critical(0, "I/O Error", qmess );
 
      abort();
 
    }
 
  }
 
					
 
}
 
</code>
 
  <code name="reactions_pce_growth.h">
 

	
 
// Executed after the cellular mechanics steps have equillibrized
 
class CellHouseKeeping {
 
public:
 
	void operator() (Cell &amp;c) const {
 
		
 
		c.EnlargeTargetArea(par.cell_expansion_rate);
 
		
 
		if (c.Area() &gt; par.rel_cell_div_threshold * c.BaseArea() ) {
 
			c.Divide();
 
		}
 
	}
 
};
 

	
 
// The number of chemical species in the cels
 
const int Cell::nchem = 0;
 

	
 
// Differential equations describing transport of chemicals from cell to cell
 
class CelltoCellTransport : public TransportFunction {
 

	
 
 public:
 
	virtual void operator()(Wall *w, double *dchem_c1, double *dchem_c2) {}
 
    
 
 };
 

	
 
// Differential equations describing chemical reactions taking place at or near the cell walls
 
// (e.g. PIN accumulation)
 
class WallDynamics : public WallReaction {
 
 public:
 
	virtual void operator()(Wall *w, double *dw1, double *dw2) {}; 
 
	
 
};
 

	
 

	
 
// Differential equations describing chemical reactions inside the cells
 
class CellDynamics : public CellReaction {
 
 public:
 
	virtual void operator()(Cell *c, double *dchem) {
 
	
 
	};
 
	
 
};
 

	
 
// Rules for cell coloring
 
void Cell::SetColor(QColor &amp;color) { }
 

	
 
// To be executed after cell division
 
void Cell::OnDivide(ParentInfo &amp;parent_info, Cell &amp;daughter) {}
 

	
 
</code>
 
  <nodes n="1277" target_length="3.09017">
 
    <node x="210.911" y="-39.9231" fixed="false" boundary="true" sam="false"/>
 
    <node x="191.318" y="108.843" fixed="false" boundary="true" sam="false"/>
 
    <node x="49.3519" y="206.243" fixed="false" boundary="true" sam="false"/>
 
    <node x="-116.346" y="180.886" fixed="false" boundary="true" sam="false"/>
 
    <node x="-174.807" y="131.435" fixed="false" boundary="true" sam="false"/>
 
    <node x="-205.135" y="-82.753" fixed="false" boundary="true" sam="false"/>
 
    <node x="-197.138" y="-88.9985" fixed="false" boundary="true" sam="false"/>
 
    <node x="-25.9056" y="-214.059" fixed="false" boundary="true" sam="false"/>
 
    <node x="46.3642" y="-206.845" fixed="false" boundary="true" sam="false"/>
 
    <node x="166.573" y="-142.11" fixed="false" boundary="true" sam="false"/>
 
    <node x="-122.758" y="172.566" fixed="false" boundary="true" sam="false"/>
 
    <node x="82.8058" y="-189.874" fixed="false" boundary="true" sam="false"/>
 
    <node x="-10.2984" y="51.9207" fixed="false" boundary="false" sam="false"/>
 
    <node x="28.8497" y="-40.624" fixed="false" boundary="false" sam="false"/>
 
    <node x="211.545" y="47.0488" fixed="false" boundary="true" sam="false"/>
 
    <node x="-152.871" y="-144.017" fixed="false" boundary="true" sam="false"/>
 
    <node x="198.118" y="76.9295" fixed="false" boundary="true" sam="false"/>
 
    <node x="31.7262" y="-13.223" fixed="false" boundary="false" sam="false"/>
 
    <node x="123.262" y="73.4429" fixed="false" boundary="false" sam="false"/>
 
    <node x="114.709" y="73.2542" fixed="false" boundary="false" sam="false"/>
 
    <node x="-23.5828" y="18.1366" fixed="false" boundary="false" sam="false"/>
 
    <node x="-121.983" y="-60.5603" fixed="false" boundary="false" sam="false"/>
 
    <node x="-72.7182" y="-54.226" fixed="false" boundary="false" sam="false"/>
 
    <node x="-159.778" y="146.915" fixed="false" boundary="true" sam="false"/>
 
    <node x="-50.1082" y="215.305" fixed="false" boundary="true" sam="false"/>
 
    <node x="-197.419" y="34.6728" fixed="false" boundary="true" sam="false"/>
 
    <node x="110.472" y="-179.83" fixed="false" boundary="true" sam="false"/>
 
    <node x="197.41" y="-64.8994" fixed="false" boundary="true" sam="false"/>
 
    <node x="50.9766" y="-9.7383" fixed="false" boundary="false" sam="false"/>
 
    <node x="138.456" y="-56.7201" fixed="false" boundary="false" sam="false"/>
 
    <node x="79.5472" y="-37.1307" fixed="false" boundary="false" sam="false"/>
 
    <node x="12.2582" y="202.517" fixed="false" boundary="true" sam="false"/>
 
    <node x="70.2362" y="62.2591" fixed="false" boundary="false" sam="false"/>
 
    <node x="13.1214" y="156.916" fixed="false" boundary="false" sam="false"/>
 
    <node x="38.6043" y="116.924" fixed="false" boundary="false" sam="false"/>
 
    <node x="-15.672" y="-208.249" fixed="false" boundary="true" sam="false"/>
 
    <node x="-61.9967" y="-57.5555" fixed="false" boundary="false" sam="false"/>
 
    <node x="-14.7433" y="-188.932" fixed="false" boundary="false" sam="false"/>
 
    <node x="-26.6759" y="-103.506" fixed="false" boundary="false" sam="false"/>
 
    <node x="-192.27" y="68.2773" fixed="false" boundary="true" sam="false"/>
 
    <node x="-58.8361" y="-17.0048" fixed="false" boundary="false" sam="false"/>
 
    <node x="-135.113" y="46.659" fixed="false" boundary="false" sam="false"/>
 
    <node x="-80.5086" y="22.1598" fixed="false" boundary="false" sam="false"/>
 
    <node x="49.1709" y="-105.902" fixed="false" boundary="false" sam="false"/>
 
    <node x="-39.0127" y="119.987" fixed="false" boundary="false" sam="false"/>
 
    <node x="-99.4391" y="-188.881" fixed="false" boundary="true" sam="false"/>
 
    <node x="70.9948" y="-123.985" fixed="false" boundary="false" sam="false"/>
 
    <node x="108.601" y="-115.421" fixed="false" boundary="false" sam="false"/>
 
    <node x="138.708" y="-72.6258" fixed="false" boundary="false" sam="false"/>
 
    <node x="-25.334" y="97.9928" fixed="false" boundary="false" sam="false"/>
 
    <node x="5.64263" y="118.914" fixed="false" boundary="false" sam="false"/>
 
    <node x="-16.0798" y="98.7365" fixed="false" boundary="false" sam="false"/>
 
    <node x="225.956" y="6.34779" fixed="false" boundary="true" sam="false"/>
 
    <node x="178.346" y="138.944" fixed="false" boundary="true" sam="false"/>
 
    <node x="-79.4658" y="143.139" fixed="false" boundary="false" sam="false"/>
 
    <node x="-100.404" y="72.4288" fixed="false" boundary="false" sam="false"/>
 
    <node x="-78.3333" y="114.854" fixed="false" boundary="false" sam="false"/>
 
    <node x="-101.536" y="84.0115" fixed="false" boundary="false" sam="false"/>
 
    <node x="124.094" y="168.201" fixed="false" boundary="true" sam="false"/>
 
    <node x="67.2273" y="98.271" fixed="false" boundary="false" sam="false"/>
 
    <node x="87.5276" y="106.016" fixed="false" boundary="false" sam="false"/>
 
    <node x="77.5685" y="101.538" fixed="false" boundary="false" sam="false"/>
 
    <node x="156.767" y="53.5892" fixed="false" boundary="false" sam="false"/>
 
    <node x="104.439" y="-30.0903" fixed="false" boundary="false" sam="false"/>
 
    <node x="160.397" y="28.6837" fixed="false" boundary="false" sam="false"/>
 
    <node x="136.813" y="-7.43009" fixed="false" boundary="false" sam="false"/>
 
    <node x="21.0654" y="-85.8334" fixed="false" boundary="false" sam="false"/>
 
    <node x="-11.9257" y="-108.625" fixed="false" boundary="false" sam="false"/>
 
    <node x="4.85444" y="-96.6449" fixed="false" boundary="false" sam="false"/>
 
    <node x="-140.199" y="-59.6756" fixed="false" boundary="false" sam="false"/>
 
    <node x="-139.649" y="-19.0377" fixed="false" boundary="false" sam="false"/>
 
    <node x="-145.845" y="22.1053" fixed="false" boundary="false" sam="false"/>
 
    <node x="-110.167" y="-169.48" fixed="false" boundary="true" sam="false"/>
 
    <node x="-58.4179" y="-95.6377" fixed="false" boundary="false" sam="false"/>
 
    <node x="-93.7595" y="-112.176" fixed="false" boundary="false" sam="false"/>
 
    <node x="-74.7638" y="-105.639" fixed="false" boundary="false" sam="false"/>
 
    <node x="-220.571" y="-31.855" fixed="false" boundary="true" sam="false"/>
 
    <node x="127.952" y="-172.758" fixed="false" boundary="true" sam="false"/>
 
    <node x="63.4212" y="-157.764" fixed="false" boundary="false" sam="false"/>
 
    <node x="21.2618" y="202.053" fixed="false" boundary="true" sam="false"/>
 
    <node x="-210.795" y="7.86111" fixed="false" boundary="true" sam="false"/>
 
    <node x="-61.7776" y="212.782" fixed="false" boundary="true" sam="false"/>
 
    <node x="-192.75" y="80.1492" fixed="false" boundary="true" sam="false"/>
 
    <node x="-17.1407" y="207.986" fixed="false" boundary="true" sam="false"/>
 
    <node x="-53.5101" y="145.95" fixed="false" boundary="false" sam="false"/>
 
    <node x="-21.4796" y="188.586" fixed="false" boundary="false" sam="false"/>
 
    <node x="-43.5294" y="162.805" fixed="false" boundary="false" sam="false"/>
 
    <node x="65.815" y="-114.566" fixed="false" boundary="false" sam="false"/>
 
    <node x="78.5215" y="-53.8382" fixed="false" boundary="false" sam="false"/>
 
    <node x="71.5196" y="-105.226" fixed="false" boundary="false" sam="false"/>
 
    <node x="138.131" y="84.7791" fixed="false" boundary="false" sam="false"/>
 
    <node x="149.788" y="154.733" fixed="false" boundary="true" sam="false"/>
 
    <node x="124.039" y="109.037" fixed="false" boundary="false" sam="false"/>
 
    <node x="142.63" y="147.615" fixed="false" boundary="false" sam="false"/>
 
    <node x="223.385" y="-4.1147" fixed="false" boundary="true" sam="false"/>
 
    <node x="152.727" y="1.2629" fixed="false" boundary="false" sam="false"/>
 
    <node x="198.583" y="-10.2325" fixed="false" boundary="false" sam="false"/>
 
    <node x="157.46" y="-146.94" fixed="false" boundary="true" sam="false"/>
 
    <node x="124.987" y="-107.171" fixed="false" boundary="false" sam="false"/>
 
    <node x="152.108" y="-141.479" fixed="false" boundary="false" sam="false"/>
 
    <node x="130.33" y="-116.61" fixed="false" boundary="false" sam="false"/>
 
    <node x="-180.556" y="-117.069" fixed="false" boundary="true" sam="false"/>
 
    <node x="-120.826" y="-170.12" fixed="false" boundary="true" sam="false"/>
 
    <node x="52.9514" y="45.7079" fixed="false" boundary="false" sam="false"/>
 
    <node x="-74.8418" y="47.2812" fixed="false" boundary="false" sam="false"/>
 
    <node x="-33.3635" y="83.692" fixed="false" boundary="false" sam="false"/>
 
    <node x="-56.1674" y="65.4447" fixed="false" boundary="false" sam="false"/>
 
    <node x="-52.1871" y="74.4999" fixed="false" boundary="false" sam="false"/>
 
    <node x="-130.191" y="-64.5069" fixed="false" boundary="false" sam="false"/>
 
    <node x="-112.084" y="-141.086" fixed="false" boundary="false" sam="false"/>
 
    <node x="-134.983" y="-80.7339" fixed="false" boundary="false" sam="false"/>
 
    <node x="-128.101" y="-116.065" fixed="false" boundary="false" sam="false"/>
 
    <node x="-10.9001" y="-151.663" fixed="false" boundary="false" sam="false"/>
 
    <node x="8.17705" y="-151.782" fixed="false" boundary="false" sam="false"/>
 
    <node x="54.0447" y="-161.415" fixed="false" boundary="false" sam="false"/>
 
    <node x="-213.821" y="-11.4249" fixed="false" boundary="true" sam="false"/>
 
    <node x="-146.417" y="-11.128" fixed="false" boundary="false" sam="false"/>
 
    <node x="-204.473" y="-12.6454" fixed="false" boundary="false" sam="false"/>
 
    <node x="-155.01" y="-11.5348" fixed="false" boundary="false" sam="false"/>
 
    <node x="52.638" y="54.1707" fixed="false" boundary="false" sam="false"/>
 
    <node x="-2.17281" y="55.9081" fixed="false" boundary="false" sam="false"/>
 
    <node x="33.6985" y="57.08" fixed="false" boundary="false" sam="false"/>
 
    <node x="-176.69" y="120.77" fixed="false" boundary="true" sam="false"/>
 
    <node x="-99.2785" y="95.8754" fixed="false" boundary="false" sam="false"/>
 
    <node x="-151.902" y="109.215" fixed="false" boundary="false" sam="false"/>
 
    <node x="-130.848" y="107.073" fixed="false" boundary="false" sam="false"/>
 
    <node x="99.494" y="62.9227" fixed="false" boundary="false" sam="false"/>
 
    <node x="114.573" y="-12.8394" fixed="false" boundary="false" sam="false"/>
 
    <node x="101.752" y="35.4239" fixed="false" boundary="false" sam="false"/>
 
    <node x="99.6266" y="8.89343" fixed="false" boundary="false" sam="false"/>
 
    <node x="22.374" y="-56.8882" fixed="false" boundary="false" sam="false"/>
 
    <node x="-47.3759" y="-31.8274" fixed="false" boundary="false" sam="false"/>
 
    <node x="-10.1874" y="-56.1358" fixed="false" boundary="false" sam="false"/>
 
    <node x="-29.2164" y="-35.6511" fixed="false" boundary="false" sam="false"/>
 
    <node x="-19.637" y="-158.113" fixed="false" boundary="false" sam="false"/>
 
    <node x="-99.6411" y="-165.461" fixed="false" boundary="false" sam="false"/>
 
    <node x="-56.3655" y="-146.159" fixed="false" boundary="false" sam="false"/>
 
    <node x="13.3045" y="167.453" fixed="false" boundary="false" sam="false"/>
 
    <node x="92.6262" y="140.778" fixed="false" boundary="false" sam="false"/>
 
    <node x="39.2344" y="171.422" fixed="false" boundary="false" sam="false"/>
 
    <node x="84.8766" y="144.604" fixed="false" boundary="false" sam="false"/>
 
    <node x="-81.7048" y="13.3621" fixed="false" boundary="false" sam="false"/>
 
    <node x="-101.07" y="-16.1762" fixed="false" boundary="false" sam="false"/>
 
    <node x="-130.441" y="-18.8196" fixed="false" boundary="false" sam="false"/>
 
    <node x="163.88" y="-44.4337" fixed="false" boundary="false" sam="false"/>
 
    <node x="24.977" y="-3.33741" fixed="false" boundary="false" sam="false"/>
 
    <node x="66.1884" y="-202.571" fixed="false" boundary="true" sam="false"/>
 
    <node x="-169.532" y="59.9275" fixed="false" boundary="false" sam="false"/>
 
    <node x="-89.0545" y="-192.382" fixed="false" boundary="true" sam="false"/>
 
    <node x="190.321" y="-95.5836" fixed="false" boundary="true" sam="false"/>
 
    <node x="84.7917" y="202.184" fixed="false" boundary="true" sam="false"/>
 
    <node x="-101.745" y="156.113" fixed="false" boundary="false" sam="false"/>
 
    <node x="188.027" y="73.5916" fixed="false" boundary="false" sam="false"/>
 
    <node x="-51.516" y="-10.839" fixed="false" boundary="false" sam="false"/>
 
    <node x="-149.635" y="-62.8059" fixed="false" boundary="false" sam="false"/>
 
    <node x="122.788" y="100.7" fixed="false" boundary="false" sam="false"/>
 
    <node x="102.239" y="106.292" fixed="false" boundary="false" sam="false"/>
 
    <node x="108.426" y="102.635" fixed="false" boundary="false" sam="false"/>
 
    <node x="6.50142" y="139.102" fixed="false" boundary="false" sam="false"/>
 
    <node x="-33.6599" y="165.505" fixed="false" boundary="false" sam="false"/>
 
    <node x="-0.8178" y="142.049" fixed="false" boundary="false" sam="false"/>
 
    <node x="-28.7534" y="159.243" fixed="false" boundary="false" sam="false"/>
 
    <node x="183.902" y="129.041" fixed="false" boundary="true" sam="false"/>
 
    <node x="-71.4312" y="107.204" fixed="false" boundary="false" sam="false"/>
 
    <node x="-59.6188" y="82.9157" fixed="false" boundary="false" sam="false"/>
 
    <node x="164.776" y="-12.322" fixed="false" boundary="false" sam="false"/>
 
    <node x="165.381" y="-37.1993" fixed="false" boundary="false" sam="false"/>
 
    <node x="164.607" y="-23.9176" fixed="false" boundary="false" sam="false"/>
 
    <node x="96.901" y="-128.724" fixed="false" boundary="false" sam="false"/>
 
    <node x="118.625" y="-173.184" fixed="false" boundary="true" sam="false"/>
 
    <node x="97.6107" y="-138.79" fixed="false" boundary="false" sam="false"/>
 
    <node x="111.789" y="-154.793" fixed="false" boundary="false" sam="false"/>
 
    <node x="-79.9451" y="198.627" fixed="false" boundary="true" sam="false"/>
 
    <node x="-78.1788" y="188.156" fixed="false" boundary="false" sam="false"/>
 
    <node x="-51.0178" y="168.918" fixed="false" boundary="false" sam="false"/>
 
    <node x="-171.726" y="-123.42" fixed="false" boundary="true" sam="false"/>
 
    <node x="-142.656" y="-97.6586" fixed="false" boundary="false" sam="false"/>
 
    <node x="-162.347" y="-117.942" fixed="false" boundary="false" sam="false"/>
 
    <node x="-37.6882" y="-214.837" fixed="false" boundary="true" sam="false"/>
 
    <node x="131.005" y="-86.6104" fixed="false" boundary="false" sam="false"/>
 
    <node x="83.1962" y="-79.1979" fixed="false" boundary="false" sam="false"/>
 
    <node x="123.44" y="-82.0626" fixed="false" boundary="false" sam="false"/>
 
    <node x="91.9877" y="-75.6426" fixed="false" boundary="false" sam="false"/>
 
    <node x="-148.236" y="12.7494" fixed="false" boundary="false" sam="false"/>
 
    <node x="-157.877" y="11.5783" fixed="false" boundary="false" sam="false"/>
 
    <node x="-189.364" y="26.6719" fixed="false" boundary="false" sam="false"/>
 
    <node x="21.1286" y="109.839" fixed="false" boundary="false" sam="false"/>
 
    <node x="20.882" y="70.5494" fixed="false" boundary="false" sam="false"/>
 
    <node x="20.6306" y="98.381" fixed="false" boundary="false" sam="false"/>
 
    <node x="25.6317" y="88.7704" fixed="false" boundary="false" sam="false"/>
 
    <node x="-140.523" y="159.679" fixed="false" boundary="true" sam="false"/>
 
    <node x="-121.693" y="112.341" fixed="false" boundary="false" sam="false"/>
 
    <node x="-134.486" y="151.667" fixed="false" boundary="false" sam="false"/>
 
    <node x="-114.612" y="118.534" fixed="false" boundary="false" sam="false"/>
 
    <node x="-64.6249" y="-103.902" fixed="false" boundary="false" sam="false"/>
 
    <node x="-61.2751" y="-110.911" fixed="false" boundary="false" sam="false"/>
 
    <node x="-54.1155" y="-135.431" fixed="false" boundary="false" sam="false"/>
 
    <node x="185.353" y="118.104" fixed="false" boundary="true" sam="false"/>
 
    <node x="144.236" y="92.8634" fixed="false" boundary="false" sam="false"/>
 
    <node x="160.983" y="103.83" fixed="false" boundary="false" sam="false"/>
 
    <node x="211.708" y="35.5985" fixed="false" boundary="true" sam="false"/>
 
    <node x="163.193" y="17.7965" fixed="false" boundary="false" sam="false"/>
 
    <node x="201.511" y="33.0676" fixed="false" boundary="false" sam="false"/>
 
    <node x="172.364" y="14.9705" fixed="false" boundary="false" sam="false"/>
 
    <node x="183.959" y="-104.382" fixed="false" boundary="true" sam="false"/>
 
    <node x="139.025" y="-81.1372" fixed="false" boundary="false" sam="false"/>
 
    <node x="174.775" y="-100.999" fixed="false" boundary="false" sam="false"/>
 
    <node x="149.188" y="-85.0611" fixed="false" boundary="false" sam="false"/>
 
    <node x="-32.8682" y="12.8876" fixed="false" boundary="false" sam="false"/>
 
    <node x="-57.7929" y="55.3967" fixed="false" boundary="false" sam="false"/>
 
    <node x="-48.5296" y="32.9357" fixed="false" boundary="false" sam="false"/>
 
    <node x="-49.1296" y="40.0124" fixed="false" boundary="false" sam="false"/>
 
    <node x="26.3229" y="-206.028" fixed="false" boundary="true" sam="false"/>
 
    <node x="25.2298" y="-158.198" fixed="false" boundary="false" sam="false"/>
 
    <node x="27.0593" y="-197.614" fixed="false" boundary="false" sam="false"/>
 
    <node x="23.4643" y="-183.167" fixed="false" boundary="false" sam="false"/>
 
    <node x="-181.091" y="-75.5459" fixed="false" boundary="false" sam="false"/>
 
    <node x="-177.717" y="-20.2975" fixed="false" boundary="false" sam="false"/>
 
    <node x="-183.9" y="-66.3829" fixed="false" boundary="false" sam="false"/>
 
    <node x="-179.124" y="-31.9273" fixed="false" boundary="false" sam="false"/>
 
    <node x="-153.748" y="54.3173" fixed="false" boundary="false" sam="false"/>
 
    <node x="-139.856" y="101.118" fixed="false" boundary="false" sam="false"/>
 
    <node x="-150.908" y="61.9166" fixed="false" boundary="false" sam="false"/>
 
    <node x="-150.435" y="77.4528" fixed="false" boundary="false" sam="false"/>
 
    <node x="62.1618" y="-28.5725" fixed="false" boundary="false" sam="false"/>
 
    <node x="-99.6234" y="-62.4219" fixed="false" boundary="false" sam="false"/>
 
    <node x="-106.68" y="-101.542" fixed="false" boundary="false" sam="false"/>
 
    <node x="-102.466" y="-70.9463" fixed="false" boundary="false" sam="false"/>
 
    <node x="31.5064" y="-100.597" fixed="false" boundary="false" sam="false"/>
 
    <node x="17.1551" y="-149.66" fixed="false" boundary="false" sam="false"/>
 
    <node x="27.6775" y="-117.7" fixed="false" boundary="false" sam="false"/>
 
    <node x="23.8446" y="-133.412" fixed="false" boundary="false" sam="false"/>
 
    <node x="68.6305" y="201.652" fixed="false" boundary="true" sam="false"/>
 
    <node x="71.4223" y="157.396" fixed="false" boundary="false" sam="false"/>
 
    <node x="68.196" y="192.919" fixed="false" boundary="false" sam="false"/>
 
    <node x="74.6847" y="177.656" fixed="false" boundary="false" sam="false"/>
 
    <node x="152.923" y="35.1804" fixed="false" boundary="false" sam="false"/>
 
    <node x="104.724" y="26.647" fixed="false" boundary="false" sam="false"/>
 
    <node x="135.764" y="36.6537" fixed="false" boundary="false" sam="false"/>
 
    <node x="121.157" y="33.5706" fixed="false" boundary="false" sam="false"/>
 
    <node x="-39.5808" y="-95.0964" fixed="false" boundary="false" sam="false"/>
 
    <node x="-34.3266" y="-86.3448" fixed="false" boundary="false" sam="false"/>
 
    <node x="-14.548" y="-64.7356" fixed="false" boundary="false" sam="false"/>
 
    <node x="-103.475" y="-24.2564" fixed="false" boundary="false" sam="false"/>
 
    <node x="-82.4534" y="-39.7244" fixed="false" boundary="false" sam="false"/>
 
    <node x="-96.6539" y="-29.6411" fixed="false" boundary="false" sam="false"/>
 
    <node x="30.1129" y="-51.485" fixed="false" boundary="false" sam="false"/>
 
    <node x="74.5377" y="-70.9554" fixed="false" boundary="false" sam="false"/>
 
    <node x="47.173" y="-63.3638" fixed="false" boundary="false" sam="false"/>
 
    <node x="64.2311" y="-71.9236" fixed="false" boundary="false" sam="false"/>
 
    <node x="63.5152" y="8.37244" fixed="false" boundary="false" sam="false"/>
 
    <node x="97.268" y="17.6251" fixed="false" boundary="false" sam="false"/>
 
    <node x="73.7662" y="6.35858" fixed="false" boundary="false" sam="false"/>
 
    <node x="80.8249" y="11.3568" fixed="false" boundary="false" sam="false"/>
 
    <node x="9.50183" y="5.55829" fixed="false" boundary="false" sam="false"/>
 
    <node x="-20.647" y="-41.4717" fixed="false" boundary="false" sam="false"/>
 
    <node x="1.10121" y="-8.5249" fixed="false" boundary="false" sam="false"/>
 
    <node x="-5.22784" y="-10.6115" fixed="false" boundary="false" sam="false"/>
 
    <node x="-69.3084" y="-201.229" fixed="false" boundary="true" sam="false"/>
 
    <node x="-49.034" y="-154.436" fixed="false" boundary="false" sam="false"/>
 
    <node x="-52.3466" y="-181.961" fixed="false" boundary="false" sam="false"/>
 
    <node x="-45.5672" y="-165.732" fixed="false" boundary="false" sam="false"/>
 
    <node x="59.9419" y="158.371" fixed="false" boundary="false" sam="false"/>
 
    <node x="44.0536" y="125.511" fixed="false" boundary="false" sam="false"/>
 
    <node x="53.2781" y="150.703" fixed="false" boundary="false" sam="false"/>
 
    <node x="-136.104" y="37.2232" fixed="false" boundary="false" sam="false"/>
 
    <node x="-100.952" y="10.9361" fixed="false" boundary="false" sam="false"/>
 
    <node x="-128.303" y="32.7513" fixed="false" boundary="false" sam="false"/>
 
    <node x="-106.281" y="18.7171" fixed="false" boundary="false" sam="false"/>
 
    <node x="18.1123" y="6.22266" fixed="false" boundary="false" sam="false"/>
 
    <node x="20.5733" y="15.0646" fixed="false" boundary="false" sam="false"/>
 
    <node x="29.509" y="48.0265" fixed="false" boundary="false" sam="false"/>
 
    <node x="186.928" y="-61.1319" fixed="false" boundary="false" sam="false"/>
 
    <node x="121.425" y="158.656" fixed="false" boundary="false" sam="false"/>
 
    <node x="78.3815" y="-181.63" fixed="false" boundary="false" sam="false"/>
 
    <node x="-216.739" y="-53.3122" fixed="false" boundary="true" sam="false"/>
 
    <node x="-184.912" y="113.042" fixed="false" boundary="true" sam="false"/>
 
    <node x="-60.4837" y="-67.2754" fixed="false" boundary="false" sam="false"/>
 
    <node x="-16.4348" y="34.5172" fixed="false" boundary="false" sam="false"/>
 
    <node x="-111.495" y="-150.493" fixed="false" boundary="false" sam="false"/>
 
    <node x="9.50712" y="192.487" fixed="false" boundary="false" sam="false"/>
 
    <node x="221.6" y="-23.9004" fixed="false" boundary="true" sam="false"/>
 
    <node x="111.372" y="185.317" fixed="false" boundary="true" sam="false"/>
 
    <node x="149.716" y="68.4832" fixed="false" boundary="false" sam="false"/>
 
    <node x="-125.207" y="53.4133" fixed="false" boundary="false" sam="false"/>
 
    <node x="-140.856" y="-27.9119" fixed="false" boundary="false" sam="false"/>
 
    <node x="122.776" y="-50.2898" fixed="false" boundary="false" sam="false"/>
 
    <node x="152.199" y="-155.032" fixed="false" boundary="true" sam="false"/>
 
    <node x="-167.571" y="-132.124" fixed="false" boundary="true" sam="false"/>
 
    <node x="-75.6213" y="-5.64008" fixed="false" boundary="false" sam="false"/>
 
    <node x="4.05731" y="209.424" fixed="false" boundary="true" sam="false"/>
 
    <node x="61.5564" y="57.8986" fixed="false" boundary="false" sam="false"/>
 
    <node x="-17.3226" y="-126.354" fixed="false" boundary="false" sam="false"/>
 
    <node x="-52.1382" y="-124.558" fixed="false" boundary="false" sam="false"/>
 
    <node x="-25.4163" y="-127.585" fixed="false" boundary="false" sam="false"/>
 
    <node x="-36.9427" y="-124.029" fixed="false" boundary="false" sam="false"/>
 
    <node x="109.596" y="-40.3139" fixed="false" boundary="false" sam="false"/>
 
    <node x="101.111" y="-70.4951" fixed="false" boundary="false" sam="false"/>
 
    <node x="105.766" y="-47.9137" fixed="false" boundary="false" sam="false"/>
 
    <node x="100.834" y="-63.101" fixed="false" boundary="false" sam="false"/>
 
    <node x="60.9484" y="-139.231" fixed="false" boundary="false" sam="false"/>
 
    <node x="-195.979" y="57.158" fixed="false" boundary="true" sam="false"/>
 
    <node x="81.9993" y="-90.539" fixed="false" boundary="false" sam="false"/>
 
    <node x="113.939" y="-108.019" fixed="false" boundary="false" sam="false"/>
 
    <node x="95.259" y="-96.6879" fixed="false" boundary="false" sam="false"/>
 
    <node x="107.92" y="-102.711" fixed="false" boundary="false" sam="false"/>
 
    <node x="128.059" y="118.205" fixed="false" boundary="false" sam="false"/>
 
    <node x="109.506" y="143.675" fixed="false" boundary="false" sam="false"/>
 
    <node x="122.832" y="121.935" fixed="false" boundary="false" sam="false"/>
 
    <node x="110.432" y="136.146" fixed="false" boundary="false" sam="false"/>
 
    <node x="130.401" y="-14.8607" fixed="false" boundary="false" sam="false"/>
 
    <node x="145.733" y="-48.5341" fixed="false" boundary="false" sam="false"/>
 
    <node x="142.699" y="-34.0887" fixed="false" boundary="false" sam="false"/>
 
    <node x="144.483" y="-41.2387" fixed="false" boundary="false" sam="false"/>
 
    <node x="-31.578" y="116.588" fixed="false" boundary="false" sam="false"/>
 
    <node x="-17.7253" y="141.012" fixed="false" boundary="false" sam="false"/>
 
    <node x="-25.9191" y="123.408" fixed="false" boundary="false" sam="false"/>
 
    <node x="-19.7949" y="134.526" fixed="false" boundary="false" sam="false"/>
 
    <node x="-185.239" y="-12.3591" fixed="false" boundary="false" sam="false"/>
 
    <node x="-183.105" y="17.4201" fixed="false" boundary="false" sam="false"/>
 
    <node x="-183.725" y="-2.80962" fixed="false" boundary="false" sam="false"/>
 
    <node x="-186.063" y="6.63678" fixed="false" boundary="false" sam="false"/>
 
    <node x="135.401" y="-126.227" fixed="false" boundary="false" sam="false"/>
 
    <node x="131.289" y="-132.589" fixed="false" boundary="false" sam="false"/>
 
    <node x="118.56" y="-151.009" fixed="false" boundary="false" sam="false"/>
 
    <node x="-171.659" y="-77.3424" fixed="false" boundary="false" sam="false"/>
 
    <node x="-151.907" y="-103.304" fixed="false" boundary="false" sam="false"/>
 
    <node x="-170.176" y="-86.2542" fixed="false" boundary="false" sam="false"/>
 
    <node x="-159.898" y="-99.0576" fixed="false" boundary="false" sam="false"/>
 
    <node x="102.222" y="72.2674" fixed="false" boundary="false" sam="false"/>
 
    <node x="96.7756" y="79.9066" fixed="false" boundary="false" sam="false"/>
 
    <node x="89.832" y="96.3816" fixed="false" boundary="false" sam="false"/>
 
    <node x="4.74127" y="172.661" fixed="false" boundary="false" sam="false"/>
 
    <node x="-27.1133" y="172.371" fixed="false" boundary="false" sam="false"/>
 
    <node x="-12.0417" y="168.932" fixed="false" boundary="false" sam="false"/>
 
    <node x="-19.6565" y="170.199" fixed="false" boundary="false" sam="false"/>
 
    <node x="-124.825" y="-129.352" fixed="false" boundary="false" sam="false"/>
 
    <node x="-147.739" y="-136.508" fixed="false" boundary="false" sam="false"/>
 
    <node x="-132.734" y="-129.189" fixed="false" boundary="false" sam="false"/>
 
    <node x="-62.6466" y="147.113" fixed="false" boundary="false" sam="false"/>
 
    <node x="25.0766" y="-66.7761" fixed="false" boundary="false" sam="false"/>
 
    <node x="-132.978" y="167.99" fixed="false" boundary="true" sam="false"/>
 
    <node x="-47.1505" y="120.586" fixed="false" boundary="false" sam="false"/>
 
    <node x="-65.2155" y="99.2168" fixed="false" boundary="false" sam="false"/>
 
    <node x="-50.9355" y="112.377" fixed="false" boundary="false" sam="false"/>
 
    <node x="-58.8764" y="101.059" fixed="false" boundary="false" sam="false"/>
 
    <node x="29.6833" y="-126.496" fixed="false" boundary="false" sam="false"/>
 
    <node x="52.7677" y="-138.127" fixed="false" boundary="false" sam="false"/>
 
    <node x="41.1864" y="-132.812" fixed="false" boundary="false" sam="false"/>
 
    <node x="62.7837" y="81.0514" fixed="false" boundary="false" sam="false"/>
 
    <node x="54.5641" y="80.7044" fixed="false" boundary="false" sam="false"/>
 
    <node x="33.0127" y="87.8754" fixed="false" boundary="false" sam="false"/>
 
    <node x="-88.2422" y="146.345" fixed="false" boundary="false" sam="false"/>
 
    <node x="-109.508" y="126.676" fixed="false" boundary="false" sam="false"/>
 
    <node x="-92.2356" y="140.603" fixed="false" boundary="false" sam="false"/>
 
    <node x="-97.9736" y="133.483" fixed="false" boundary="false" sam="false"/>
 
    <node x="115.576" y="175.6" fixed="false" boundary="true" sam="false"/>
 
    <node x="81.9563" y="171.696" fixed="false" boundary="false" sam="false"/>
 
    <node x="106.823" y="170.735" fixed="false" boundary="false" sam="false"/>
 
    <node x="89.7403" y="168.011" fixed="false" boundary="false" sam="false"/>
 
    <node x="143.072" y="1.88081" fixed="false" boundary="false" sam="false"/>
 
    <node x="115.053" y="27.2894" fixed="false" boundary="false" sam="false"/>
 
    <node x="131.047" y="11.3072" fixed="false" boundary="false" sam="false"/>
 
    <node x="120.117" y="20.6238" fixed="false" boundary="false" sam="false"/>
 
    <node x="-38.8773" y="211.538" fixed="false" boundary="true" sam="false"/>
 
    <node x="-58.032" y="173.93" fixed="false" boundary="false" sam="false"/>
 
    <node x="-40.2489" y="201.647" fixed="false" boundary="false" sam="false"/>
 
    <node x="-54.0344" y="180.55" fixed="false" boundary="false" sam="false"/>
 
    <node x="139.376" y="129.986" fixed="false" boundary="false" sam="false"/>
 
    <node x="166.584" y="112.621" fixed="false" boundary="false" sam="false"/>
 
    <node x="147.932" y="128.751" fixed="false" boundary="false" sam="false"/>
 
    <node x="161.779" y="119.987" fixed="false" boundary="false" sam="false"/>
 
    <node x="143.786" y="-129.443" fixed="false" boundary="false" sam="false"/>
 
    <node x="164.612" y="-97.0108" fixed="false" boundary="false" sam="false"/>
 
    <node x="150.057" y="-124.152" fixed="false" boundary="false" sam="false"/>
 
    <node x="159.594" y="-103.157" fixed="false" boundary="false" sam="false"/>
 
    <node x="-13.1493" y="-180.147" fixed="false" boundary="false" sam="false"/>
 
    <node x="19.8259" y="-176.521" fixed="false" boundary="false" sam="false"/>
 
    <node x="-4.60575" y="-181.361" fixed="false" boundary="false" sam="false"/>
 
    <node x="12.1893" y="-179.31" fixed="false" boundary="false" sam="false"/>
 
    <node x="-217.13" y="-42.1417" fixed="false" boundary="true" sam="false"/>
 
    <node x="-186.156" y="-49.3753" fixed="false" boundary="false" sam="false"/>
 
    <node x="-208.689" y="-40.3773" fixed="false" boundary="false" sam="false"/>
 
    <node x="-193.15" y="-44.0592" fixed="false" boundary="false" sam="false"/>
 
    <node x="-188.907" y="91.2448" fixed="false" boundary="true" sam="false"/>
 
    <node x="-151.543" y="86.1497" fixed="false" boundary="false" sam="false"/>
 
    <node x="-179.341" y="90.9175" fixed="false" boundary="false" sam="false"/>
 
    <node x="-164.683" y="88.3669" fixed="false" boundary="false" sam="false"/>
 
    <node x="98.1249" y="43.9665" fixed="false" boundary="false" sam="false"/>
 
    <node x="58.7807" y="29.7288" fixed="false" boundary="false" sam="false"/>
 
    <node x="88.6438" y="42.5016" fixed="false" boundary="false" sam="false"/>
 
    <node x="66.2484" y="32.8312" fixed="false" boundary="false" sam="false"/>
 
    <node x="27.5847" y="-24.3998" fixed="false" boundary="false" sam="false"/>
 
    <node x="-9.65571" y="-27.6381" fixed="false" boundary="false" sam="false"/>
 
    <node x="13.6424" y="-31.4104" fixed="false" boundary="false" sam="false"/>
 
    <node x="-1.36222" y="-30.9039" fixed="false" boundary="false" sam="false"/>
src/VirtualLeaf.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 <string>
 
#include <fstream>
 
#include <sstream>
 
#include <cstring>
 
#include <functional> 
 
#include <getopt.h>
 
#include <cerrno>
 
#include "mesh.h"
 
#include "parameter.h"
 
#include "random.h"
 
#include "pi.h"
 
#include "cellitem.h"
 
#include "canvas.h"
 
#include "cell.h"
 
#include "output.h"
 
#include <qwidget.h>
 
#include <q3process.h>
 
#include <qapplication.h>
 
#include <QDesktopWidget>
 
#include <QGraphicsScene>
 
#include <QMessageBox>
 
//Added by qt3to4:
 
#include <QMouseEvent>
 

	
 
#include <unistd.h>
 
#include <q3textstream.h> 
 

	
 
#ifdef HAVE_QWT
 
#include "data_plot.h"
 
#endif
 
#include <QPalette>
 
#include <QBrush>
 
#include <QToolTip>
 
#include "simplugin.h"
 
#include <QPluginLoader>
 
#include <QDir>
 
#include "modelcatalogue.h"
 

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

	
 
extern Parameter par;
 

	
 
MainBase *main_window = 0;
 

	
 
#ifdef XFIGGRAPHICS
 
#define TIMESTEP double Graphics::TimeStep(void)
 
#endif
 

	
 
class PrintNode {
 
public:
 
  void operator() (const Node &n) const 
 
  {
 
    cerr << n.Index() << ": " << n <<  endl;
 
  }
 
};
 

	
 

	
 
class EdgeSource {
 

	
 
public:
 
  void operator() (Cell &c) {
 

	
 
    if (c.AtBoundaryP()) {
 
      cerr << "Cell " << c.Index() << " is a source cell.\n";
 
      c.SetSource(0,par.source);
 
    } else {
 
      cerr << "Cell " << c.Index() << " is _not_ a source cell.\n";
 
    }
 
  }
 
};
 

	
 

	
 

	
 
class CellInfo {
 
public:
 
  void operator() (Cell &c,std::ostream &os) const {
 
    os << "Cell " << c.index << " says: " << endl;
 
    os << "c.nodes.size() = " << c.nodes.size() << endl;
 
    for (list<Node *>::iterator i=c.nodes.begin(); i!=c.nodes.end(); i++) {
 
      cerr << (*i)->Index() << " ";
 
    }
 
    cerr << endl;
 
  }
 
};
 

	
 
double PINSum(Cell &c) {
 
  return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj );
 
}
 

	
 

	
 
class DrawCell {
 
public:
 
  void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const {
 
    if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) {
 
      if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) {
 
	if (m.ShowToolTipsP()) {
 
	  //QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr());
 
		QString info_string=QString("Cell %1, chemicals(%2): ").arg(c.Index()).arg(Cell::NChem());
 
		for (int i=0;i<Cell::NChem();i++) {
 
			info_string += QString("%1 ").arg(c.Chemical(i));
 
		}
 
		info_string += QString("\nArea is %1\n Circumference is %2\n Boundary type is %3").arg(c.Area()).arg(c.WallCircumference()).arg(c.BoundaryStr());
 
		
 
	  info_string += "\nNodes: " + c.printednodelist();
 
	  c.Draw(&canvas, info_string);
 
	} else {
 
	  c.Draw(&canvas);
 
	}
 
      }
 
      if (m.ShowCentersP()){
 
	c.DrawCenter(&canvas);
 
      }
 
      if (m.ShowFluxesP()){
 
	c.DrawFluxes(&canvas, par.arrowsize);
 
      }
 
    }
 
  }
 
};
 

	
 
Mesh mesh;
 
bool batch=false;
 

	
 
void MainBase::Plot(int resize_stride)
 
{
 

	
 
  clear();
 

	
 
  static int count=0;
 
  int count=(int)mesh.getTime();
 

	
 
  if (resize_stride) {
 
    if ( !((count)%resize_stride) ) {
 
      FitLeafToCanvas();
 
    }
 
  }
 

	
 
  mesh.LoopCells(DrawCell(),canvas,*this);
 

	
 
  if (ShowNodeNumbersP()) 
 
    mesh.LoopNodes( bind2nd (mem_fun_ref ( &Node::DrawIndex), &canvas ) ) ;
 
  if (ShowCellNumbersP()) 
 
    mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ;
 

	
 
  if (ShowCellAxesP()) 
 
    mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) );
 

	
 
  if (ShowCellStrainP()) 
 
    mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) );
 

	
 
  if (ShowWallsP())
 
    mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) );
 

	
 
/*  if (ShowApoplastsP()) 
 
    mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::DrawApoplast ), &canvas ) );
 
*/
 
  if (ShowMeshP()) 
 
    mesh.DrawNodes(&canvas);
 

	
 
  if (ShowBoundaryOnlyP()) 
 
    mesh.DrawBoundary(&canvas);
 

	
 
  if ( ( batch || MovieFramesP() )) {
 

	
 
     static int frame = 0;
 
    // frame numbers are sequential for the most frequently written file type.
 
    // for the less frequently written file type they match the other type
 
    if (!(count%par.storage_stride) )  {
 

	
 
    if (!(count%par.storage_stride) ) {
 
      stringstream fname;
 
      fname << par.datadir << "/leaf.";
 
      fname.fill('0');
 
      fname.width(6);
 

	
 
      fname << frame << ".jpg";
 
      if (par.storage_stride <= par.xml_storage_stride) {
 
	frame = (int)mesh.getTime();
 
      }
 

	
 
      // Write high-res JPG snapshot every plot step
 
      Save(fname.str().c_str(), "JPEG",1024,768);
 
      fname << count << ".png";
 
      // Write high-res PNG snapshot every plot step
 
      Save(fname.str().c_str(), "PNG", 1024, 768);
 
    }
 

	
 
    if (!(count%par.xml_storage_stride)) {
 
      stringstream fname;
 
      fname << par.datadir << "/leaf.";
 
      fname.fill('0');
 
      fname.width(6);
 
      fname << frame << ".xml";
 

	
 
      if (par.xml_storage_stride < par.storage_stride) {
 
	frame = (int)mesh.getTime();
 
      }
 
      fname << count << ".xml";
 
      // Write XML file every ten plot steps
 
      mesh.XMLSave(fname.str().c_str(), XMLSettingsTree());
 
    }
 
  }
 
 count++;
 
}
 

	
 

	
 

	
 
INIT {
 

	
 
  //mesh.SetSimPlugin(plugin);
 
  if (leaffile) { 
 
    xmlNode *settings;
 
    mesh.XMLRead(leaffile, &settings);
 

	
 
    main_window->XMLReadSettings(settings);
 
    xmlFree(settings);
 
    main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str()));
 

	
 
  } else {
 
    mesh.StandardInit();
 
  }
 
  
 
  Cell::SetMagnification(1);
 
  Cell::setOffset(0,0);
 
  
 
  FitLeafToCanvas();
 
  Plot();
 

	
 
}
 

	
 
TIMESTEP {
 

	
 
  static int i=0;
 
  static int t=0;
 
  static int ncells;
 

	
 
  if (!batch) {
 
    UserMessage(QString("Time: %1").arg(mesh.getTimeHours().c_str()),0);
 
  }
 

	
 
  ncells=mesh.NCells();
 

	
 

	
 
  double dh;
 

	
 
  if(DynamicCellsP()) {
 
    dh = mesh.DisplaceNodes();
 

	
 
    // Only allow for node insertion, cell division and cell growth
 
    // if the system has equillibrized
 
    // i.e. cell wall tension equillibrization is much faster
 
    // than biological processes, including division, cell wall yielding
 
    // and cell expansion
 
    mesh.InsertNodes(); // (this amounts to cell wall yielding)
 

	
 
    if ( (-dh) < par.energy_threshold) {
 

	
 
      mesh.IncreaseCellCapacityIfNecessary();
 
      mesh.DoCellHouseKeeping();
 
      //mesh.LoopCurrentCells(mem_fun(&plugin->CellHouseKeeping)); // this includes cell division
 

	
 
      // Reaction diffusion	
 
      mesh.ReactDiffuse(par.rd_dt);
 
      t++;
 
      Plot(par.resize_stride);
 
    }
 
  } else {
 
    mesh.ReactDiffuse(par.rd_dt);
 
    Plot(par.resize_stride);
 
  }
 
  i++;
 
  return mesh.getTime();
 
}
 

	
 

	
 

	
 
/* Called if a cell is clicked */
 
void Cell::OnClick(QMouseEvent *e){}
 

	
 

	
 
/* Custom message handler - Default appends a newline character to the end of each line. */ 
 
void vlMessageOutput(QtMsgType type, const char *msg)
 
{
 
  switch (type) {
 
  case QtDebugMsg:
 
    //fprintf(stderr, "Debug: %s\n", msg);
 
    cerr << msg << flush;
 
    break;
 
  case QtWarningMsg:
 
    //fprintf(stderr, "Warning: %s\n", msg);
 
    cerr << "Warning: " << msg << flush;
 
    break;
 
  case QtCriticalMsg:
 
    fprintf(stderr, "Critical: %s\n", msg);
 
    cerr << "Critical: " << msg << flush;
 
    break;
 
  case QtFatalMsg:
 
    //fprintf(stderr, "Fatal: %s\n", msg);
 
    cerr << "Fatal: " << msg << flush;
 
    abort();
 
  }
 
}
 

	
 

	
 
Parameter par;
 

	
 
int main(int argc,char **argv) {
 

	
 
  try {
 
    int c;
 
    char *leaffile=0;
 
    char *modelfile=0;
 

	
 
    while (1) {
 

	
 
      //int this_option_optind = optind ? optind : 1;
 
      int option_index = 0;
 
      static struct option long_options[] = {
 
	{"batch", no_argument, NULL, 'b'},
 
	{"leaffile", required_argument, NULL, 'l'},
 
	{"model", required_argument, NULL, 'm'} 
 
      };
 

	
 
      // short option 'p' creates trouble for non-commandline usage on MacOSX. Option -p changed to -P (capital)
 
      static char *short_options = "blm";
 
      c = getopt_long (argc, argv, "bl:m:",
 
		       long_options, &option_index);
 
      if (c == -1)
 
	break;
 

	
 

	
 
      if (c==0) {
 
	printf ("option %s", long_options[option_index].name);
 
	if (optarg)
 
	  printf (" with arg %s", optarg);
 
	printf ("\n");
 

	
 
	c = short_options[option_index];
 
      }
 

	
 
      switch (c) {
 
      case 'b':
 
	cerr << "Running in batch mode\n";
 
	batch=true;
 
	break;
 

	
 
      case 'l':
 
	leaffile=strdup(optarg);
 
	if (!leaffile) {
 
	  throw("Out of memory");
 
	}
 
	printf("Reading leaf state file '%s'\n", leaffile);
 
	break;
 

	
 
      case 'm':
 
	modelfile=strdup(optarg);
 
	if (!modelfile) {
 
	  throw("Out of memory");
 
	}
 
	break;
 

	
 
      case '?':
 
	break;
 

	
 
      default:
 
	printf ("?? getopt returned character code 0%o ??\n", c);
 
      }
 
    }
 

	
 

	
 
    if (optind < argc) {
 
      printf ("non-option ARGV-elements: ");
 
      while (optind < argc)
 
	printf ("%s ", argv[optind++]);
 
      printf ("\n");
 
    }
 

	
 
    bool useGUI = !batch;
 
    qInstallMsgHandler(vlMessageOutput); // custom message handler
 
    QApplication app(argc,argv,useGUI);
 

	
 

	
 

	
 
    QPalette tooltippalette = QToolTip::palette();
 
    QColor transparentcolor = QColor(tooltippalette.brush(QPalette::Window).color());
 

	
 
    tooltippalette.setBrush (QPalette::Window, QBrush (transparentcolor) );
 
    QToolTip::setPalette( tooltippalette );
 

	
 
    QGraphicsScene canvas(0,0,8000,6000);
 

	
 

	
 
    if (useGUI) {
 
      main_window=new Main(canvas, mesh);
 
      if ( QApplication::desktop()->width() > ((Main *)main_window)->width() + 10
 
	   && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) {
 

	
 
	((Main *)main_window)->show();
 
	((Main *)main_window)->resize( ((Main *)main_window)->sizeHint());
 
      } else {
 
        ((Main *)main_window)->showMaximized();
 
      }
 
      
 
      // show "About" window at start up
 
      ((Main *)main_window)->about();
 
    } else {
 
      main_window=new MainBase(canvas, mesh);
 
    }
 

	
 
    canvas.setSceneRect(QRectF());
 
    if (!batch) {
 
      QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) );
 
    }
 

	
 
    //    main_window->Init(leaffile);
 

	
 
    // Install model or read catalogue of models
 
    ModelCatalogue model_catalogue(&mesh, useGUI?(Main *)main_window:0,modelfile);
 

	
 

	
 
    if (useGUI)
 
      model_catalogue.PopulateModelMenu();
 
    model_catalogue.InstallFirstModel();
 
    
 
    
 

	
 
    /*    Cell::SetMagnification(1);
 
    Cell::setOffset(0,0);
 

	
 
    main_window->FitLeafToCanvas();
 

	
 
    main_window->Plot();
 
    */
 
    if (batch) {
 
      double t=0.;
 
      do {
 
	t = main_window->TimeStep();
 
      } while (t < par.maxt);
 
    } else
 
      return app.exec();
 

	
 
  } catch (const char *message) {
 
    if (batch) { 
 
      cerr << "Exception caught:" << endl;
 
      cerr << message << endl;
 
      abort();
 
    } else {
 
      QString qmess=QString("Exception caught: %1").arg(message);
 
      QMessageBox::critical(0, "Critical Error", qmess);
 
      abort();
 
    }
 
  } catch (ios_base::failure) {
 
    stringstream error_message;
 
    error_message << "I/O failure: " << strerror(errno);
 
    if (batch) {
 
      cerr << error_message.str() <<endl;
 
      abort();
 
    } else {
 
      QString qmess(error_message.str().c_str());
 
      QMessageBox::critical(0, "I/O Error", qmess );
 
      abort();
 
    }
 
  }
 
}
 

	
 
/* finis */
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 *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;
 
  }
 
}
 

	
 
void 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;
 
  }
 

	
 
  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)), 0, -1)) {
 
    if (!image->save(QDir::toNativeSeparators(QString(fname)), format)) {
 
      MyWarning::warning("Image not saved successfully. Is the disk full or the extension not recognized?");
 
    };
 
    }
 
    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";
 
  }
 
}
 

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

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