Changeset - bb80657b6912
[Not reviewed]
default
0 13 0
Michael Guravage - 15 years ago 2010-10-08 16:58:27
michael.guravage@cwi.nl
Export Cell Data at interval specified in the leafML file or explicitly via the file menu.
Added new parameters to VirtualLeafpar.tmpl
Added GPL boilerplate to make_{parameter,pardialog}_source.pl files.
Added new parameters to auxin_growth.xml. See respective ChangeLog files for details.

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed data/leaves/ChangeLog
changed data/leaves/auxin_growth.xml
changed src/ChangeLog
changed src/VirtualLeafpar.tmpl
changed src/canvas.cpp
changed src/canvas.h
changed src/parameter.cpp
changed src/parameter.h
changed src/pardialog.cpp
changed src/pardialog.h
changed src/perl/ChangeLog
changed src/perl/make_parameter_source.pl
changed src/perl/make_pardialog_source.pl
8 files changed:
0 comments (0 inline, 0 general)
data/leaves/ChangeLog
Show inline comments
 
2010-10-08    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* auxin_growth.xml: Added export_interval and export_fn_prefix parameters.
 

	
 

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

	
 
	* Added: tutorial3_init.xml
 
	tutorial4_init.xml
 
	tutorial5_init.xml
 

	
 
	* Removed: bend.xml
 
	circ.xml
 
	explant.xml
 
	init.xml
 
	one_acc_point_van3.xml
 
	one_acc_point_van3_growth.xml
 
	one_acc_point_van3_growth2.xml
 
	tissue.xml
data/leaves/auxin_growth.xml
Show inline comments
 
<?xml version="1.0" encoding="UTF-8"?>
 

	
 
<!-- 
 
  $Rev$:  Revision of last commit
 
  $Author$:  Author of last commit
 
  $Source$:  Source file
 
  $Date$:  Date of last commit
 

	
 
  This file is part of the Virtual Leaf.
 

	
 
  The Virtual Leaf 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.
 

	
 
  The Virtual Leaf 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.
 
-->
 

	
 
<leaf name="/Users/roel/VLeafClean_plugin/Snapshot/VLeafMacOSX/auxin_growth.xml" date="Sat Aug 29 18:28:19 2009" simtime="11660">
 
  <parameter>
 
    <par name="export_interval" val="1000"/>
 
    <par name="export_fn_prefix" val="CELLDATA_"/>
 
    <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="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="1e-06"/>
 
        <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"/>
 
      </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="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="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"/>
 
  </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
 
			Save(fname.str().c_str(), "PDF");
 
			*/
 
			
 
			fname &lt;&lt; frame &lt;&lt; ".jpg";
 
			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);
 
			
 
		}
 
	
 
		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(10);
 
    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="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="10" 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"/>
src/ChangeLog
Show inline comments
 
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/VirtualLeafpar.tmpl
Show inline comments
 
title = Parameter values for The Virtual Leaf / title
 
label = <b>Visualization</b> / label
 
arrowcolor = white / string
 
arrowsize = 100 / double
 
textcolor = red / string
 
cellnumsize = 1 / int
 
nodenumsize = 1 / int
 
node_mag = 1.0 / double 
 
outlinewidth = 1.0 / double
 
cell_outline_color = forestgreen / string
 
resize_stride = 0 / int
 
label = / label
 
label = <b>Cell mechanics</b> / label
 
T = 1.0 / double
 
lambda_length = 100. / double
 
lambda_celllength = 0. / double
 
target_length = 60. / double 
 
cell_expansion_rate = 1. / double
 
cell_div_expansion_rate = 0. / double
 
auxin_dependent_growth = true / bool
 
ode_accuracy = 1e-4 / double
 
mc_stepsize = 0.4 / double
 
mc_cell_stepsize = 0.2 / double
 
energy_threshold = 1000. / double
 
bend_lambda = 0. / double
 
alignment_lambda = 0. / double
 
rel_cell_div_threshold = 2. / double
 
rel_perimeter_stiffness = 2 / double
 
collapse_node_threshold = 0.05 / double
 
morphogen_div_threshold = 0.2 / double
 
morphogen_expansion_threshold = 0.01 / double
 
copy_wall = true / bool
 
label = / label
 
label = <b>Auxin transport and PIN1 dynamics</b> / label
 
source = 0. / double
 
D = 0., 0.0, 0.0, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. / doublelist
 
initval = 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. / doublelist
 
k1 = 1. / double
 
k2 = 0.3 / double
 
r = 1. / double
 
kr = 1. / double
 
#k3 = 1 / double
 
#k4 = 0.3 / double
 
km = 1. / double
 
Pi_tot = 1. / double
 
transport = 0.036 / double
 
ka = 1 / double
 
# d = 1e-06 / double
 
# e = 0.01 / double
 
# f = 10 / double
 
pin_prod = 0.001 / double
 
pin_prod_in_epidermis = 0.1 / double
 
pin_breakdown = 0.001 / double
 
pin_breakdown_internal = 0.001 / double
 
aux1prod = 0.001 / double
 
aux1prodmeso = 0. / double
 
aux1decay = 0.001 / double
 
aux1decaymeso = 0.1 / double
 
aux1transport = 0.036 / double
 
aux_cons = 0. / double
 
aux_breakdown = 0. / double
 
kaux1 = 1 / double
 
kap = 1 / double
 
leaf_tip_source = 0.001 / double
 
sam_efflux = 0.0001 / double
 
sam_auxin = 10. / double
 
# gf_prod = 1e-3 / double
 
# gf_decay = 1e-3 / double
 
sam_auxin_breakdown = 0 / double
 
#label = / label
 
#label = <b>miscellaneous</b> / label
 
van3prod = 0.002 / double
 
van3autokat = 0.1 / double
 
van3sat = 10 / double
 
k2van3 = 0.3 / double
 
#glvprod = 0.0 / double
 
#glvbreakdown = 0. / double
 
label = / label
 
label = <b>Integration parameters</b> / label
 
dt = 0.1 / double 
 
rd_dt = 1.0 / double
 
datadir = . / directory 
 
movie = false / bool
 
nit = 100000 / int
 
maxt = 1000. / double
 
storage_stride = 10 / int
 
xml_storage_stride = 500 / int
 
rseed = -1 / int
 
#label = / label
 
#label = <b>Parameters for new chemical</b> / label
 
#glvproduction = 0. / double
 
#glvdecay = 0. / double
 
#glvdiffthreshold = 0. / double
 
label = / label
 
label = <b>Meinhardt leaf venation model</b> / label
 
constituous_expansion_limit = 16 / int
 
vessel_inh_level = 1 / double
 
vessel_expansion_rate = 0.25 / double
 
d = 0. / double
 
e = 0. / double
 
f = 0. / double
 
c = 0. / double
 
mu = 0. / double
 
nu = 0. / double
 
rho0 = 0. / double
 
rho1 = 0. / double
 
c0 = 0. / double
 
gamma = 0. / double
 
eps = 0. / double
 
label = / label
 
label = <b>User-defined parameters</b> / label
 
k = 0., 0.0, 0.0, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. / doublelist
 
i1 = 0 / int
 
i2 = 0 / int
 
i3 = 0 / int
 
i4 = 0 / int
 
i5 = 0 / int
 
s1 =  / string
 
s2 =  / string
 
s3 =  / string
 
b1 = false / bool
 
b2 = false / bool
 
b3 = false / bool
 
b4 = false / bool
 
dir1 = . / directory
 
dir2 = . / directory
 
export_interval = 0 / int
 
export_fn_prefix = CellData_ / string
src/canvas.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 <time.h>
 
#include <string>
 
#include <fstream>
 
#include <streambuf>
 
#include <QGraphicsScene>
 
#include <QGraphicsView>
 
#include <qdatetime.h>
 
#include <q3mainwindow.h>
 
#include <qstatusbar.h>
 
#include <qmessagebox.h>
 
#include <qmenubar.h>
 
#include <qapplication.h>
 
#include <qpainter.h>
 
#include <qprinter.h>
 
#include <qlabel.h>
 
#include <qimage.h>
 
#include <q3progressdialog.h>
 
#include <qtimer.h>
 
#include <qslider.h>
 
#include <qpixmap.h>
 
#include <qfile.h>
 
#include <qdir.h>
 
#include <q3filedialog.h>
 
#include <QGraphicsItem>
 
#include <QList>
 
#include <QDir>
 

	
 
#include <QDebug>
 

	
 
#include <set>
 

	
 
//Added by qt3to4:
 
#include <Q3ValueList>
 
#include <Q3PopupMenu>
 
#include <QMouseEvent>
 
#include <typeinfo>
 
#include <cstring>
 
#include <q3process.h>
 
#include <qlayout.h>
 
#include <qspinbox.h>
 
#include <fstream>
 
#include <sstream>
 
#include "pardialog.h"
 
#include "parameter.h"
 
#include "canvas.h"
 
#include "node.h"
 
#include "nodeset.h"
 
#include "nodeitem.h"
 
#include "cellitem.h"
 
#include "wallitem.h"
 
#include "mesh.h"
 
#include "xmlwrite.h"
 
#include "miscq.h"
 
#include "OptionFileDialog.h"
 
#include <cstdlib>
 
#include <cstdio>
 
#include "modelcatalogue.h"
 

	
 
#include <algorithm>
 

	
 
// Include VIB and PSB logos
 
#include "psb.xpm"
 
#include "cwi.xpm"
 

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

	
 
using namespace std;
 

	
 
// We use a global variable to save memory - all the brushes and pens in
 
// the mesh are shared.
 

	
 
#define QUOTE_ME(s) QUOTE_ME_2NDLEV(s)
 
#define QUOTE_ME_2NDLEV(s) #s
 

	
 
static QColor dark_red("darkRed");
 

	
 

	
 
static const int imageRTTI = 984376;
 
extern Parameter par;
 
const QString Main::caption("Virtual leaf");
 
const QString Main::caption_with_file("Virtual leaf: %1");
 

	
 
FigureEditor::FigureEditor(
 
			   QGraphicsScene& c, Mesh &m, QWidget* parent,
 
			   const char* name, Qt::WindowFlags f) :
 
  QGraphicsView(&c,parent), mesh(m)
 
{
 
  intersection_line = 0;
 
  //angle_line = 0;
 
  setInteractive(true);
 
  moving = 0;  
 
  rotation_mode = false;
 
}
 

	
 

	
 
void FigureEditor::clear()
 
{
 
  QList<QGraphicsItem *> list = scene()->items();
 
  QList<QGraphicsItem *>::Iterator it = list.begin();
 
  for (; it != list.end(); ++it) {
 
    delete *it;
 
  }
 
}
 

	
 
void FigureEditor::wheelEvent(QWheelEvent *event)
 
{
 
  scaleView(pow((double)2, -event->delta() / 240.0));
 
}
 

	
 

	
 
void FigureEditor::scaleView (qreal scaleFactor)
 
{
 
  qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)). width();
 
  if (factor < 0.07 || factor > 100) return;
 
  scale (scaleFactor, scaleFactor);
 
}
 

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

	
 
  QImage *image = new QImage(sizex, sizey, QImage::Format_RGB32);
 
  image->fill(QColor(Qt::white).rgb());
 
  QPainter *painter=new QPainter(image);
 

	
 
  render(painter);
 

	
 
  image->save(QString(fname),format);
 
  delete painter;
 
  delete image;
 
}
 

	
 
void FigureEditor::mousePressEvent(QMouseEvent* e)
 
{
 
  static QList<Node*> selected;
 
  emit MousePressed();
 

	
 
  //QPointF p = matrix().inverted().map(e->pos());
 
  QPointF p = mapToScene(e->pos());
 

	
 
#ifdef QDEBUG  
 
  qDebug() << endl << "MousePressEvent location: (" << p.x() << "," << p.y() << ")." << endl;
 
  qDebug() << "Magnification:  " << Cell::Magnification() << endl;
 
  qDebug() << "Offsets:  " << Cell::Offset() << endl;
 
#endif
 

	
 

	
 
  QList<QGraphicsItem *> l=scene()->items(p);
 

	
 
#ifdef QDEBUG  
 
  qDebug() << "MousePressEvents, items: " << l.size() << endl;
 
  qDebug() << "Mouse button modifier: " << e->modifiers() << endl;
 
#endif
 

	
 
  if (e->button()==Qt::RightButton || l.size()==0) {
 

	
 
    //cerr << "Drawing an intersection line from " << p.x() << ", " << p.y() << endl;
 
    intersection_line = new QGraphicsLineItem( 0, scene() );
 
    intersection_line->setPen( QPen( QColor("red"), 3, Qt::DashLine ) );
 
    intersection_line->setLine( QLineF(p,p) );
 
    intersection_line->setZValue( 100 );
 
    intersection_line->show();
 
  }
 

	
 
  for (QList<QGraphicsItem *>::Iterator it=l.begin(); it!=l.end(); ++it) {
 
#ifdef QDEBUG
 
    qDebug() << typeid(**it).name() << endl;
 
#endif
 

	
 
    if ( !strcmp(typeid(**it).name(),"8NodeItem")) {
 

	
 
      stringstream data_strstream;
 
      data_strstream << (dynamic_cast<NodeItem*>(*it))->getNode();
 
      dynamic_cast<Main *>(parent())->UserMessage(QString(data_strstream.str().c_str()));
 

	
 
      (dynamic_cast<NodeItem*>(*it))->OnClick(e->button());
 
    }
 
    else 
 
      if ( !strcmp(typeid(**it).name(),"8CellItem") ) {
 

	
 
	Cell &c=((dynamic_cast<CellItem *>(*it))->getCell());      
 
	// OnClick to be defined in end-user code
 
	c.OnClick(e);
 
      } else {
 
	if ( !strcmp(typeid(**it).name(),"8WallItem") ) {
 
	  (dynamic_cast<WallItem *>(*it))->OnClick(e);
 
	} 
 
      }
 
  }
 

	
 
  FullRedraw();
 
  moving = 0;
 
}
 

	
 
void FigureEditor::mouseMoveEvent(QMouseEvent* e)
 
{
 

	
 
  // User chooses "rotation mode" and we can rotate the object around its center of mass
 
  if (dynamic_cast<Main *>(parent())->RotationModeP()) {
 

	
 
    QPointF p = mapToScene(e->pos());
 
    p.setX(p.x() / Cell::Magnification());
 
    p.setY(p.y() / Cell::Magnification());
 

	
 

	
 
    // get object's center of mass
 
    QPointF rotation_midpoint = mesh.Centroid()*Cell::Factor() - Cell::Offset();
 

	
 

	
 
    // calculate rotation angle
 
    double dy = (rotation_midpoint.y() - p.y());
 
    double dx = (rotation_midpoint.x() - p.x());
 
    double new_rot_angle = atan2(dx, dy);
 
    double d_alpha = new_rot_angle - rot_angle;
 
    rot_angle = new_rot_angle;
 

	
 
    mesh.Rotate(d_alpha, ( Vector(rotation_midpoint) + Cell::Offset() ) / Cell::Factor() );
 

	
 
    dynamic_cast<Main *>(parent())->Plot(0);
 
    FullRedraw();
 
    return;
 
  }
 
 
 
  
 
  if ( moving ) {
 

	
 
    QPointF p = mapToScene(e->pos());
 
    moving->userMove(p.x() - moving_start.x(),
 
		     p.y() - moving_start.y());
 
    moving_start = p;
 
    scene()->update();
 

	
 
  }
 

	
 
  //cerr << "event";
 

	
 
  // keep track of intersection line to interactively cut a growing leaf
 

	
 
  if ( intersection_line ) {
 

	
 
    QPointF sp = intersection_line -> line().p1(); // startpoint
 
    QPointF ep = mapToScene(e->pos()); // endpoint
 
    intersection_line -> setLine( QLineF(sp, ep) ); 
 
    scene()->update();
 
    // Need this for Mac
 
    FullRedraw();
 
  }
 
}
 

	
 
//void FigureEditor::contentsMouseReleaseEvent(QMouseEvent* e)
 
void FigureEditor::mouseReleaseEvent(QMouseEvent* e)
 
