diff --git a/data/leaves/ChangeLog b/data/leaves/ChangeLog new file mode 100644 --- /dev/null +++ b/data/leaves/ChangeLog @@ -0,0 +1,14 @@ +2010-06-23 + + * 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 diff --git a/data/leaves/bend.xml b/data/leaves/bend.xml deleted file mode 100644 --- a/data/leaves/bend.xml +++ /dev/null @@ -1,1061 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#include "canvas.h" -#include "cell.h" -#include "output.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> - -#include <unistd.h> -#include <q3textstream.h> - - -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -#include "simplugin.h" -#include "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 &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - - - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - - -class DrawCell { -public: - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - } - - } - -}; - -Mesh mesh; -bool batch=false; - - -void MainBase::Plot(int resize_stride) { - - clear(); - - - static int count=0; - if (resize_stride) { - if ( !((++count)%resize_stride) ) { - FitLeafToCanvas(); - } - } - mesh.LoopCells(DrawCell(),canvas,*this); - - if (ShowNodeNumbersP()) - mesh.LoopNodes( bind2nd (mem_fun_ref ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowApoplastsP()) - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::DrawApoplast ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - if ( ( batch || MovieFramesP() )) { - - static int frame = 0; - // frame numbers are sequential for the most frequently written file type. - // for the less frequently written file type they match the other type - if (!(count%par.storage_stride) ) { - - stringstream fname; - fname << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - - /* - fname << frame << ".pdf"; - if (par.storage_stride <= par.xml_storage_stride) { - frame++; - } - - // Write high-res JPG snapshot every plot step - Save(fname.str().c_str(), "PDF"); - */ - - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < 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<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - Cell &circle=mesh.CircularCell(0,0,10,10); - - circle.SetTargetArea(circle.CalcArea()); - mesh.SetBaseArea(); - // clean up chemicals - for (int c=0; c<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) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(&TestPlugin::CellHouseKeeping); // this includes cell division - - // Reaction diffusion - /*CelltoCellTransport *transport_f = &TestPlugin::CelltoCellTransport; - CellReaction *cellreaction_f = new plugin->CellDynamics(); - WallReaction *wall_f = new WallDynamics();*/ - - mesh.ReactDiffuse(plugin, par.rd_dt); - - - t++; - - Plot(par.resize_stride); - - /*QVector< QPair<double, int> > angles=mesh.VertexAnglesValues(); - QString afname=QString("Angles/anglesvalues%1.dat").arg(t,6,10,QChar('0')); - ofstream af(afname.toStdString().c_str()); - */ - - /*for (QVector< QPair<qreal, int> >::const_iterator v=angles.begin(); - v!=angles.end(); - v++) { - af << v->first << " " << v->second << 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, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'l': - leaffile=strdup(optarg); - if (!leaffile) { - throw("Out of memory"); - } - printf("Reading leaf state file '%s'\n", leaffile); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - - if (optind < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - 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()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) { - - ((Main *)main_window)->show(); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } else { - ((Main *)main_window)->showMaximized(); - } - } else { - main_window=new MainBase(canvas, mesh); - - } - - - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - - - - main_window->Init(leaffile); - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - - - - main_window->Plot(); - - - - if (batch) { - double t=0.; - do { - t = main_window->TimeStep(); - } while (t < par.maxt); - - } else - return app.exec(); - - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - - -// Executed after the cellular mechanics steps have equillibrized -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - c.EnlargeTargetArea(par.cell_expansion_rate); - - if (c.Area() > 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 &color) { } - -// To be executed after cell division -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) {} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/circ.xml b/data/leaves/circ.xml deleted file mode 100644 --- a/data/leaves/circ.xml +++ /dev/null @@ -1,794 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#include "canvas.h" -#include "cell.h" -#include "output.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> - -#include <unistd.h> -#include <q3textstream.h> - - -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -#include "simplugin.h" -#include "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 &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - - - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - - -class DrawCell { -public: - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - } - - } - -}; - -Mesh mesh; -bool batch=false; - - -void MainBase::Plot(int resize_stride) { - - clear(); - - - static int count=0; - if (resize_stride) { - if ( !((++count)%resize_stride) ) { - FitLeafToCanvas(); - } - } - mesh.LoopCells(DrawCell(),canvas,*this); - - if (ShowNodeNumbersP()) - mesh.LoopNodes( bind2nd (mem_fun_ref ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowApoplastsP()) - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::DrawApoplast ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - if ( ( batch || MovieFramesP() )) { - - static int frame = 0; - // frame numbers are sequential for the most frequently written file type. - // for the less frequently written file type they match the other type - if (!(count%par.storage_stride) ) { - - stringstream fname; - fname << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - - /* - fname << frame << ".pdf"; - if (par.storage_stride <= par.xml_storage_stride) { - frame++; - } - - // Write high-res JPG snapshot every plot step - Save(fname.str().c_str(), "PDF"); - */ - - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < 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<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - Cell &circle=mesh.CircularCell(0,0,10,10); - - circle.SetTargetArea(circle.CalcArea()); - mesh.SetBaseArea(); - // clean up chemicals - for (int c=0; c<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) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(&TestPlugin::CellHouseKeeping); // this includes cell division - - // Reaction diffusion - /*CelltoCellTransport *transport_f = &TestPlugin::CelltoCellTransport; - CellReaction *cellreaction_f = new plugin->CellDynamics(); - WallReaction *wall_f = new WallDynamics();*/ - - mesh.ReactDiffuse(plugin, par.rd_dt); - - - t++; - - Plot(par.resize_stride); - - /*QVector< QPair<double, int> > angles=mesh.VertexAnglesValues(); - QString afname=QString("Angles/anglesvalues%1.dat").arg(t,6,10,QChar('0')); - ofstream af(afname.toStdString().c_str()); - */ - - /*for (QVector< QPair<qreal, int> >::const_iterator v=angles.begin(); - v!=angles.end(); - v++) { - af << v->first << " " << v->second << 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, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'l': - leaffile=strdup(optarg); - if (!leaffile) { - throw("Out of memory"); - } - printf("Reading leaf state file '%s'\n", leaffile); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - - if (optind < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - 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()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) { - - ((Main *)main_window)->show(); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } else { - ((Main *)main_window)->showMaximized(); - } - } else { - main_window=new MainBase(canvas, mesh); - - } - - - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - - - - main_window->Init(leaffile); - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - - - - main_window->Plot(); - - - - if (batch) { - double t=0.; - do { - t = main_window->TimeStep(); - } while (t < par.maxt); - - } else - return app.exec(); - - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - - -// Executed after the cellular mechanics steps have equillibrized -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - c.EnlargeTargetArea(par.cell_expansion_rate); - - if (c.Area() > 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 &color) { } - -// To be executed after cell division -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) {} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/explant.xml b/data/leaves/explant.xml deleted file mode 100644 --- a/data/leaves/explant.xml +++ /dev/null @@ -1,40235 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#include "canvas.h" -#include "cell.h" -#include "output.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> - -#include <unistd.h> -#include <q3textstream.h> - - -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -#include "simplugin.h" -#include "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 &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - - - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - - -class DrawCell { -public: - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - } - - } - -}; - -Mesh mesh; -bool batch=false; - - -void MainBase::Plot(int resize_stride) { - - clear(); - - - static int count=0; - if (resize_stride) { - if ( !((++count)%resize_stride) ) { - FitLeafToCanvas(); - } - } - mesh.LoopCells(DrawCell(),canvas,*this); - - if (ShowNodeNumbersP()) - mesh.LoopNodes( bind2nd (mem_fun_ref ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowApoplastsP()) - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::DrawApoplast ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - if ( ( batch || MovieFramesP() )) { - - static int frame = 0; - // frame numbers are sequential for the most frequently written file type. - // for the less frequently written file type they match the other type - if (!(count%par.storage_stride) ) { - - stringstream fname; - fname << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - - /* - fname << frame << ".pdf"; - if (par.storage_stride <= par.xml_storage_stride) { - frame++; - } - - // Write high-res JPG snapshot every plot step - Save(fname.str().c_str(), "PDF"); - */ - - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < 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<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - Cell &circle=mesh.CircularCell(0,0,10,10); - - circle.SetTargetArea(circle.CalcArea()); - mesh.SetBaseArea(); - // clean up chemicals - for (int c=0; c<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) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(&TestPlugin::CellHouseKeeping); // this includes cell division - - // Reaction diffusion - /*CelltoCellTransport *transport_f = &TestPlugin::CelltoCellTransport; - CellReaction *cellreaction_f = new plugin->CellDynamics(); - WallReaction *wall_f = new WallDynamics();*/ - - mesh.ReactDiffuse(plugin, par.rd_dt); - - - t++; - - Plot(par.resize_stride); - - /*QVector< QPair<double, int> > angles=mesh.VertexAnglesValues(); - QString afname=QString("Angles/anglesvalues%1.dat").arg(t,6,10,QChar('0')); - ofstream af(afname.toStdString().c_str()); - */ - - /*for (QVector< QPair<qreal, int> >::const_iterator v=angles.begin(); - v!=angles.end(); - v++) { - af << v->first << " " << v->second << 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, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'l': - leaffile=strdup(optarg); - if (!leaffile) { - throw("Out of memory"); - } - printf("Reading leaf state file '%s'\n", leaffile); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - - if (optind < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - 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()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) { - - ((Main *)main_window)->show(); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } else { - ((Main *)main_window)->showMaximized(); - } - } else { - main_window=new MainBase(canvas, mesh); - - } - - - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - - - - main_window->Init(leaffile); - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - - - - main_window->Plot(); - - - - if (batch) { - double t=0.; - do { - t = main_window->TimeStep(); - } while (t < par.maxt); - - } else - return app.exec(); - - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - - -// Executed after the cellular mechanics steps have equillibrized -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - c.EnlargeTargetArea(par.cell_expansion_rate); - - if (c.Area() > 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 &color) { } - -// To be executed after cell division -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) {} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/init.xml b/data/leaves/init.xml deleted file mode 100644 --- a/data/leaves/init.xml +++ /dev/null @@ -1,1050 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#include "canvas.h" -#include "cell.h" -#include "output.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> - -#include <unistd.h> -#include <q3textstream.h> - - -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -#include "simplugin.h" -#include "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 &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - - - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - - -class DrawCell { -public: - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - } - - } - -}; - -Mesh mesh; -bool batch=false; - - -void MainBase::Plot(int resize_stride) { - - clear(); - - - static int count=0; - if (resize_stride) { - if ( !((++count)%resize_stride) ) { - FitLeafToCanvas(); - } - } - mesh.LoopCells(DrawCell(),canvas,*this); - - if (ShowNodeNumbersP()) - mesh.LoopNodes( bind2nd (mem_fun_ref ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowApoplastsP()) - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::DrawApoplast ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - if ( ( batch || MovieFramesP() )) { - - static int frame = 0; - // frame numbers are sequential for the most frequently written file type. - // for the less frequently written file type they match the other type - if (!(count%par.storage_stride) ) { - - stringstream fname; - fname << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - - /* - fname << frame << ".pdf"; - if (par.storage_stride <= par.xml_storage_stride) { - frame++; - } - - // Write high-res JPG snapshot every plot step - Save(fname.str().c_str(), "PDF"); - */ - - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < 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<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - Cell &circle=mesh.CircularCell(0,0,10,10); - - circle.SetTargetArea(circle.CalcArea()); - mesh.SetBaseArea(); - // clean up chemicals - for (int c=0; c<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) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(&TestPlugin::CellHouseKeeping); // this includes cell division - - // Reaction diffusion - /*CelltoCellTransport *transport_f = &TestPlugin::CelltoCellTransport; - CellReaction *cellreaction_f = new plugin->CellDynamics(); - WallReaction *wall_f = new WallDynamics();*/ - - mesh.ReactDiffuse(plugin, par.rd_dt); - - - t++; - - Plot(par.resize_stride); - - /*QVector< QPair<double, int> > angles=mesh.VertexAnglesValues(); - QString afname=QString("Angles/anglesvalues%1.dat").arg(t,6,10,QChar('0')); - ofstream af(afname.toStdString().c_str()); - */ - - /*for (QVector< QPair<qreal, int> >::const_iterator v=angles.begin(); - v!=angles.end(); - v++) { - af << v->first << " " << v->second << 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, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'l': - leaffile=strdup(optarg); - if (!leaffile) { - throw("Out of memory"); - } - printf("Reading leaf state file '%s'\n", leaffile); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - - if (optind < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - 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()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) { - - ((Main *)main_window)->show(); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } else { - ((Main *)main_window)->showMaximized(); - } - } else { - main_window=new MainBase(canvas, mesh); - - } - - - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - - - - main_window->Init(leaffile); - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - - - - main_window->Plot(); - - - - if (batch) { - double t=0.; - do { - t = main_window->TimeStep(); - } while (t < par.maxt); - - } else - return app.exec(); - - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - - -// Executed after the cellular mechanics steps have equillibrized -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - c.EnlargeTargetArea(par.cell_expansion_rate); - - if (c.Area() > 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 &color) { } - -// To be executed after cell division -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) {} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/one_acc_point_van3.xml b/data/leaves/one_acc_point_van3.xml deleted file mode 100644 --- a/data/leaves/one_acc_point_van3.xml +++ /dev/null @@ -1,5181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#ifdef QTGRAPHICS -#include "canvas.h" -#include "cell.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> -#endif -#include <unistd.h> -#include <q3textstream.h> -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -//#include "reactions.h" - -//#include "reactions_auxacc.h" -//#include "reactions_pinaux3.h" -//#include "reactions_aux1.h" -//#define REACTIONS_HEADER "reactions_growth.h" -//#include "reactions_tips_nor.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.; - -#ifdef XFIGGRAPHICS -#define TIMESTEP double Graphics::TimeStep(void) -#endif - -//ofstream debug_stream("debug.log"); - -class PrintNode { -public: - void operator() (const Node &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - -/*class SetArea { - public: - void operator() (Cell &c) const { - c.SetTargetArea(4*c.CalcArea()); - c.SetTargetLength(4*c.Length()); - } - - };*/ - -#ifdef XFIGGRAPHICS -class XFigCell { -public: - void operator() (Cell &c,std::ostream &os) const { - c.XFigPrint(os); - } -}; -#endif - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - -#ifdef QTGRAPHICS -class DrawCell { -public: - /*void operator() (Cell &c,Graphics &g) const { - c.Draw(g); - }*/ - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5)\n %6 of PIN1 at walls.\n Area is %7\n PIN sum is %8\n Circumference is %9\n Boundary type is %10").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - // if (m.ShowMeshP()) - // c.DrawNodes(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - //c.DrawTriangles(canvas); - } - //cerr << "Area of cell " << c.Index() << " is " << c.Area() << endl; - } - -}; -#endif - - -const char *xfig_header = "#FIG 3.2\nLandscape\nCenter\nInches\nLetter\n100.00\nSingle\n-2\n1200 2\n"; - -Mesh mesh; -bool batch=false; - - - -#ifdef QTGRAPHICS -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 ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - //mesh.LoopCells( bind2nd (mem_fun_ref( &Cell::DrawWalls), &canvas ) ); - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - // check to see if chemicals emitted by leaf edge diffuse evenly. Yes, they do. - - /* - Vector mesh_centroid = mesh.Centroid(); - Vector first_moment = mesh.FirstConcMoment(0); - - QCanvasEllipse *disk1 = 0; - if (disk1==0) { - disk1 = new QCanvasEllipse ( 50, 50, &canvas ); - disk1->setBrush( QColor("red") ); - disk1->setZ(5); - disk1->show(); - } - - QCanvasEllipse *disk2 = 0; - if (disk2==0) { - disk2=new QCanvasEllipse ( 50, 50, &canvas ); - disk2->setBrush( QColor("blue") ); - disk2->setZ(7); - disk2->show(); - - } - - Vector offset = mesh.Offset(); - double factor = mesh.Factor(); - - disk1 -> move((offset.x+mesh_centroid.x)*factor,(offset.y+mesh_centroid.y)*factor); - disk2 -> move((offset.x+first_moment.x)*factor,(offset.y+first_moment.y)*factor); - - */ - - - 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - //fname << mesh.getTime() << ".xml"; - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < par.storage_stride) { - frame++; - } - // Write XML file every ten plot steps - mesh.XMLSave(fname.str().c_str(), XMLSettingsTree()); - } - - } -} -#endif - -//double areaunit=0; - -void Cell::Flux(double *flux, double *D) { - - // Algorithm according to Rudge & Haseloff 2005 - // (will we need to take cell area into account?) - // For the time being, we don't: assume cell area is - // mainly determined by vacuole. - - // loop over cell edges - - for (int c=0;c<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - // calculate edge length - // (will later be updated during node displacement for efficiency) - //double edge_length = (m->nodes[(*i)->n1]-m->nodes[(*i)->n2]).Norm(); - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - //Cell &circle=mesh.CircularCell(0,0,10,10); - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - //Cell &circle=mesh.LeafPrimordium(10,50); - Cell &circle=mesh.CircularCell(0,0,10,10); - //circle.SetChemical(1,0); - - // petiole is auxin sink - //mesh.getCell(1).SetSource(0,0); - - // petiole becomes provascular cell - //mesh.getCell(1).SetChemical(1,0.6); - - circle.SetTargetArea(circle.CalcArea()); - //circle.SetChemical(2,1e-60); - mesh.SetBaseArea(); - - circle.SetChemical(1, par.Pi_tot ); - circle.SetChemical(0, 0.); - //mesh.LoopCells(EdgeSource()); - } -} - -TIMESTEP { - - static int i=0; - static int t=0; - static int ncells; - - if (!batch) { - UserMessage(QString("Time: %1").arg(mesh.getTimeHours().c_str()),0); - } - - - - //if (!(i%1000)) - //Save(QString("leaf%1.eps").arg(i).ascii(), "PDF"); - - /* static ofstream *kinematic=0; - if (kinematic == 0) { - stringstream kinematic_fname; - kinematic_fname << par.datadir << "/kinematic.dat"; - cerr << "Writing kinematic data to " << kinematic_fname.str() << endl; - - kinematic = new ofstream(kinematic_fname.str().c_str()); - } - - *kinematic << t << " " << i << " " << mesh.Area() << " " << mesh.NCells() << endl; - */ - - ncells=mesh.NCells(); - - - double dh; - //const double en_threshold = 1; - - //mesh.RandomlyLoopCells( mem_fun_ref(&Cell::Displace )); - - //static bool dumpflag=false; - - if(DynamicCellsP()) { - dh = mesh.DisplaceNodes(); - - - //static ofstream enfile("energy.dat"); - //enfile << i << " " << dh << "\n"; - - // Only allow for node insertion, cell division and cell growth - // if the system has equillibrized - // i.e. cell wall tension equillibrization is much faster - // than biological processes, including division, cell wall yielding - // and cell expansion - mesh.InsertNodes(); // (this amounts to cell wall yielding) - - if ( (-dh) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(CellHouseKeeping()); // this includes cell division - - // Reaction diffusion - TransportFunction *transport_f = new AuxinTransport(); - CellReaction *cellreaction_f = new AuxinAndDifferentiation(); - WallReaction *wall_f = new PIN1Localization(); - - mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt); - - - t++; - - Plot(); - } - } else { - - TransportFunction *transport_f = new AuxinTransport(); - CellReaction *cellreaction_f = new AuxinAndDifferentiation(); - WallReaction *wall_f = new PIN1Localization(); - - mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt); - - Plot(); - - } - - - i++; - return mesh.getTime(); - -} - -void Main::Divide(void) { - - static Vector axis(1,0,0); - mesh.IncreaseCellCapacityIfNecessary(); - - mesh.LoopCurrentCells( bind2nd( mem_fun_ref(&Cell::DivideOverAxis),axis) ); - axis=axis.Perp2D(); - //mesh.LoopCells( mem_fun_ref(&Cell::Divide) ); - Plot(); - -} - - -/* Called if a cell is clicked */ -void Cell::OnClick(QMouseEvent *e) { - - cerr << "Calling OnClick()\n"; - /* cerr << *m->boundary_polygon; - //m->RepairBoundaryPolygon(); - //SetChemical(0,par.cellsource); - cerr << "Mesh's centroid: " << m->Centroid() << endl; - cerr << "First moment of chem[0]: " << m->FirstConcMoment(0) << endl; - - */ - /* - cerr << "Cell: " << Index() << ", has walls: "; - - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - cerr << **w << " "; - } - - cerr << endl; - */ - /* cerr << "Cell: " << Index() << ", has neighbors: "; - - for (list<Cell *>::const_iterator c=neighbors.begin(); - c!=neighbors.end(); - c++) { - cerr << (*c)->Index() << " "; - } - - cerr << endl;*/ - - /* - mesh.PrintWallList(); - */ - - double circ=0.; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - cerr << (*w)->N1()->Index() << "->" << (*w)->N2()->Index() << " = " << (*w)->Length() << endl; - circ += (*w)->Length(); - } - cerr << "Circ is " << circ << endl; - - - if (e->button() == Qt::MidButton) { - double sum_pin_bef = getMesh().CalcProtCellsWalls(1); - - QString message(QString("Dividing Cell %1").arg(index)); - ((Main *)main_window)->UserMessage(message); - cerr << message.toStdString(); - Divide(); - ((Main *)main_window)->Plot(); - - double sum_pin_aft = getMesh().CalcProtCellsWalls(1); - - cerr << "Sum PIN1, before: " << sum_pin_bef << ", after: " << sum_pin_aft << endl; - return; - } - if (e->button() == Qt::LeftButton) { - //double sum_walls=0.; - cerr << "Wall lengths: "; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - //cerr << (*w)->getTransporter(this, 1) << " "; - cerr << (*w)->Length() << " "; - //sum_walls+=(*w)->getTransporter(this, 1); //* (*w)->Length(); - } - - cerr << ", Chemical(1) = " << Chemical(1) << ", sum = " << SumTransporters(1) + Chemical(1) << endl; - - QString message; - message=QString("Cell %1 has chemicals ( %2, %3, %4, %5), and it has %6 of PIN1 at its walls. Area is %7").arg(Index()).arg(chem[0]).arg(chem[1]).arg(chem[2]).arg(chem[3]).arg(SumTransporters(1)).arg(Area()); - - ((Main *)main_window)->UserMessage(message); - - /* cerr << "Cell " << index << " has chemicals ( " << chem[0] << ", " << chem[1] << " ) " << endl; - - cerr << "Cell " << index << "'s amount of PIN1 at the walls: " << SumTransporters(1) << endl;*/ -#ifdef QTGRAPHICS - /* double sum_PIN1 = Chemical(4); - - for (list<Wall *>::const_iterator i = walls.begin(); - i!=walls.end(); - i++) { - sum_PIN1 += (*i)->getTransporter(this, 0); - } - */ - - //main_window->UserMessage(QString("Concentration chemical 0 of cell %1 = %2").arg(Index()).arg(chem[0])); - //main_window->UserMessage(QString("Target area of cell %1 = %2").arg(Index()).arg(TargetArea())); - //main_window->UserMessage(QString("Sum PIN1 of cell %1 = %2 (intracellular %3)").arg(Index()).arg(sum_PIN1).arg(Chemical(4))); - - /* QString message; - message=QString("Cell %1's nodes are:").arg(Index()); - - for (list<int>::iterator it=neighbors.begin(); - it!=neighbors.end(); - it++) { - message += QString(" %2").arg(*it); - } - - main_window->UserMessage(message);*/ - - //SetWallLengths(); - //main_window->UserMessage(QString("Cell %1 apoptoses.").arg(Index())); - //Apoptose(); - //m->CleanUpCellNodeLists(); -#ifdef HAVE_QWT - QStringList curvenames; - curvenames += QString("Auxin"); - curvenames += QString("PIN1"); - curvenames += QString("AUX1"); - curvenames += QString("Wall PIN1"); - PlotDialog *plot = new PlotDialog((Main *)main_window, QString("Monitor for Cell %1").arg(Index()), curvenames); - QObject::connect(this, SIGNAL(ChemMonValue(double, double *)), - plot, SLOT(AddValue(double,double *))); -#endif - } else { - //Divide(); - } -#endif -} - - - // Set sum of PIN1 back to Pi_tot. Hence we assume the cell maintain a constant level of Pi. - -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) { - - //cerr << "Calling Cell::OnDivide()" << endl; - - // PIN1 distributes between parent and daughter according to area - double area = Area(), daughter_area = daughter.Area(); - double tot_area = area + daughter_area; - - //chem[1]*=(area/tot_area); - //daughter.chem[1]*=(daughter_area/tot_area); - - // For lack of detailed data, or a better rule, we assume that cells remain polarized - // after division - - // So the PIN1 is redistributed according to the original polarization over the walls - - // parent_info contains info about the parent - // redistribute the PIN in the endosome according to area - - chem[1] = parent_info.PINendosome*(area/tot_area); - daughter.chem[1] = parent_info.PINendosome*(daughter_area/tot_area); - - // Now redistribute the membrane PINs according to the original polarization in the parent - // mmm... I'd like to have a better, biologically motivated rule for this, - // but for lack of something better... I hope I'm excused :-). Let's say the overall - // organization of the actin fibres is not completely destroyed after division... - - // distribute wallPINs according to the circumference of the parent and daughter - double circ = Circumference( ); - double daughter_circ = daughter.Circumference(); - double tot_circ = circ + daughter_circ; - - double wallPINs = (circ / tot_circ) * parent_info.PINmembrane; - double daughter_wallPINs = (daughter_circ / tot_circ) * parent_info.PINmembrane; - - //cerr << "wallPINs = " << wallPINs << ", daughter_wallPINs = " << daughter_wallPINs << "sum = " << wallPINs + daughter_wallPINs << ", PINmembrane = " << parent_info.PINmembrane << endl; - // distrubute it according to the overall polarity - Vector polarization = parent_info.polarization.Normalised().Perp2D(); - - double sum=0.; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - - // distribute according to angle (0 degrees: maximum, 180 degrees minimum) - double tmp=InnerProduct((*w)->getWallVector(this),polarization); // move domain from [-1,1] to [0,1] - - //cerr << "[" << tmp << "]"; - sum+=tmp; - //(*w)->setTransporter(this, 1, - } - - //cerr << "Sum is " << sum << endl; - //double sum_wall_Pi = SumTransporters(1); - - // After division, cells produce PIN1 (in intracellular storage) until total amount becomes Pi_tot - //SetChemical(1, par.Pi_tot - sum_wall_Pi ); - //SetNewChem(1, Chemical(1)); - - //cerr << "[ " << sum_wall_Pi + Chemical(1) << "]"; -} - -void Wall::OnWallInsert(void) { - - // NOTE: THIS FUNCTION IS CALLED AFTER Cell::OnDivide(); - // After division, we put some PIN1 on the walls, to prevent quick - // redistribution of PIN1s and consequent auxin accumulation after - // division. - - // make sure dPij/dt = 0 at both sides of the new wall. - - // True for: - // Pij = k1/k2 * A_j * L_ij * P_i - // Pji = k1/k2 * A_i * L_ij * P_j - - //transporters1[1] = (par.k1/par.k2) * c2->Chemical(0) * length * c1->Chemical(1); - //transporters2[1] = (par.k1/par.k2) * c1->Chemical(0) * length * c2->Chemical(1); - - //transporters1[1]=transporters2[1]=0.; - // cerr << "Length of new wall is " << length << endl; - //cerr << "PIN1 is [ " << transporters1[1] << " | " << transporters2[1] << "] "; -} - - - - -int main(int argc,char **argv) { - - try { - - //if (argc<2 || strstr(argv[1],".par")==0) { - // throw "Usage: Leaf [parfile].par"; - //} - //par.Read(argv[1]); - - // parse command-line options - - int c; - //int digit_optind = 0; - - char *parfile=0; - char *leaffile=0; - /* ofstream args("args.txt"); - for (int i=0;i<argc;i++) { - args << argv[i] << endl; - }*/ - - while (1) { - - //int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = { - {"batch", 0, 0, 0}, - {"par", 1, 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 = "bP:l"; - c = getopt_long (argc, argv, "bP:l:", - long_options, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'p': - parfile=strdup(optarg); - if (!parfile) { - throw("Out of memory"); - } - printf ("parameter file is '%s'\n", parfile); - - 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 < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - -#ifdef X11GRAPHICS - X11Graphics g(par.sizex,par.sizey); - g.ChangeTitle("Virtual Leaf"); -#endif -#ifdef QTGRAPHICS - //QApplication app(argc, argv); - - //argc=1; - QCoreApplication *app; - - QGraphicsScene canvas(0,0,8000,6000); - - QPalette tooltippalette = QToolTip::palette(); - QColor transparentcolor = QColor(tooltippalette.brush(QPalette::Window).color()); - //transparentcolor.setAlphaF(0.9); - - tooltippalette.setBrush (QPalette::Window, QBrush (transparentcolor) ); - QToolTip::setPalette( tooltippalette ); - - if (batch) { - // Note: QCoreApplication allows for command line applications, independent of X-Server on Unix. - // Allows for running on cluster - app = new QCoreApplication(argc,argv); - main_window=new MainBase(canvas, mesh); - } else { - app = new QApplication(argc,argv); - main_window=new Main(canvas, mesh); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } - - - if (!batch) { - if ( QApplication::desktop()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) - ((Main *)main_window)->show(); - else - ((Main *)main_window)->showMaximized(); - } - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - // return app.exec(); -#endif - - if (parfile) - par.Read(parfile); - - //else - // par.Read("default.par"); - Seed(par.rseed); - -#ifdef XFIGGRAPHICS - Graphics g; -#endif - - - main_window->Init(leaffile); - - // if we have supplied a leaffile AND a parfile, reread the parameter file, - // because the leaffile also contains parameter information - if (leaffile && parfile) { - par.Read(parfile); - } - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - -#ifdef QTGRAPHICS - - // check if leaf crosses boundary - /* Vector bbll,bbur; - mesh.BoundingBox(bbll,bbur); - - double scale_x = canvas.width()/(bbur.x-bbll.x); - double scale_y = canvas.height()/(bbur.y-bbll.y); - - Cell::Scale(scale_x<scale_y ? scale_x:scale_y); // smallest of scale_x and scale_y - - double offset_x = (canvas.width()/Cell::Magnification()-(bbur.x-bbll.x))/2.; - double offset_y = (canvas.height()/Cell::Magnification()-(bbur.y-bbll.y))/2.; - Cell::setOffset(offset_x, offset_y); - */ - /* Vector bbll,bbur; - mesh.BoundingBox(bbll,bbur); - cerr << "bbll = " << bbll << endl; - cerr << "bbur = " << bbur << endl; - double cw = (bbur.x - bbll.x); - double ch = (bbur.y - bbll.y); - double factor = canvas.width()/(2*cw); - cerr << "factor = " << factor << ", width = " << canvas.width() << endl; - cerr << "Size is " << cw << " x " << ch << endl; - canvas.resize((int)(2*cw*factor),(int)(2*ch*factor)); - Cell::SetMagnification(factor); - //main_window->scale(factor); - //Cell::Translate(-bbll.x+cw/2,-bbll.y+ch/2); - cerr << -bbll.x+cw/2 << ", " << -bbll.y+ch/2 << ", " << canvas.width() << ", " << canvas.height() << endl; - Cell::Translate((-bbll.x+cw/2),(-bbll.y+ch/2)); - */ - - - main_window->Plot(); - - -#endif - -#ifdef QTGRAPHICS - if (batch) { - //main_window->toggleMovieFrames(); - //main_window->toggleShowNodes(); - //for (int i=0;i<par.nit;i++) { - double t=0.; - do { - t = main_window->TimeStep(); - /* cerr << endl << "***********************************************" << endl; - cerr << "Time is " << t << endl; - cerr << "par.maxt = " << par.maxt << endl; - cerr << endl << "***********************************************" << endl;*/ - } while (t < par.maxt); - - } else - return app->exec(); -#else - //for (int i=0;i<par.nit;i++) { - do { - t= g.TimeStep(); - } while (t < par.maxt); -#endif - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - -extern double auxin_account; -const int Cell::nchem = 4; - -class AuxinTransport : public TransportFunction { - - public: - virtual void operator()(Wall *w, double *dchem_c1, double *dchem_c2) { - // leaf edge is const source of auxin - // (Neumann boundary condition: we specify the influx) - if (w->C2()->BoundaryPolP()) { - if (w->AuxinSource()) { - double aux_flux = par.leaf_tip_source * w->Length(); - dchem_c1[0]+= aux_flux; - - // dchem_c2 is undefined..! - return; - } else { - if (w->AuxinSink()) { - - // efflux into Shoot Apical meristem - // we assume all PINs are directed towards shoot apical meristem - dchem_c1[0] -= par.sam_efflux * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)); - - return; - } else { - - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)) - + par.aux1transport * w->C2()->Chemical(2) * w->C1()->Chemical(0) / (par.kaux1 + w->C1()->Chemical(0)) ); - - // efflux from cell 2 to cell 1 - double trans21 = ( par.transport * w->Transporters2(1) * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)) - + par.aux1transport * w->C1()->Chemical(2) * w->C2()->Chemical(0) / (par.kaux1 + w->C2()->Chemical(0)) ); - - dchem_c1[0] += trans21 - trans12; - dchem_c2[0] += trans12 - trans21; - return; - } - - } - } - - - if (w->C1()->BoundaryPolP()) { - - if (w->AuxinSource()) { - double aux_flux = par.leaf_tip_source * w->Length(); - dchem_c2[0] += aux_flux; - // dchem_c1 is undefined...! - return; - } else { - - if (w->AuxinSink()) { - - - // efflux into Shoot Apical meristem - // we assume all PINs are directed towards shoot apical meristem - - // no passive fluxes: outside is impermeable - - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - // assumption: no AUX1 in shoot apical meristem - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0))); - dchem_c1[0] += - trans12; - - return; - - //dchem_c2[0] -= par.sam_efflux * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)); - - // return; - } else { - - } - } - } - - - // Passive fluxes (Fick's law) - // only auxin flux now - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::NChem();c++) { - double phi = w->Length() * ( par.D[c] ) * ( w->C2()->Chemical(c) - w->C1()->Chemical(c) ); - dchem_c1[c] += phi; - dchem_c2[c] -= phi; - } - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)) - + par.aux1transport * w->C2()->Chemical(2) * w->C1()->Chemical(0) / (par.kaux1 + w->C1()->Chemical(0)) ); - - // efflux from cell 2 to cell 1 - double trans21 = ( par.transport * w->Transporters2(1) * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)) - + par.aux1transport * w->C1()->Chemical(2) * w->C2()->Chemical(0) / (par.kaux1 + w->C2()->Chemical(0)) ); - - dchem_c1[0] += trans21 - trans12; - dchem_c2[0] += trans12 - trans21; - - } -}; - -class PIN1Localization : public WallReaction { - - public: - virtual void operator()(Wall *w, double *dw1, double *dw2) { - - - - // Cells polarize available PIN1 to Shoot Apical Meristem - if (w->C2()->BoundaryPolP()) { - if (w->AuxinSink()) { - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - // assume high auxin concentration in SAM, to convince PIN1 to polarize to it - // exocytosis regulated0 - double nb_auxin = par.sam_auxin; - double receptor_level = nb_auxin * par.r / (par.kr + nb_auxin); - - dw1[1] = par.k1 * w->C1()->Chemical(1) * receptor_level /( par.km + w->C1()->Chemical(1) ) - par.k2 * w->Transporters1(1); - - dw2[1] = 0.; - return; - - } else { - dw1[0]=dw2[0]=dw1[1]=dw2[1]=dw1[2]=dw2[2]; - return; - } - } - - if (w->C1()->BoundaryPolP()) { - if (w->AuxinSink()) { - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - // assume high auxin concentration in SAM, to convince PIN1 to polarize to it - // exocytosis regulated - double nb_auxin = par.sam_auxin; - double receptor_level = nb_auxin * par.r / (par.kr + nb_auxin); - dw2[1] = par.k1 * w->C2()->Chemical(1) * receptor_level /( par.km + w->C2()->Chemical(1) ) - par.k2 * w->Transporters2(1); - - dw1[1] = 0.; - return; - - } else { - dw1[0]=dw2[0]=dw1[1]=dw2[1]=dw1[2]=dw2[2]; - return; - } - } - - - - // PIN1 localization at wall 1 - // Note: chemical 0 is Auxin (intracellular storage only) - // Chemical 1 is PIN1 (walls and intracellular storage) - //! \f$ \frac{d Pij/dt}{dt} = k_1 A_j \frac{P_i}{L_ij} - k_2 P_{ij} \f$ - // Note that Pij is measured in term of concentration (mol/L) - // Pi in terms of quantity (mol) - - double dPijdt1=0., dPijdt2=0.; - - // normal cell - double auxin2 = w->C2()->Chemical(0); - double receptor_level1 = auxin2 * par.r / (par.kr + auxin2); - - dPijdt1 = - // exocytosis regulated - par.k1 * w->C1()->Chemical(1) * receptor_level1 / ( par.km + w->C1()->Chemical(1) ) - par.k2 * w->Transporters1(1); - - double auxin1 = w->C1()->Chemical(0); - double receptor_level2 = auxin1 * par.r / (par.kr + auxin1); - - // normal cell - dPijdt2 = - - // exocytosis regulated - par.k1 * w->C2()->Chemical(1) * receptor_level2 / ( par.km + w->C2()->Chemical(1) ) - par.k2 * w->Transporters2(1); - - /* PIN1 of neighboring vascular cell inhibits PIN1 endocytosis */ - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - dw1[1] = dPijdt1; - dw2[1] = dPijdt2; - - } -}; - - -inline double YlPilPli(Cell &here, Cell &nb, Wall &w) { - return nb.Chemical(2) * w.Transporters1(1) * w.Transporters2(1); -} - -inline double AlPil(Cell &here, Cell &nb, Wall &w) { - return nb.Chemical(0) * w.getTransporter( &here, 1 ); -} - -inline double AlplusYlLil(Cell &here, Cell &nb, Wall &w) { - return ( nb.Chemical(0) + nb.Chemical(2) ) * w.Length(); -} - -inline double AlLil(Cell &here, Cell &nb, Wall &w) { - return ( nb.Chemical(0) ) * w.Length(); -} - -inline double Lil(Cell &here, Cell &nb, Wall &w) { - return w.Length(); -} - -inline double complex_PijAj(Cell &here, Cell &nb, Wall &w) { - - // gives the amount of complex "auxinreceptor-Pin1" at the wall (at QSS) - //return here.Chemical(1) * nb.Chemical(0) / ( par.km + here.Chemical(1)); - - double nb_aux = (nb.BoundaryPolP() && w.AuxinSink()) ? par.sam_auxin : nb.Chemical(0); - double receptor_level = nb_aux * par.r / (par.kr + nb_aux); - - return here.Chemical(1) * receptor_level / ( par.km + here.Chemical(1)); - -} - -class AuxinAndDifferentiation : public CellReaction { - - // Note: Pi and Pij measured in numbers of molecules, not concentrations - public: - virtual void operator()(Cell *c, double *dchem) { - - double dPidt = 0.; - - double sum_Pij = c->SumTransporters( 1 ); - - // exocytosis regulated: - // van3 expression reduces rate of PIN1 endocytosis - dPidt = -par.k1 * c->ReduceCellAndWalls<double>( complex_PijAj ) + - (c->Chemical(3) < 0.5 ? par.k2 : par.k2van3) * sum_Pij; - - // production of PIN depends on auxin concentration - dPidt += (c->AtBoundaryP()?par.pin_prod_in_epidermis:par.pin_prod) * c->Chemical(0) - c->Chemical(1) * par.pin_breakdown; - - /*if (c->AtBoundaryP()) { - dchem[2] = 0.01; - //cerr << "Making cell blue.\n"; - } else { - dchem[2] = -0.1 * c->Chemical(2); - }*/ - - // no PIN production in SAM - if (c->Boundary() == Cell::SAM) { - dchem[1]=0.; - dchem[0]= - par.sam_auxin_breakdown * c->Chemical(0); - dchem[2]=0.; - } else { - - dchem[1] = dPidt; - - - // source of auxin - dchem[0] = par.aux_cons; - - // auxin-induced AUX1 production, in the epidermis - dchem[2] = ( c->AtBoundaryP() ? par.aux1prod : par.aux1prodmeso ) * ( c->Chemical(0) / ( 1. + par.kap * c->Chemical(0) ) ) - par.aux1decay * c->Chemical(2) ;//: 0.; - - // auxin-induced production of VAN-3? Autokatalysis? - //dchem[3] = par.van3prod * (c->Chemical(0) / (1. + par.kvp * c-> Chemical(0) ) ) - double A = c->Chemical(0); - double van3 = c->Chemical(3); - dchem[3] = par.van3prod * A - par.van3autokat * van3 + van3*van3/(1 + par.van3sat * van3*van3 ); - } - } - -}; - - - - -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - if (c.Boundary()==Cell::None) { - c.CheckForDivision(); - - // expand if this is not a provascular cell - if (c.Chemical(3) < 0.7 ) { - c.EnlargeTargetArea(par.cell_expansion_rate); - } - } - } -}; - -void Cell::SetColor(QColor &color) { - - // Red: AUX1 - // Green: Auxin - // Blue: van-3 - color.setRgb(chem[2]/(1+chem[2]) * 255.,(chem[0]/(1+chem[0]) * 255.),(chem[3]/(1+chem[3]) *255.) ); - -} - -void Cell::CheckForDivision(void) { - // if (/* Chemical(0)<0.4 && */ /* differentiated cells do not divide */ area > 2*base_area /* || Length()>50 */) { - - if (Chemical(0) > par.morphogen_div_threshold ) - if (area > par.rel_cell_div_threshold * base_area ) { - /* remark no longer valid? //m->IncreaseCellCapacityIfNecessary(); - // Note that calling Divide as follows prevents trouble if cell - // vector is relocated */ - Divide(); - } - -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/one_acc_point_van3_growth.xml b/data/leaves/one_acc_point_van3_growth.xml deleted file mode 100644 --- a/data/leaves/one_acc_point_van3_growth.xml +++ /dev/null @@ -1,5181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#ifdef QTGRAPHICS -#include "canvas.h" -#include "cell.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> -#endif -#include <unistd.h> -#include <q3textstream.h> -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -//#include "reactions.h" - -//#include "reactions_auxacc.h" -//#include "reactions_pinaux3.h" -//#include "reactions_aux1.h" -//#define REACTIONS_HEADER "reactions_growth.h" -//#include "reactions_tips_nor.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.; - -#ifdef XFIGGRAPHICS -#define TIMESTEP double Graphics::TimeStep(void) -#endif - -//ofstream debug_stream("debug.log"); - -class PrintNode { -public: - void operator() (const Node &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - -/*class SetArea { - public: - void operator() (Cell &c) const { - c.SetTargetArea(4*c.CalcArea()); - c.SetTargetLength(4*c.Length()); - } - - };*/ - -#ifdef XFIGGRAPHICS -class XFigCell { -public: - void operator() (Cell &c,std::ostream &os) const { - c.XFigPrint(os); - } -}; -#endif - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - -#ifdef QTGRAPHICS -class DrawCell { -public: - /*void operator() (Cell &c,Graphics &g) const { - c.Draw(g); - }*/ - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5)\n %6 of PIN1 at walls.\n Area is %7\n PIN sum is %8\n Circumference is %9\n Boundary type is %10").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - // if (m.ShowMeshP()) - // c.DrawNodes(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - //c.DrawTriangles(canvas); - } - //cerr << "Area of cell " << c.Index() << " is " << c.Area() << endl; - } - -}; -#endif - - -const char *xfig_header = "#FIG 3.2\nLandscape\nCenter\nInches\nLetter\n100.00\nSingle\n-2\n1200 2\n"; - -Mesh mesh; -bool batch=false; - - - -#ifdef QTGRAPHICS -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 ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - //mesh.LoopCells( bind2nd (mem_fun_ref( &Cell::DrawWalls), &canvas ) ); - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - // check to see if chemicals emitted by leaf edge diffuse evenly. Yes, they do. - - /* - Vector mesh_centroid = mesh.Centroid(); - Vector first_moment = mesh.FirstConcMoment(0); - - QCanvasEllipse *disk1 = 0; - if (disk1==0) { - disk1 = new QCanvasEllipse ( 50, 50, &canvas ); - disk1->setBrush( QColor("red") ); - disk1->setZ(5); - disk1->show(); - } - - QCanvasEllipse *disk2 = 0; - if (disk2==0) { - disk2=new QCanvasEllipse ( 50, 50, &canvas ); - disk2->setBrush( QColor("blue") ); - disk2->setZ(7); - disk2->show(); - - } - - Vector offset = mesh.Offset(); - double factor = mesh.Factor(); - - disk1 -> move((offset.x+mesh_centroid.x)*factor,(offset.y+mesh_centroid.y)*factor); - disk2 -> move((offset.x+first_moment.x)*factor,(offset.y+first_moment.y)*factor); - - */ - - - 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - //fname << mesh.getTime() << ".xml"; - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < par.storage_stride) { - frame++; - } - // Write XML file every ten plot steps - mesh.XMLSave(fname.str().c_str(), XMLSettingsTree()); - } - - } -} -#endif - -//double areaunit=0; - -void Cell::Flux(double *flux, double *D) { - - // Algorithm according to Rudge & Haseloff 2005 - // (will we need to take cell area into account?) - // For the time being, we don't: assume cell area is - // mainly determined by vacuole. - - // loop over cell edges - - for (int c=0;c<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - // calculate edge length - // (will later be updated during node displacement for efficiency) - //double edge_length = (m->nodes[(*i)->n1]-m->nodes[(*i)->n2]).Norm(); - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - //Cell &circle=mesh.CircularCell(0,0,10,10); - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - //Cell &circle=mesh.LeafPrimordium(10,50); - Cell &circle=mesh.CircularCell(0,0,10,10); - //circle.SetChemical(1,0); - - // petiole is auxin sink - //mesh.getCell(1).SetSource(0,0); - - // petiole becomes provascular cell - //mesh.getCell(1).SetChemical(1,0.6); - - circle.SetTargetArea(circle.CalcArea()); - //circle.SetChemical(2,1e-60); - mesh.SetBaseArea(); - - circle.SetChemical(1, par.Pi_tot ); - circle.SetChemical(0, 0.); - //mesh.LoopCells(EdgeSource()); - } -} - -TIMESTEP { - - static int i=0; - static int t=0; - static int ncells; - - if (!batch) { - UserMessage(QString("Time: %1").arg(mesh.getTimeHours().c_str()),0); - } - - - - //if (!(i%1000)) - //Save(QString("leaf%1.eps").arg(i).ascii(), "PDF"); - - /* static ofstream *kinematic=0; - if (kinematic == 0) { - stringstream kinematic_fname; - kinematic_fname << par.datadir << "/kinematic.dat"; - cerr << "Writing kinematic data to " << kinematic_fname.str() << endl; - - kinematic = new ofstream(kinematic_fname.str().c_str()); - } - - *kinematic << t << " " << i << " " << mesh.Area() << " " << mesh.NCells() << endl; - */ - - ncells=mesh.NCells(); - - - double dh; - //const double en_threshold = 1; - - //mesh.RandomlyLoopCells( mem_fun_ref(&Cell::Displace )); - - //static bool dumpflag=false; - - if(DynamicCellsP()) { - dh = mesh.DisplaceNodes(); - - - //static ofstream enfile("energy.dat"); - //enfile << i << " " << dh << "\n"; - - // Only allow for node insertion, cell division and cell growth - // if the system has equillibrized - // i.e. cell wall tension equillibrization is much faster - // than biological processes, including division, cell wall yielding - // and cell expansion - mesh.InsertNodes(); // (this amounts to cell wall yielding) - - if ( (-dh) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(CellHouseKeeping()); // this includes cell division - - // Reaction diffusion - TransportFunction *transport_f = new AuxinTransport(); - CellReaction *cellreaction_f = new AuxinAndDifferentiation(); - WallReaction *wall_f = new PIN1Localization(); - - mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt); - - - t++; - - Plot(); - } - } else { - - TransportFunction *transport_f = new AuxinTransport(); - CellReaction *cellreaction_f = new AuxinAndDifferentiation(); - WallReaction *wall_f = new PIN1Localization(); - - mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt); - - Plot(); - - } - - - i++; - return mesh.getTime(); - -} - -void Main::Divide(void) { - - static Vector axis(1,0,0); - mesh.IncreaseCellCapacityIfNecessary(); - - mesh.LoopCurrentCells( bind2nd( mem_fun_ref(&Cell::DivideOverAxis),axis) ); - axis=axis.Perp2D(); - //mesh.LoopCells( mem_fun_ref(&Cell::Divide) ); - Plot(); - -} - - -/* Called if a cell is clicked */ -void Cell::OnClick(QMouseEvent *e) { - - cerr << "Calling OnClick()\n"; - /* cerr << *m->boundary_polygon; - //m->RepairBoundaryPolygon(); - //SetChemical(0,par.cellsource); - cerr << "Mesh's centroid: " << m->Centroid() << endl; - cerr << "First moment of chem[0]: " << m->FirstConcMoment(0) << endl; - - */ - /* - cerr << "Cell: " << Index() << ", has walls: "; - - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - cerr << **w << " "; - } - - cerr << endl; - */ - /* cerr << "Cell: " << Index() << ", has neighbors: "; - - for (list<Cell *>::const_iterator c=neighbors.begin(); - c!=neighbors.end(); - c++) { - cerr << (*c)->Index() << " "; - } - - cerr << endl;*/ - - /* - mesh.PrintWallList(); - */ - - double circ=0.; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - cerr << (*w)->N1()->Index() << "->" << (*w)->N2()->Index() << " = " << (*w)->Length() << endl; - circ += (*w)->Length(); - } - cerr << "Circ is " << circ << endl; - - - if (e->button() == Qt::MidButton) { - double sum_pin_bef = getMesh().CalcProtCellsWalls(1); - - QString message(QString("Dividing Cell %1").arg(index)); - ((Main *)main_window)->UserMessage(message); - cerr << message.toStdString(); - Divide(); - ((Main *)main_window)->Plot(); - - double sum_pin_aft = getMesh().CalcProtCellsWalls(1); - - cerr << "Sum PIN1, before: " << sum_pin_bef << ", after: " << sum_pin_aft << endl; - return; - } - if (e->button() == Qt::LeftButton) { - //double sum_walls=0.; - cerr << "Wall lengths: "; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - //cerr << (*w)->getTransporter(this, 1) << " "; - cerr << (*w)->Length() << " "; - //sum_walls+=(*w)->getTransporter(this, 1); //* (*w)->Length(); - } - - cerr << ", Chemical(1) = " << Chemical(1) << ", sum = " << SumTransporters(1) + Chemical(1) << endl; - - QString message; - message=QString("Cell %1 has chemicals ( %2, %3, %4, %5), and it has %6 of PIN1 at its walls. Area is %7").arg(Index()).arg(chem[0]).arg(chem[1]).arg(chem[2]).arg(chem[3]).arg(SumTransporters(1)).arg(Area()); - - ((Main *)main_window)->UserMessage(message); - - /* cerr << "Cell " << index << " has chemicals ( " << chem[0] << ", " << chem[1] << " ) " << endl; - - cerr << "Cell " << index << "'s amount of PIN1 at the walls: " << SumTransporters(1) << endl;*/ -#ifdef QTGRAPHICS - /* double sum_PIN1 = Chemical(4); - - for (list<Wall *>::const_iterator i = walls.begin(); - i!=walls.end(); - i++) { - sum_PIN1 += (*i)->getTransporter(this, 0); - } - */ - - //main_window->UserMessage(QString("Concentration chemical 0 of cell %1 = %2").arg(Index()).arg(chem[0])); - //main_window->UserMessage(QString("Target area of cell %1 = %2").arg(Index()).arg(TargetArea())); - //main_window->UserMessage(QString("Sum PIN1 of cell %1 = %2 (intracellular %3)").arg(Index()).arg(sum_PIN1).arg(Chemical(4))); - - /* QString message; - message=QString("Cell %1's nodes are:").arg(Index()); - - for (list<int>::iterator it=neighbors.begin(); - it!=neighbors.end(); - it++) { - message += QString(" %2").arg(*it); - } - - main_window->UserMessage(message);*/ - - //SetWallLengths(); - //main_window->UserMessage(QString("Cell %1 apoptoses.").arg(Index())); - //Apoptose(); - //m->CleanUpCellNodeLists(); -#ifdef HAVE_QWT - QStringList curvenames; - curvenames += QString("Auxin"); - curvenames += QString("PIN1"); - curvenames += QString("AUX1"); - curvenames += QString("Wall PIN1"); - PlotDialog *plot = new PlotDialog((Main *)main_window, QString("Monitor for Cell %1").arg(Index()), curvenames); - QObject::connect(this, SIGNAL(ChemMonValue(double, double *)), - plot, SLOT(AddValue(double,double *))); -#endif - } else { - //Divide(); - } -#endif -} - - - // Set sum of PIN1 back to Pi_tot. Hence we assume the cell maintain a constant level of Pi. - -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) { - - //cerr << "Calling Cell::OnDivide()" << endl; - - // PIN1 distributes between parent and daughter according to area - double area = Area(), daughter_area = daughter.Area(); - double tot_area = area + daughter_area; - - //chem[1]*=(area/tot_area); - //daughter.chem[1]*=(daughter_area/tot_area); - - // For lack of detailed data, or a better rule, we assume that cells remain polarized - // after division - - // So the PIN1 is redistributed according to the original polarization over the walls - - // parent_info contains info about the parent - // redistribute the PIN in the endosome according to area - - chem[1] = parent_info.PINendosome*(area/tot_area); - daughter.chem[1] = parent_info.PINendosome*(daughter_area/tot_area); - - // Now redistribute the membrane PINs according to the original polarization in the parent - // mmm... I'd like to have a better, biologically motivated rule for this, - // but for lack of something better... I hope I'm excused :-). Let's say the overall - // organization of the actin fibres is not completely destroyed after division... - - // distribute wallPINs according to the circumference of the parent and daughter - double circ = Circumference( ); - double daughter_circ = daughter.Circumference(); - double tot_circ = circ + daughter_circ; - - double wallPINs = (circ / tot_circ) * parent_info.PINmembrane; - double daughter_wallPINs = (daughter_circ / tot_circ) * parent_info.PINmembrane; - - //cerr << "wallPINs = " << wallPINs << ", daughter_wallPINs = " << daughter_wallPINs << "sum = " << wallPINs + daughter_wallPINs << ", PINmembrane = " << parent_info.PINmembrane << endl; - // distrubute it according to the overall polarity - Vector polarization = parent_info.polarization.Normalised().Perp2D(); - - double sum=0.; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - - // distribute according to angle (0 degrees: maximum, 180 degrees minimum) - double tmp=InnerProduct((*w)->getWallVector(this),polarization); // move domain from [-1,1] to [0,1] - - //cerr << "[" << tmp << "]"; - sum+=tmp; - //(*w)->setTransporter(this, 1, - } - - //cerr << "Sum is " << sum << endl; - //double sum_wall_Pi = SumTransporters(1); - - // After division, cells produce PIN1 (in intracellular storage) until total amount becomes Pi_tot - //SetChemical(1, par.Pi_tot - sum_wall_Pi ); - //SetNewChem(1, Chemical(1)); - - //cerr << "[ " << sum_wall_Pi + Chemical(1) << "]"; -} - -void Wall::OnWallInsert(void) { - - // NOTE: THIS FUNCTION IS CALLED AFTER Cell::OnDivide(); - // After division, we put some PIN1 on the walls, to prevent quick - // redistribution of PIN1s and consequent auxin accumulation after - // division. - - // make sure dPij/dt = 0 at both sides of the new wall. - - // True for: - // Pij = k1/k2 * A_j * L_ij * P_i - // Pji = k1/k2 * A_i * L_ij * P_j - - //transporters1[1] = (par.k1/par.k2) * c2->Chemical(0) * length * c1->Chemical(1); - //transporters2[1] = (par.k1/par.k2) * c1->Chemical(0) * length * c2->Chemical(1); - - //transporters1[1]=transporters2[1]=0.; - // cerr << "Length of new wall is " << length << endl; - //cerr << "PIN1 is [ " << transporters1[1] << " | " << transporters2[1] << "] "; -} - - - - -int main(int argc,char **argv) { - - try { - - //if (argc<2 || strstr(argv[1],".par")==0) { - // throw "Usage: Leaf [parfile].par"; - //} - //par.Read(argv[1]); - - // parse command-line options - - int c; - //int digit_optind = 0; - - char *parfile=0; - char *leaffile=0; - /* ofstream args("args.txt"); - for (int i=0;i<argc;i++) { - args << argv[i] << endl; - }*/ - - while (1) { - - //int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = { - {"batch", 0, 0, 0}, - {"par", 1, 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 = "bP:l"; - c = getopt_long (argc, argv, "bP:l:", - long_options, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'p': - parfile=strdup(optarg); - if (!parfile) { - throw("Out of memory"); - } - printf ("parameter file is '%s'\n", parfile); - - 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 < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - -#ifdef X11GRAPHICS - X11Graphics g(par.sizex,par.sizey); - g.ChangeTitle("Virtual Leaf"); -#endif -#ifdef QTGRAPHICS - //QApplication app(argc, argv); - - //argc=1; - QCoreApplication *app; - - QGraphicsScene canvas(0,0,8000,6000); - - QPalette tooltippalette = QToolTip::palette(); - QColor transparentcolor = QColor(tooltippalette.brush(QPalette::Window).color()); - //transparentcolor.setAlphaF(0.9); - - tooltippalette.setBrush (QPalette::Window, QBrush (transparentcolor) ); - QToolTip::setPalette( tooltippalette ); - - if (batch) { - // Note: QCoreApplication allows for command line applications, independent of X-Server on Unix. - // Allows for running on cluster - app = new QCoreApplication(argc,argv); - main_window=new MainBase(canvas, mesh); - } else { - app = new QApplication(argc,argv); - main_window=new Main(canvas, mesh); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } - - - if (!batch) { - if ( QApplication::desktop()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) - ((Main *)main_window)->show(); - else - ((Main *)main_window)->showMaximized(); - } - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - // return app.exec(); -#endif - - if (parfile) - par.Read(parfile); - - //else - // par.Read("default.par"); - Seed(par.rseed); - -#ifdef XFIGGRAPHICS - Graphics g; -#endif - - - main_window->Init(leaffile); - - // if we have supplied a leaffile AND a parfile, reread the parameter file, - // because the leaffile also contains parameter information - if (leaffile && parfile) { - par.Read(parfile); - } - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - -#ifdef QTGRAPHICS - - // check if leaf crosses boundary - /* Vector bbll,bbur; - mesh.BoundingBox(bbll,bbur); - - double scale_x = canvas.width()/(bbur.x-bbll.x); - double scale_y = canvas.height()/(bbur.y-bbll.y); - - Cell::Scale(scale_x<scale_y ? scale_x:scale_y); // smallest of scale_x and scale_y - - double offset_x = (canvas.width()/Cell::Magnification()-(bbur.x-bbll.x))/2.; - double offset_y = (canvas.height()/Cell::Magnification()-(bbur.y-bbll.y))/2.; - Cell::setOffset(offset_x, offset_y); - */ - /* Vector bbll,bbur; - mesh.BoundingBox(bbll,bbur); - cerr << "bbll = " << bbll << endl; - cerr << "bbur = " << bbur << endl; - double cw = (bbur.x - bbll.x); - double ch = (bbur.y - bbll.y); - double factor = canvas.width()/(2*cw); - cerr << "factor = " << factor << ", width = " << canvas.width() << endl; - cerr << "Size is " << cw << " x " << ch << endl; - canvas.resize((int)(2*cw*factor),(int)(2*ch*factor)); - Cell::SetMagnification(factor); - //main_window->scale(factor); - //Cell::Translate(-bbll.x+cw/2,-bbll.y+ch/2); - cerr << -bbll.x+cw/2 << ", " << -bbll.y+ch/2 << ", " << canvas.width() << ", " << canvas.height() << endl; - Cell::Translate((-bbll.x+cw/2),(-bbll.y+ch/2)); - */ - - - main_window->Plot(); - - -#endif - -#ifdef QTGRAPHICS - if (batch) { - //main_window->toggleMovieFrames(); - //main_window->toggleShowNodes(); - //for (int i=0;i<par.nit;i++) { - double t=0.; - do { - t = main_window->TimeStep(); - /* cerr << endl << "***********************************************" << endl; - cerr << "Time is " << t << endl; - cerr << "par.maxt = " << par.maxt << endl; - cerr << endl << "***********************************************" << endl;*/ - } while (t < par.maxt); - - } else - return app->exec(); -#else - //for (int i=0;i<par.nit;i++) { - do { - t= g.TimeStep(); - } while (t < par.maxt); -#endif - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - -extern double auxin_account; -const int Cell::nchem = 4; - -class AuxinTransport : public TransportFunction { - - public: - virtual void operator()(Wall *w, double *dchem_c1, double *dchem_c2) { - // leaf edge is const source of auxin - // (Neumann boundary condition: we specify the influx) - if (w->C2()->BoundaryPolP()) { - if (w->AuxinSource()) { - double aux_flux = par.leaf_tip_source * w->Length(); - dchem_c1[0]+= aux_flux; - - // dchem_c2 is undefined..! - return; - } else { - if (w->AuxinSink()) { - - // efflux into Shoot Apical meristem - // we assume all PINs are directed towards shoot apical meristem - dchem_c1[0] -= par.sam_efflux * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)); - - return; - } else { - - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)) - + par.aux1transport * w->C2()->Chemical(2) * w->C1()->Chemical(0) / (par.kaux1 + w->C1()->Chemical(0)) ); - - // efflux from cell 2 to cell 1 - double trans21 = ( par.transport * w->Transporters2(1) * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)) - + par.aux1transport * w->C1()->Chemical(2) * w->C2()->Chemical(0) / (par.kaux1 + w->C2()->Chemical(0)) ); - - dchem_c1[0] += trans21 - trans12; - dchem_c2[0] += trans12 - trans21; - return; - } - - } - } - - - if (w->C1()->BoundaryPolP()) { - - if (w->AuxinSource()) { - double aux_flux = par.leaf_tip_source * w->Length(); - dchem_c2[0] += aux_flux; - // dchem_c1 is undefined...! - return; - } else { - - if (w->AuxinSink()) { - - - // efflux into Shoot Apical meristem - // we assume all PINs are directed towards shoot apical meristem - - // no passive fluxes: outside is impermeable - - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - // assumption: no AUX1 in shoot apical meristem - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0))); - dchem_c1[0] += - trans12; - - return; - - //dchem_c2[0] -= par.sam_efflux * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)); - - // return; - } else { - - } - } - } - - - // Passive fluxes (Fick's law) - // only auxin flux now - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::NChem();c++) { - double phi = w->Length() * ( par.D[c] ) * ( w->C2()->Chemical(c) - w->C1()->Chemical(c) ); - dchem_c1[c] += phi; - dchem_c2[c] -= phi; - } - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)) - + par.aux1transport * w->C2()->Chemical(2) * w->C1()->Chemical(0) / (par.kaux1 + w->C1()->Chemical(0)) ); - - // efflux from cell 2 to cell 1 - double trans21 = ( par.transport * w->Transporters2(1) * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)) - + par.aux1transport * w->C1()->Chemical(2) * w->C2()->Chemical(0) / (par.kaux1 + w->C2()->Chemical(0)) ); - - dchem_c1[0] += trans21 - trans12; - dchem_c2[0] += trans12 - trans21; - - } -}; - -class PIN1Localization : public WallReaction { - - public: - virtual void operator()(Wall *w, double *dw1, double *dw2) { - - - - // Cells polarize available PIN1 to Shoot Apical Meristem - if (w->C2()->BoundaryPolP()) { - if (w->AuxinSink()) { - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - // assume high auxin concentration in SAM, to convince PIN1 to polarize to it - // exocytosis regulated0 - double nb_auxin = par.sam_auxin; - double receptor_level = nb_auxin * par.r / (par.kr + nb_auxin); - - dw1[1] = par.k1 * w->C1()->Chemical(1) * receptor_level /( par.km + w->C1()->Chemical(1) ) - par.k2 * w->Transporters1(1); - - dw2[1] = 0.; - return; - - } else { - dw1[0]=dw2[0]=dw1[1]=dw2[1]=dw1[2]=dw2[2]; - return; - } - } - - if (w->C1()->BoundaryPolP()) { - if (w->AuxinSink()) { - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - // assume high auxin concentration in SAM, to convince PIN1 to polarize to it - // exocytosis regulated - double nb_auxin = par.sam_auxin; - double receptor_level = nb_auxin * par.r / (par.kr + nb_auxin); - dw2[1] = par.k1 * w->C2()->Chemical(1) * receptor_level /( par.km + w->C2()->Chemical(1) ) - par.k2 * w->Transporters2(1); - - dw1[1] = 0.; - return; - - } else { - dw1[0]=dw2[0]=dw1[1]=dw2[1]=dw1[2]=dw2[2]; - return; - } - } - - - - // PIN1 localization at wall 1 - // Note: chemical 0 is Auxin (intracellular storage only) - // Chemical 1 is PIN1 (walls and intracellular storage) - //! \f$ \frac{d Pij/dt}{dt} = k_1 A_j \frac{P_i}{L_ij} - k_2 P_{ij} \f$ - // Note that Pij is measured in term of concentration (mol/L) - // Pi in terms of quantity (mol) - - double dPijdt1=0., dPijdt2=0.; - - // normal cell - double auxin2 = w->C2()->Chemical(0); - double receptor_level1 = auxin2 * par.r / (par.kr + auxin2); - - dPijdt1 = - // exocytosis regulated - par.k1 * w->C1()->Chemical(1) * receptor_level1 / ( par.km + w->C1()->Chemical(1) ) - par.k2 * w->Transporters1(1); - - double auxin1 = w->C1()->Chemical(0); - double receptor_level2 = auxin1 * par.r / (par.kr + auxin1); - - // normal cell - dPijdt2 = - - // exocytosis regulated - par.k1 * w->C2()->Chemical(1) * receptor_level2 / ( par.km + w->C2()->Chemical(1) ) - par.k2 * w->Transporters2(1); - - /* PIN1 of neighboring vascular cell inhibits PIN1 endocytosis */ - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - dw1[1] = dPijdt1; - dw2[1] = dPijdt2; - - } -}; - - -inline double YlPilPli(Cell &here, Cell &nb, Wall &w) { - return nb.Chemical(2) * w.Transporters1(1) * w.Transporters2(1); -} - -inline double AlPil(Cell &here, Cell &nb, Wall &w) { - return nb.Chemical(0) * w.getTransporter( &here, 1 ); -} - -inline double AlplusYlLil(Cell &here, Cell &nb, Wall &w) { - return ( nb.Chemical(0) + nb.Chemical(2) ) * w.Length(); -} - -inline double AlLil(Cell &here, Cell &nb, Wall &w) { - return ( nb.Chemical(0) ) * w.Length(); -} - -inline double Lil(Cell &here, Cell &nb, Wall &w) { - return w.Length(); -} - -inline double complex_PijAj(Cell &here, Cell &nb, Wall &w) { - - // gives the amount of complex "auxinreceptor-Pin1" at the wall (at QSS) - //return here.Chemical(1) * nb.Chemical(0) / ( par.km + here.Chemical(1)); - - double nb_aux = (nb.BoundaryPolP() && w.AuxinSink()) ? par.sam_auxin : nb.Chemical(0); - double receptor_level = nb_aux * par.r / (par.kr + nb_aux); - - return here.Chemical(1) * receptor_level / ( par.km + here.Chemical(1)); - -} - -class AuxinAndDifferentiation : public CellReaction { - - // Note: Pi and Pij measured in numbers of molecules, not concentrations - public: - virtual void operator()(Cell *c, double *dchem) { - - double dPidt = 0.; - - double sum_Pij = c->SumTransporters( 1 ); - - // exocytosis regulated: - // van3 expression reduces rate of PIN1 endocytosis - dPidt = -par.k1 * c->ReduceCellAndWalls<double>( complex_PijAj ) + - (c->Chemical(3) < 0.5 ? par.k2 : par.k2van3) * sum_Pij; - - // production of PIN depends on auxin concentration - dPidt += (c->AtBoundaryP()?par.pin_prod_in_epidermis:par.pin_prod) * c->Chemical(0) - c->Chemical(1) * par.pin_breakdown; - - /*if (c->AtBoundaryP()) { - dchem[2] = 0.01; - //cerr << "Making cell blue.\n"; - } else { - dchem[2] = -0.1 * c->Chemical(2); - }*/ - - // no PIN production in SAM - if (c->Boundary() == Cell::SAM) { - dchem[1]=0.; - dchem[0]= - par.sam_auxin_breakdown * c->Chemical(0); - dchem[2]=0.; - } else { - - dchem[1] = dPidt; - - - // source of auxin - dchem[0] = par.aux_cons; - - // auxin-induced AUX1 production, in the epidermis - dchem[2] = ( c->AtBoundaryP() ? par.aux1prod : par.aux1prodmeso ) * ( c->Chemical(0) / ( 1. + par.kap * c->Chemical(0) ) ) - par.aux1decay * c->Chemical(2) ;//: 0.; - - // auxin-induced production of VAN-3? Autokatalysis? - //dchem[3] = par.van3prod * (c->Chemical(0) / (1. + par.kvp * c-> Chemical(0) ) ) - double A = c->Chemical(0); - double van3 = c->Chemical(3); - dchem[3] = par.van3prod * A - par.van3autokat * van3 + van3*van3/(1 + par.van3sat * van3*van3 ); - } - } - -}; - - - - -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - if (c.Boundary()==Cell::None) { - c.CheckForDivision(); - - // expand if this is not a provascular cell - if (c.Chemical(3) < 0.7 ) { - c.EnlargeTargetArea(par.cell_expansion_rate); - } - } - } -}; - -void Cell::SetColor(QColor &color) { - - // Red: AUX1 - // Green: Auxin - // Blue: van-3 - color.setRgb(chem[2]/(1+chem[2]) * 255.,(chem[0]/(1+chem[0]) * 255.),(chem[3]/(1+chem[3]) *255.) ); - -} - -void Cell::CheckForDivision(void) { - // if (/* Chemical(0)<0.4 && */ /* differentiated cells do not divide */ area > 2*base_area /* || Length()>50 */) { - - //if (Chemical(0) > par.morphogen_div_threshold ) - if (area > par.rel_cell_div_threshold * base_area ) { - /* remark no longer valid? //m->IncreaseCellCapacityIfNecessary(); - // Note that calling Divide as follows prevents trouble if cell - // vector is relocated */ - Divide(); - } - -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/one_acc_point_van3_growth2.xml b/data/leaves/one_acc_point_van3_growth2.xml deleted file mode 100644 --- a/data/leaves/one_acc_point_van3_growth2.xml +++ /dev/null @@ -1,11348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#ifdef QTGRAPHICS -#include "canvas.h" -#include "cell.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> -#endif -#include <unistd.h> -#include <q3textstream.h> -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -//#include "reactions.h" - -//#include "reactions_auxacc.h" -//#include "reactions_pinaux3.h" -//#include "reactions_aux1.h" -//#define REACTIONS_HEADER "reactions_growth.h" -//#include "reactions_tips_nor.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.; - -#ifdef XFIGGRAPHICS -#define TIMESTEP double Graphics::TimeStep(void) -#endif - -//ofstream debug_stream("debug.log"); - -class PrintNode { -public: - void operator() (const Node &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - -/*class SetArea { - public: - void operator() (Cell &c) const { - c.SetTargetArea(4*c.CalcArea()); - c.SetTargetLength(4*c.Length()); - } - - };*/ - -#ifdef XFIGGRAPHICS -class XFigCell { -public: - void operator() (Cell &c,std::ostream &os) const { - c.XFigPrint(os); - } -}; -#endif - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - -#ifdef QTGRAPHICS -class DrawCell { -public: - /*void operator() (Cell &c,Graphics &g) const { - c.Draw(g); - }*/ - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5)\n %6 of PIN1 at walls.\n Area is %7\n PIN sum is %8\n Circumference is %9\n Boundary type is %10").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - // if (m.ShowMeshP()) - // c.DrawNodes(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - //c.DrawTriangles(canvas); - } - //cerr << "Area of cell " << c.Index() << " is " << c.Area() << endl; - } - -}; -#endif - - -const char *xfig_header = "#FIG 3.2\nLandscape\nCenter\nInches\nLetter\n100.00\nSingle\n-2\n1200 2\n"; - -Mesh mesh; -bool batch=false; - - - -#ifdef QTGRAPHICS -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 ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - //mesh.LoopCells( bind2nd (mem_fun_ref( &Cell::DrawWalls), &canvas ) ); - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - // check to see if chemicals emitted by leaf edge diffuse evenly. Yes, they do. - - /* - Vector mesh_centroid = mesh.Centroid(); - Vector first_moment = mesh.FirstConcMoment(0); - - QCanvasEllipse *disk1 = 0; - if (disk1==0) { - disk1 = new QCanvasEllipse ( 50, 50, &canvas ); - disk1->setBrush( QColor("red") ); - disk1->setZ(5); - disk1->show(); - } - - QCanvasEllipse *disk2 = 0; - if (disk2==0) { - disk2=new QCanvasEllipse ( 50, 50, &canvas ); - disk2->setBrush( QColor("blue") ); - disk2->setZ(7); - disk2->show(); - - } - - Vector offset = mesh.Offset(); - double factor = mesh.Factor(); - - disk1 -> move((offset.x+mesh_centroid.x)*factor,(offset.y+mesh_centroid.y)*factor); - disk2 -> move((offset.x+first_moment.x)*factor,(offset.y+first_moment.y)*factor); - - */ - - - 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - //fname << mesh.getTime() << ".xml"; - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < par.storage_stride) { - frame++; - } - // Write XML file every ten plot steps - mesh.XMLSave(fname.str().c_str(), XMLSettingsTree()); - } - - } -} -#endif - -//double areaunit=0; - -void Cell::Flux(double *flux, double *D) { - - // Algorithm according to Rudge & Haseloff 2005 - // (will we need to take cell area into account?) - // For the time being, we don't: assume cell area is - // mainly determined by vacuole. - - // loop over cell edges - - for (int c=0;c<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - // calculate edge length - // (will later be updated during node displacement for efficiency) - //double edge_length = (m->nodes[(*i)->n1]-m->nodes[(*i)->n2]).Norm(); - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - //Cell &circle=mesh.CircularCell(0,0,10,10); - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - //Cell &circle=mesh.LeafPrimordium(10,50); - Cell &circle=mesh.CircularCell(0,0,10,10); - //circle.SetChemical(1,0); - - // petiole is auxin sink - //mesh.getCell(1).SetSource(0,0); - - // petiole becomes provascular cell - //mesh.getCell(1).SetChemical(1,0.6); - - circle.SetTargetArea(circle.CalcArea()); - //circle.SetChemical(2,1e-60); - mesh.SetBaseArea(); - - circle.SetChemical(1, par.Pi_tot ); - circle.SetChemical(0, 0.); - //mesh.LoopCells(EdgeSource()); - } -} - -TIMESTEP { - - static int i=0; - static int t=0; - static int ncells; - - if (!batch) { - UserMessage(QString("Time: %1").arg(mesh.getTimeHours().c_str()),0); - } - - - - //if (!(i%1000)) - //Save(QString("leaf%1.eps").arg(i).ascii(), "PDF"); - - /* static ofstream *kinematic=0; - if (kinematic == 0) { - stringstream kinematic_fname; - kinematic_fname << par.datadir << "/kinematic.dat"; - cerr << "Writing kinematic data to " << kinematic_fname.str() << endl; - - kinematic = new ofstream(kinematic_fname.str().c_str()); - } - - *kinematic << t << " " << i << " " << mesh.Area() << " " << mesh.NCells() << endl; - */ - - ncells=mesh.NCells(); - - - double dh; - //const double en_threshold = 1; - - //mesh.RandomlyLoopCells( mem_fun_ref(&Cell::Displace )); - - //static bool dumpflag=false; - - if(DynamicCellsP()) { - dh = mesh.DisplaceNodes(); - - - //static ofstream enfile("energy.dat"); - //enfile << i << " " << dh << "\n"; - - // Only allow for node insertion, cell division and cell growth - // if the system has equillibrized - // i.e. cell wall tension equillibrization is much faster - // than biological processes, including division, cell wall yielding - // and cell expansion - mesh.InsertNodes(); // (this amounts to cell wall yielding) - - if ( (-dh) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(CellHouseKeeping()); // this includes cell division - - // Reaction diffusion - TransportFunction *transport_f = new AuxinTransport(); - CellReaction *cellreaction_f = new AuxinAndDifferentiation(); - WallReaction *wall_f = new PIN1Localization(); - - mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt); - - - t++; - - Plot(); - } - } else { - - TransportFunction *transport_f = new AuxinTransport(); - CellReaction *cellreaction_f = new AuxinAndDifferentiation(); - WallReaction *wall_f = new PIN1Localization(); - - mesh.ReactDiffuse_New(transport_f, cellreaction_f, wall_f, par.rd_dt); - - Plot(); - - } - - - i++; - return mesh.getTime(); - -} - -void Main::Divide(void) { - - static Vector axis(1,0,0); - mesh.IncreaseCellCapacityIfNecessary(); - - mesh.LoopCurrentCells( bind2nd( mem_fun_ref(&Cell::DivideOverAxis),axis) ); - axis=axis.Perp2D(); - //mesh.LoopCells( mem_fun_ref(&Cell::Divide) ); - Plot(); - -} - - -/* Called if a cell is clicked */ -void Cell::OnClick(QMouseEvent *e) { - - cerr << "Calling OnClick()\n"; - /* cerr << *m->boundary_polygon; - //m->RepairBoundaryPolygon(); - //SetChemical(0,par.cellsource); - cerr << "Mesh's centroid: " << m->Centroid() << endl; - cerr << "First moment of chem[0]: " << m->FirstConcMoment(0) << endl; - - */ - /* - cerr << "Cell: " << Index() << ", has walls: "; - - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - cerr << **w << " "; - } - - cerr << endl; - */ - /* cerr << "Cell: " << Index() << ", has neighbors: "; - - for (list<Cell *>::const_iterator c=neighbors.begin(); - c!=neighbors.end(); - c++) { - cerr << (*c)->Index() << " "; - } - - cerr << endl;*/ - - /* - mesh.PrintWallList(); - */ - - double circ=0.; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - cerr << (*w)->N1()->Index() << "->" << (*w)->N2()->Index() << " = " << (*w)->Length() << endl; - circ += (*w)->Length(); - } - cerr << "Circ is " << circ << endl; - - - if (e->button() == Qt::MidButton) { - double sum_pin_bef = getMesh().CalcProtCellsWalls(1); - - QString message(QString("Dividing Cell %1").arg(index)); - ((Main *)main_window)->UserMessage(message); - cerr << message.toStdString(); - Divide(); - ((Main *)main_window)->Plot(); - - double sum_pin_aft = getMesh().CalcProtCellsWalls(1); - - cerr << "Sum PIN1, before: " << sum_pin_bef << ", after: " << sum_pin_aft << endl; - return; - } - if (e->button() == Qt::LeftButton) { - //double sum_walls=0.; - cerr << "Wall lengths: "; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - //cerr << (*w)->getTransporter(this, 1) << " "; - cerr << (*w)->Length() << " "; - //sum_walls+=(*w)->getTransporter(this, 1); //* (*w)->Length(); - } - - cerr << ", Chemical(1) = " << Chemical(1) << ", sum = " << SumTransporters(1) + Chemical(1) << endl; - - QString message; - message=QString("Cell %1 has chemicals ( %2, %3, %4, %5), and it has %6 of PIN1 at its walls. Area is %7").arg(Index()).arg(chem[0]).arg(chem[1]).arg(chem[2]).arg(chem[3]).arg(SumTransporters(1)).arg(Area()); - - ((Main *)main_window)->UserMessage(message); - - /* cerr << "Cell " << index << " has chemicals ( " << chem[0] << ", " << chem[1] << " ) " << endl; - - cerr << "Cell " << index << "'s amount of PIN1 at the walls: " << SumTransporters(1) << endl;*/ -#ifdef QTGRAPHICS - /* double sum_PIN1 = Chemical(4); - - for (list<Wall *>::const_iterator i = walls.begin(); - i!=walls.end(); - i++) { - sum_PIN1 += (*i)->getTransporter(this, 0); - } - */ - - //main_window->UserMessage(QString("Concentration chemical 0 of cell %1 = %2").arg(Index()).arg(chem[0])); - //main_window->UserMessage(QString("Target area of cell %1 = %2").arg(Index()).arg(TargetArea())); - //main_window->UserMessage(QString("Sum PIN1 of cell %1 = %2 (intracellular %3)").arg(Index()).arg(sum_PIN1).arg(Chemical(4))); - - /* QString message; - message=QString("Cell %1's nodes are:").arg(Index()); - - for (list<int>::iterator it=neighbors.begin(); - it!=neighbors.end(); - it++) { - message += QString(" %2").arg(*it); - } - - main_window->UserMessage(message);*/ - - //SetWallLengths(); - //main_window->UserMessage(QString("Cell %1 apoptoses.").arg(Index())); - //Apoptose(); - //m->CleanUpCellNodeLists(); -#ifdef HAVE_QWT - QStringList curvenames; - curvenames += QString("Auxin"); - curvenames += QString("PIN1"); - curvenames += QString("AUX1"); - curvenames += QString("Wall PIN1"); - PlotDialog *plot = new PlotDialog((Main *)main_window, QString("Monitor for Cell %1").arg(Index()), curvenames); - QObject::connect(this, SIGNAL(ChemMonValue(double, double *)), - plot, SLOT(AddValue(double,double *))); -#endif - } else { - //Divide(); - } -#endif -} - - - // Set sum of PIN1 back to Pi_tot. Hence we assume the cell maintain a constant level of Pi. - -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) { - - //cerr << "Calling Cell::OnDivide()" << endl; - - // PIN1 distributes between parent and daughter according to area - double area = Area(), daughter_area = daughter.Area(); - double tot_area = area + daughter_area; - - //chem[1]*=(area/tot_area); - //daughter.chem[1]*=(daughter_area/tot_area); - - // For lack of detailed data, or a better rule, we assume that cells remain polarized - // after division - - // So the PIN1 is redistributed according to the original polarization over the walls - - // parent_info contains info about the parent - // redistribute the PIN in the endosome according to area - - chem[1] = parent_info.PINendosome*(area/tot_area); - daughter.chem[1] = parent_info.PINendosome*(daughter_area/tot_area); - - // Now redistribute the membrane PINs according to the original polarization in the parent - // mmm... I'd like to have a better, biologically motivated rule for this, - // but for lack of something better... I hope I'm excused :-). Let's say the overall - // organization of the actin fibres is not completely destroyed after division... - - // distribute wallPINs according to the circumference of the parent and daughter - double circ = Circumference( ); - double daughter_circ = daughter.Circumference(); - double tot_circ = circ + daughter_circ; - - double wallPINs = (circ / tot_circ) * parent_info.PINmembrane; - double daughter_wallPINs = (daughter_circ / tot_circ) * parent_info.PINmembrane; - - //cerr << "wallPINs = " << wallPINs << ", daughter_wallPINs = " << daughter_wallPINs << "sum = " << wallPINs + daughter_wallPINs << ", PINmembrane = " << parent_info.PINmembrane << endl; - // distrubute it according to the overall polarity - Vector polarization = parent_info.polarization.Normalised().Perp2D(); - - double sum=0.; - for (list<Wall *>::const_iterator w=walls.begin(); - w!=walls.end(); - w++) { - - // distribute according to angle (0 degrees: maximum, 180 degrees minimum) - double tmp=InnerProduct((*w)->getWallVector(this),polarization); // move domain from [-1,1] to [0,1] - - //cerr << "[" << tmp << "]"; - sum+=tmp; - //(*w)->setTransporter(this, 1, - } - - //cerr << "Sum is " << sum << endl; - //double sum_wall_Pi = SumTransporters(1); - - // After division, cells produce PIN1 (in intracellular storage) until total amount becomes Pi_tot - //SetChemical(1, par.Pi_tot - sum_wall_Pi ); - //SetNewChem(1, Chemical(1)); - - //cerr << "[ " << sum_wall_Pi + Chemical(1) << "]"; -} - -void Wall::OnWallInsert(void) { - - // NOTE: THIS FUNCTION IS CALLED AFTER Cell::OnDivide(); - // After division, we put some PIN1 on the walls, to prevent quick - // redistribution of PIN1s and consequent auxin accumulation after - // division. - - // make sure dPij/dt = 0 at both sides of the new wall. - - // True for: - // Pij = k1/k2 * A_j * L_ij * P_i - // Pji = k1/k2 * A_i * L_ij * P_j - - //transporters1[1] = (par.k1/par.k2) * c2->Chemical(0) * length * c1->Chemical(1); - //transporters2[1] = (par.k1/par.k2) * c1->Chemical(0) * length * c2->Chemical(1); - - //transporters1[1]=transporters2[1]=0.; - // cerr << "Length of new wall is " << length << endl; - //cerr << "PIN1 is [ " << transporters1[1] << " | " << transporters2[1] << "] "; -} - - - - -int main(int argc,char **argv) { - - try { - - //if (argc<2 || strstr(argv[1],".par")==0) { - // throw "Usage: Leaf [parfile].par"; - //} - //par.Read(argv[1]); - - // parse command-line options - - int c; - //int digit_optind = 0; - - char *parfile=0; - char *leaffile=0; - /* ofstream args("args.txt"); - for (int i=0;i<argc;i++) { - args << argv[i] << endl; - }*/ - - while (1) { - - //int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = { - {"batch", 0, 0, 0}, - {"par", 1, 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 = "bP:l"; - c = getopt_long (argc, argv, "bP:l:", - long_options, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'p': - parfile=strdup(optarg); - if (!parfile) { - throw("Out of memory"); - } - printf ("parameter file is '%s'\n", parfile); - - 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 < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - -#ifdef X11GRAPHICS - X11Graphics g(par.sizex,par.sizey); - g.ChangeTitle("Virtual Leaf"); -#endif -#ifdef QTGRAPHICS - //QApplication app(argc, argv); - - //argc=1; - QCoreApplication *app; - - QGraphicsScene canvas(0,0,8000,6000); - - QPalette tooltippalette = QToolTip::palette(); - QColor transparentcolor = QColor(tooltippalette.brush(QPalette::Window).color()); - //transparentcolor.setAlphaF(0.9); - - tooltippalette.setBrush (QPalette::Window, QBrush (transparentcolor) ); - QToolTip::setPalette( tooltippalette ); - - if (batch) { - // Note: QCoreApplication allows for command line applications, independent of X-Server on Unix. - // Allows for running on cluster - app = new QCoreApplication(argc,argv); - main_window=new MainBase(canvas, mesh); - } else { - app = new QApplication(argc,argv); - main_window=new Main(canvas, mesh); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } - - - if (!batch) { - if ( QApplication::desktop()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) - ((Main *)main_window)->show(); - else - ((Main *)main_window)->showMaximized(); - } - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - // return app.exec(); -#endif - - if (parfile) - par.Read(parfile); - - //else - // par.Read("default.par"); - Seed(par.rseed); - -#ifdef XFIGGRAPHICS - Graphics g; -#endif - - - main_window->Init(leaffile); - - // if we have supplied a leaffile AND a parfile, reread the parameter file, - // because the leaffile also contains parameter information - if (leaffile && parfile) { - par.Read(parfile); - } - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - -#ifdef QTGRAPHICS - - // check if leaf crosses boundary - /* Vector bbll,bbur; - mesh.BoundingBox(bbll,bbur); - - double scale_x = canvas.width()/(bbur.x-bbll.x); - double scale_y = canvas.height()/(bbur.y-bbll.y); - - Cell::Scale(scale_x<scale_y ? scale_x:scale_y); // smallest of scale_x and scale_y - - double offset_x = (canvas.width()/Cell::Magnification()-(bbur.x-bbll.x))/2.; - double offset_y = (canvas.height()/Cell::Magnification()-(bbur.y-bbll.y))/2.; - Cell::setOffset(offset_x, offset_y); - */ - /* Vector bbll,bbur; - mesh.BoundingBox(bbll,bbur); - cerr << "bbll = " << bbll << endl; - cerr << "bbur = " << bbur << endl; - double cw = (bbur.x - bbll.x); - double ch = (bbur.y - bbll.y); - double factor = canvas.width()/(2*cw); - cerr << "factor = " << factor << ", width = " << canvas.width() << endl; - cerr << "Size is " << cw << " x " << ch << endl; - canvas.resize((int)(2*cw*factor),(int)(2*ch*factor)); - Cell::SetMagnification(factor); - //main_window->scale(factor); - //Cell::Translate(-bbll.x+cw/2,-bbll.y+ch/2); - cerr << -bbll.x+cw/2 << ", " << -bbll.y+ch/2 << ", " << canvas.width() << ", " << canvas.height() << endl; - Cell::Translate((-bbll.x+cw/2),(-bbll.y+ch/2)); - */ - - - main_window->Plot(); - - -#endif - -#ifdef QTGRAPHICS - if (batch) { - //main_window->toggleMovieFrames(); - //main_window->toggleShowNodes(); - //for (int i=0;i<par.nit;i++) { - double t=0.; - do { - t = main_window->TimeStep(); - /* cerr << endl << "***********************************************" << endl; - cerr << "Time is " << t << endl; - cerr << "par.maxt = " << par.maxt << endl; - cerr << endl << "***********************************************" << endl;*/ - } while (t < par.maxt); - - } else - return app->exec(); -#else - //for (int i=0;i<par.nit;i++) { - do { - t= g.TimeStep(); - } while (t < par.maxt); -#endif - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - -extern double auxin_account; -const int Cell::nchem = 4; - -class AuxinTransport : public TransportFunction { - - public: - virtual void operator()(Wall *w, double *dchem_c1, double *dchem_c2) { - // leaf edge is const source of auxin - // (Neumann boundary condition: we specify the influx) - if (w->C2()->BoundaryPolP()) { - if (w->AuxinSource()) { - double aux_flux = par.leaf_tip_source * w->Length(); - dchem_c1[0]+= aux_flux; - - // dchem_c2 is undefined..! - return; - } else { - if (w->AuxinSink()) { - - // efflux into Shoot Apical meristem - // we assume all PINs are directed towards shoot apical meristem - dchem_c1[0] -= par.sam_efflux * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)); - - return; - } else { - - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)) - + par.aux1transport * w->C2()->Chemical(2) * w->C1()->Chemical(0) / (par.kaux1 + w->C1()->Chemical(0)) ); - - // efflux from cell 2 to cell 1 - double trans21 = ( par.transport * w->Transporters2(1) * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)) - + par.aux1transport * w->C1()->Chemical(2) * w->C2()->Chemical(0) / (par.kaux1 + w->C2()->Chemical(0)) ); - - dchem_c1[0] += trans21 - trans12; - dchem_c2[0] += trans12 - trans21; - return; - } - - } - } - - - if (w->C1()->BoundaryPolP()) { - - if (w->AuxinSource()) { - double aux_flux = par.leaf_tip_source * w->Length(); - dchem_c2[0] += aux_flux; - // dchem_c1 is undefined...! - return; - } else { - - if (w->AuxinSink()) { - - - // efflux into Shoot Apical meristem - // we assume all PINs are directed towards shoot apical meristem - - // no passive fluxes: outside is impermeable - - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - // assumption: no AUX1 in shoot apical meristem - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0))); - dchem_c1[0] += - trans12; - - return; - - //dchem_c2[0] -= par.sam_efflux * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)); - - // return; - } else { - - } - } - } - - - // Passive fluxes (Fick's law) - // only auxin flux now - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::NChem();c++) { - double phi = w->Length() * ( par.D[c] ) * ( w->C2()->Chemical(c) - w->C1()->Chemical(c) ); - dchem_c1[c] += phi; - dchem_c2[c] -= phi; - } - // Active fluxes (PIN1 and AUX1 mediated transport) - - // (Transporters measured in moles, here) - // efflux from cell 1 to cell 2 - double trans12 = ( par.transport * w->Transporters1(1) * w->C1()->Chemical(0) / (par.ka + w->C1()->Chemical(0)) - + par.aux1transport * w->C2()->Chemical(2) * w->C1()->Chemical(0) / (par.kaux1 + w->C1()->Chemical(0)) ); - - // efflux from cell 2 to cell 1 - double trans21 = ( par.transport * w->Transporters2(1) * w->C2()->Chemical(0) / (par.ka + w->C2()->Chemical(0)) - + par.aux1transport * w->C1()->Chemical(2) * w->C2()->Chemical(0) / (par.kaux1 + w->C2()->Chemical(0)) ); - - dchem_c1[0] += trans21 - trans12; - dchem_c2[0] += trans12 - trans21; - - } -}; - -class PIN1Localization : public WallReaction { - - public: - virtual void operator()(Wall *w, double *dw1, double *dw2) { - - - - // Cells polarize available PIN1 to Shoot Apical Meristem - if (w->C2()->BoundaryPolP()) { - if (w->AuxinSink()) { - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - // assume high auxin concentration in SAM, to convince PIN1 to polarize to it - // exocytosis regulated0 - double nb_auxin = par.sam_auxin; - double receptor_level = nb_auxin * par.r / (par.kr + nb_auxin); - - dw1[1] = par.k1 * w->C1()->Chemical(1) * receptor_level /( par.km + w->C1()->Chemical(1) ) - par.k2 * w->Transporters1(1); - - dw2[1] = 0.; - return; - - } else { - dw1[0]=dw2[0]=dw1[1]=dw2[1]=dw1[2]=dw2[2]; - return; - } - } - - if (w->C1()->BoundaryPolP()) { - if (w->AuxinSink()) { - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - // assume high auxin concentration in SAM, to convince PIN1 to polarize to it - // exocytosis regulated - double nb_auxin = par.sam_auxin; - double receptor_level = nb_auxin * par.r / (par.kr + nb_auxin); - dw2[1] = par.k1 * w->C2()->Chemical(1) * receptor_level /( par.km + w->C2()->Chemical(1) ) - par.k2 * w->Transporters2(1); - - dw1[1] = 0.; - return; - - } else { - dw1[0]=dw2[0]=dw1[1]=dw2[1]=dw1[2]=dw2[2]; - return; - } - } - - - - // PIN1 localization at wall 1 - // Note: chemical 0 is Auxin (intracellular storage only) - // Chemical 1 is PIN1 (walls and intracellular storage) - //! \f$ \frac{d Pij/dt}{dt} = k_1 A_j \frac{P_i}{L_ij} - k_2 P_{ij} \f$ - // Note that Pij is measured in term of concentration (mol/L) - // Pi in terms of quantity (mol) - - double dPijdt1=0., dPijdt2=0.; - - // normal cell - double auxin2 = w->C2()->Chemical(0); - double receptor_level1 = auxin2 * par.r / (par.kr + auxin2); - - dPijdt1 = - // exocytosis regulated - par.k1 * w->C1()->Chemical(1) * receptor_level1 / ( par.km + w->C1()->Chemical(1) ) - par.k2 * w->Transporters1(1); - - double auxin1 = w->C1()->Chemical(0); - double receptor_level2 = auxin1 * par.r / (par.kr + auxin1); - - // normal cell - dPijdt2 = - - // exocytosis regulated - par.k1 * w->C2()->Chemical(1) * receptor_level2 / ( par.km + w->C2()->Chemical(1) ) - par.k2 * w->Transporters2(1); - - /* PIN1 of neighboring vascular cell inhibits PIN1 endocytosis */ - - dw1[0] = 0.; dw2[0] = 0.; - dw1[2] = 0.; dw2[2] = 0.; - - dw1[1] = dPijdt1; - dw2[1] = dPijdt2; - - } -}; - - -inline double YlPilPli(Cell &here, Cell &nb, Wall &w) { - return nb.Chemical(2) * w.Transporters1(1) * w.Transporters2(1); -} - -inline double AlPil(Cell &here, Cell &nb, Wall &w) { - return nb.Chemical(0) * w.getTransporter( &here, 1 ); -} - -inline double AlplusYlLil(Cell &here, Cell &nb, Wall &w) { - return ( nb.Chemical(0) + nb.Chemical(2) ) * w.Length(); -} - -inline double AlLil(Cell &here, Cell &nb, Wall &w) { - return ( nb.Chemical(0) ) * w.Length(); -} - -inline double Lil(Cell &here, Cell &nb, Wall &w) { - return w.Length(); -} - -inline double complex_PijAj(Cell &here, Cell &nb, Wall &w) { - - // gives the amount of complex "auxinreceptor-Pin1" at the wall (at QSS) - //return here.Chemical(1) * nb.Chemical(0) / ( par.km + here.Chemical(1)); - - double nb_aux = (nb.BoundaryPolP() && w.AuxinSink()) ? par.sam_auxin : nb.Chemical(0); - double receptor_level = nb_aux * par.r / (par.kr + nb_aux); - - return here.Chemical(1) * receptor_level / ( par.km + here.Chemical(1)); - -} - -class AuxinAndDifferentiation : public CellReaction { - - // Note: Pi and Pij measured in numbers of molecules, not concentrations - public: - virtual void operator()(Cell *c, double *dchem) { - - double dPidt = 0.; - - double sum_Pij = c->SumTransporters( 1 ); - - // exocytosis regulated: - // van3 expression reduces rate of PIN1 endocytosis - dPidt = -par.k1 * c->ReduceCellAndWalls<double>( complex_PijAj ) + - (c->Chemical(3) < 0.5 ? par.k2 : par.k2van3) * sum_Pij; - - // production of PIN depends on auxin concentration - dPidt += (c->AtBoundaryP()?par.pin_prod_in_epidermis:par.pin_prod) * c->Chemical(0) - c->Chemical(1) * par.pin_breakdown; - - /*if (c->AtBoundaryP()) { - dchem[2] = 0.01; - //cerr << "Making cell blue.\n"; - } else { - dchem[2] = -0.1 * c->Chemical(2); - }*/ - - // no PIN production in SAM - if (c->Boundary() == Cell::SAM) { - dchem[1]=0.; - dchem[0]= - par.sam_auxin_breakdown * c->Chemical(0); - dchem[2]=0.; - } else { - - dchem[1] = dPidt; - - - // source of auxin - dchem[0] = par.aux_cons; - - // auxin-induced AUX1 production, in the epidermis - dchem[2] = ( c->AtBoundaryP() ? par.aux1prod : par.aux1prodmeso ) * ( c->Chemical(0) / ( 1. + par.kap * c->Chemical(0) ) ) - par.aux1decay * c->Chemical(2) ;//: 0.; - - // auxin-induced production of VAN-3? Autokatalysis? - //dchem[3] = par.van3prod * (c->Chemical(0) / (1. + par.kvp * c-> Chemical(0) ) ) - double A = c->Chemical(0); - double van3 = c->Chemical(3); - dchem[3] = par.van3prod * A - par.van3autokat * van3 + van3*van3/(1 + par.van3sat * van3*van3 ); - } - } - -}; - - - - -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - if (c.Boundary()==Cell::None) { - c.CheckForDivision(); - - // expand if this is not a provascular cell - if (c.Chemical(3) < 0.7 ) { - c.EnlargeTargetArea(par.cell_expansion_rate); - } - } - } -}; - -void Cell::SetColor(QColor &color) { - - // Red: AUX1 - // Green: Auxin - // Blue: van-3 - color.setRgb(chem[2]/(1+chem[2]) * 255.,(chem[0]/(1+chem[0]) * 255.),(chem[3]/(1+chem[3]) *255.) ); - -} - -void Cell::CheckForDivision(void) { - // if (/* Chemical(0)<0.4 && */ /* differentiated cells do not divide */ area > 2*base_area /* || Length()>50 */) { - - //if (Chemical(0) > par.morphogen_div_threshold ) - if (area > par.rel_cell_div_threshold * base_area ) { - /* remark no longer valid? //m->IncreaseCellCapacityIfNecessary(); - // Note that calling Divide as follows prevents trouble if cell - // vector is relocated */ - Divide(); - } - -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/tissue.xml b/data/leaves/tissue.xml deleted file mode 100644 --- a/data/leaves/tissue.xml +++ /dev/null @@ -1,20231 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <fstream> -#include <sstream> -#include <cstring> -#include <functional> -#include <getopt.h> -#include <cerrno> -#include "mesh.h" -#include "parameter.h" -#include "random.h" -#include "pi.h" -#include "cellitem.h" -#include "canvas.h" -#include "cell.h" -#include "output.h" -#include <qwidget.h> -#include <q3process.h> -#include <qapplication.h> -#include <QDesktopWidget> -#include <QGraphicsScene> -#include <QMessageBox> -//Added by qt3to4: -#include <QMouseEvent> - -#include <unistd.h> -#include <q3textstream.h> - - -#ifdef HAVE_QWT -#include "data_plot.h" -#endif -#include <QPalette> -#include <QBrush> -#include <QToolTip> -#include "simplugin.h" -#include "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 &n) const - { - cerr << n.Index() << ": " << n << endl; - } -}; - - -class EdgeSource { - -public: - void operator() (Cell &c) { - - if (c.AtBoundaryP()) { - cerr << "Cell " << c.Index() << " is a source cell.\n"; - c.SetSource(0,par.source); - } else { - cerr << "Cell " << c.Index() << " is _not_ a source cell.\n"; - } - } - -}; - - - -class CellInfo { -public: - void operator() (Cell &c,std::ostream &os) const { - os << "Cell " << c.index << " says: " << endl; - os << "c.nodes.size() = " << c.nodes.size() << endl; - for (list<Node *>::iterator i=c.nodes.begin(); - i!=c.nodes.end(); - i++) { - cerr << (*i)->Index() << " "; - } - cerr << endl; - } -}; - -double PINSum(Cell &c) { - - return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj ); - -} - - -class DrawCell { -public: - void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const { - if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) { - if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) - if (m.ShowToolTipsP()) { - QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr()); - - info_string += "\n" + c.printednodelist(); - - c.Draw(&canvas, info_string); - } else { - c.Draw(&canvas); - } - if (m.ShowCentersP()) - c.DrawCenter(&canvas); - if (m.ShowFluxesP()) - c.DrawFluxes(&canvas, par.arrowsize); - - } - - } - -}; - -Mesh mesh; -bool batch=false; - - -void MainBase::Plot(int resize_stride) { - - clear(); - - - static int count=0; - if (resize_stride) { - if ( !((++count)%resize_stride) ) { - FitLeafToCanvas(); - } - } - mesh.LoopCells(DrawCell(),canvas,*this); - - if (ShowNodeNumbersP()) - mesh.LoopNodes( bind2nd (mem_fun_ref ( &Node::DrawIndex), &canvas ) ) ; - if (ShowCellNumbersP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawIndex), &canvas ) ) ; - - if (ShowCellAxesP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawAxis), &canvas ) ); - - if (ShowCellStrainP()) - mesh.LoopCells( bind2nd (mem_fun_ref ( &Cell::DrawStrain), &canvas ) ); - - if (ShowWallsP()) - - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::Draw ), &canvas ) ); - - if (ShowApoplastsP()) - mesh.LoopWalls( bind2nd( mem_fun_ref( &Wall::DrawApoplast ), &canvas ) ); - - if (ShowMeshP()) - mesh.DrawNodes(&canvas); - - if (ShowBoundaryOnlyP()) - mesh.DrawBoundary(&canvas); - - - if ( ( batch || MovieFramesP() )) { - - static int frame = 0; - // frame numbers are sequential for the most frequently written file type. - // for the less frequently written file type they match the other type - if (!(count%par.storage_stride) ) { - - stringstream fname; - fname << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - - /* - fname << frame << ".pdf"; - if (par.storage_stride <= par.xml_storage_stride) { - frame++; - } - - // Write high-res JPG snapshot every plot step - Save(fname.str().c_str(), "PDF"); - */ - - fname << frame << ".jpg"; - if (par.storage_stride <= 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 << par.datadir << "/leaf."; - fname.fill('0'); - fname.width(6); - fname << frame << ".xml"; - - if (par.xml_storage_stride < 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<Cell::nchem;c++) flux[c]=0.; - - for (list<Wall *>::iterator i=walls.begin(); - i!=walls.end(); - i++) { - - - // leaf cannot take up chemicals from environment ("no flux boundary") - if ((*i)->c2->BoundaryPolP()) continue; - - - // flux depends on edge length and concentration difference - for (int c=0;c<Cell::nchem;c++) { - double phi = (*i)->length * ( D[c] ) * ( (*i)->c2->chem[c] - chem[c] ); - - if ((*i)->c1!=this) { - cerr << "Warning, bad cells boundary: " << (*i)->c1->index << ", " << index << endl; - } - - flux[c] += phi; - } - } - -} - -INIT { - - if (leaffile) { - xmlNode *settings; - mesh.XMLRead(leaffile, &settings); - main_window->XMLReadSettings(settings); - xmlFree(settings); - main_window->UserMessage(QString("Ready. Time is %1").arg(mesh.getTimeHours().c_str())); - - } else { - - Cell &circle=mesh.CircularCell(0,0,10,10); - - circle.SetTargetArea(circle.CalcArea()); - mesh.SetBaseArea(); - // clean up chemicals - for (int c=0; c<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) < par.energy_threshold) { - - mesh.IncreaseCellCapacityIfNecessary(); - mesh.LoopCurrentCells(&TestPlugin::CellHouseKeeping); // this includes cell division - - // Reaction diffusion - /*CelltoCellTransport *transport_f = &TestPlugin::CelltoCellTransport; - CellReaction *cellreaction_f = new plugin->CellDynamics(); - WallReaction *wall_f = new WallDynamics();*/ - - mesh.ReactDiffuse(plugin, par.rd_dt); - - - t++; - - Plot(par.resize_stride); - - /*QVector< QPair<double, int> > angles=mesh.VertexAnglesValues(); - QString afname=QString("Angles/anglesvalues%1.dat").arg(t,6,10,QChar('0')); - ofstream af(afname.toStdString().c_str()); - */ - - /*for (QVector< QPair<qreal, int> >::const_iterator v=angles.begin(); - v!=angles.end(); - v++) { - af << v->first << " " << v->second << 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, &option_index); - if (c == -1) - break; - - - if (c==0) { - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - - c = short_options[option_index]; - } - - switch (c) { - case 'b': - cerr << "Running in batch mode\n"; - batch=true; - break; - - case 'l': - leaffile=strdup(optarg); - if (!leaffile) { - throw("Out of memory"); - } - printf("Reading leaf state file '%s'\n", leaffile); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - - if (optind < argc) { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - 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()->width() > ((Main *)main_window)->width() + 10 - && QApplication::desktop()->height() > ((Main *)main_window)->height() +30 ) { - - ((Main *)main_window)->show(); - ((Main *)main_window)->resize( ((Main *)main_window)->sizeHint()); - } else { - ((Main *)main_window)->showMaximized(); - } - } else { - main_window=new MainBase(canvas, mesh); - - } - - - - canvas.setSceneRect(QRectF()); - if (!batch) { - QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); - } - - - - main_window->Init(leaffile); - - Cell::SetMagnification(10); - Cell::setOffset(0,0); - - main_window->FitLeafToCanvas(); - - - - main_window->Plot(); - - - - if (batch) { - double t=0.; - do { - t = main_window->TimeStep(); - } while (t < par.maxt); - - } else - return app.exec(); - - - } catch (const char *message) { - if (batch) { - cerr << "Exception caught:" << endl; - cerr << message << endl; - abort(); - } else { - QString qmess=QString("Exception caught: %1").arg(message); - QMessageBox::critical(0, "Critical Error", qmess); - abort(); - } - } catch (ios_base::failure) { - stringstream error_message; - error_message << "I/O failure: " << strerror(errno); - if (batch) { - cerr << error_message.str() <<endl; - abort(); - } else { - QString qmess(error_message.str().c_str()); - QMessageBox::critical(0, "I/O Error", qmess ); - abort(); - } - } - -} - - - -// Executed after the cellular mechanics steps have equillibrized -class CellHouseKeeping { -public: - void operator() (Cell &c) const { - - c.EnlargeTargetArea(par.cell_expansion_rate); - - if (c.Area() > 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 &color) { } - -// To be executed after cell division -void Cell::OnDivide(ParentInfo &parent_info, Cell &daughter) {} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/leaves/tutorial3_init.xml b/data/leaves/tutorial3_init.xml new file mode 100644 --- /dev/null +++ b/data/leaves/tutorial3_init.xml @@ -0,0 +1,20136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/leaves/tutorial4_init.xml b/data/leaves/tutorial4_init.xml new file mode 100644 --- /dev/null +++ b/data/leaves/tutorial4_init.xml @@ -0,0 +1,20136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/leaves/tutorial5_init.xml b/data/leaves/tutorial5_init.xml new file mode 100644 --- /dev/null +++ b/data/leaves/tutorial5_init.xml @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/installation.pdf b/doc/installation.pdf --- a/doc/installation.pdf +++ b/doc/installation.pdf @@ -5,7 +5,8 @@ 1 0 obj % The standard fonts dictionary << /F1 2 0 R /F2 3 0 R - /F3 5 0 R >> + /F3 5 0 R + /F4 6 0 R >> endobj % 'F1': class PDFType1Font 2 0 obj @@ -29,13 +30,13 @@ endobj 4 0 obj << /A << /S /URI /Type /Action - /URI (http://qt.nokia.com/downloads/downloads#lgpl/) >> + /URI (http://qt.nokia.com/downloads/downloads) >> /Border [ 0 0 0 ] - /Rect [ 367.7599 + /Rect [ 406.3656 657.5936 - 447.6713 + 487.547 669.5936 ] /Subtype /Link /Type /Annot >> @@ -49,16 +50,25 @@ 5 0 obj /Subtype /Type1 /Type /Font >> endobj +% 'F4': class PDFType1Font +6 0 obj +% Font Helvetica-Oblique +<< /BaseFont /Helvetica-Oblique + /Encoding /WinAnsiEncoding + /Name /F4 + /Subtype /Type1 + /Type /Font >> +endobj % 'Page1': class PDFPage -6 0 obj +7 0 obj % Page dictionary << /Annots [ 4 0 R ] - /Contents 17 0 R + /Contents 18 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 16 0 R + /Parent 17 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -70,14 +80,14 @@ 6 0 obj /Type /Page >> endobj % 'Page2': class PDFPage -7 0 obj +8 0 obj % Page dictionary -<< /Contents 18 0 R +<< /Contents 19 0 R /MediaBox [ 0 0 595.2756 841.8898 ] - /Parent 16 0 R + /Parent 17 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text @@ -88,101 +98,101 @@ 7 0 obj /Trans << >> /Type /Page >> endobj -% 'R8': class PDFCatalog -8 0 obj +% 'R9': class PDFCatalog +9 0 obj % Document Root -<< /Outlines 10 0 R - /PageLabels 19 0 R +<< /Outlines 11 0 R + /PageLabels 20 0 R /PageMode /UseNone - /Pages 16 0 R + /Pages 17 0 R /Type /Catalog >> endobj -% 'R9': class PDFInfo -9 0 obj +% 'R10': class PDFInfo +10 0 obj << /Author () - /CreationDate (D:20100623080642-01'00') + /CreationDate (D:20100623123520-01'00') /Keywords () /Producer (ReportLab http://www.reportlab.com) /Subject (\(unspecified\)) /Title (Installation Instructions) >> endobj -% 'R10': class PDFOutlines -10 0 obj +% 'R11': class PDFOutlines +11 0 obj << /Count 5 - /First 11 0 R - /Last 15 0 R + /First 12 0 R + /Last 16 0 R /Type /Outlines >> endobj % 'Outline.0': class OutlineEntryObject -11 0 obj -<< /Dest [ 6 0 R +12 0 obj +<< /Dest [ 7 0 R /XYZ 62.69291 717.0236 0 ] - /Next 12 0 R - /Parent 10 0 R + /Next 13 0 R + /Parent 11 0 R /Title (Requirements) >> endobj % 'Outline.1': class OutlineEntryObject -12 0 obj -<< /Dest [ 6 0 R +13 0 obj +<< /Dest [ 7 0 R /XYZ 62.69291 618.0236 0 ] - /Next 13 0 R - /Parent 10 0 R - /Prev 11 0 R + /Next 14 0 R + /Parent 11 0 R + /Prev 12 0 R /Title (All Platforms) >> endobj % 'Outline.2': class OutlineEntryObject -13 0 obj -<< /Dest [ 6 0 R +14 0 obj +<< /Dest [ 7 0 R /XYZ 62.69291 507.0236 0 ] - /Next 14 0 R - /Parent 10 0 R - /Prev 12 0 R + /Next 15 0 R + /Parent 11 0 R + /Prev 13 0 R /Title (Linux) >> endobj % 'Outline.3': class OutlineEntryObject -14 0 obj -<< /Dest [ 6 0 R - /XYZ - 62.69291 - 260.4236 - 0 ] - /Next 15 0 R - /Parent 10 0 R - /Prev 13 0 R - /Title (Windows) >> -endobj -% 'Outline.4': class OutlineEntryObject 15 0 obj << /Dest [ 7 0 R /XYZ 62.69291 - 753.0236 + 248.4236 0 ] - /Parent 10 0 R + /Next 16 0 R + /Parent 11 0 R /Prev 14 0 R + /Title (Windows) >> +endobj +% 'Outline.4': class OutlineEntryObject +16 0 obj +<< /Dest [ 8 0 R + /XYZ + 62.69291 + 561.8236 + 0 ] + /Parent 11 0 R + /Prev 15 0 R /Title (MacOS) >> endobj -% 'R16': class PDFPages -16 0 obj +% 'R17': class PDFPages +17 0 obj % page tree << /Count 2 - /Kids [ 6 0 R - 7 0 R ] + /Kids [ 7 0 R + 8 0 R ] /Type /Pages >> endobj -% 'R17': class PDFStream -17 0 obj +% 'R18': class PDFStream +18 0 obj % page stream -<< /Length 5687 >> +<< /Length 6935 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q @@ -201,7 +211,7 @@ Q q 1 0 0 1 62.69291 630.0236 cm q -BT 1 0 0 1 0 52.82 Tm .076098 Tw 12 TL /F1 10 Tf 0 0 0 rg (The Virtual Leaf is written with the QT Cross platform application and UI framework, and can run on Linux,) Tj T* 0 Tw 1.85686 Tw (Apple Macintosh and Windows machines. To compile the Virtual Leaf you will need to install the QT) Tj T* 0 Tw 1.050697 Tw (software development kit \(SDK\) which you can download from the ) Tj 0 0 .501961 rg (QT download site) Tj 0 0 0 rg (. Whether installed) Tj T* 0 Tw 1.357045 Tw (globally by a system administrator our locally in your own user space, make sure the QT bin directory) Tj T* 0 Tw (containing qmake is in your execution path.) Tj T* ET +BT 1 0 0 1 0 52.82 Tm .244104 Tw 12 TL /F1 10 Tf 0 0 0 rg (The VirtualLeaf is written with the QT Cross platform application and UI framework, and can run on Linux,) Tj T* 0 Tw .684651 Tw (Apple Macintosh and Windows machines. To compile the VirtualLeaf from source you will need to install) Tj T* 0 Tw 1.685697 Tw (the QT software development kit\(SDK\) which you can download from the ) Tj 0 0 .501961 rg (QT download site) Tj 0 0 0 rg (. Whether) Tj T* 0 Tw 1.454692 Tw (installed globally by a system administrator our locally in your own user space, make sure the QT bin) Tj T* 0 Tw (directory containing qmake is in your execution path. Platform specific instructions follow.) Tj T* ET Q Q q @@ -213,7 +223,7 @@ Q q 1 0 0 1 62.69291 519.0236 cm q -BT 1 0 0 1 0 64.82 Tm 4.093984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Compilation is effected with make, either the native ) Tj /F3 10 Tf (make ) Tj /F1 10 Tf (on UNIX and MAC systems or the) Tj T* 0 Tw .268735 Tw /F3 10 Tf (mingw32-make ) Tj /F1 10 Tf (distributed with the windows version of QT. In the Virtual Leaf ) Tj /F3 10 Tf (src ) Tj /F1 10 Tf (directory you will find) Tj T* 0 Tw 1.243516 Tw (a ) Tj /F3 10 Tf (Makefile) Tj /F1 10 Tf (, the root of a hierarchy of makefiles, that will guide the compilation and installation of the) Tj T* 0 Tw 4.280814 Tw (VirtualLeaf executable, its default plugins and the tutorial examples. To facilitate cross platform) Tj T* 0 Tw .276651 Tw (compatibility, the makefiles expect an environment variable named ) Tj /F3 10 Tf (MAKE ) Tj /F1 10 Tf (to name the make utility to use.) Tj T* 0 Tw (The fallback default is 'make.' Platform specific instructions follow.) Tj T* ET +BT 1 0 0 1 0 64.82 Tm .005984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Compilation is effected with make, either the native ) Tj /F3 10 Tf (make ) Tj /F1 10 Tf (on UNIX and MAC systems or ) Tj /F3 10 Tf (mingw32-make) Tj T* 0 Tw .192927 Tw /F1 10 Tf (distributed with the windows version of QT. In the VirtualLeaf ) Tj /F3 10 Tf (src ) Tj /F1 10 Tf (directory you will find a ) Tj /F3 10 Tf (Makefile) Tj /F1 10 Tf (, the) Tj T* 0 Tw 3.275984 Tw (root of a hierarchy of makefiles, that will guide the compilation and installation of the VirtualLeaf) Tj T* 0 Tw 1.899982 Tw (executable, its default plugins and the tutorial examples. To facilitate cross platform compatibility, the) Tj T* 0 Tw 2.09284 Tw (makefiles use two environment variables: ) Tj /F3 10 Tf (MAKE ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (QMAKE ) Tj /F1 10 Tf (to name the make and QT-make utility) Tj T* 0 Tw (respectively. The fallback defaults are ) Tj /F3 10 Tf (make ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (qmake) Tj /F1 10 Tf (. Platform specific instructions follow.) Tj T* ET Q Q q @@ -225,8 +235,7 @@ Q q 1 0 0 1 62.69291 468.0236 cm q -0 0 0 rg -BT 1 0 0 1 0 4.82 Tm /F1 10 Tf 12 TL (Prepend the QT bin directory to your path, for example:) Tj T* ET +BT 1 0 0 1 0 4.82 Tm 12 TL /F1 10 Tf 0 0 0 rg (So the Makefiles can find ) Tj /F3 10 Tf (qmake) Tj /F1 10 Tf (, prepend the QT bin directory to your execution path, for example:) Tj T* ET Q Q q @@ -252,11 +261,11 @@ Q q 1 0 0 1 62.69291 402.8236 cm q -BT 1 0 0 1 0 16.82 Tm .87686 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you wish to use some other make utility than make, instantiate an environment variable named ) Tj /F3 10 Tf (MAKE) Tj /F1 10 Tf (,) Tj T* 0 Tw (for example:) Tj T* ET +BT 1 0 0 1 0 16.82 Tm 1.09936 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you wish to use some other ) Tj /F3 10 Tf (make ) Tj /F1 10 Tf (or ) Tj /F3 10 Tf (qmake ) Tj /F1 10 Tf (utilities other than the defaults, instantiate environment) Tj T* 0 Tw (variables named ) Tj /F3 10 Tf (MAKE ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (QMAKE) Tj /F1 10 Tf (, for example:) Tj T* ET Q Q q -1 0 0 1 62.69291 369.6236 cm +1 0 0 1 62.69291 357.6236 cm q q 1 0 0 1 0 0 cm @@ -266,23 +275,23 @@ q .662745 .662745 .662745 RG .5 w .960784 .960784 .862745 rg -n -6 -6 468.6898 24 re B* +n -6 -6 468.6898 36 re B* Q q -BT 1 0 0 1 0 5.71 Tm 12 TL /F3 10 Tf 0 0 0 rg (>) Tj ( export MAKE=gmake.) Tj T* ET +BT 1 0 0 1 0 17.71 Tm 12 TL /F3 10 Tf 0 0 0 rg (>) Tj ( export MAKE=gmake) Tj T* (>) Tj ( export QMAKE=/home/michael/MyQT/qt/bin/qmake) Tj T* ET Q Q Q Q Q q -1 0 0 1 62.69291 349.6236 cm +1 0 0 1 62.69291 337.6236 cm q -BT 1 0 0 1 0 4.82 Tm 12 TL /F1 10 Tf 0 0 0 rg (Go to the ) Tj /F3 10 Tf (src ) Tj /F1 10 Tf (directory and invoke make, for example:) Tj T* ET +BT 1 0 0 1 0 4.82 Tm 12 TL /F1 10 Tf 0 0 0 rg (To compile the VirtualLeaf, go to the VirtualLeaf ) Tj /F3 10 Tf (src ) Tj /F1 10 Tf (directory and invoke ) Tj /F3 10 Tf (make) Tj /F1 10 Tf (, for example:) Tj T* ET Q Q q -1 0 0 1 62.69291 304.4236 cm +1 0 0 1 62.69291 292.4236 cm q q 1 0 0 1 0 0 cm @@ -302,35 +311,33 @@ Q Q Q q -1 0 0 1 62.69291 272.4236 cm +1 0 0 1 62.69291 260.4236 cm q -BT 1 0 0 1 0 16.82 Tm 6.059213 Tw 12 TL /F1 10 Tf 0 0 0 rg (When complete, you will find the ) Tj /F3 10 Tf (VirtualLeaf ) Tj /F1 10 Tf (binary in ) Tj /F3 10 Tf (v1.0/bin ) Tj /F1 10 Tf (and the plugins in) Tj T* 0 Tw /F3 10 Tf (v1.0/bin/models) Tj /F1 10 Tf (.) Tj T* ET +BT 1 0 0 1 0 16.82 Tm .059985 Tw 12 TL /F1 10 Tf 0 0 0 rg (Once the compilation is complete, you will find the ) Tj /F3 10 Tf (VirtualLeaf ) Tj /F1 10 Tf (binary in ) Tj /F3 10 Tf (v1.0/bin ) Tj /F1 10 Tf (and the plugins in) Tj T* 0 Tw /F3 10 Tf (v1.0/bin/models) Tj /F1 10 Tf (.) Tj T* ET Q Q q -1 0 0 1 62.69291 239.4236 cm +1 0 0 1 62.69291 227.4236 cm q BT 1 0 0 1 0 8.435 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Windows) Tj T* ET Q Q q -1 0 0 1 62.69291 185.4236 cm +1 0 0 1 62.69291 173.4236 cm q -BT 1 0 0 1 0 40.82 Tm 2.017984 Tw 12 TL /F1 10 Tf 0 0 0 rg (For convenience sake the libiconv, libxml2 and libz header files and libraries are distributed with the) Tj T* 0 Tw .669986 Tw (Virtual Leaf code, and Virtual Leaf will compile correctly with them. If, however, you wish to compile with) Tj T* 0 Tw 3.246136 Tw (other versions of these libraries, you will need to reassign the ) Tj /F3 10 Tf (LIBZML2DIR) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (LIBICONVDIR ) Tj /F1 10 Tf (and) Tj T* 0 Tw /F3 10 Tf (LIBZDIR ) Tj /F1 10 Tf (variables in all the project files.) Tj T* ET +BT 1 0 0 1 0 40.82 Tm 3.219979 Tw 12 TL /F1 10 Tf 0 0 0 rg (For convenience sake, three required development libraries: ) Tj /F3 10 Tf (libiconv) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (libxml2 ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (libz ) Tj /F1 10 Tf (are) Tj T* 0 Tw .387318 Tw (distributed with the VirtualLeaf code, and the VirtualLeaf will compile correctly with them. If, however, you) Tj T* 0 Tw .590651 Tw (wish to use other versions of these libraries, you will need to reassign the ) Tj /F3 10 Tf (LIBICONVDIR) Tj /F1 10 Tf (, ) Tj /F3 10 Tf (LIBZML2DIR) Tj T* 0 Tw /F1 10 Tf (and ) Tj /F3 10 Tf (LIBZDIR ) Tj /F1 10 Tf (variables in all the project files.) Tj T* ET Q Q q -1 0 0 1 62.69291 143.4236 cm +1 0 0 1 62.69291 131.4236 cm q -0 0 0 rg -BT 1 0 0 1 0 28.82 Tm /F1 10 Tf 12 TL .878876 Tw (After installing QT you should be able to invoke a QT command window from the start menu. This shell) Tj T* 0 Tw .25784 Tw (automatically includes the necessary QT folder in your execution PATH. Within this command window, go) Tj T* 0 Tw (to the Virtual Leaf's src directory,) Tj T* ET +BT 1 0 0 1 0 28.82 Tm 3.513555 Tw 12 TL /F1 10 Tf 0 0 0 rg (As stated earlier, the Makefiles rely on two environment variables: ) Tj /F3 10 Tf (MAKE ) Tj /F1 10 Tf (and ) Tj /F3 10 Tf (QMAKE) Tj /F1 10 Tf (. Since QT) Tj T* 0 Tw 1.479147 Tw (executable names are consistent across platforms, the ) Tj /F3 10 Tf (QMAKE ) Tj /F1 10 Tf (default value, ) Tj /F3 10 Tf (QMAKE=qmake) Tj /F1 10 Tf (, will work) Tj T* 0 Tw (fine. You will have to create an environment named ) Tj /F3 10 Tf (MAKE ) Tj /F1 10 Tf (though.) Tj T* ET Q Q q -1 0 0 1 62.69291 113.4236 cm +1 0 0 1 62.69291 89.42362 cm q -0 0 0 rg -BT 1 0 0 1 0 16.82 Tm /F1 10 Tf 12 TL 1.927765 Tw (In the start menu, right click on My Computer and choose properties from the drop down list. In the) Tj T* 0 Tw (advanced tab click on environment variables. Append the QT) Tj T* ET +BT 1 0 0 1 0 28.82 Tm .928488 Tw 12 TL /F1 10 Tf 0 0 0 rg (To add an environment variable call up the ) Tj /F4 10 Tf (system tool) Tj /F1 10 Tf (, either with a left click on the ) Tj /F4 10 Tf (start menu ) Tj /F1 10 Tf (then a ) Tj T* 0 Tw .439986 Tw (right click on ) Tj /F4 10 Tf (My Computer ) Tj /F1 10 Tf (and choosing ) Tj /F4 10 Tf (properties ) Tj /F1 10 Tf (from the drop down list, or by choosing ) Tj /F4 10 Tf (control panel ) Tj T* 0 Tw .069988 Tw /F1 10 Tf (from the ) Tj /F4 10 Tf (start menu ) Tj /F1 10 Tf (and then double clicking on the ) Tj /F4 10 Tf (system tool ) Tj /F1 10 Tf (itself. Once in the ) Tj /F4 10 Tf (system tool) Tj /F1 10 Tf (, choose the) Tj T* 0 Tw ET Q Q q @@ -350,14 +357,52 @@ Q endstream endobj -% 'R18': class PDFStream -18 0 obj +% 'R19': class PDFStream +19 0 obj % page stream -<< /Length 452 >> +<< /Length 2509 >> stream 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET q -1 0 0 1 62.69291 732.0236 cm +1 0 0 1 62.69291 705.0236 cm +q +BT 1 0 0 1 0 40.82 Tm .052651 Tw 12 TL /F4 10 Tf 0 0 0 rg (advanced ) Tj /F1 10 Tf (tab and then click the ) Tj /F4 10 Tf (environment variables ) Tj /F1 10 Tf (button. The environment variables screen is split in) Tj T* 0 Tw .503735 Tw (two with ) Tj /F4 10 Tf (User ) Tj /F1 10 Tf (variables above and ) Tj /F4 10 Tf (System ) Tj /F1 10 Tf (variables below. Add a new users variable named ) Tj /F3 10 Tf (Make ) Tj /F1 10 Tf (with) Tj T* 0 Tw .939213 Tw (the value, e.g. ) Tj /F3 10 Tf (mingw32-make) Tj /F1 10 Tf (. the QT\(SDK\) contains the ) Tj /F4 10 Tf (minimum gnu for windows ) Tj /F1 10 Tf (\(mingw\) compiler;) Tj T* 0 Tw (commonly installed in: ) Tj /F3 10 Tf (c:\\QT\\qt-version\\mingw\\bin) Tj /F1 10 Tf (. Look there for the make utility name.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 651.0236 cm +q +BT 1 0 0 1 0 40.82 Tm 2.446235 Tw 12 TL /F1 10 Tf 0 0 0 rg (After installing QT and setting the ) Tj /F3 10 Tf (MAKE ) Tj /F1 10 Tf (environment variable, you should be able to invoke a QT) Tj T* 0 Tw .648651 Tw (command window from the ) Tj /F4 10 Tf (start menu) Tj /F1 10 Tf (. This shell automatically includes the necessary QT folder in your) Tj T* 0 Tw 1.380651 Tw (execution PATH. Within this command window, go to the VirtualLeaf ) Tj /F3 10 Tf (src ) Tj /F1 10 Tf (folder and invoke make, for) Tj T* 0 Tw (example:) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 605.8236 cm +q +q +1 0 0 1 0 0 cm +q +1 0 0 1 6.6 6.6 cm +q +.662745 .662745 .662745 RG +.5 w +.960784 .960784 .862745 rg +n -6 -6 468.6898 36 re B* +Q +q +BT 1 0 0 1 0 17.71 Tm 12 TL /F3 10 Tf 0 0 0 rg (>) Tj ( c:\\Documents and Settings\\michael\\VirtualLeaf\\v1.0\\src) Tj T* (>) Tj ( mingw32-make) Tj T* ET +Q +Q +Q +Q +Q +q +1 0 0 1 62.69291 573.8236 cm +q +BT 1 0 0 1 0 16.82 Tm 4.213059 Tw 12 TL /F1 10 Tf 0 0 0 rg (When complete, you will find the ) Tj /F3 10 Tf (VirtualLeaf.exe ) Tj /F1 10 Tf (binary in ) Tj /F3 10 Tf (v1.0/bin ) Tj /F1 10 Tf (and the plugins in) Tj T* 0 Tw /F3 10 Tf (v1.0/bin/models) Tj /F1 10 Tf (.) Tj T* ET +Q +Q +q +1 0 0 1 62.69291 540.8236 cm q BT 1 0 0 1 0 8.435 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (MacOS) Tj T* ET Q @@ -379,58 +424,59 @@ Q endstream endobj -% 'R19': class PDFPageLabels -19 0 obj +% 'R20': class PDFPageLabels +20 0 obj % Document Root << /Nums [ 0 - 20 0 R + 21 0 R 1 - 21 0 R ] >> + 22 0 R ] >> endobj -% 'R20': class PDFPageLabel -20 0 obj +% 'R21': class PDFPageLabel +21 0 obj % None << /S /D /St 1 >> endobj -% 'R21': class PDFPageLabel -21 0 obj +% 'R22': class PDFPageLabel +22 0 obj % None << /S /D /St 2 >> endobj xref -0 22 +0 23 0000000000 65535 f 0000000113 00000 n -0000000233 00000 n -0000000398 00000 n -0000000585 00000 n -0000000836 00000 n -0000000995 00000 n -0000001294 00000 n -0000001573 00000 n -0000001730 00000 n -0000001966 00000 n -0000002091 00000 n -0000002263 00000 n +0000000245 00000 n +0000000410 00000 n +0000000597 00000 n +0000000841 00000 n +0000001002 00000 n +0000001181 00000 n +0000001480 00000 n +0000001759 00000 n +0000001917 00000 n +0000002154 00000 n +0000002279 00000 n 0000002451 00000 n -0000002631 00000 n -0000002813 00000 n -0000002962 00000 n -0000003077 00000 n -0000008865 00000 n -0000009421 00000 n -0000009527 00000 n -0000009604 00000 n +0000002639 00000 n +0000002819 00000 n +0000003001 00000 n +0000003150 00000 n +0000003265 00000 n +0000010301 00000 n +0000012915 00000 n +0000013021 00000 n +0000013098 00000 n trailer << /ID % ReportLab generated PDF document -- digest (http://www.reportlab.com) - [(\030\0369*\371\251A7q\357\344\306\204\322.\262) (\030\0369*\371\251A7q\357\344\306\204\322.\262)] + [(\247u5\225Y\035H\257\370\345\300\201\313\031U0) (\247u5\225Y\035H\257\370\345\300\201\313\031U0)] - /Info 9 0 R - /Root 8 0 R - /Size 22 >> + /Info 10 0 R + /Root 9 0 R + /Size 23 >> startxref -9651 +13145 %%EOF diff --git a/doc/installation.rst b/doc/installation.rst --- a/doc/installation.rst +++ b/doc/installation.rst @@ -16,73 +16,118 @@ Installation Instructions Requirements ------------ -The Virtual Leaf is written with the QT Cross platform application and +The VirtualLeaf is written with the QT Cross platform application and UI framework, and can run on Linux, Apple Macintosh and Windows -machines. To compile the Virtual Leaf you will need to install the QT -software development kit (SDK) which you can download from the `QT download -site `_. Whether -installed globally by a system administrator our locally in your own -user space, make sure the QT bin directory containing qmake is in your -execution path. +machines. To compile the VirtualLeaf from source you will need to +install the QT software development kit(SDK) which you can download +from the `QT download site `_. +Whether installed globally by a system administrator our locally in +your own user space, make sure the QT bin directory containing qmake +is in your execution path. Platform specific instructions follow. All Platforms ------------- Compilation is effected with make, either the native ``make`` on UNIX -and MAC systems or the ``mingw32-make`` distributed with the windows -version of QT. In the Virtual Leaf ``src`` directory you will find a +and MAC systems or ``mingw32-make`` distributed with the windows +version of QT. In the VirtualLeaf ``src`` directory you will find a ``Makefile``, the root of a hierarchy of makefiles, that will guide the compilation and installation of the VirtualLeaf executable, its default plugins and the tutorial examples. To facilitate cross -platform compatibility, the makefiles expect an environment variable -named ``MAKE`` to name the make utility to use. The fallback default -is 'make.' Platform specific instructions follow. +platform compatibility, the makefiles use two environment variables: +``MAKE`` and ``QMAKE`` to name the make and QT-make utility +respectively. The fallback defaults are ``make`` and +``qmake``. Platform specific instructions follow. Linux ----- -Prepend the QT bin directory to your path, for example:: +So the Makefiles can find ``qmake``, prepend the QT bin directory to +your execution path, for example:: > PATH=/opt/QT/qt/bin:$PATH -If you wish to use some other make utility than make, instantiate an -environment variable named ``MAKE``, for example:: +If you wish to use some other ``make`` or ``qmake`` utilities other +than the defaults, instantiate environment variables named ``MAKE`` +and ``QMAKE``, for example:: - > export MAKE=gmake. + > export MAKE=gmake + > export QMAKE=/home/michael/MyQT/qt/bin/qmake -Go to the ``src`` directory and invoke make, for example:: +To compile the VirtualLeaf, go to the VirtualLeaf ``src`` directory +and invoke ``make``, for example:: > cd /home/michael/VirtualLeaf/v1.0/src > make -When complete, you will find the ``VirtualLeaf`` binary in -``v1.0/bin`` and the plugins in ``v1.0/bin/models``. +Once the compilation is complete, you will find the ``VirtualLeaf`` +binary in ``v1.0/bin`` and the plugins in ``v1.0/bin/models``. Windows ------- -For convenience sake the libiconv, libxml2 and libz header files and -libraries are distributed with the Virtual Leaf code, and Virtual Leaf -will compile correctly with them. If, however, you wish to compile -with other versions of these libraries, you will need to reassign the -``LIBZML2DIR``, ``LIBICONVDIR`` and ``LIBZDIR`` variables in all the -project files. +For convenience sake, three required development libraries: +``libiconv``, ``libxml2`` and ``libz`` are distributed with the +VirtualLeaf code, and the VirtualLeaf will compile correctly with +them. If, however, you wish to use other versions of these libraries, +you will need to reassign the ``LIBICONVDIR``, ``LIBZML2DIR`` and +``LIBZDIR`` variables in all the project files. + +As stated earlier, the Makefiles rely on two environment variables: +``MAKE`` and ``QMAKE``. Since QT executable names are consistent +across platforms, the ``QMAKE`` default value, ``QMAKE=qmake``, will +work fine. You will have to create an environment named ``MAKE`` +though. -After installing QT you should be able to invoke a QT command window -from the start menu. This shell automatically includes the necessary -QT folder in your execution PATH. Within this command window, go to the -Virtual Leaf's src directory, +To add an environment variable call up the *system tool*, either with a +left click on the *start menu* then a right click on *My Computer* and +choosing *properties* from the drop down list, or by choosing *control +panel* from the *start menu* and then double clicking on the *system +tool* itself. Once in the *system tool*, choose the *advanced* tab and +then click the *environment variables* button. The environment +variables screen is split in two with *User* variables above and *System* +variables below. Add a new users variable named ``Make`` with the +value, e.g. ``mingw32-make``. the QT(SDK) contains the *minimum gnu +for windows* (mingw) compiler; commonly installed in: +``c:\QT\qt-version\mingw\bin``. Look there for the make utility name. -In the start menu, right click on My Computer and choose properties -from the drop down list. In the advanced tab click on environment -variables. Append the QT +After installing QT and setting the ``MAKE`` environment variable, you +should be able to invoke a QT command window from the *start +menu*. This shell automatically includes the necessary QT folder in +your execution PATH. Within this command window, go to the VirtualLeaf +``src`` folder and invoke make, for example:: + + > c:\Documents and Settings\michael\VirtualLeaf\v1.0\src + > mingw32-make + +When complete, you will find the ``VirtualLeaf.exe`` binary in +``v1.0/bin`` and the plugins in ``v1.0/bin/models``. MacOS ----- +Make sure that XCode development environment is installed from +the MacOSX installations DVDs. Also download and install a recent +version of Qt as described above (version >4.4). +Open the Terminal program (in ``/Applications/Utilities/``). +Unpack the VirtualLeaf source package into your home folder, +by typing:: + > cd + > tar xzf VirtualLeaf-V1.0.tgz + +Now go to the ``src`` directory, set the right options for qmake, +and invoke make, by typing, for example:: + + > cd + > cd VirtualLeaf/v1.0/src + > export QMAKESPEC=macx-g++; make + +When complete, you will find the ``VirtualLeaf`` binary in +``v1.0/bin`` and the plugins in ``v1.0/bin/models``. + diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2010-06-23 + * VirtualLeaf-install.nsi: New gpl license text. + + * VirtualLeaf.pro: Disabled console mode. + * mesh.cpp (Clear): Added parentheses to qDebug statments. (TestIllegalWalls): Replaced qDebug(). diff --git a/src/VirtualLeaf-install.nsi b/src/VirtualLeaf-install.nsi --- a/src/VirtualLeaf-install.nsi +++ b/src/VirtualLeaf-install.nsi @@ -78,7 +78,7 @@ !insertmacro MUI_PAGE_WELCOME # License page -!insertmacro MUI_PAGE_LICENSE "..\doc\GPL" +!insertmacro MUI_PAGE_LICENSE "..\doc\gpl3.txt" # Components page !insertmacro MUI_PAGE_COMPONENTS diff --git a/src/VirtualLeaf.pro b/src/VirtualLeaf.pro --- a/src/VirtualLeaf.pro +++ b/src/VirtualLeaf.pro @@ -49,7 +49,7 @@ QT += qt3support } win32 { - CONFIG += console + CONFIG -= console LIBXML2DIR = ..\lib\libxml2 LIBICONVDIR = ..\lib\libiconv LIBZDIR = ..\lib\libz