Changeset - 5564fc0d72bc
[Not reviewed]
default
1 5 2
Roeland Merks - 15 years ago 2010-06-04 15:55:15
roeland.merks@cwi.nl
Updated the Makefiles and updated testplugin to new plugin interface.

user: Roeland Merks <roeland.merks@cwi.nl>
branch 'default'
added src/Makefile
added src/build_models/Makefile
changed src/VirtualLeaf.pro
changed src/build_models/leafplugin.cpp
changed src/build_models/leafplugin.h
changed src/build_models/testplugin.cpp
changed src/build_models/testplugin.h
removed src/build_models/simplugin.h
8 files changed with 117 insertions and 133 deletions:
0 comments (0 inline, 0 general)
src/Makefile
Show inline comments
 
new file 100644
 
# $Id: Makefile,v 3f0977faba37 2010/06/03 15:54:37 michael $
 

	
 
QMAKE = qmake
 

	
 
all: VirtualLeaf libplugin plugins
 

	
 
VirtualLeaf: Makefile.VirtualLeaf
 
	make -f Makefile.VirtualLeaf
 

	
 
Makefile.VirtualLeaf: VirtualLeaf.pro
 
	$(QMAKE) -makefile -o $@ $< 
 

	
 
libplugin: Makefile.libplugin
 
	make -f Makefile.libplugin
 

	
 
Makefile.libplugin: libplugin.pro
 
	$(QMAKE) -makefile -o $@ $< 
 

	
 
plugins:
 
	make -C build_models
 

	
 
clean:
 
	make -f Makefile.libplugin clean
 
	make -f Makefile.VirtualLeaf clean
 
	make -C build_models clean
 

	
 
#finis
src/VirtualLeaf.pro
Show inline comments
 
@@ -20,204 +20,204 @@
 
#
 

	
 
CONFIG += release
 
CONFIG -= debug
 
CONFIG += qt
 

	
 
QMAKE_CXXFLAGS += -fexceptions
 
QMAKE_CXXFLAGS_DEBUG += -g3
 
QMAKE_CXXFLAGS_DEBUG += -DQDEBUG
 

	
 
#REACTIONS = reactions_auxin_growth.h 
 
#REACTIONS = reactions_meinhardt.h
 
#REACTIONS = reactions_pce_growth.h
 
DEFINES += QTGRAPHICS
 
DEFINES += REACTIONS_HEADER=$${REACTIONS}
 
DEFINES += REACTIONS_HEADER_STRING=\"$${REACTIONS}\"
 
DEFINES += FLEMING
 

	
 
PERLDIR = ./perl
 
BINDIR = ../bin
 
DESTDIR = $$BINDIR
 
TARGET = VirtualLeaf
 
TEMPLATE = app
 
PARTMPL = $${TARGET}par.tmpl
 
MAINSRC = $${TARGET}.cpp
 
QT -= network sql xml
 
QT += qt3support
 

	
 
!win32 {
 
 GRAPHICS = qt #qwt
 
}
 

	
 
win32 {
 
 CONFIG += console
 
 LIBXML2DIR = C:\libxml2
 
 LIBICONVDIR = C:\libiconv
 
 LIBZDIR = C:\libz
 
 system(DEL parameter.cpp parameter.h) 
 
 GRAPHICS = qt 
 
 RC_FILE = VirtualLeaf.rc
 
 QMAKE_CXXFLAGS += -DLIBXML_STATIC
 
 QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include
 
 QMAKE_POST_LINK = "\
 
  C:\Bin\cp release\VirtualLeaf.exe \
 
  C:\Qt\4.5.3\bin\Qt3Support4.dll \
 
  C:\Qt\4.5.3\bin\QtGui4.dll \
 
  C:\Qt\4.5.3\bin\QtSql4.dll \
 
  C:\Qt\4.5.3\bin\QtXml4.dll \
 
  C:\Qt\4.5.3\bin\QtCore4.dll \
 
  C:\Qt\4.5.3\bin\QtNetwork4.dll \
 
  C:\Qt\4.5.3\bin\QtSvg4.dll \
 
  C:\bin\iconv.dll \
 
  C:\bin\libxml2.dll \
 
  C:\bin\zlib1.dll \
 
  C:\MinGW\bin\mingwm10.dll \
 
  $${DESTDIR}"
 
 LIBS += -L$${LIBXML2DIR}\lib -lxml2 -L$${LIBICONVDIR}\lib -L$${LIBZDIR}\lib  -lz -lm -lwsock32 -liconv
 
}
 

	
 