{
 

	
 
  emit MouseReleased();
 
  // intersection line for leaf was finished now.
 

	
 
  if (e->button()==Qt::LeftButton) { 
 
    if (intersection_line ) {
 
#ifdef QDEBUG
 
      qDebug() << "Trying to cut leaf" << endl;
 
#endif
 
      QPointF sp = intersection_line -> line().p1(); // startpoint
 
      QPointF ep = mapToScene(e->pos());
 

	
 
      intersection_line -> setLine( QLineF(sp, ep) ); 
 
      intersection_line -> show();
 

	
 
      vector <CellItem *> intersected_cells = getIntersectedCells();
 

	
 
      // no cells selected, do nothing
 
      if (intersected_cells.size()==0) {
 
#ifdef QDEBUG
 
	qDebug() << "No cells detected :-(" << endl;
 
#endif
 
	return;
 
      }
 

	
 

	
 
      Vector startpoint = Vector(sp.x(), sp.y()) / Cell::Factor() - Cell::Offset();
 
      Vector endpoint = Vector(ep.x(), ep.y()) / Cell::Factor() - Cell::Offset();
 

	
 
      NodeSet *node_set = new NodeSet;
 

	
 
      for (vector<CellItem *>::iterator it = intersected_cells.begin(); it != intersected_cells.end(); it++) {
 
	(*it)->setBrush(QBrush("purple"));
 
	
 
	Cell &c=(*it)->getCell();
 

	
 
	// sometimes the cell hasn't properly divided yet before the
 
	// next division is called?  so check for it?  let's find a way
 
	// to do this later. Note that this functionality currently
 
	// might result in a segmentation fault for users who are
 
	// quickly dragging and releasing division lines...
 
	scene()->update();
 

	
 
#ifdef QDEBUG
 
	qDebug() << "Dividing Cell " << c.Index() << endl;
 
#endif
 

	
 
	c.DivideOverGivenLine( startpoint, endpoint, true, node_set);
 
      }
 

	
 
      node_set->CleanUp();
 
      mesh.AddNodeSet(node_set);
 

	
 
#ifdef QDEBUG
 
      qDebug() << "Done DivideOverGivenLine" << endl;
 
#endif
 

	
 
      mesh.TestIllegalWalls();
 
      // Do the actual cutting and removing
 
      if (intersected_cells.size()) {
 
	mesh.CutAwayBelowLine( startpoint, endpoint ); 
 

	
 
	// Correct flags of nodeset
 
	for (NodeSet::iterator i = node_set->begin(); i != node_set->end(); i++) {
 
	  (*i)->SetSAM();
 
	  (*i)->SetBoundary();
 
	}
 

	
 
	// Make cells attached to nodeset part of the boundary
 
	// This is a temporary solution for the following:
 
	//   If a cell attached to a NodeSet divides (with a division plane intersecting the node set), 
 
	//   we must insert a new node into the node set.
 
	// For now, we add a layer of "virtual cells" inbetween. 
 
	list<Cell *> cells_attached_to_nodeset = node_set->getCells();
 
	for ( list<Cell *>::iterator c = cells_attached_to_nodeset.begin(); c != cells_attached_to_nodeset.end(); c++) {
 
	  (*c)->SetBoundary(Cell::SAM);
 
	}
 

	
 

	
 

	
 
#ifdef QDEBUG
 
	qDebug() << "Done CutAwayBelowLine" << endl;
 
#endif
 
	mesh.TestIllegalWalls();
 
	mesh.RepairBoundaryPolygon();
 
#ifdef QDEBUG
 
	qDebug() << "Done RepairBoundaryPolygon" << endl;
 
#endif
 
	mesh.TestIllegalWalls();
 
	mesh.CleanUpWalls();
 
#ifdef QDEBUG
 
	qDebug() << "Done CleanUpWalls" << endl;
 
#endif
 
	mesh.TestIllegalWalls();
 
      }
 

	
 
      dynamic_cast<Main *>(parent())->Plot();
 

	
 
#ifdef QDEBUG
 
      cerr << "NodeSet of cutting line: " << *node_set << endl;
 
#endif
 
    }
 
  } else 
 
    if (e->button()==Qt::RightButton) {
 

	
 
      if (intersection_line /* && !angle_line*/) {
 

	
 
	QPointF p = mapToScene(e->pos());
 
	QPointF sp = intersection_line->line().p1();
 

	
 
	viewport()->setMouseTracking( TRUE );
 
      } 
 
    }
 
}
 

	
 

	
 
// returns a vector of pointer to cells colliding with intersection line
 
vector <CellItem *> FigureEditor::getIntersectedCells(void)
 
{ 
 
  vector <CellItem *> colliding_cells;
 

	
 
  QList<QGraphicsItem *> l = intersection_line->collidingItems( );
 

	
 
#ifdef QDEBUG
 
  qDebug() <<  "l.size() = " << l.size() << endl;
 
#endif
 

	
 
  for (QList<QGraphicsItem *>::Iterator it=l.begin(); it!=l.end(); ++it) {
 

	
 
#ifdef QDEBUG
 
    qDebug() << typeid(**it).name() << endl;
 
#endif
 

	
 
    if ( !strcmp(typeid(**it).name(),"8CellItem") ) {
 
      colliding_cells.push_back(dynamic_cast<CellItem *>(*it));
 
    }
 
  }
 

	
 
  delete intersection_line;
 
  intersection_line = 0;
 
  return colliding_cells;
 
}
 

	
 
void FigureEditor::FullRedraw(void)
 
{
 
  QList<QRectF> rl;
 
  rl << sceneRect();
 
  updateScene(rl);   
 
}
 

	
 

	
 
NodeItem *FigureEditor::selectedNodeItem(QList<QGraphicsItem *> graphicItems) const
 
{
 
  NodeItem *nodeItem = 0;
 
  // graphicItems is a list of the QgraphicItems under the mouse click event 
 
  QList<QGraphicsItem *>::Iterator it = graphicItems.begin();
 
  for (; it != graphicItems.end(); ++it) {
 
    if ( !strcmp(typeid(**it).name(),"8NodeItem")) {
 
      // the object under the mouse click is a Nodeitem
 
      nodeItem = dynamic_cast<NodeItem *>(*it);
 
      // indicate we've selected it
 
      nodeItem->setBrush(dark_red);
 
      break;
 
    }
 
  }
 
  return nodeItem;
 
}
 

	
 

	
 
void FigureEditor::insertNode(QPointF p)
 
{
 
  Node *node = new Node(p.x(), p.y(), 0);
 
  mesh.AddNode(node);
 
  scene()->clearSelection();
 
  dynamic_cast<Main *>(parent())->Plot();
 
  FullRedraw();
 
#ifdef QDEBUG  
 
  qDebug() << "Node: " << p << endl;
 
#endif
 
}
 

	
 
static uint mainCount = 0;
 

	
 
Main::Main(QGraphicsScene& c, Mesh &m, QWidget* parent, const char* name, Qt::WindowFlags f) :
 
  Q3MainWindow(parent,name,f),
 
  MainBase(c,m),
 
  mesh(m)
 
{
 
  editor = new FigureEditor(canvas,mesh, this);
 

	
 
#ifdef QDEBUG
 
  qDebug() << "Interactive = " << editor->isEnabled();
 
#endif
 

	
 
  working_dir = 0;
 
  QObject::connect( editor, SIGNAL(MousePressed()), this, SLOT(PauseIfRunning()));
 
  QObject::connect( editor, SIGNAL(MouseReleased()), this, SLOT(ContIfRunning()));
 
  QMenuBar* menu = menuBar();
 

	
 
  Q3PopupMenu* file = new Q3PopupMenu( menu );
 

	
 
  file->insertItem("&Read leaf", this, SLOT(readStateXML()));
 
  file->insertItem("&Save leaf", this, SLOT(saveStateXML()));
 
  file->insertItem("Snapshot", this, SLOT(snapshot()), Qt::CTRL+Qt::SHIFT+Qt::Key_S);
 

	
 
  file->insertSeparator();
 
  file->insertItem("Read next leaf", this, SLOT(readNextStateXML()), Qt::Key_PageDown);
 
  file->insertItem("Read previous leaf", this, SLOT(readPrevStateXML()), Qt::Key_PageUp);
 
  file->insertItem("Read last leaf", this, SLOT(readLastStateXML()), Qt::Key_End);
 
  file->insertItem("Read first leaf", this, SLOT(readFirstStateXML()), Qt::Key_Home);
 
  file->insertItem("Export cell areas", this, SLOT(exportCellData()));
 

	
 
  file->insertSeparator();
 
  file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
 
  file->insertSeparator();
 
  file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
 
  menu->insertItem("&File", file);
 

	
 
  Q3PopupMenu* edit = new Q3PopupMenu( menu );
 
  edit->insertItem("Reset Chemicals and Transporters", this, SLOT( CleanMesh()), Qt::CTRL+Qt::Key_R );
 
  edit->insertItem("Reset Chemicals", this, SLOT( CleanMeshChemicals()) );
 
  edit->insertItem("Reset Transporters", this, SLOT( CleanMeshTransporters()) );
 
  edit->insertItem("Randomize PIN1 Transporters", this, SLOT( RandomizeMesh()) );
 
  edit->insertItem("Cut away SAM", this, SLOT( CutSAM() ));
 
  menu->insertItem("&Edit", edit);
 

	
 
  run = new Q3PopupMenu( menu );
 
  running = false;
 
  paused_id = run->insertItem("&Simulation paused", this, SLOT(togglePaused()), Qt::Key_S);
 
  run->setItemChecked(paused_id, FALSE);
 

	
 
  menu->insertItem("&Run", run);
 

	
 
  view = new Q3PopupMenu( menu );
 
  view->insertItem("&Zoom in", this, SLOT(zoomIn()), Qt::CTRL+Qt::Key_Equal);
 
  view->insertItem("Zoom &out", this, SLOT(zoomOut()), Qt::CTRL+Qt::Key_Minus);
 
  view->insertSeparator();
 
  com_id = view->insertItem("Show cell &centers", this, SLOT(toggleShowCellCenters()));
 
  view->setItemChecked(com_id, FALSE);
 

	
 
  mesh_id = view->insertItem("Show &nodes", this, SLOT(toggleShowNodes()), Qt::CTRL+Qt::SHIFT+Qt::Key_N);
 
  view->setItemChecked(mesh_id, TRUE);
 
  node_number_id = view->insertItem("Show node numbers", this, SLOT(toggleNodeNumbers()), Qt::CTRL+Qt::SHIFT+Qt::Key_M);
 
  view->setItemChecked(node_number_id, FALSE);
 
  cell_number_id = view->insertItem("Show cell numbers", this, SLOT(toggleCellNumbers()));
 
  view->setItemChecked(cell_number_id, FALSE);
 
  hide_cells_id = view->insertItem("Hide cells", this, SLOT(toggleHideCells()));
 
  view->setItemChecked(hide_cells_id, FALSE);
 
  border_id = view->insertItem("Show &border cells", this, SLOT(toggleShowBorderCells()));
 
  view->setItemChecked(border_id, FALSE);
 
  cell_axes_id = view->insertItem("Show cell &axes", this, SLOT(toggleCellAxes()));
 
  cell_strain_id = view->insertItem("Show cell &strain", this, SLOT(toggleCellStrain()));
 
  view->setItemChecked(cell_axes_id, FALSE);
 
  fluxes_id = view->insertItem("Show &fluxes", this, SLOT(toggleShowFluxes()));
 
  view->setItemChecked(fluxes_id, FALSE);
 
  cell_walls_id = view->insertItem("Show transporters", this, SLOT(toggleShowWalls()));
 
  view->setItemChecked(cell_walls_id, FALSE);
 
 // apoplasts_id = view->insertItem("Show apoplasts", this, SLOT(toggleShowApoplasts()));
 
 // view->setItemChecked(apoplasts_id, FALSE);
 
  view->insertSeparator();
 
  only_boundary_id = view->insertItem("Show only leaf &boundary", this, SLOT(toggleLeafBoundary()));
 
  view->insertSeparator();
 
  movie_frames_id = view->insertItem("Start saving movie &frames", this, SLOT(toggleMovieFrames()));
 
  view->setItemChecked(movie_frames_id, par.movie);
 

	
 
  view->setItemChecked(only_boundary_id, FALSE);
 
  menu->insertItem("&View", view);
 

	
 

	
 
  options = new Q3PopupMenu( menu );
 
  dyn_cells_id = options->insertItem("Cell growth", this, SLOT(toggleDynCells()));
 
  options->setItemChecked(dyn_cells_id, true);
 

	
 
  options->insertItem("Edit &parameters", this, SLOT(EditParameters()), Qt::CTRL+Qt::Key_E);
 

	
 
  rotation_mode_id = options->insertItem("Rotate leaf", this, SLOT(EnterRotationMode()), Qt::CTRL + Qt::SHIFT + Qt::Key_R);
 
  options->setItemChecked(rotation_mode_id, false);
 

	
 
  menu->insertItem("&Options",options);
 

	
 
  // Menu of models
 
  modelmenu = new QMenu( menu );
 
  menu->insertItem("&Models", modelmenu);
 

	
 

	
 
  menu->insertSeparator();
 

	
 
  helpmenu = new Q3PopupMenu( menu );
 
  tooltips_id = helpmenu->insertItem("Show Cell&Info", this, SLOT(Refresh()));
 
  helpmenu->setItemChecked(tooltips_id, true);
 
  helpmenu->insertSeparator();
 
    //helpmenu->insertSeparator();
 
  helpmenu->insertItem("&LICENSE", this, SLOT(gpl()) );
 
  helpmenu->insertItem("About", this, SLOT(about()) ); //, Key_F1);
 
	
 
	menu->insertItem("&Help",helpmenu);
 
  statusBar();
 
  setCentralWidget(editor);
 
  printer = 0;
 
  init();
 

	
 
  // Start timer which repetitively invokes
 
  // a simulation time step
 
  timer = new QTimer( this );
 
  connect( timer, SIGNAL(timeout()), SLOT(TimeStepWrap()) );
 

	
 
  stopSimulation();
 
  statusBar()->addWidget(new QLabel("Ready."));
 
  setCaption(caption);
 
  gifanim = 0;
 

	
 
  infobar = new InfoBar();
 
  addDockWindow(infobar);
 
}
 

	
 
void Main::RefreshInfoBar(void)
 
{
 
  infobar->SetText(mesh.ModelID());
 
}
 

	
 

	
 
void Main::UserMessage(QString message, int timeout)
 
{
 
  statusBar()->showMessage(message, timeout);
 
}
 

	
 

	
 
void Main::init()
 
{
 
  clear();
 

	
 
  static int r=24;
 
  srand(++r);
 

	
 
  mainCount++;
 
}
 

	
 
Main::~Main()
 
{
 
  delete printer;
 
  if ( !--mainCount ) {
 
  }
 
  //EndGifAnim();
 
}
 

	
 
void Main::newView()
 
{
 
  // Open a new view... have it delete when closed.
 
  Main *m = new Main(canvas, mesh, 0, 0, Qt::WDestructiveClose);
 
  qApp->setMainWidget(m);
 
  m->show();
 
  qApp->setMainWidget(0);
 
}
 

	
 

	
 
void Main::EditParameters()
 
{
 

	
 
  ParameterDialog *pardial = new ParameterDialog(this, "stridediag");
 

	
 
  // Make sure the values in the parameter dialog are updated after a file is read 
 
  // each method changing the parameters (reading XML or PAR files) should
 
  // emit this signal
 
  QObject::connect(   this, SIGNAL( ParsChanged() ), pardial, SLOT( Reset() ) );
 
}
 

	
 
void Main::savePars()
 
{
 

	
 
  stopSimulation();
 

	
 
  Q3FileDialog *fd = new Q3FileDialog( this, "file dialog", TRUE );
 
  fd->setMode( Q3FileDialog::AnyFile );
 
  fd->setFilter( "Parameter files (*.par)");
 

	
 
  QString fileName;
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 
    ofstream parfile((const char *)fileName);
 
    par.Write(parfile);
 
  }
 

	
 
  startSimulation();
 
}
 

	
 
void Main::readPars()
 
{
 

	
 
  stopSimulation();
 

	
 
  Q3FileDialog *fd = new Q3FileDialog( this, "file dialog", TRUE );
 
  fd->setMode( Q3FileDialog::ExistingFile );
 
  fd->setFilter( "Parameter files (*.par)");
 

	
 
  QString fileName;
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 
    par.Read((const char *)fileName);
 
  }
 

	
 
  emit ParsChanged();
 
}
 

	
 

	
 
void Main::saveStateXML()
 
{
 

	
 
  stopSimulation();
 
  Q3FileDialog *fd = new Q3FileDialog( this, "file dialog", TRUE );
 
  fd->setMode( Q3FileDialog::AnyFile );
 
  fd->setFilter( "XML (*.xml)");
 
  QString fileName;
 

	
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 
    if ( QFile::exists( fileName ) &&
 
	 QMessageBox::question(
 
			       this,
 
			       tr("Overwrite File? -- Leaf Growth"),
 
			       tr("A file called %1 already exists."
 
				  "Do you want to overwrite it?")
 
			       .arg( fileName ),
 
			       tr("&Yes"), tr("&No"),
 
			       QString::null, 1, 1 ) ) {
 
      return saveStateXML();
 

	
 
    } else {
 

	
 
      mesh.XMLSave((const char *)fileName, XMLSettingsTree());
 

	
 
    }
 
  }
 
}
 

	
 

	
 

	
 
void Main::snapshot()
 
{
 

	
 

	
 
  stopSimulation();
 
  Q3FileDialog *fd = new Q3FileDialog( this, "Save snapshot", TRUE );
 
  fd->setMode( Q3FileDialog::AnyFile );
 

	
 
  QString fileName;
 

	
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 
    if ( QFile::exists( fileName ) &&
 
	 QMessageBox::question(
 
			       this,
 
			       tr("Overwrite File? -- Leaf Growth"),
 
			       tr("A file called %1 already exists."
 
				  "Do you want to overwrite it?")
 
			       .arg( fileName ),
 
			       tr("&Yes"), tr("&No"),
 
			       QString::null, 1, 1 ) ) {
 
      return snapshot();
 

	
 
    } else {
 

	
 
      // extract extension from filename
 
      QString extension = getExtension(fileName);
 

	
 
      // Save bitmaps at 1024x768
 
      Save((const char *)fileName, extension, 1024, 768);
 
    }
 
  }
 
}
 

	
 

	
 

	
 
void Main::readPrevStateXML()
 
{
 

	
 
  // if we have already read a file, read the next file
 
  if (!currentFile.isEmpty() && working_dir) {
 
    QString next_file;
 

	
 
    QStringList xml_files = working_dir->entryList("*.xml");
 
    QString currentFile_nopath = currentFile.section( '/', -1 );
 
    QString currentFile_path = currentFile.section( '/', 0, -2 );
 

	
 
    QList<QString>::iterator f = xml_files.find( currentFile_nopath );
 

	
 
    if (f == xml_files.end()) {
 
      return;
 
    }
 

	
 
    if (f==xml_files.begin()) {
 
      QMessageBox mb( "Read previous leaf",
 
		      "No more files",
 
		      QMessageBox::Information,
 
		      QMessageBox::Ok | QMessageBox::Default,
 
		      QMessageBox::NoButton,
 
		      QMessageBox::NoButton);
 
      mb.exec();
 
      return;
 
    }
 
    next_file = *(--f);
 
    next_file = currentFile_path+"/"+next_file;
 

	
 
    readStateXML((const char *)next_file);
 

	
 
  }
 
}
 

	
 
int Main::readStateXML(const char *filename, bool geometry, bool pars, bool simtime)
 
{
 

	
 
  try {
 
    xmlNode *settings;
 
    mesh.XMLRead((const char *)filename, &settings, geometry, pars, simtime);
 
#ifdef QDEBUG
 
    qDebug() << "Reading done."<< endl;
 
#endif
 
    XMLReadSettings(settings);
 
    xmlFree(settings);
 
    Cell::SetMagnification(1);
 
    Cell::setOffset(0,0);
 

	
 
    FitLeafToCanvas();
 
    
 
    currentFile =  QString(filename);
 

	
 
    Plot();
 
    QString status_message = QString("Successfully read leaf from file %1. Time is %2 h.").arg(currentFile).arg(mesh.getTimeHours().c_str());
 
    cerr << status_message.toStdString() << endl;
 
    setCaption(caption_with_file.arg(filename));
 
    statusBar()->message(status_message);
 
    emit ParsChanged();
 
#ifdef QDEBUG
 
    qDebug() << "Done. Returning 0." << endl;
 
#endif
 
    return 0;
 
  } catch (const char *error_message) {
 
    QMessageBox mb( "Read leaf from XML file",
 
		    QString(error_message),
 
		    QMessageBox::Critical,
 
		    QMessageBox::Ok | QMessageBox::Default,
 
		    Qt::NoButton,
 
		    Qt::NoButton);
 
    mb.exec();
 
    return 1;
 
  }
 
}
 

	
 

	
 
void Main::readNextStateXML()
 
{
 

	
 
  // if we have already read a file, read the next file
 
  if (!currentFile.isEmpty() && working_dir) {
 
    QString next_file;
 

	
 
    QStringList xml_files = working_dir->entryList("*.xml");
 
    QString currentFile_nopath = currentFile.section( '/', -1 );
 
    QString currentFile_path = currentFile.section( '/', 0, -2 );
 

	
 

	
 
    QList<QString>::iterator f = xml_files.find( currentFile_nopath );
 

	
 
    if (f == xml_files.end()) {
 
      return;
 
    }
 

	
 
    ++f;
 
    if (f==xml_files.end()) {
 
      QMessageBox mb( "Read next leaf",
 
		      "No more files",
 
		      QMessageBox::Information,
 
		      QMessageBox::Ok | QMessageBox::Default,
 
		      QMessageBox::NoButton,
 
		      QMessageBox::NoButton);
 
      mb.exec();
 
      return;
 
    }
 
    next_file = *f;
 
    next_file = currentFile_path+"/"+next_file;
 

	
 
    readStateXML((const char*)next_file);
 
  }
 
}
 

	
 
void Main::readLastStateXML()
 
{
 

	
 
  // if we have already read a file, read the next file
 
  if (!currentFile.isEmpty() && working_dir) {
 
    QString next_file;
 

	
 
    QStringList xml_files = working_dir->entryList("*.xml");
 
    QString currentFile_nopath = currentFile.section( '/', -1 );
 
    QString currentFile_path = currentFile.section( '/', 0, -2 );
 

	
 

	
 
    next_file = xml_files.back();
 

	
 
    next_file = currentFile_path+"/"+next_file;
 

	
 
    readStateXML((const char*)next_file);
 
  }
 
}
 

	
 

	
 
void Main::readFirstStateXML()
 
{
 

	
 
  // if we have already read a file, read the next file
 
  if (!currentFile.isEmpty() && working_dir) {
 
    QString next_file;
 

	
 
    QStringList xml_files = working_dir->entryList("*.xml");
 
    QString currentFile_nopath = currentFile.section( '/', -1 );
 
    QString currentFile_path = currentFile.section( '/', 0, -2 );
 

	
 

	
 
    next_file = xml_files.front();
 

	
 
    next_file = currentFile_path+"/"+next_file;
 

	
 
    readStateXML((const char*)next_file);
 
  }
 
}
 

	
 
void Main::readStateXML()
 
{
 

	
 
  //  extern Mesh mesh;
 

	
 
  stopSimulation();
 
#ifdef QDEBUG
 
  qDebug() << "Trying to open an OptionFileDialog" << endl;
 
#endif
 
  OptionFileDialog *fd = new OptionFileDialog( this, "read dialog", TRUE );
 
  fd->setMode( OptionFileDialog::ExistingFile );
 
  fd->setFilter( "XML files (*.xml)");
 
  if (working_dir) {
 
    fd->setDir(*working_dir);
 
  }
 
  QString fileName;
 
  if ( fd->exec() == QDialog::Accepted ) {
 

	
 
    fileName = fd->selectedFile();
 
    if (working_dir) {
 
      delete working_dir;
 
    }
 
    working_dir = fd->dir();
 

	
 
    if (readStateXML((const char *)fileName,fd->readGeometryP(), fd->readParametersP()) )
 
      return readStateXML(); // user can try again
 
  }
 
}
 

	
 

	
 
void Main::clear()
 
{
 
  editor->clear();
 
}
 

	
 
void Main::about()
 