# Application icons
 
macx {
 
 ICON = leaficon.icns
 
 # make sure that the executable can find the libqwt share library
 
 QMAKE_POST_LINK = "mkdir $${DESTDIR}/$${TARGET}.app/Contents/Frameworks; \
 
  cp /usr/local/qwt/lib/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/Frameworks/.; \
 
  #install_name_tool -change libqwt.5.dylib $$QWTDIR/lib/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/MacOS/$${TARGET}; \
 
  install_name_tool -id @executable_path/../Frameworks/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/Frameworks/libqwt.dylib; \
 
  install_name_tool -change libqwt.5.dylib @executable_path/../Frameworks/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/MacOS/$${TARGET};\
 
  cp leaficon.icns $${DESTDIR}/$${TARGET}.app; "
 
}
 

	
 
macx:release {
 
 LIBS+= -dead_strip
 
}
 

	
 
unix {
 
 system(rm -f parameter.cpp parameter.h) 
 
 CC = /usr/bin/gcc 
 
 QWTDIR = /ufs/guravage/opt/qwt-5.2.1-svn
 
 QMAKE_LIBDIR += $$QWTDIR/lib 
 
 QMAKE_CXXFLAGS += -fPIC -I/usr/include/libxml2
 
 QMAKE_LFLAGS += -fPIC
 
 LIBS += -lxml2 -lz -lm 
 
}
 

	
 
system(perl $$PERLDIR/make_parameter_source.pl $$PARTMPL)
 
system(perl $$PERLDIR/make_pardialog_source.pl $$PARTMPL)
 
#system(perl $$PERLDIR/make_xmlwritecode.pl -h $$REACTIONS)
 

	
 
# Input
 
HEADERS += \
 
 apoplastitem.h \
 
 canvas.h \
 
 cellbase.h \
 
 cell.h \
 
 cellitem.h \
 
 forwardeuler.h \
 
# forwardeuler.h \
 
 infobar.h \
 
 mainbase.h \
 
 mainbase.h \
 
 matrix.h \
 
 mesh.h \
 
 miscq.h \
 
 modelcatalogue.h \
 
 Neighbor.h \
 
 node.h \
 
 nodeitem.h \
 
 nodeset.h \
 
 OptionFileDialog.h \
 
 output.h \
 
 parameter.h \
 
 pardialog.h \
 
 parse.h \
 
 pi.h \
 
 qcanvasarrow.h \
 
 random.h \
 
 rungekutta.h \
 
 simitembase.h \
 
 simplugin.h \
 
 sqr.h \
 
 tiny.h \
 
 transporterdialog.h \
 
 UniqueMessage.h \
 
 vector.h \
 
 wallbase.h \
 
 wall.h \
 
 wallitem.h \
 
 warning.h \
 
 xmlwrite.h \
 
 $${PARTMPL}
 

	
 
SOURCES += \
 
 apoplastitem.cpp \
 
 canvas.cpp \
 
 cellbase.cpp \
 
 cell.cpp \
 
 cellitem.cpp \
 
 forwardeuler.cpp \
 
# forwardeuler.cpp \
 
 mainbase.cpp \
 
 matrix.cpp \
 
 mesh.cpp \
 
 miscq.cpp \
 
 modelcatalogue.cpp \
 
 Neighbor.cpp \
 
 node.cpp \
 
 nodeitem.cpp \
 
 nodeset.cpp \
 
 OptionFileDialog.cpp \
 
 output.cpp \
 
 parameter.cpp \
 
 pardialog.cpp \
 
 parse.cpp \
 
 random.cpp \
 
 rungekutta.cpp \
 
 simitembase.cpp \
 
 transporterdialog.cpp \
 
 UniqueMessage.cpp \
 
 vector.cpp \
 
 wallbase.cpp \
 
 wall.cpp \
 
 wallitem.cpp \
 
 warning.cpp \
 
 xmlwritecode.cpp \
 
 xmlwrite.cpp \
 
 $$MAINSRC
 

	
 