{
 
  static QMessageBox* about = new QMessageBox
 
    ( "VirtualLeaf V1.0",
 
      "<h3>VirtualLeaf V1.0</h3>"
 
      "<p>"
 
      "An Open Source framework for cell-based modeling of plant tissue growth and development <br>"
 
      "(c) 2005-2008, Roeland Merks <i>et al.</i><br>"
 
      "    <a href=\"http://www.psb.vib-ugent.be\">VIB Department Plant Systems Biology</a>, "
 
      "Ghent, Belgium <br>"
 
      "(c) 2008-2010, <a href=\"http://www.cwi.nl/~merks\">Roeland Merks <i>et al.</i></a> <br>"
 
      "    <a href=\"http://www.cwi.nl\">Centrum Wiskunde & Informatica</a> and <a href=\"http://www.ncsb.nl\">Netherlands Consortium for Systems Biology</a>, Amsterdam, Netherlands <br>"
 
"<br>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.<br>"
 
      "<br>If you use this code for your projects, please cite our paper:"
 
"<br>Merks, Guravage, Inze, and Beemster. An Open Source framework for cell-based modeling of plant tissue growth and development. <i>Plant Physiology,</i> submitted.<br> . <br>"
 
      "<br>Please share your model plugins and extensions at <a href=\"http://virtualleaf.googlecode.com\">http://virtualleaf.googlecode.com</a>.", 
 
      QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
 
  about->setButtonText( 1, "Dismiss" );
 
  about->show();
 
}
 

	
 

	
 
void Main::gpl()
 
{
 
  static QMessageBox* gpl = new QMessageBox ( "GPL License", "", 
 
      QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
 

	
 
  QDir docDir(QApplication::applicationDirPath());
 
  docDir.cd("../doc"); // Where Linux expects gpl3.txt
 
  QString path = docDir.filePath("gpl3.txt");
 
  if (!docDir.exists("gpl3.txt")){
 
    docDir = QApplication::applicationDirPath();
 
    docDir.cd("doc"); // Where Windows expects gpl3.txt
 
    path = docDir.filePath("gpl3.txt");
 
  }
 

	
 
  // At this point path points either to the linux variant, which
 
  // exists, or the windows variant, which may exist. Testing the
 
  // ifstream object will determine whether we've found gpl3.txt.
 

	
 
  std::ifstream file(path.toStdString().c_str());
 
  std::string str;
 

	
 
  if (file) {
 
    file.seekg(0, std::ios::end);   
 
    str.reserve(file.tellg());
 
    file.seekg(0, std::ios::beg);
 

	
 
    str.assign((std::istreambuf_iterator<char>(file)),
 
	       std::istreambuf_iterator<char>());
 

	
 
    gpl->setDetailedText(QString(str.c_str()));
 
  }
 

	
 
  gpl->setText(QString( "<h3>GNU GENERAL PUBLIC LICENSE</h3>"
 
			"<p>Version 3, 29 June 2007</p>"
 
			"<p>Copyright &copy; 2007 Free Software Foundation, Inc. "
 
			"&lt;<a href=\"http://fsf.org/\">http://fsf.org/</a>&gt;</p><p>"
 
			"Everyone is permitted to copy and distribute verbatim copies "
 
			"of this license document, but changing it is not allowed.</p>"
 
			"<h2>GNU GENERAL PUBLIC LICENSE</h2>"));
 

	
 
  gpl->setButtonText( 1, "Dismiss" );
 
  gpl->show();
 
}
 

	
 
void Main::aboutQt(){
 
  QMessageBox::aboutQt( this, "Virtual Leaf" );
 
}
 

	
 
void Main::toggleShowCellCenters()
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleShowWalls()
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleShowApoplasts()
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleShowNodes()
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleNodeNumbers(void)
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleCellNumbers(void)
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleCellAxes(void)
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleCellStrain(void)
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleShowFluxes(void)
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleShowBorderCells()
 
{
 
  Plot();
 
}
 

	
 
void Main::toggleHideCells(void)
 
{
 
  Plot();
 
  editor->FullRedraw();
 
}
 

	
 
void Main::toggleMovieFrames(){}
 

	
 
void Main::toggleLeafBoundary(){}
 

	
 
void Main::toggleDynCells() {}
 

	
 
void Main::startSimulation(void)
 
{
 
  timer->start( 0 );
 
  statusBar()->message("Simulation started");
 
  running = true;
 
}
 

	
 
void Main::stopSimulation(void)
 
{
 
  timer->stop();
 
  cerr << "Stopping simulation" << endl;
 
  statusBar()->message("Simulation paused");
 
  running = false;
 
}
 

	
 
void Main::togglePaused()
 
{
 
  bool s = run->isItemChecked(paused_id);
 
  if (s) {
 
    cerr << "Calling start simulation" << endl;
 
    startSimulation();
 
  } else {
 
    cerr << "Calling stop simulation" << endl;
 
    stopSimulation();
 
  }
 
}
 

	
 
void Main::setFluxArrowSize(int size)
 
{
 
  flux_arrow_size = size/100.;
 
}
 

	
 

	
 
void Main::enlarge()
 
{
 
  canvas.setSceneRect( QRectF( 0,0, canvas.width()*4./3., canvas.height()*4./3.) );
 
}
 

	
 
void Main::shrink()
 
{
 
  canvas.setSceneRect( QRectF( 0,0, canvas.width()*3/4, canvas.height()*3/4) );
 
}
 

	
 

	
 
void Main::scale(double factor)
 
{
 
  QMatrix m = editor->matrix();
 
  m.scale(factor, factor);
 
  editor->setMatrix( m );
 
}
 

	
 
void Main::zoomIn()
 
{
 
  QMatrix m = editor->matrix();
 
  m.scale( 1.1, 1.1 );
 
  editor->setMatrix( m );
 
}
 

	
 
void Main::zoomOut()
 
{
 
  QMatrix m = editor->matrix();
 
  m.scale( 0.9, 0.9 );
 
  editor->setMatrix( m );
 
}
 

	
 

	
 
void Main::print()
 
{
 
  if ( !printer ) printer = new QPrinter;
 

	
 
  if ( printer->setup(this) ) {
 

	
 
    //    extern Mesh mesh;
 
    Vector bbll,bbur;
 
    mesh.BoundingBox(bbll,bbur);
 

	
 
#ifdef QDEBUG
 
    qDebug() << "bbll = " << bbll << endl;
 
    qDebug() << "bbur = " << bbur << endl;
 
#endif
 
    double cw = (bbur.x - bbll.x);
 
    double ch = (bbur.y - bbll.y);
 
    QPainter pp(printer);
 
    QRect vp=pp.viewport();
 
#ifdef QDEBUG
 
    qDebug() << "Paper width = " << vp.width() << " x " << vp.height() << endl;
 
#endif
 

	
 
    // Note that Cell is also translated...
 
    pp.translate(-bbur.x,-bbur.y);
 
    if (cw>ch) {
 
      pp.scale(vp.width()/(2*cw*Cell::Magnification()), vp.width()/(2*cw*Cell::Magnification()));
 
    } else {
 
      pp.scale(vp.height()/(2*ch*Cell::Magnification()), vp.height()/(2*ch*Cell::Magnification()));
 
    }
 
    canvas.render(&pp, QRectF(), QRectF(0.,0.,canvas.width(),canvas.height()));
 
  }
 
}
 

	
 

	
 
void Main::TimeStepWrap(void)
 
{
 
  static int t=0;
 
  TimeStep();
 
  t++;
 

	
 
  if ((par.export_interval > 0) && ((t % par.export_interval) == 0)){
 
    this->exportCellData(QString(par.datadir) + QString('/') + QString(par.export_fn_prefix) + this->TimeStamp());
 
  }
 

	
 
  // check number of timesteps
 
  if (t==par.nit) {
 
    emit SimulationDone();
 
  }
 
}
 

	
 

	
 
QString Main::TimeStamp(){
 
  time_t rawtime;
 
  struct tm * timeinfo;
 
  char buffer [15];
 

	
 
  time ( &rawtime );
 
  timeinfo = localtime ( &rawtime );
 
  strftime (buffer,15,"%Y%m%d%H%M%S",timeinfo);
 
  return QString(buffer);
 
}
 

	
 

	
 
void Main::RestartSim(void)
 
{
 

	
 
  stopSimulation();
 
  if ( QMessageBox::question(
 
			     this,
 
			     tr("Restart simulation?"),
 
			     tr("Restart simulation.\n"
 
				"Are you sure?"),
 
			     QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton ) == QMessageBox::Yes ) {
 

	
 
    cerr << "Restarting simulation" << endl;
 
    //    extern Mesh mesh;
 
    mesh.Clear();
 
    Init();
 
    Plot();
 
    editor->FullRedraw();
 
  } 
 
  //startSimulation();
 
}
 

	
 

	
 
void Main::FitCanvasToWindow(void)
 
{
 

	
 
  double scale_factor_x = (double)editor->width()/(double)canvas.width();
 
  double scale_factor_y = (double)editor->height()/(double)canvas.height();
 
  double scale_factor = scale_factor_x > scale_factor_y ? scale_factor_x : scale_factor_y;
 
  QMatrix m = editor->matrix();
 

	
 
#ifdef QDEBUG  
 
  qDebug() << "editor->width() = " << editor->width() << endl;
 
  qDebug() << "editor->height() = " << editor->height() << endl;
 

	
 
  qDebug() << "scale_factor = " << scale_factor << endl;
 
  qDebug() << "scale_factor_x = " << scale_factor_x << endl;
 
  qDebug() << "scale_factor_y = " << scale_factor_y << endl;
 
#endif
 
  m.scale( scale_factor, scale_factor );
 
  editor->setMatrix( m );
 
  editor->show();
 
}
 

	
 
void Main::PauseIfRunning(void)
 
{
 
  if (running) {
 
    timer->stop();
 
  }
 
}
 

	
 
void Main::ContIfRunning(void)
 
{
 
  if (running) {
 
    timer->start( 0 );
 
  }
 
}
 

	
 
void Main::FitLeafToCanvas(void) 
 
{
 

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

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

	
 
  // give the leaf some space
 
  Vector border = ((ur-ll)/5.);
 

	
 
  QRectF bb( ll.x - border.x, ll.y - border.y, ur.x-ll.x + 2*border.x, ur.y-ll.y + 2*border.y );
 

	
 

	
 
  // cerr << ur << ", " << ll << endl;
 
  // editor->fitInView(bb, Qt::KeepAspectRatio);
 
  editor->ensureVisible(bb);
 
  //editor->setTransform(viewport);
 
}
 

	
 
void Main::CleanMesh(void) 
 
{
 
  vector<double> clean_chem(Cell::NChem());
 
  vector<double> clean_transporters(Cell::NChem());
 

	
 
  for (int i=0;i<Cell::NChem();i++) {
 
    clean_chem[i]=par.initval[i];
 
    clean_transporters[i]=0.;		
 
  }
 

	
 
  mesh.CleanChemicals(clean_chem);
 
  mesh.CleanTransporters(clean_transporters);
 

	
 
  mesh.setTime(0);
 
  Plot();
 

	
 
  editor->FullRedraw();
 
}
 

	
 
void Main::CleanMeshChemicals(void) 
 
{
 

	
 
  vector<double> clean_chem(Cell::NChem());
 

	
 
  for (int i=0;i<Cell::NChem();i++) {
 
    clean_chem[i]=par.initval[i];
 
  }
 

	
 
  mesh.CleanChemicals(clean_chem);
 
  mesh.setTime(0);
 
  Plot();
 

	
 
  editor->FullRedraw();
 
}
 

	
 
void Main::CleanMeshTransporters(void) 
 
{
 
  vector<double> clean_transporters(Cell::NChem());
 
  for (int i=0;i<Cell::NChem();i++) {
 
    clean_transporters[i]=0.;
 
  }
 

	
 
  mesh.CleanTransporters(clean_transporters);
 

	
 
  mesh.setTime(0);
 
  Plot();
 

	
 
  editor->FullRedraw();
 
}
 

	
 
void Main::RandomizeMesh(void) 
 
{
 

	
 
  vector<double> max_chem(Cell::NChem());
 
  vector<double> max_transporters(Cell::NChem());
 

	
 
  for (int i=0;i<Cell::NChem();i++) {
 
    max_transporters[i]=0.;
 
    max_chem[i]=par.initval[i];
 
  }
 

	
 
  // Amount of PIN1 at walls
 
  max_transporters[1] = 0.01;
 

	
 
  mesh.RandomizeChemicals(max_chem, max_transporters);
 

	
 
  Plot();
 
}
 

	
 
void Main::XMLReadSettings(xmlNode *settings) 
 
{
 

	
 
  MainBase::XMLReadSettings(settings);
 
  
 
  view->setItemChecked(com_id, showcentersp);
 
  view->setItemChecked(mesh_id, showmeshp);
 
  view->setItemChecked(border_id, showbordercellp);
 
  view->setItemChecked(node_number_id, shownodenumbersp);
 
  view->setItemChecked(cell_number_id, showcellnumbersp);
 
  view->setItemChecked(cell_axes_id, showcellsaxesp);
 
  view->setItemChecked(cell_strain_id, showcellstrainp);
 
  view->setItemChecked(movie_frames_id, movieframesp);
 
  view->setItemChecked(only_boundary_id, showboundaryonlyp);
 
  view->setItemChecked(fluxes_id, showfluxesp);
 
  view->setItemChecked(hide_cells_id, hidecellsp);
 
  options->setItemChecked(dyn_cells_id, dynamicscellsp);
 
  view->setItemChecked( cell_walls_id, showwallsp);
 
 // view->setItemChecked( apoplasts_id, showapoplastsp);
 
  
 
  editor->setTransform(viewport);
 
}
 

	
 
xmlNode *Main::XMLSettingsTree(void) 
 
{
 

	
 
  showcentersp = view->isItemChecked(com_id);
 
  showmeshp = view->isItemChecked(mesh_id);
 
  showbordercellp =  view->isItemChecked(border_id);
 
  shownodenumbersp =  view->isItemChecked(node_number_id);
 
  showcellnumbersp =  view->isItemChecked(cell_number_id);
 
  showcellsaxesp = view->isItemChecked( cell_axes_id );
 
  showcellstrainp = view->isItemChecked( cell_strain_id );
 
  movieframesp = view->isItemChecked(movie_frames_id);;
 
  showboundaryonlyp =  view->isItemChecked(only_boundary_id);
 
  showfluxesp = view->isItemChecked(fluxes_id);
 
  dynamicscellsp = options->isItemChecked(dyn_cells_id);
 
  showwallsp = view->isItemChecked( cell_walls_id);
 
  //showapoplastsp = view->isItemChecked( apoplasts_id);
 
  hidecellsp = view->isItemChecked( hide_cells_id);
 

	
 
  xmlNode *settings = MainBase::XMLSettingsTree();
 
  QTransform viewport(editor->transform());
 
  xmlAddChild(settings, XMLViewportTree(viewport));
 
  return settings;
 
}
 

	
 
void Main::exportCellData(void) {
 
  Q3FileDialog *fd = new Q3FileDialog( this, "file dialog", TRUE );
 
  QString fileName;
 
void Main::exportCellData(QString fileName) {
 
  
 
  stopSimulation();
 
  fd->setMode( Q3FileDialog::AnyFile );
 

	
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 

	
 
#ifdef QDEBUG  
 
    qDebug() << "exportCellData filename: " << fileName << endl;
 
  qDebug() << "exportCellData fileName: " << fileName << endl;
 
#endif
 

	
 
  // perhaps make this more general: a popup window were user selects data he wants to export
 
  // can go to "settings" section of XML file as well so this can also be measured off-line
 
  // mesh.CSVExport would take an QMap or so to record all options
 
  // first line gives legenda
 

	
 
    QFile file(fileName);
 
    if ( file.open( IO_WriteOnly ) ) {
 
      QTextStream stream( &file );
 
      mesh.CSVExportCellData(stream);
 
      mesh.CSVExportMeshData(stream);
 
      file.close();
 
    }
 
  QFile file(fileName);
 
  if ( file.open( IO_WriteOnly ) ) {
 
    QTextStream stream( &file );
 
    mesh.CSVExportCellData(stream);
 
    mesh.CSVExportMeshData(stream);
 
    file.close();
 
  }
 
}
 

	
 

	
 
void Main::exportCellData() {
 
  QString fileName;
 
  Q3FileDialog *fd = new Q3FileDialog( this, "file dialog", TRUE );
 

	
 
  stopSimulation();
 
  fd->setMode( Q3FileDialog::AnyFile );
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 
  }
 
  this->exportCellData(fileName);
 
}
 

	
 

	
 
/* finis */
src/canvas.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 _CANVAS_H_
 
#define _CANVAS_H_
 

	
 
#include <q3popupmenu.h>
 
#include <q3mainwindow.h>
 
#include <q3intdict.h>
 
#include <QGraphicsScene>
 
#include <QGraphicsView>
 
#include <QList>
 

	
 
#include <string>
 
#include <sstream>
 

	
 
//Added by qt3to4:
 
#include <QMouseEvent>
 
#include <vector>
 
#include "simitembase.h"
 
#include "mainbase.h"
 
#include "cellitem.h"
 
#include "infobar.h"
 

	
 
#include "nodeitem.h"
 
#include "cell.h"
 

	
 
#ifdef HAVE_QWT
 
#include "data_plot.h"
 
#endif
 

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

	
 
#if defined(Q_OS_MAC)
 
#define PREFIX "cmd"
 
#else
 
#define PREFIX "crtl"
 
#endif
 

	
 

	
 
class QFile;
 
class QDir;
 
class ModelCatalogue;
 
class InfoBar;
 

	
 
class FigureEditor : public QGraphicsView {
 
  Q_OBJECT
 

	
 
    friend class Main;
 
 public:
 
  FigureEditor(QGraphicsScene&, Mesh&, QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
 
  void clear();
 
  void Save(const char *fname, const char *format, int sizex=640, int sizey=480);
 
  void FullRedraw(void);
 

	
 
 protected:
 
  void mousePressEvent(QMouseEvent*);
 
  void mouseMoveEvent(QMouseEvent*);
 
  void mouseReleaseEvent(QMouseEvent*);
 
  void wheelEvent(QWheelEvent *event);
 
  void scaleView(qreal scaleFactor);
 

	
 
  vector <CellItem *> getIntersectedCells(void);
 
  void insertNode(QPointF p);
 
  NodeItem *selectedNodeItem(QList<QGraphicsItem *> l) const;  
 

	
 
 signals:
 
  void status(const QString&);
 
  void MousePressed(void);
 
  void MouseReleased(void);
 
 protected:
 
  Mesh &mesh;
 

	
 
 private:
 
  //NodeItem* moving;
 
  SimItemBase *moving;
 
  QPointF moving_start;
 

	
 
  QGraphicsLineItem *intersection_line;
 
  bool rotation_mode;
 
  bool insert_mode;
 
  double rot_angle;
 
};
 

	
 
class Main : public Q3MainWindow, public MainBase {
 
  Q_OBJECT
 
    friend class ModelCatalogue; // needs to populate menu item models
 
 public:
 
  Main(QGraphicsScene&, Mesh&, QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
 
  ~Main();
 
  virtual bool ShowCentersP(void) {return view->isItemChecked(com_id);}
 
  virtual bool ShowMeshP(void) {return view->isItemChecked(mesh_id);}
 
  virtual bool ShowBorderCellsP(void) {return view->isItemChecked(border_id);}
 
  virtual bool PausedP(void) {return run->isItemChecked(paused_id);}
 
  virtual bool ShowNodeNumbersP(void) {return view->isItemChecked(node_number_id);}
 
  virtual bool ShowCellNumbersP(void) {return view->isItemChecked(cell_number_id);}
 
  virtual bool ShowCellAxesP(void) {return view->isItemChecked(cell_axes_id);}
 
  virtual bool ShowCellStrainP(void) {return view->isItemChecked(cell_strain_id);}
 
  virtual bool MovieFramesP(void) {return view->isItemChecked(movie_frames_id);}
 
  virtual bool ShowBoundaryOnlyP(void) {return view->isItemChecked(only_boundary_id);}
 
  virtual bool ShowWallsP(void) {return view->isItemChecked(cell_walls_id);}
 
 // virtual bool ShowApoplastsP(void) { return view->isItemChecked(apoplasts_id);}
 
  virtual bool ShowFluxesP(void) { return view->isItemChecked(fluxes_id); }
 
  virtual bool DynamicCellsP(void) { return options->isItemChecked(dyn_cells_id); }
 
  virtual bool RotationModeP(void) { return options->isItemChecked(rotation_mode_id); }
 
  virtual bool InsertModeP(void) { return options->isItemChecked(insert_mode_id); }
 
  virtual bool ShowToolTipsP(void) { return helpmenu->isItemChecked(tooltips_id); }
 
  virtual bool HideCellsP(void) { return view->isItemChecked(hide_cells_id); }
 
  void scale(double factor); 
 
  virtual double getFluxArrowsize(void)
 
  {
 
    return flux_arrow_size;
 
  }
 

	
 
  void FitCanvasToWindow();
 
  void FitLeafToCanvas(void);
 

	
 

	
 
  public slots:
 

	
 
  void about();
 
  void gpl();
 
  void TimeStepWrap();
 
  void togglePaused();
 
  void setFluxArrowSize(int size);
 
  void RestartSim(void);
 
  void toggleShowCellCenters(void);
 
  void toggleShowNodes(void);
 
  void toggleShowBorderCells(void);
 
  void toggleShowFluxes(void);
 
  void toggleNodeNumbers(void);
 
  void toggleCellNumbers(void);
 
  void toggleCellAxes(void);
 
  void toggleCellStrain(void);
 
  void toggleShowWalls(void);
 
  void toggleShowApoplasts(void);
 
  void toggleDynCells(void);
 
  void toggleMovieFrames(void);
 
  void toggleLeafBoundary(void);
 
  void toggleHideCells(void);
 
  void print();
 
  void startSimulation(void);
 
  void stopSimulation(void);
 
  void RefreshInfoBar(void);
 

	
 
  void EnterRotationMode(void)
 
  {
 

	
 
    UserMessage("Rotation mode. Click mouse to exit.");
 
    if (editor) {
 
      editor->rot_angle = 0. ; 
 

	
 
      // Exit rotation mode if mouse is clicked
 
      connect(editor, SIGNAL(MousePressed()), this, SLOT(ExitRotationMode()));
 
      
 
      editor->setMouseTracking(true);
 

	
 
    }
 

	
 
  }
 
  void ExitRotationMode(void)
 
  { 
 
    UserMessage("Exited rotation mode.",2000);
 

	
 
    options->setItemChecked(rotation_mode_id, false); 
 
    if (editor)
 
      disconnect(editor, SIGNAL(MousePressed()), this, SLOT(ExitRotationMode()));
 
    editor->setMouseTracking(false);
 
 
 
  }
 

	
 
  virtual void UserMessage(QString message, int timeout=0);
 
  void Refresh(void) { Plot(); }
 
  void PauseIfRunning(void);
 
  void ContIfRunning(void);
 
  virtual void XMLReadSettings(xmlNode *settings);
 

	
 
  private slots:
 
  void aboutQt();
 
  void newView();
 
  void EditParameters();
 
  void readStateXML();
 
  int readStateXML(const char *filename, bool geometry = true, bool pars=true, bool simtime = true);
 
  void readNextStateXML();
 
  void readPrevStateXML();
 
  void readFirstStateXML();
 
  void readLastStateXML();
 
  void exportCellData();
 
  void exportCellData(QString);
 
  void saveStateXML();
 
  void snapshot();
 
  void savePars();
 
  void readPars();
 
  void clear();
 
  void init();
 
  virtual void CutSAM() { MainBase::CutSAM(); Refresh();}
 

	
 
  void enlarge();
 
  void shrink();
 
  void zoomIn();
 
  void zoomOut();
 

	
 
  void CleanMesh();
 
  void CleanMeshChemicals(void);
 
  void CleanMeshTransporters(void);
 

	
 
  void RandomizeMesh();
 

	
 
  QString TimeStamp();
 

	
 
 signals:
 
  void SimulationDone(void);
 
  void ParsChanged(void);
 

	
 
 protected:
 
  Mesh &mesh;
 

	
 
 private:
 
  NodeSet *node_set;
 
  FigureEditor *editor;
 
  Q3PopupMenu* options;
 
  Q3PopupMenu *view;
 
  Q3PopupMenu *run;
 
  QMenu *modelmenu;
 
  Q3PopupMenu *helpmenu;
 

	
 
  QPrinter* printer;
 
  const QDir *working_dir;
 
  QString currentFile;
 
  //  toggle item states 
 
  int dbf_id; // options->Double Buffer
 
  int com_id; // view->Show centers
 
  int mesh_id; // view->Show mesh
 
  int node_number_id; // view->Show Node numbers
 
  int cell_number_id; // view->Show Cell numbers
 
  int border_id; // view->Show border cells
 
  int paused_id; // run->Simulation paused
 
  int cell_axes_id; // view->Show cell axes
 
  int cell_strain_id; // view->Show cell strain
 
  int only_boundary_id; // view ->Show only leaf boundary
 
  int cell_walls_id; // view -> Show transporters
 
  //int apoplasts_id; // view -> Show apoplasts
 
  int tooltips_id; // help -> Show Cell Info
 
  int hide_cells_id; // view->Hide Cells
 
  double flux_arrow_size;
 
  int movie_frames_id;
 
  int fluxes_id;
 
  int dyn_cells_id;
 
  int rotation_mode_id;
 
  int insert_mode_id;
 
  QTimer *timer;
 
  QFile *gifanim;
 
  bool running;
 
  virtual xmlNode *XMLSettingsTree(void);
 
  static const QString caption;
 
  static const QString caption_with_file;
 
  InfoBar *infobar;
 
};
 

	
 
#endif
 

	
 
/* finis*/
src/parameter.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.
 
 *
 
 */
 

	
 
// Do not edit. All edits will be discarded.
 

	
 

	
 
#include "parameter.h"
 
#include <cstdio>
 
#include <cstring>
 
#include <cstdlib>
 
#include <cerrno>
 
#include <iostream>
 
#include <sstream>
 
#include "output.h"
 
#include "parse.h"
 
#include "xmlwrite.h"
 
#include "warning.h"
 
#include <QLocale>
 
#include <QDir>
 
#include <QStringList>
 

	
 
using namespace std;
 

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

	
 
Parameter::Parameter() {
 
  arrowcolor = strdup("white");
 
  arrowsize = 100;
 
  textcolor = strdup("red");
 
  cellnumsize = 1;
 
  nodenumsize = 1;
 
  node_mag = 1.0;
 
  outlinewidth = 1.0;
 
  cell_outline_color = strdup("forestgreen");
 
  resize_stride = 0;
 
  T = 1.0;
 
  lambda_length = 100.;
 
  lambda_celllength = 0.;
 
  target_length = 60.;
 
  cell_expansion_rate = 1.;
 
  cell_div_expansion_rate = 0.;
 
  auxin_dependent_growth = true;
 
  ode_accuracy = 1e-4;
 
  mc_stepsize = 0.4;
 
  mc_cell_stepsize = 0.2;
 
  energy_threshold = 1000.;
 
  bend_lambda = 0.;
 
  alignment_lambda = 0.;
 
  rel_cell_div_threshold = 2.;
 
  rel_perimeter_stiffness = 2;
 
  collapse_node_threshold = 0.05;
 
  morphogen_div_threshold = 0.2;
 
  morphogen_expansion_threshold = 0.01;
 
  copy_wall = true;
 
  source = 0.;
 
  D = new double[15];
 
  D[0] = 0.;
 
  D[1] = 0.0;
 
  D[2] = 0.0;
 
  D[3] = 0.;
 
  D[4] = 0.;
 
  D[5] = 0.;
 
  D[6] = 0.;
 
  D[7] = 0.;
 
  D[8] = 0.;
 
  D[9] = 0.;
 
  D[10] = 0.;
 
  D[11] = 0.;
 
  D[12] = 0.;
 
  D[13] = 0.;
 
  D[14] = 0.;
 
  initval = new double[15];
 
  initval[0] = 0.;
 
  initval[1] = 0.;
 
  initval[2] = 0.;
 
  initval[3] = 0.;
 
  initval[4] = 0.;
 
  initval[5] = 0.;
 
  initval[6] = 0.;
 
  initval[7] = 0.;
 
  initval[8] = 0.;
 
  initval[9] = 0.;
 
  initval[10] = 0.;
 
  initval[11] = 0.;
 
  initval[12] = 0.;
 
  initval[13] = 0.;
 
  initval[14] = 0.;
 
  k1 = 1.;
 
  k2 = 0.3;
 
  r = 1.;
 
  kr = 1.;
 
  km = 1.;
 
  Pi_tot = 1.;
 
  transport = 0.036;
 
  ka = 1;
 
  pin_prod = 0.001;
 
  pin_prod_in_epidermis = 0.1;
 
  pin_breakdown = 0.001;
 
  pin_breakdown_internal = 0.001;
 
  aux1prod = 0.001;
 
  aux1prodmeso = 0.;
 
  aux1decay = 0.001;
 
  aux1decaymeso = 0.1;
 
  aux1transport = 0.036;
 
  aux_cons = 0.;
 
  aux_breakdown = 0.;
 
  kaux1 = 1;
 
  kap = 1;
 
  leaf_tip_source = 0.001;
 
  sam_efflux = 0.0001;
 
  sam_auxin = 10.;
 
  sam_auxin_breakdown = 0;
 
  van3prod = 0.002;
 
  van3autokat = 0.1;
 
  van3sat = 10;
 
  k2van3 = 0.3;
 
  dt = 0.1;
 
  rd_dt = 1.0;
 
  datadir = strdup(".");
 
  datadir = AppendHomeDirIfPathRelative(datadir);
 
  movie = false;
 
  nit = 100000;
 
  maxt = 1000.;
 
  storage_stride = 10;
 
  xml_storage_stride = 500;
 
  rseed = -1;
 
  constituous_expansion_limit = 16;
 
  vessel_inh_level = 1;
 
  vessel_expansion_rate = 0.25;
 
  d = 0.;
 
  e = 0.;
 
  f = 0.;
 
  c = 0.;
 
  mu = 0.;
 
  nu = 0.;
 
  rho0 = 0.;
 
  rho1 = 0.;
 
  c0 = 0.;
 
  gamma = 0.;
 
  eps = 0.;
 
  k = new double[15];
 
  k[0] = 0.;
 
  k[1] = 0.0;
 
  k[2] = 0.0;
 
  k[3] = 0.;
 
  k[4] = 0.;
 
  k[5] = 0.;
 
  k[6] = 0.;
 
  k[7] = 0.;
 
  k[8] = 0.;
 
  k[9] = 0.;
 
  k[10] = 0.;
 
  k[11] = 0.;
 
  k[12] = 0.;
 
  k[13] = 0.;
 
  k[14] = 0.;
 
  i1 = 0;
 
  i2 = 0;
 
  i3 = 0;
 
  i4 = 0;
 
  i5 = 0;
 
  s1 = strdup("");
 
  s2 = strdup("");
 
  s3 = strdup("");
 
  b1 = false;
 
  b2 = false;
 
  b3 = false;
 
  b4 = false;
 
  dir1 = strdup(".");
 
  dir2 = strdup(".");
 
  export_interval = 100;
 
  export_fn_prefix = strdup("CELLDATA");
 
}
 

	
 
Parameter::~Parameter() {
 
    
 
  // destruct parameter object
 
  // free string parameter
 
  CleanUp();
 
// destruct parameter object
 
// free string parameter
 
CleanUp();
 
}
 

	
 
void Parameter::CleanUp(void) {
 
  if (arrowcolor) 
 
    free(arrowcolor);
 
     free(arrowcolor);
 
  if (textcolor) 
 
    free(textcolor);
 
     free(textcolor);
 
  if (cell_outline_color) 
 
    free(cell_outline_color);
 
     free(cell_outline_color);
 
  if (D) 
 
    free(D);
 
     free(D);
 
  if (initval) 
 
    free(initval);
 
     free(initval);
 
  if (datadir) 
 
    free(datadir);
 
     free(datadir);
 
  if (k) 
 
    free(k);
 
     free(k);
 
  if (s1) 
 
    free(s1);
 
     free(s1);
 
  if (s2) 
 
    free(s2);
 
     free(s2);
 
  if (s3) 
 
    free(s3);
 
     free(s3);
 
  if (dir1) 
 
    free(dir1);
 
     free(dir1);
 
  if (dir2) 
 
    free(dir2);
 
     free(dir2);
 
  if (export_fn_prefix) 
 
     free(export_fn_prefix);
 

	
 
}
 

	
 
void Parameter::Read(const char *filename) {
 
    
 
  static bool ReadP=false;
 

	
 
  if (ReadP) {
 

	
 
    //throw "Run Time Error in parameter.cpp: Please Read parameter file only once!!";
 
    CleanUp();
 
	
 
  } else
 
    ReadP=true;
 

	
 
  FILE *fp=OpenReadFile(filename);
 

	
 

	
 
  arrowcolor = sgetpar(fp, "arrowcolor", "white", true);
 
  arrowsize = fgetpar(fp, "arrowsize", 100, true);
 
  textcolor = sgetpar(fp, "textcolor", "red", true);
 
  cellnumsize = igetpar(fp, "cellnumsize", 1, true);
 
  nodenumsize = igetpar(fp, "nodenumsize", 1, true);
 
  node_mag = fgetpar(fp, "node_mag", 1.0, true);
 
  outlinewidth = fgetpar(fp, "outlinewidth", 1.0, true);
 
  cell_outline_color = sgetpar(fp, "cell_outline_color", "forestgreen", true);
 
  resize_stride = igetpar(fp, "resize_stride", 0, true);
 
  T = fgetpar(fp, "T", 1.0, true);
 
  lambda_length = fgetpar(fp, "lambda_length", 100., true);
 
  lambda_celllength = fgetpar(fp, "lambda_celllength", 0., true);
 
  target_length = fgetpar(fp, "target_length", 60., true);
 
  cell_expansion_rate = fgetpar(fp, "cell_expansion_rate", 1., true);
 
  cell_div_expansion_rate = fgetpar(fp, "cell_div_expansion_rate", 0., true);
 
  auxin_dependent_growth = bgetpar(fp, "auxin_dependent_growth", true, true);
 
  ode_accuracy = fgetpar(fp, "ode_accuracy", 1e-4, true);
 
  mc_stepsize = fgetpar(fp, "mc_stepsize", 0.4, true);
 
  mc_cell_stepsize = fgetpar(fp, "mc_cell_stepsize", 0.2, true);
 
  energy_threshold = fgetpar(fp, "energy_threshold", 1000., true);
 
  bend_lambda = fgetpar(fp, "bend_lambda", 0., true);
 
  alignment_lambda = fgetpar(fp, "alignment_lambda", 0., true);
 
  rel_cell_div_threshold = fgetpar(fp, "rel_cell_div_threshold", 2., true);
 
  rel_perimeter_stiffness = fgetpar(fp, "rel_perimeter_stiffness", 2, true);
 
  collapse_node_threshold = fgetpar(fp, "collapse_node_threshold", 0.05, true);
 
  morphogen_div_threshold = fgetpar(fp, "morphogen_div_threshold", 0.2, true);
 
  morphogen_expansion_threshold = fgetpar(fp, "morphogen_expansion_threshold", 0.01, true);
 
  copy_wall = bgetpar(fp, "copy_wall", true, true);
 
  source = fgetpar(fp, "source", 0., true);
 
  D = dgetparlist(fp, "D", 15, true);
 
  initval = dgetparlist(fp, "initval", 15, true);
 
  k1 = fgetpar(fp, "k1", 1., true);
 
  k2 = fgetpar(fp, "k2", 0.3, true);
 
  r = fgetpar(fp, "r", 1., true);
 
  kr = fgetpar(fp, "kr", 1., true);
 
  km = fgetpar(fp, "km", 1., true);
 
  Pi_tot = fgetpar(fp, "Pi_tot", 1., true);
 
  transport = fgetpar(fp, "transport", 0.036, true);
 
  ka = fgetpar(fp, "ka", 1, true);
 
  pin_prod = fgetpar(fp, "pin_prod", 0.001, true);
 
  pin_prod_in_epidermis = fgetpar(fp, "pin_prod_in_epidermis", 0.1, true);
 
  pin_breakdown = fgetpar(fp, "pin_breakdown", 0.001, true);
 
  pin_breakdown_internal = fgetpar(fp, "pin_breakdown_internal", 0.001, true);
 
  aux1prod = fgetpar(fp, "aux1prod", 0.001, true);
 
  aux1prodmeso = fgetpar(fp, "aux1prodmeso", 0., true);
 
  aux1decay = fgetpar(fp, "aux1decay", 0.001, true);
 
  aux1decaymeso = fgetpar(fp, "aux1decaymeso", 0.1, true);
 
  aux1transport = fgetpar(fp, "aux1transport", 0.036, true);
 
  aux_cons = fgetpar(fp, "aux_cons", 0., true);
 
  aux_breakdown = fgetpar(fp, "aux_breakdown", 0., true);
 
  kaux1 = fgetpar(fp, "kaux1", 1, true);
 
  kap = fgetpar(fp, "kap", 1, true);
 
  leaf_tip_source = fgetpar(fp, "leaf_tip_source", 0.001, true);
 
  sam_efflux = fgetpar(fp, "sam_efflux", 0.0001, true);
 
  sam_auxin = fgetpar(fp, "sam_auxin", 10., true);
 
  sam_auxin_breakdown = fgetpar(fp, "sam_auxin_breakdown", 0, true);
 
  van3prod = fgetpar(fp, "van3prod", 0.002, true);
 
  van3autokat = fgetpar(fp, "van3autokat", 0.1, true);
 
  van3sat = fgetpar(fp, "van3sat", 10, true);
 
  k2van3 = fgetpar(fp, "k2van3", 0.3, true);
 
  dt = fgetpar(fp, "dt", 0.1, true);
 
  rd_dt = fgetpar(fp, "rd_dt", 1.0, true);
 
  datadir = sgetpar(fp, "datadir", ".", true);
 
  datadir = AppendHomeDirIfPathRelative(datadir);
 
  if (strcmp(datadir, "."))
 
    MakeDir(datadir);
 
  movie = bgetpar(fp, "movie", false, true);
 
  nit = igetpar(fp, "nit", 100000, true);
 
  maxt = fgetpar(fp, "maxt", 1000., true);
 
  storage_stride = igetpar(fp, "storage_stride", 10, true);
 
  xml_storage_stride = igetpar(fp, "xml_storage_stride", 500, true);
 
  rseed = igetpar(fp, "rseed", -1, true);
 
  constituous_expansion_limit = igetpar(fp, "constituous_expansion_limit", 16, true);
 
  vessel_inh_level = fgetpar(fp, "vessel_inh_level", 1, true);
 
  vessel_expansion_rate = fgetpar(fp, "vessel_expansion_rate", 0.25, true);
 
  d = fgetpar(fp, "d", 0., true);
 
  e = fgetpar(fp, "e", 0., true);
 
  f = fgetpar(fp, "f", 0., true);
 
  c = fgetpar(fp, "c", 0., true);
 
  mu = fgetpar(fp, "mu", 0., true);
 
  nu = fgetpar(fp, "nu", 0., true);
 
  rho0 = fgetpar(fp, "rho0", 0., true);
 
  rho1 = fgetpar(fp, "rho1", 0., true);
 
  c0 = fgetpar(fp, "c0", 0., true);
 
  gamma = fgetpar(fp, "gamma", 0., true);
 
  eps = fgetpar(fp, "eps", 0., true);
 
  k = dgetparlist(fp, "k", 15, true);
 
  i1 = igetpar(fp, "i1", 0, true);
 
  i2 = igetpar(fp, "i2", 0, true);
 
  i3 = igetpar(fp, "i3", 0, true);
 
  i4 = igetpar(fp, "i4", 0, true);
 
  i5 = igetpar(fp, "i5", 0, true);
 
  s1 = sgetpar(fp, "s1", "", true);
 
  s2 = sgetpar(fp, "s2", "", true);
 
  s3 = sgetpar(fp, "s3", "", true);
 
  b1 = bgetpar(fp, "b1", false, true);
 
  b2 = bgetpar(fp, "b2", false, true);
 
  b3 = bgetpar(fp, "b3", false, true);
 
  b4 = bgetpar(fp, "b4", false, true);
 
  dir1 = sgetpar(fp, "dir1", ".", true);
 
  if (strcmp(dir1, "."))
 
    MakeDir(dir1);
 
  dir2 = sgetpar(fp, "dir2", ".", true);
 
  if (strcmp(dir2, "."))
 
    MakeDir(dir2);
 
  export_interval = igetpar(fp, "export_interval", 100, true);
 
  export_fn_prefix = sgetpar(fp, "export_fn_prefix", "CELLDATA", true);
 
}
 

	
 
const char *sbool(const bool &p) {
 

	
 
  const char *true_str="true";
 
  const char *false_str="false";
 
  if (p)
 
    return true_str;
 
  else
 
    return false_str;
 
}
 

	
 
void Parameter::Write(ostream &os) const {
 

	
 

	
 
  if (arrowcolor) 
 
    os << " arrowcolor = " << arrowcolor << endl;
 
  os << " arrowcolor = " << arrowcolor << endl;
 
  os << " arrowsize = " << arrowsize << endl;
 

	
 
  if (textcolor) 
 
    os << " textcolor = " << textcolor << endl;
 
  os << " textcolor = " << textcolor << endl;
 
  os << " cellnumsize = " << cellnumsize << endl;
 
  os << " nodenumsize = " << nodenumsize << endl;
 
  os << " node_mag = " << node_mag << endl;
 
  os << " outlinewidth = " << outlinewidth << endl;
 

	
 
  if (cell_outline_color) 
 
    os << " cell_outline_color = " << cell_outline_color << endl;
 
  os << " cell_outline_color = " << cell_outline_color << endl;
 
  os << " resize_stride = " << resize_stride << endl;
 
  os << " T = " << T << endl;
 
  os << " lambda_length = " << lambda_length << endl;
 
  os << " lambda_celllength = " << lambda_celllength << endl;
 
  os << " target_length = " << target_length << endl;
 
  os << " cell_expansion_rate = " << cell_expansion_rate << endl;
 
  os << " cell_div_expansion_rate = " << cell_div_expansion_rate << endl;
 
  os << " auxin_dependent_growth = " << sbool(auxin_dependent_growth) << endl;
 
  os << " ode_accuracy = " << ode_accuracy << endl;
 
  os << " mc_stepsize = " << mc_stepsize << endl;
 
  os << " mc_cell_stepsize = " << mc_cell_stepsize << endl;
 
  os << " energy_threshold = " << energy_threshold << endl;
 
  os << " bend_lambda = " << bend_lambda << endl;
 
  os << " alignment_lambda = " << alignment_lambda << endl;
 
  os << " rel_cell_div_threshold = " << rel_cell_div_threshold << endl;
 
  os << " rel_perimeter_stiffness = " << rel_perimeter_stiffness << endl;
 
  os << " collapse_node_threshold = " << collapse_node_threshold << endl;
 
  os << " morphogen_div_threshold = " << morphogen_div_threshold << endl;
 
  os << " morphogen_expansion_threshold = " << morphogen_expansion_threshold << endl;
 
  os << " copy_wall = " << sbool(copy_wall) << endl;
 
  os << " source = " << source << endl;
 
  os << " D = "<< D[0] << ", " << D[1] << ", " << D[2] << ", " << D[3] << ", " << D[4] << ", " << D[5] << ", " << D[6] << ", " << D[7] << ", " << D[8] << ", " << D[9] << ", " << D[10] << ", " << D[11] << ", " << D[12] << ", " << D[13] << ", " << D[14] << endl;
 
  os << " initval = "<< initval[0] << ", " << initval[1] << ", " << initval[2] << ", " << initval[3] << ", " << initval[4] << ", " << initval[5] << ", " << initval[6] << ", " << initval[7] << ", " << initval[8] << ", " << initval[9] << ", " << initval[10] << ", " << initval[11] << ", " << initval[12] << ", " << initval[13] << ", " << initval[14] << endl;
 
  os << " k1 = " << k1 << endl;
 
  os << " k2 = " << k2 << endl;
 
  os << " r = " << r << endl;
 
  os << " kr = " << kr << endl;
 
  os << " km = " << km << endl;
 
  os << " Pi_tot = " << Pi_tot << endl;
 
  os << " transport = " << transport << endl;
 
  os << " ka = " << ka << endl;
 
  os << " pin_prod = " << pin_prod << endl;
 
  os << " pin_prod_in_epidermis = " << pin_prod_in_epidermis << endl;
 
  os << " pin_breakdown = " << pin_breakdown << endl;
 
  os << " pin_breakdown_internal = " << pin_breakdown_internal << endl;
 
  os << " aux1prod = " << aux1prod << endl;
 
  os << " aux1prodmeso = " << aux1prodmeso << endl;
 
  os << " aux1decay = " << aux1decay << endl;
 
  os << " aux1decaymeso = " << aux1decaymeso << endl;
 
  os << " aux1transport = " << aux1transport << endl;
 
  os << " aux_cons = " << aux_cons << endl;
 
  os << " aux_breakdown = " << aux_breakdown << endl;
 
  os << " kaux1 = " << kaux1 << endl;
 
  os << " kap = " << kap << endl;
 
  os << " leaf_tip_source = " << leaf_tip_source << endl;
 
  os << " sam_efflux = " << sam_efflux << endl;
 
  os << " sam_auxin = " << sam_auxin << endl;
 
  os << " sam_auxin_breakdown = " << sam_auxin_breakdown << endl;
 
  os << " van3prod = " << van3prod << endl;
 
  os << " van3autokat = " << van3autokat << endl;
 
  os << " van3sat = " << van3sat << endl;
 
  os << " k2van3 = " << k2van3 << endl;
 
  os << " dt = " << dt << endl;
 
  os << " rd_dt = " << rd_dt << endl;
 
  if (datadir) {
 
    QDir dataDir = QDir::home().relativeFilePath(datadir);
 
    os << " datadir = " << dataDir.dirName().toStdString() << endl;
 
  }
 
  else {
 
    os << "datadir = ." << endl;
 
  }
 
                                     QDir dataDir = QDir::home().relativeFilePath(datadir);
 
                                     os << " datadir = " << dataDir.dirName().toStdString() << endl;
 
                                 }
 
                                 else {
 
                                     os << "datadir = ." << endl;
 
                                 }
 
  os << " movie = " << sbool(movie) << endl;
 
  os << " nit = " << nit << endl;
 
  os << " maxt = " << maxt << endl;
 
  os << " storage_stride = " << storage_stride << endl;
 
  os << " xml_storage_stride = " << xml_storage_stride << endl;
 
  os << " rseed = " << rseed << endl;
 
  os << " constituous_expansion_limit = " << constituous_expansion_limit << endl;
 
  os << " vessel_inh_level = " << vessel_inh_level << endl;
 
  os << " vessel_expansion_rate = " << vessel_expansion_rate << endl;
 
  os << " d = " << d << endl;
 
  os << " e = " << e << endl;
 
  os << " f = " << f << endl;
 
  os << " c = " << c << endl;
 
  os << " mu = " << mu << endl;
 
  os << " nu = " << nu << endl;
 
  os << " rho0 = " << rho0 << endl;
 
  os << " rho1 = " << rho1 << endl;
 
  os << " c0 = " << c0 << endl;
 
  os << " gamma = " << gamma << endl;
 
  os << " eps = " << eps << endl;
 
  os << " k = "<< k[0] << ", " << k[1] << ", " << k[2] << ", " << k[3] << ", " << k[4] << ", " << k[5] << ", " << k[6] << ", " << k[7] << ", " << k[8] << ", " << k[9] << ", " << k[10] << ", " << k[11] << ", " << k[12] << ", " << k[13] << ", " << k[14] << endl;
 
  os << " i1 = " << i1 << endl;
 
  os << " i2 = " << i2 << endl;
 
  os << " i3 = " << i3 << endl;
 
  os << " i4 = " << i4 << endl;
 
  os << " i5 = " << i5 << endl;
 

	
 
  if (s1) 
 
    os << " s1 = " << s1 << endl;
 
  os << " s1 = " << s1 << endl;
 

	
 
  if (s2) 
 
    os << " s2 = " << s2 << endl;
 
  os << " s2 = " << s2 << endl;
 

	
 
  if (s3) 
 
    os << " s3 = " << s3 << endl;
 
  os << " s3 = " << s3 << endl;
 
  os << " b1 = " << sbool(b1) << endl;
 
  os << " b2 = " << sbool(b2) << endl;
 
  os << " b3 = " << sbool(b3) << endl;
 
  os << " b4 = " << sbool(b4) << endl;
 

	
 
  if (dir1) 
 
    os << " dir1 = " << dir1 << endl;
 
  os << " dir1 = " << dir1 << endl;
 

	
 
  if (dir2) 
 
    os << " dir2 = " << dir2 << endl;
 
  os << " dir2 = " << dir2 << endl;
 
  os << " export_interval = " << export_interval << endl;
 

	
 
  if (export_fn_prefix) 
 
  os << " export_fn_prefix = " << export_fn_prefix << endl;
 
}
 

	
 
void Parameter::XMLAdd(xmlNode *root) const {
 
  xmlNode *xmlparameter = xmlNewChild(root, NULL, BAD_CAST "parameter", NULL);
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "arrowcolor" );
 
    ostringstream text;
 
    xmlNode *xmlparameter = xmlNewChild(root, NULL, BAD_CAST "parameter", NULL);
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "arrowcolor" );
 
  ostringstream text;
 

	
 
    if (arrowcolor) 
 
      text << arrowcolor;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "arrowsize" );
 
    ostringstream text;
 
  if (arrowcolor) 
 
    text << arrowcolor;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "arrowsize" );
 
  ostringstream text;
 
    text << arrowsize;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "textcolor" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "textcolor" );
 
  ostringstream text;
 

	
 
    if (textcolor) 
 
      text << textcolor;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cellnumsize" );
 
    ostringstream text;
 
  if (textcolor) 
 
    text << textcolor;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cellnumsize" );
 
  ostringstream text;
 
    text << cellnumsize;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "nodenumsize" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "nodenumsize" );
 
  ostringstream text;
 
    text << nodenumsize;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "node_mag" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "node_mag" );
 
  ostringstream text;
 
    text << node_mag;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "outlinewidth" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "outlinewidth" );
 
  ostringstream text;
 
    text << outlinewidth;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cell_outline_color" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cell_outline_color" );
 
  ostringstream text;
 

	
 
    if (cell_outline_color) 
 
      text << cell_outline_color;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "resize_stride" );
 
    ostringstream text;
 
  if (cell_outline_color) 
 
    text << cell_outline_color;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "resize_stride" );
 
  ostringstream text;
 
    text << resize_stride;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "T" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "T" );
 
  ostringstream text;
 
    text << T;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "lambda_length" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "lambda_length" );
 
  ostringstream text;
 
    text << lambda_length;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "lambda_celllength" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "lambda_celllength" );
 
  ostringstream text;
 
    text << lambda_celllength;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "target_length" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "target_length" );
 
  ostringstream text;
 
    text << target_length;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cell_expansion_rate" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cell_expansion_rate" );
 
  ostringstream text;
 
    text << cell_expansion_rate;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cell_div_expansion_rate" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "cell_div_expansion_rate" );
 
  ostringstream text;
 
    text << cell_div_expansion_rate;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "auxin_dependent_growth" );
 
    ostringstream text;
 
    text << sbool(auxin_dependent_growth);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "ode_accuracy" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "auxin_dependent_growth" );
 
  ostringstream text;
 
text << sbool(auxin_dependent_growth);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "ode_accuracy" );
 
  ostringstream text;
 
    text << ode_accuracy;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "mc_stepsize" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "mc_stepsize" );
 
  ostringstream text;
 
    text << mc_stepsize;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "mc_cell_stepsize" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "mc_cell_stepsize" );
 
  ostringstream text;
 
    text << mc_cell_stepsize;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "energy_threshold" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "energy_threshold" );
 
  ostringstream text;
 
    text << energy_threshold;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "bend_lambda" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "bend_lambda" );
 
  ostringstream text;
 
    text << bend_lambda;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "alignment_lambda" );
 
  ostringstream text;
 
    text << alignment_lambda;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rel_cell_div_threshold" );
 
  ostringstream text;
 
    text << rel_cell_div_threshold;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rel_perimeter_stiffness" );
 
  ostringstream text;
 
    text << rel_perimeter_stiffness;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "collapse_node_threshold" );
 
  ostringstream text;
 
    text << collapse_node_threshold;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "morphogen_div_threshold" );
 
  ostringstream text;
 
    text << morphogen_div_threshold;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "morphogen_expansion_threshold" );
 
  ostringstream text;
 
    text << morphogen_expansion_threshold;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "copy_wall" );
 
  ostringstream text;
 