contains( TARGET, leaf_fleming ) {
 
 DEFINES += FLEMING	
 
}
 

	
 
contains(GRAPHICS, qwt) {
 
 #macx:LIBS += -L$$QWTDIR/lib -lqwt
 
 #win32:LIBS += -L$$QWTDIR/lib -lqwt5
 
 #LIBS += -L$$QWTDIR/lib -lqwt
 
 INCLUDEPATH += $$QWTDIR/include
 
 DEFINES += HAVE_QWT
 
 HEADERS += data_plot.h
 
 SOURCES += data_plot.cpp
 
}
 

	
 
contains( GRAPHICS, qt ) {
 
 message( "Building Qt executable" )
 
 QMAKE_CXXFLAGS += -DQTGRAPHICS # -fpermissive
 
}
 

	
 
contains( GRAPHICS, xfig ) {
 
 message("Building Xfig executable (background runnable).")
 
 QMAKE_CXXFLAGS += -DXFIGGRAPHICS
 
}
 

	
 
contains( GRAPHICS, x11 ) {
 
 !unix {
 
  error("X11 graphics only available on Unix systems.")
 
 }
 
 message("Building X11 executable")
 
 SOURCES += x11graph.cpp
 
 HEADERS += x11graph.h
 
 QMAKE_CXXFLAGS += -DX11GRAPHICS
 
 CONFIG -= qt
 
 CONFIG += x11
 
 unix:LIBS += -lpng
 
}
 

	
 
# finis
src/build_models/Makefile
Show inline comments
 
new file 100644
 
# $Id: Makefile,v 3f0977faba37 2010/06/03 15:54:37 michael $
 

	
 
QMAKE = qmake
 

	
 
all: plugin_auxingrowth plugin_leaf plugin_meinhardt plugin_test
 

	
 
plugin_auxingrowth: Makefile.plugin_auxingrowth
 
	make -f Makefile.plugin_auxingrowth
 

	
 
Makefile.plugin_auxingrowth: plugin_auxingrowth.pro
 
	$(QMAKE) -makefile -o $@ $< 
 

	
 
plugin_leaf: Makefile.plugin_leaf
 
	make -f Makefile.plugin_leaf
 

	
 
Makefile.plugin_leaf: plugin_leaf.pro
 
	$(QMAKE) -makefile -o $@ $< 
 

	
 
plugin_meinhardt: Makefile.plugin_meinhardt
 
	make -f Makefile.plugin_meinhardt
 

	
 
Makefile.plugin_meinhardt: plugin_meinhardt.pro
 
	$(QMAKE) -makefile -o $@ $< 
 

	
 
plugin_test: Makefile.plugin_test
 
	make -f Makefile.plugin_test
 

	
 
Makefile.plugin_test: plugin_test.pro
 
	$(QMAKE) -makefile -o $@ $< 
 

	
 
clean:
 
	make -f Makefile.plugin_auxingrowth clean
 
	make -f Makefile.plugin_leaf clean
 
	make -f Makefile.plugin_meinhardt clean
 
	make -f Makefile.plugin_test clean
 

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

	
 
#include <QObject>
 
#include <QtGui>
 

	
 
#include "simplugin.h"
 

	
 
#include "parameter.h"
 

	
 
#include "wallbase.h"
 
#include "cellbase.h"
 
#include "leafplugin.h"
 

	
 
#include "far_mem_5.h"
 

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

	
 
bool batch = false;
 

	
 
// To be executed after cell division
 