text << sbool(copy_wall);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "source" );
 
  ostringstream text;
 
    text << source;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "D" );
 
  xmlNode *xmlvalarray = xmlNewChild(xmlpar, NULL, BAD_CAST "valarray", NULL);
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "alignment_lambda" );
 
    ostringstream text;
 
    text << alignment_lambda;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rel_cell_div_threshold" );
 
    ostringstream text;
 
    text << rel_cell_div_threshold;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rel_perimeter_stiffness" );
 
    ostringstream text;
 
    text << rel_perimeter_stiffness;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "collapse_node_threshold" );
 
    ostringstream text;
 
    text << collapse_node_threshold;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "morphogen_div_threshold" );
 
    ostringstream text;
 
    text << morphogen_div_threshold;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "morphogen_expansion_threshold" );
 
    ostringstream text;
 
    text << morphogen_expansion_threshold;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "copy_wall" );
 
    ostringstream text;
 
    text << sbool(copy_wall);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "source" );
 
    ostringstream text;
 
    text << source;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << D[0];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "D" );
 
    xmlNode *xmlvalarray = xmlNewChild(xmlpar, NULL, BAD_CAST "valarray", NULL);
 
    {
 
      ostringstream text;
 
      text << D[0];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[1];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[2];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[3];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[4];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[5];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[6];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[7];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[8];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[9];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[10];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[11];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[12];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[13];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << D[14];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    ostringstream text;
 
    text << D[1];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[2];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[3];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[4];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[5];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[6];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[7];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[8];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[9];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[10];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[11];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[12];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << D[13];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "initval" );
 
    xmlNode *xmlvalarray = xmlNewChild(xmlpar, NULL, BAD_CAST "valarray", NULL);
 
    {
 
      ostringstream text;
 
      text << initval[0];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[1];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[2];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[3];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[4];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[5];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[6];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[7];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[8];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[9];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[10];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[11];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[12];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[13];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << initval[14];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    ostringstream text;
 
    text << D[14];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "initval" );
 
  xmlNode *xmlvalarray = xmlNewChild(xmlpar, NULL, BAD_CAST "valarray", NULL);
 
  {
 
    ostringstream text;
 
    text << initval[0];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << initval[1];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << initval[2];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << initval[3];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << initval[4];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << initval[5];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k1" );
 
    ostringstream text;
 
    text << k1;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k2" );
 
    ostringstream text;
 
    text << k2;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[6];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "r" );
 
    ostringstream text;
 
    text << r;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[7];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "kr" );
 
    ostringstream text;
 
    text << kr;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "km" );
 
    ostringstream text;
 
    text << km;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[8];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "Pi_tot" );
 
    ostringstream text;
 
    text << Pi_tot;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[9];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "transport" );
 
    ostringstream text;
 
    text << transport;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "ka" );
 
    ostringstream text;
 
    text << ka;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[10];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_prod" );
 
    ostringstream text;
 
    text << pin_prod;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[11];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_prod_in_epidermis" );
 
    ostringstream text;
 
    text << pin_prod_in_epidermis;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[12];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_breakdown" );
 
    ostringstream text;
 
    text << pin_breakdown;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_breakdown_internal" );
 
    ostringstream text;
 
    text << pin_breakdown_internal;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[13];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1prod" );
 
    ostringstream text;
 
    text << aux1prod;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1prodmeso" );
 
    ostringstream text;
 
    text << aux1prodmeso;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1decay" );
 
    ostringstream text;
 
    text << aux1decay;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1decaymeso" );
 
    ostringstream text;
 
    text << aux1decaymeso;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1transport" );
 
    ostringstream text;
 
    text << aux1transport;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux_cons" );
 
    ostringstream text;
 
    text << aux_cons;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux_breakdown" );
 
    ostringstream text;
 
    text << aux_breakdown;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "kaux1" );
 
    ostringstream text;
 
    text << kaux1;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << initval[14];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "kap" );
 
    ostringstream text;
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k1" );
 
  ostringstream text;
 
    text << k1;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k2" );
 
  ostringstream text;
 
    text << k2;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "r" );
 
  ostringstream text;
 
    text << r;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "kr" );
 
  ostringstream text;
 
    text << kr;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "km" );
 
  ostringstream text;
 
    text << km;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "Pi_tot" );
 
  ostringstream text;
 
    text << Pi_tot;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "transport" );
 
  ostringstream text;
 
    text << transport;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "ka" );
 
  ostringstream text;
 
    text << ka;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_prod" );
 
  ostringstream text;
 
    text << pin_prod;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_prod_in_epidermis" );
 
  ostringstream text;
 
    text << pin_prod_in_epidermis;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_breakdown" );
 
  ostringstream text;
 
    text << pin_breakdown;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "pin_breakdown_internal" );
 
  ostringstream text;
 
    text << pin_breakdown_internal;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1prod" );
 
  ostringstream text;
 
    text << aux1prod;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1prodmeso" );
 
  ostringstream text;
 
    text << aux1prodmeso;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1decay" );
 
  ostringstream text;
 
    text << aux1decay;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1decaymeso" );
 
  ostringstream text;
 
    text << aux1decaymeso;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux1transport" );
 
  ostringstream text;
 
    text << aux1transport;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux_cons" );
 
  ostringstream text;
 
    text << aux_cons;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "aux_breakdown" );
 
  ostringstream text;
 
    text << aux_breakdown;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "kaux1" );
 
  ostringstream text;
 
    text << kaux1;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "kap" );
 
  ostringstream text;
 
    text << kap;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "leaf_tip_source" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "leaf_tip_source" );
 
  ostringstream text;
 
    text << leaf_tip_source;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "sam_efflux" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "sam_efflux" );
 
  ostringstream text;
 
    text << sam_efflux;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "sam_auxin" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "sam_auxin" );
 
  ostringstream text;
 
    text << sam_auxin;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "sam_auxin_breakdown" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "sam_auxin_breakdown" );
 
  ostringstream text;
 
    text << sam_auxin_breakdown;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "van3prod" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "van3prod" );
 
  ostringstream text;
 
    text << van3prod;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "van3autokat" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "van3autokat" );
 
  ostringstream text;
 
    text << van3autokat;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "van3sat" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "van3sat" );
 
  ostringstream text;
 
    text << van3sat;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k2van3" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k2van3" );
 
  ostringstream text;
 
    text << k2van3;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "dt" );
 
  ostringstream text;
 
    text << dt;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rd_dt" );
 
  ostringstream text;
 
    text << rd_dt;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "datadir" );
 
  ostringstream text;
 

	
 
  if (datadir) {
 
                                     QDir dataDir = QDir::home().relativeFilePath(datadir);
 
                                     text << dataDir.dirName().toStdString();
 
                                   }
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "movie" );
 
  ostringstream text;
 
text << sbool(movie);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "nit" );
 
  ostringstream text;
 
    text << nit;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "maxt" );
 
  ostringstream text;
 
    text << maxt;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "storage_stride" );
 
  ostringstream text;
 
    text << storage_stride;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "xml_storage_stride" );
 
  ostringstream text;
 
    text << xml_storage_stride;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rseed" );
 
  ostringstream text;
 
    text << rseed;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "constituous_expansion_limit" );
 
  ostringstream text;
 
    text << constituous_expansion_limit;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "vessel_inh_level" );
 
  ostringstream text;
 
    text << vessel_inh_level;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "vessel_expansion_rate" );
 
  ostringstream text;
 
    text << vessel_expansion_rate;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "d" );
 
  ostringstream text;
 
    text << d;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "e" );
 
  ostringstream text;
 
    text << e;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "f" );
 
  ostringstream text;
 
    text << f;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "c" );
 
  ostringstream text;
 
    text << c;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "mu" );
 
  ostringstream text;
 
    text << mu;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "nu" );
 
  ostringstream text;
 
    text << nu;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rho0" );
 
  ostringstream text;
 
    text << rho0;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rho1" );
 
  ostringstream text;
 
    text << rho1;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "c0" );
 
  ostringstream text;
 
    text << c0;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "gamma" );
 
  ostringstream text;
 
    text << gamma;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "eps" );
 
  ostringstream text;
 
    text << eps;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k" );
 
  xmlNode *xmlvalarray = xmlNewChild(xmlpar, NULL, BAD_CAST "valarray", NULL);
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "dt" );
 
    ostringstream text;
 
    text << dt;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rd_dt" );
 
    ostringstream text;
 
    text << rd_dt;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "datadir" );
 
    ostringstream text;
 

	
 
    if (datadir) {
 
      QDir dataDir = QDir::home().relativeFilePath(datadir);
 
      text << dataDir.dirName().toStdString();
 
    }
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "movie" );
 
    ostringstream text;
 
    text << sbool(movie);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "nit" );
 
    ostringstream text;
 
    text << nit;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "maxt" );
 
    ostringstream text;
 
    text << maxt;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "storage_stride" );
 
    ostringstream text;
 
    text << storage_stride;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "xml_storage_stride" );
 
    ostringstream text;
 
    text << xml_storage_stride;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rseed" );
 
    ostringstream text;
 
    text << rseed;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "constituous_expansion_limit" );
 
    ostringstream text;
 
    text << constituous_expansion_limit;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "vessel_inh_level" );
 
    ostringstream text;
 
    text << vessel_inh_level;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "vessel_expansion_rate" );
 
    ostringstream text;
 
    text << vessel_expansion_rate;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "d" );
 
    ostringstream text;
 
    text << d;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "e" );
 
    ostringstream text;
 
    text << e;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "f" );
 
    ostringstream text;
 
    text << f;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "c" );
 
    ostringstream text;
 
    text << c;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "mu" );
 
    ostringstream text;
 
    text << mu;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[0];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "nu" );
 
    ostringstream text;
 
    text << nu;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[1];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << k[2];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rho0" );
 
    ostringstream text;
 
    text << k[3];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << rho0;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[4];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << k[5];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << k[6];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "rho1" );
 
    ostringstream text;
 
    text << k[7];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << rho1;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[8];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << k[9];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "c0" );
 
    ostringstream text;
 
    text << c0;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[10];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "gamma" );
 
    ostringstream text;
 
    text << gamma;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[11];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "eps" );
 
    ostringstream text;
 
    text << eps;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[12];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    ostringstream text;
 
    text << k[13];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "k" );
 
    xmlNode *xmlvalarray = xmlNewChild(xmlpar, NULL, BAD_CAST "valarray", NULL);
 
    {
 
      ostringstream text;
 
      text << k[0];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[1];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[2];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[3];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[4];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[5];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[6];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[7];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[8];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[9];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[10];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[11];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[12];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[13];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
    {
 
      ostringstream text;
 
      text << k[14];
 
      xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
      xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
    }
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i1" );
 
    ostringstream text;
 
    text << i1;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
    text << k[14];
 
    xmlNode *xmlval = xmlNewChild(xmlvalarray, NULL, BAD_CAST "val", NULL);
 
    xmlNewProp(xmlval, BAD_CAST "v", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i2" );
 
    ostringstream text;
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i1" );
 
  ostringstream text;
 
    text << i1;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i2" );
 
  ostringstream text;
 
    text << i2;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i3" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i3" );
 
  ostringstream text;
 
    text << i3;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i4" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i4" );
 
  ostringstream text;
 
    text << i4;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i5" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "i5" );
 
  ostringstream text;
 
    text << i5;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "s1" );
 
    ostringstream text;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "s1" );
 
  ostringstream text;
 

	
 
    if (s1) 
 
      text << s1;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "s2" );
 
    ostringstream text;
 
  if (s1) 
 
    text << s1;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "s2" );
 
  ostringstream text;
 

	
 
    if (s2) 
 
      text << s2;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "s3" );
 
    ostringstream text;
 
  if (s2) 
 
    text << s2;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "s3" );
 
  ostringstream text;
 

	
 
    if (s3) 
 
      text << s3;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b1" );
 
    ostringstream text;
 
    text << sbool(b1);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b2" );
 
    ostringstream text;
 
    text << sbool(b2);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b3" );
 
    ostringstream text;
 
    text << sbool(b3);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b4" );
 
    ostringstream text;
 
    text << sbool(b4);
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "dir1" );
 
    ostringstream text;
 
  if (s3) 
 
    text << s3;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b1" );
 
  ostringstream text;
 
text << sbool(b1);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b2" );
 
  ostringstream text;
 
text << sbool(b2);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b3" );
 
  ostringstream text;
 
text << sbool(b3);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "b4" );
 
  ostringstream text;
 
text << sbool(b4);
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "dir1" );
 
  ostringstream text;
 

	
 
    if (dir1) 
 
      text << dir1;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  {
 
    xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
    xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "dir2" );
 
    ostringstream text;
 
  if (dir1) 
 
    text << dir1;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "dir2" );
 
  ostringstream text;
 

	
 
    if (dir2) 
 
      text << dir2;
 
    xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
  }
 
  if (dir2) 
 
    text << dir2;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "export_interval" );
 
  ostringstream text;
 
    text << export_interval;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
{
 
  xmlNode *xmlpar = xmlNewChild(xmlparameter, NULL, BAD_CAST "par", NULL);
 
  xmlNewProp(xmlpar, BAD_CAST "name", BAD_CAST "export_fn_prefix" );
 
  ostringstream text;
 

	
 
  if (export_fn_prefix) 
 
    text << export_fn_prefix;
 
xmlNewProp(xmlpar, BAD_CAST "val", BAD_CAST text.str().c_str());
 
}
 
}
 
void Parameter::AssignValToPar(const char *namec, const char *valc) {
 
  QLocale standardlocale(QLocale::C);
 
  bool ok;
 
  if (!strcmp(namec, "arrowcolor")) {
 
    if (arrowcolor) { free(arrowcolor); }
 
    arrowcolor=strdup(valc);
 
  }
 
  if (!strcmp(namec, "arrowsize")) {
 
    arrowsize = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'arrowsize' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "textcolor")) {
 
    if (textcolor) { free(textcolor); }
 
    textcolor=strdup(valc);
 
  }
 
  if (!strcmp(namec, "cellnumsize")) {
 
    cellnumsize = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'cellnumsize' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "nodenumsize")) {
 
    nodenumsize = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'nodenumsize' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "node_mag")) {
 
    node_mag = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'node_mag' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "outlinewidth")) {
 
    outlinewidth = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'outlinewidth' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "cell_outline_color")) {
 
    if (cell_outline_color) { free(cell_outline_color); }
 
    cell_outline_color=strdup(valc);
 
  }
 
  if (!strcmp(namec, "resize_stride")) {
 
    resize_stride = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'resize_stride' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "T")) {
 
    T = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'T' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "lambda_length")) {
 
    lambda_length = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'lambda_length' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "lambda_celllength")) {
 
    lambda_celllength = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'lambda_celllength' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "target_length")) {
 
    target_length = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'target_length' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "cell_expansion_rate")) {
 
    cell_expansion_rate = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'cell_expansion_rate' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "cell_div_expansion_rate")) {
 
    cell_div_expansion_rate = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'cell_div_expansion_rate' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "auxin_dependent_growth")) {
 
    auxin_dependent_growth = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "ode_accuracy")) {
 
    ode_accuracy = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'ode_accuracy' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "mc_stepsize")) {
 
    mc_stepsize = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'mc_stepsize' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "mc_cell_stepsize")) {
 
    mc_cell_stepsize = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'mc_cell_stepsize' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "energy_threshold")) {
 
    energy_threshold = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'energy_threshold' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "bend_lambda")) {
 
    bend_lambda = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'bend_lambda' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "alignment_lambda")) {
 
    alignment_lambda = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'alignment_lambda' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "rel_cell_div_threshold")) {
 
    rel_cell_div_threshold = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rel_cell_div_threshold' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "rel_perimeter_stiffness")) {
 
    rel_perimeter_stiffness = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rel_perimeter_stiffness' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "collapse_node_threshold")) {
 
    collapse_node_threshold = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'collapse_node_threshold' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "morphogen_div_threshold")) {
 
    morphogen_div_threshold = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'morphogen_div_threshold' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "morphogen_expansion_threshold")) {
 
    morphogen_expansion_threshold = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'morphogen_expansion_threshold' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "copy_wall")) {
 
    copy_wall = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "source")) {
 
    source = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'source' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "k1")) {
 
    k1 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'k1' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "k2")) {
 
    k2 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'k2' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "r")) {
 
    r = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'r' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "kr")) {
 
    kr = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'kr' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "km")) {
 
    km = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'km' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "Pi_tot")) {
 
    Pi_tot = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'Pi_tot' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "transport")) {
 
    transport = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'transport' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "ka")) {
 
    ka = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'ka' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "pin_prod")) {
 
    pin_prod = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_prod' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "pin_prod_in_epidermis")) {
 
    pin_prod_in_epidermis = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_prod_in_epidermis' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "pin_breakdown")) {
 
    pin_breakdown = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_breakdown' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "pin_breakdown_internal")) {
 
    pin_breakdown_internal = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_breakdown_internal' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux1prod")) {
 
    aux1prod = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1prod' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux1prodmeso")) {
 
    aux1prodmeso = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1prodmeso' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux1decay")) {
 
    aux1decay = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1decay' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux1decaymeso")) {
 
    aux1decaymeso = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1decaymeso' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux1transport")) {
 
    aux1transport = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1transport' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux_cons")) {
 
    aux_cons = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux_cons' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "aux_breakdown")) {
 
    aux_breakdown = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux_breakdown' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "kaux1")) {
 
    kaux1 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'kaux1' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "kap")) {
 
    kap = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'kap' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "leaf_tip_source")) {
 
    leaf_tip_source = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'leaf_tip_source' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "sam_efflux")) {
 
    sam_efflux = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'sam_efflux' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "sam_auxin")) {
 
    sam_auxin = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'sam_auxin' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "sam_auxin_breakdown")) {
 
    sam_auxin_breakdown = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'sam_auxin_breakdown' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "van3prod")) {
 
    van3prod = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'van3prod' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "van3autokat")) {
 
    van3autokat = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'van3autokat' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "van3sat")) {
 
    van3sat = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'van3sat' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "k2van3")) {
 
    k2van3 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'k2van3' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "dt")) {
 
    dt = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'dt' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "rd_dt")) {
 
    rd_dt = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rd_dt' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "datadir")) {
 
    if (datadir) { free(datadir); }
 
    datadir=strdup(valc);
 
    datadir = AppendHomeDirIfPathRelative(datadir);
 
  }
 
  if (!strcmp(namec, "movie")) {
 
    movie = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "nit")) {
 
    nit = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'nit' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "maxt")) {
 
    maxt = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'maxt' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "storage_stride")) {
 
    storage_stride = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'storage_stride' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "xml_storage_stride")) {
 
    xml_storage_stride = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'xml_storage_stride' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "rseed")) {
 
    rseed = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'rseed' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "constituous_expansion_limit")) {
 
    constituous_expansion_limit = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'constituous_expansion_limit' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "vessel_inh_level")) {
 
    vessel_inh_level = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'vessel_inh_level' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "vessel_expansion_rate")) {
 
    vessel_expansion_rate = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'vessel_expansion_rate' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "d")) {
 
    d = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'd' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "e")) {
 
    e = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'e' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "f")) {
 
    f = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'f' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "c")) {
 
    c = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'c' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "mu")) {
 
    mu = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'mu' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "nu")) {
 
    nu = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'nu' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "rho0")) {
 
    rho0 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rho0' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "rho1")) {
 
    rho1 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rho1' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "c0")) {
 
    c0 = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'c0' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "gamma")) {
 
    gamma = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'gamma' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "eps")) {
 
    eps = standardlocale.toDouble(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'eps' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "i1")) {
 
    i1 = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i1' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "i2")) {
 
    i2 = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i2' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "i3")) {
 
    i3 = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i3' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "i4")) {
 
    i4 = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i4' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "i5")) {
 
    i5 = standardlocale.toInt(valc, &ok);
 
    if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i5' from XML file.",valc); }
 
  }
 
  if (!strcmp(namec, "s1")) {
 
    if (s1) { free(s1); }
 
    s1=strdup(valc);
 
  }
 
  if (!strcmp(namec, "s2")) {
 
    if (s2) { free(s2); }
 
    s2=strdup(valc);
 
  }
 
  if (!strcmp(namec, "s3")) {
 
    if (s3) { free(s3); }
 
    s3=strdup(valc);
 
  }
 
  if (!strcmp(namec, "b1")) {
 
    b1 = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "b2")) {
 
    b2 = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "b3")) {
 
    b3 = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "b4")) {
 
    b4 = strtobool(valc);
 
  }
 
  if (!strcmp(namec, "dir1")) {
 
    if (dir1) { free(dir1); }
 
    dir1=strdup(valc);
 
  }
 
  if (!strcmp(namec, "dir2")) {
 
    if (dir2) { free(dir2); }
 
    dir2=strdup(valc);
 
if (!strcmp(namec, "arrowcolor")) {
 
  if (arrowcolor) { free(arrowcolor); }
 
  arrowcolor=strdup(valc);
 
}
 
if (!strcmp(namec, "arrowsize")) {
 
  arrowsize = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'arrowsize' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "textcolor")) {
 
  if (textcolor) { free(textcolor); }
 
  textcolor=strdup(valc);
 
}
 