void LeafPlugin::OnDivide(ParentInfo &parent_info, CellBase &daughter1, CellBase &daughter2) {
 
void LeafPlugin::OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2) {
 
		// PIN1 distributes between parent and daughter according to area
 
  double area = daughter1.Area(), daughter_area = daughter2.Area();
 
  double area = daughter1->Area(), daughter_area = daughter2->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
 
  
 
	// "Fudge" rule: if one of the cells is at the boundary, remove all AUX1 in the other cell
 
  if (daughter1.AtBoundaryP() && !daughter2.AtBoundaryP()) {
 
    //daughter2.new_chem[2]=daughter2.chem[2]=0.;
 
		daughter2.SetNewChem(2,0);
 
		daughter2.SetChemical(2,0);
 
  if (daughter1->AtBoundaryP() && !daughter2->AtBoundaryP()) {
 
    //daughter2->new_chem[2]=daughter2->chem[2]=0.;
 
		daughter2->SetNewChem(2,0);
 
		daughter2->SetChemical(2,0);
 
		//daughter.new_chem[0]=daughter.chem[0]=0.;
 
		//cerr << "Clearing daughter\n";
 
		//for (list<Wall *>::const_iterator w=daughter.walls.begin();
 
		//	 w!=daughter.walls.end();
 
		//	 w++) {
 
			
 
		//	(*w)->setTransporter(&daughter, 1, 0.);
 
		
 
		//}
 
		//new_chem[2]=chem[2]=parent_info.PINendosome;
 
		daughter1.SetNewChem(2,parent_info.PINendosome);
 
		daughter1.SetChemical(2,parent_info.PINendosome);
 
		//new_chem[2]=chem[2]=parent_info->PINendosome;
 
		daughter1->SetNewChem(2,parent_info->PINendosome);
 
		daughter1->SetChemical(2,parent_info->PINendosome);
 
 
 
	} else {
 
		if (daughter2.AtBoundaryP() && !daughter1.AtBoundaryP()) {
 
		if (daughter2->AtBoundaryP() && !daughter1->AtBoundaryP()) {
 
		  
 
		  //new_chem[2]=chem[2]=0.;
 
		  daughter1.SetNewChem(2,0);
 
		  daughter1.SetChemical(2,0);
 
		  daughter1->SetNewChem(2,0);
 
		  daughter1->SetChemical(2,0);
 
		  
 
			/*new_chem[0]=chem[0]=0.;
 
			for (list<Wall *>::const_iterator w=walls.begin();
 
				 w!=walls.end();
 
				 w++) {
 
				
 
				(*w)->setTransporter(this, 1, 0.);
 
			}*/
 
		  //daughter2.chem[2]=parent_info.PINendosome;
 
		  daughter2.SetChemical(2,parent_info.PINendosome);
 
		  //daughter2->chem[2]=parent_info->PINendosome;
 
		  daughter2->SetChemical(2,parent_info->PINendosome);
 
		  //cerr << "Clearing parent\n";
 
		  
 
		} else {
 
		  //daughter1.new_chem[2]=daughter1.chem[2] = parent_info.PINendosome*(area/tot_area);
 
		  daughter1.SetNewChem(2,parent_info.PINendosome*(area/tot_area));
 
		  daughter1.SetChemical(2, parent_info.PINendosome*(area/tot_area));
 
		  //daughter2.new_chem[2]=daughter2.chem[2] = parent_info.PINendosome*(daughter_area/tot_area);
 
		  daughter2.SetNewChem(2,parent_info.PINendosome*(daughter_area/tot_area));
 
		  daughter2.SetChemical(2,parent_info.PINendosome*(daughter_area/tot_area));
 
		  //daughter1->new_chem[2]=daughter1->chem[2] = parent_info->PINendosome*(area/tot_area);
 
		  daughter1->SetNewChem(2,parent_info->PINendosome*(area/tot_area));
 
		  daughter1->SetChemical(2, parent_info->PINendosome*(area/tot_area));
 
		  //daughter2->new_chem[2]=daughter2->chem[2] = parent_info->PINendosome*(daughter_area/tot_area);
 
		  daughter2->SetNewChem(2,parent_info->PINendosome*(daughter_area/tot_area));
 
		  daughter2->SetChemical(2,parent_info->PINendosome*(daughter_area/tot_area));
 
		  
 
		}
 
	}
 
	
 
	/*
 
	  // NB: Code commented out; not yet adapted to plugin format... RM 18/12/2009
 
	// 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;
 
	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;
 
     	//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();
 
	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 LeafPlugin::SetCellColor(CellBase &c, QColor &color) { 
 
void LeafPlugin::SetCellColor(CellBase *c, 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.) );
 
  color.setRgb(c.Chemical(2)/(1+c.Chemical(2)) * 255.,(c.Chemical(0)/(1+c.Chemical(0)) * 255.),(c.Chemical(3)/(1+c.Chemical(3)) *255.) );
 
  //  color->setRgb(chem[2]/(1+chem[2]) * 255.,(chem[0]/(1+chem[0]) * 255.),(chem[3]/(1+chem[3]) *255.) );
 
  color->setRgb(c->Chemical(2)/(1+c->Chemical(2)) * 255.,(c->Chemical(0)/(1+c->Chemical(0)) * 255.),(c->Chemical(3)/(1+c->Chemical(3)) *255.) );
 
  
 

	
 
}
 

	
 

	
 

	
 
void LeafPlugin::CellHouseKeeping(CellBase &c) {
 
void LeafPlugin::CellHouseKeeping(CellBase *c) {
 
	
 
  if (c.Boundary()==CellBase::None) {
 
    if (c.Area() > par->rel_cell_div_threshold * c.BaseArea() ) {
 
      //c.SetChemical(0,0);
 
      c.Divide();
 
  if (c->Boundary()==CellBase::None) {
 
    if (c->Area() > par->rel_cell_div_threshold * c->BaseArea() ) {
 
      //c->SetChemical(0,0);
 
      c->Divide();
 
    }		
 
    
 
    // expand if this is not a provascular cell
 
    if (c.Chemical(3) < 0.7 ) {
 
      c.EnlargeTargetArea(par->cell_expansion_rate);
 
    if (c->Chemical(3) < 0.7 ) {
 
      c->EnlargeTargetArea(par->cell_expansion_rate);
 
    } 
 
  }  
 
  
 
}
 

	
 
void LeafPlugin::CelltoCellTransport(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<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;
 
	  
 
   
 

	
 
}
 
void LeafPlugin::WallDynamics(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;
 
  
 
}
 

	
 
double LeafPlugin::complex_PijAj(CellBase &here, CellBase &nb, Wall &w) { 
 
double LeafPlugin::complex_PijAj(CellBase *here, CellBase *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 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));
 
  return here->Chemical(1) * receptor_level / ( par->km + here->Chemical(1));
 
  
 
}
 

	
 

	
 
void LeafPlugin::CellDynamics(CellBase *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>( far_3_arg_mem_fun( *this, &LeafPlugin::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() == CellBase::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 ); 
 
  }
 
}
 

	
 

	
 

	
 

	
 

	
 

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

	
 
#ifndef _LEAFPLUGIN_H_
 
#define _LEAFPLUGIN_H_
 

	
 
#include <QObject>
 
#include <QtGui>
 
#include <QString>
 
#include "../simplugin.h"
 

	
 

	
 
class LeafPlugin : public QObject, SimPluginInterface {
 
	Q_OBJECT
 
	Q_INTERFACES(SimPluginInterface);
 

	
 
public:
 
	virtual QString ModelID(void) { return QString( "Traveling wave model with influx carriers - Merks and Beemster, 2006-2008" ); }
 
	
 
	// Executed after the cellular mechanics steps have equillibrized
 
	virtual void CellHouseKeeping (CellBase &c);
 
	virtual void CellHouseKeeping (CellBase *c);
 
	// Differential equations describing transport of chemicals from cell to cell
 
	virtual void CelltoCellTransport(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)
 
	virtual void WallDynamics(Wall *w, double *dw1, double *dw2);
 
	
 
	// Differential equations describing chemical reactions inside the cells
 
	virtual void CellDynamics(CellBase *c, double *dchem);
 
	
 
	// to be executed after a cell division
 
	virtual void OnDivide(ParentInfo &parent_info, CellBase &daughter1, CellBase &daughter2);
 
	virtual void OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2);
 
	
 
	// to be executed for coloring a cell
 
	virtual void SetCellColor(CellBase &c, QColor &color);	
 
	virtual void SetCellColor(CellBase *c, QColor *color);	
 
	// return number of chemicals
 
	virtual int NChem(void) { return 4; }
 

	
 
 private:
 
	double complex_PijAj(CellBase &here, CellBase &nb, Wall &w);
 
	double complex_PijAj(CellBase *here, CellBase *nb, Wall *w);
 
	
 
};
 

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

	
 
#include <QObject>
 
#include <QtGui>
 

	
 
#include "simplugin.h"
 

	
 
#include "parameter.h"
 

	
 
#include "wallbase.h"
 
#include "cellbase.h"
 
#include "testplugin.h"
 

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

	
 
bool batch = false;
 

	
 
// To be executed after cell division
 
void TestPlugin::OnDivide(ParentInfo &parent_info, CellBase &daughter1, CellBase &daughter2) {
 
void TestPlugin::OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2) {
 
	
 
}
 

	
 
void TestPlugin::SetCellColor(CellBase &c, QColor &color) { 
 
void TestPlugin::SetCellColor(CellBase *c, QColor *color) { 
 

	
 
	static QStringList colors;
 
	if (colors.size()==0) {
 
		colors << "red" << "green" << "blue";
 
	}
 
	color = colors[c.Index()%colors.size()];
 
	color->setNamedColor(colors[c->Index()%colors.size()]);
 
}
 

	
 

	
 

	
 
void TestPlugin::CellHouseKeeping(CellBase &c) {
 
void TestPlugin::CellHouseKeeping(CellBase *c) {
 
	
 
	c.EnlargeTargetArea(par->cell_expansion_rate);
 
	if (c.Area() > par->rel_cell_div_threshold * c.BaseArea() ) {
 
		c.Divide();
 
	c->EnlargeTargetArea(par->cell_expansion_rate);
 
	if (c->Area() > par->rel_cell_div_threshold * c->BaseArea() ) {
 
		c->Divide();
 
	}
 
}
 

	
 
void TestPlugin::CelltoCellTransport(Wall *w, double *dchem_c1, double *dchem_c2) {}
 
void TestPlugin::WallDynamics(Wall *w, double *dw1, double *dw2) {}
 
void TestPlugin::CellDynamics(CellBase *c, double *dchem) { }
 

	
 

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

	
 

	
 
#include <QObject>
 
#include <QtGui>
 
#include <QString>
 
#include "../simplugin.h"
 

	
 

	
 
class TestPlugin : public QObject, SimPluginInterface {
 
	Q_OBJECT
 
	Q_INTERFACES(SimPluginInterface);
 

	
 
public:
 
	virtual QString ModelID(void) { return QString( "Test model" ); }
 
	
 
	// Executed after the cellular mechanics steps have equillibrized
 
	virtual void CellHouseKeeping (CellBase &c);
 
	virtual void CellHouseKeeping (CellBase *c);
 
	// Differential equations describing transport of chemicals from cell to cell
 
	virtual void CelltoCellTransport(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)
 
	virtual void WallDynamics(Wall *w, double *dw1, double *dw2);
 
	
 
	// Differential equations describing chemical reactions inside the cells
 
	virtual void CellDynamics(CellBase *c, double *dchem);
 
	
 
	// to be executed after a cell division
 
	virtual void OnDivide(ParentInfo &parent_info, CellBase &daughter1, CellBase &daughter2);
 
	virtual void OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2);
 
	
 
	// to be executed for coloring a cell
 
	virtual void SetCellColor(CellBase &c, QColor &color);	
 
	virtual void SetCellColor(CellBase *c, QColor *color);	
 
	// return number of chemicals
 
	virtual int NChem(void) { return 0; }
 
};
 

	
 

	
 

	
 

	
0 comments (0 inline, 0 general)