if (!strcmp(namec, "cellnumsize")) {
 
  cellnumsize = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'cellnumsize' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "nodenumsize")) {
 
  nodenumsize = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'nodenumsize' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "node_mag")) {
 
  node_mag = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'node_mag' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "outlinewidth")) {
 
  outlinewidth = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'outlinewidth' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "cell_outline_color")) {
 
  if (cell_outline_color) { free(cell_outline_color); }
 
  cell_outline_color=strdup(valc);
 
}
 
if (!strcmp(namec, "resize_stride")) {
 
  resize_stride = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'resize_stride' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "T")) {
 
  T = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'T' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "lambda_length")) {
 
  lambda_length = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'lambda_length' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "lambda_celllength")) {
 
  lambda_celllength = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'lambda_celllength' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "target_length")) {
 
  target_length = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'target_length' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "cell_expansion_rate")) {
 
  cell_expansion_rate = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'cell_expansion_rate' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "cell_div_expansion_rate")) {
 
  cell_div_expansion_rate = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'cell_div_expansion_rate' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "auxin_dependent_growth")) {
 
auxin_dependent_growth = strtobool(valc);
 
}
 
if (!strcmp(namec, "ode_accuracy")) {
 
  ode_accuracy = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'ode_accuracy' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "mc_stepsize")) {
 
  mc_stepsize = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'mc_stepsize' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "mc_cell_stepsize")) {
 
  mc_cell_stepsize = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'mc_cell_stepsize' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "energy_threshold")) {
 
  energy_threshold = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'energy_threshold' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "bend_lambda")) {
 
  bend_lambda = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'bend_lambda' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "alignment_lambda")) {
 
  alignment_lambda = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'alignment_lambda' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "rel_cell_div_threshold")) {
 
  rel_cell_div_threshold = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rel_cell_div_threshold' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "rel_perimeter_stiffness")) {
 
  rel_perimeter_stiffness = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rel_perimeter_stiffness' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "collapse_node_threshold")) {
 
  collapse_node_threshold = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'collapse_node_threshold' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "morphogen_div_threshold")) {
 
  morphogen_div_threshold = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'morphogen_div_threshold' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "morphogen_expansion_threshold")) {
 
  morphogen_expansion_threshold = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'morphogen_expansion_threshold' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "copy_wall")) {
 
copy_wall = strtobool(valc);
 
}
 
if (!strcmp(namec, "source")) {
 
  source = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'source' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "k1")) {
 
  k1 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'k1' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "k2")) {
 
  k2 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'k2' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "r")) {
 
  r = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'r' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "kr")) {
 
  kr = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'kr' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "km")) {
 
  km = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'km' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "Pi_tot")) {
 
  Pi_tot = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'Pi_tot' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "transport")) {
 
  transport = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'transport' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "ka")) {
 
  ka = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'ka' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "pin_prod")) {
 
  pin_prod = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_prod' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "pin_prod_in_epidermis")) {
 
  pin_prod_in_epidermis = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_prod_in_epidermis' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "pin_breakdown")) {
 
  pin_breakdown = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_breakdown' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "pin_breakdown_internal")) {
 
  pin_breakdown_internal = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'pin_breakdown_internal' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux1prod")) {
 
  aux1prod = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1prod' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux1prodmeso")) {
 
  aux1prodmeso = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1prodmeso' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux1decay")) {
 
  aux1decay = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1decay' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux1decaymeso")) {
 
  aux1decaymeso = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1decaymeso' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux1transport")) {
 
  aux1transport = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux1transport' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux_cons")) {
 
  aux_cons = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux_cons' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "aux_breakdown")) {
 
  aux_breakdown = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'aux_breakdown' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "kaux1")) {
 
  kaux1 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'kaux1' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "kap")) {
 
  kap = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'kap' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "leaf_tip_source")) {
 
  leaf_tip_source = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'leaf_tip_source' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "sam_efflux")) {
 
  sam_efflux = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'sam_efflux' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "sam_auxin")) {
 
  sam_auxin = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'sam_auxin' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "sam_auxin_breakdown")) {
 
  sam_auxin_breakdown = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'sam_auxin_breakdown' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "van3prod")) {
 
  van3prod = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'van3prod' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "van3autokat")) {
 
  van3autokat = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'van3autokat' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "van3sat")) {
 
  van3sat = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'van3sat' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "k2van3")) {
 
  k2van3 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'k2van3' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "dt")) {
 
  dt = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'dt' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "rd_dt")) {
 
  rd_dt = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rd_dt' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "datadir")) {
 
  if (datadir) { free(datadir); }
 
  datadir=strdup(valc);
 
  datadir = AppendHomeDirIfPathRelative(datadir);
 
}
 
if (!strcmp(namec, "movie")) {
 
movie = strtobool(valc);
 
}
 
if (!strcmp(namec, "nit")) {
 
  nit = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'nit' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "maxt")) {
 
  maxt = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'maxt' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "storage_stride")) {
 
  storage_stride = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'storage_stride' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "xml_storage_stride")) {
 
  xml_storage_stride = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'xml_storage_stride' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "rseed")) {
 
  rseed = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'rseed' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "constituous_expansion_limit")) {
 
  constituous_expansion_limit = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'constituous_expansion_limit' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "vessel_inh_level")) {
 
  vessel_inh_level = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'vessel_inh_level' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "vessel_expansion_rate")) {
 
  vessel_expansion_rate = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'vessel_expansion_rate' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "d")) {
 
  d = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'd' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "e")) {
 
  e = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'e' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "f")) {
 
  f = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'f' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "c")) {
 
  c = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'c' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "mu")) {
 
  mu = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'mu' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "nu")) {
 
  nu = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'nu' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "rho0")) {
 
  rho0 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rho0' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "rho1")) {
 
  rho1 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'rho1' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "c0")) {
 
  c0 = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'c0' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "gamma")) {
 
  gamma = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'gamma' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "eps")) {
 
  eps = standardlocale.toDouble(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to double while reading parameter 'eps' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "i1")) {
 
  i1 = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i1' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "i2")) {
 
  i2 = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i2' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "i3")) {
 
  i3 = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i3' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "i4")) {
 
  i4 = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i4' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "i5")) {
 
  i5 = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'i5' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "s1")) {
 
  if (s1) { free(s1); }
 
  s1=strdup(valc);
 
}
 
if (!strcmp(namec, "s2")) {
 
  if (s2) { free(s2); }
 
  s2=strdup(valc);
 
}
 
if (!strcmp(namec, "s3")) {
 
  if (s3) { free(s3); }
 
  s3=strdup(valc);
 
}
 
if (!strcmp(namec, "b1")) {
 
b1 = strtobool(valc);
 
}
 
if (!strcmp(namec, "b2")) {
 
b2 = strtobool(valc);
 
}
 
if (!strcmp(namec, "b3")) {
 
b3 = strtobool(valc);
 
}
 
if (!strcmp(namec, "b4")) {
 
b4 = strtobool(valc);
 
}
 
if (!strcmp(namec, "dir1")) {
 
  if (dir1) { free(dir1); }
 
  dir1=strdup(valc);
 
}
 
if (!strcmp(namec, "dir2")) {
 
  if (dir2) { free(dir2); }
 
  dir2=strdup(valc);
 
}
 
if (!strcmp(namec, "export_interval")) {
 
  export_interval = standardlocale.toInt(valc, &ok);
 
  if (!ok) { MyWarning::error("Read error: cannot convert string \"%s\" to integer while reading parameter 'export_interval' from XML file.",valc); }
 
}
 
if (!strcmp(namec, "export_fn_prefix")) {
 
  if (export_fn_prefix) { free(export_fn_prefix); }
 
  export_fn_prefix=strdup(valc);
 
}
 
}
 
void Parameter::AssignValArrayToPar(const char *namec, vector<double> valarray) {
 
if (!strcmp(namec, "D")) {
 
  int i=0;
 
  vector<double>::const_iterator v=valarray.begin();
 
  while (v!=valarray.end() && i <= 14 ) {
 
     D[i++]=*(v++);
 
  }
 
}
 
void Parameter::AssignValArrayToPar(const char *namec, vector<double> valarray) {
 
  if (!strcmp(namec, "D")) {
 
    int i=0;
 
    vector<double>::const_iterator v=valarray.begin();
 
    while (v!=valarray.end() && i <= 14 ) {
 
      D[i++]=*(v++);
 
    }
 
if (!strcmp(namec, "initval")) {
 
  int i=0;
 
  vector<double>::const_iterator v=valarray.begin();
 
  while (v!=valarray.end() && i <= 14 ) {
 
     initval[i++]=*(v++);
 
  }
 
  if (!strcmp(namec, "initval")) {
 
    int i=0;
 
    vector<double>::const_iterator v=valarray.begin();
 
    while (v!=valarray.end() && i <= 14 ) {
 
      initval[i++]=*(v++);
 
    }
 
}
 
if (!strcmp(namec, "k")) {
 
  int i=0;
 
  vector<double>::const_iterator v=valarray.begin();
 
  while (v!=valarray.end() && i <= 14 ) {
 
     k[i++]=*(v++);
 
  }
 
  if (!strcmp(namec, "k")) {
 
    int i=0;
 
    vector<double>::const_iterator v=valarray.begin();
 
    while (v!=valarray.end() && i <= 14 ) {
 
      k[i++]=*(v++);
 
    }
 
  }
 
}
 
}
 

	
 
ostream &operator<<(ostream &os, Parameter &p) {
 
  p.Write(os);
 
  return os;
 
    p.Write(os);
 
    return os;
 
}
 

	
 
/* finis */
src/parameter.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.
 
 *
 
 */
 

	
 
// WARNING: This file is automatically generated by make_parameter_source.pl. Do not edit.
 
// All edits will be discarded.
 

	
 
#ifndef _PARAMETER_H_
 
#define _PARAMETER_H_
 
#include "vector.h"
 
#include <vector>
 

	
 
#include <libxml/parser.h>
 
#include <libxml/tree.h>
 

	
 
 class Parameter {
 
		
 
 public: 
 
   Parameter();
 
   ~Parameter();
 
   void CleanUp(void);
 
   void Read(const char *filename);
 
   void Write(ostream &os) const;
 
   void XMLAdd(xmlNode *root) const;
 
   void XMLRead(xmlNode *root);
 
   void AssignValToPar(const char *namec, const char *valc);
 
   void AssignValArrayToPar(const char *namec, vector<double> valarray);
 
  char * arrowcolor;
 
  double arrowsize;
 
  char * textcolor;
 
  int cellnumsize;
 
  int nodenumsize;
 
  double node_mag;
 
  double outlinewidth;
 
  char * cell_outline_color;
 
  int resize_stride;
 
  double T;
 
  double lambda_length;
 
  double lambda_celllength;
 
  double target_length;
 
  double cell_expansion_rate;
 
  double cell_div_expansion_rate;
 
  bool auxin_dependent_growth;
 
  double ode_accuracy;
 
  double mc_stepsize;
 
  double mc_cell_stepsize;
 
  double energy_threshold;
 
  double bend_lambda;
 
  double alignment_lambda;
 
  double rel_cell_div_threshold;
 
  double rel_perimeter_stiffness;
 
  double collapse_node_threshold;
 
  double morphogen_div_threshold;
 
  double morphogen_expansion_threshold;
 
  bool copy_wall;
 
  double source;
 
  double * D;
 
  double * initval;
 
  double k1;
 
  double k2;
 
  double r;
 
  double kr;
 
  double km;
 
  double Pi_tot;
 
  double transport;
 
  double ka;
 
  double pin_prod;
 
  double pin_prod_in_epidermis;
 
  double pin_breakdown;
 
  double pin_breakdown_internal;
 
  double aux1prod;
 
  double aux1prodmeso;
 
  double aux1decay;
 
  double aux1decaymeso;
 
  double aux1transport;
 
  double aux_cons;
 
  double aux_breakdown;
 
  double kaux1;
 
  double kap;
 
  double leaf_tip_source;
 
  double sam_efflux;
 
  double sam_auxin;
 
  double sam_auxin_breakdown;
 
  double van3prod;
 
  double van3autokat;
 
  double van3sat;
 
  double k2van3;
 
  double dt;
 
  double rd_dt;
 
  char * datadir;
 
  bool movie;
 
  int nit;
 
  double maxt;
 
  int storage_stride;
 
  int xml_storage_stride;
 
  int rseed;
 
  int constituous_expansion_limit;
 
  double vessel_inh_level;
 
  double vessel_expansion_rate;
 
  double d;
 
  double e;
 
  double f;
 
  double c;
 
  double mu;
 
  double nu;
 
  double rho0;
 
  double rho1;
 
  double c0;
 
  double gamma;
 
  double eps;
 
  double * k;
 
  int i1;
 
  int i2;
 
  int i3;
 
  int i4;
 
  int i5;
 
  char * s1;
 
  char * s2;
 
  char * s3;
 
  bool b1;
 
  bool b2;
 
  bool b3;
 
  bool b4;
 
  char * dir1;
 
  char * dir2;
 
  int export_interval;
 
  char * export_fn_prefix;
 
 private:
 
 };
 

	
 
 ostream &operator<<(ostream &os, Parameter &p);
 
 const char *sbool(const bool &p);
 

	
 

	
 
#endif
 

	
 
/* finis */

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)