Changeset - c32457e84c7f
[Not reviewed]
Merge default
0 14 0
Roeland Merks - 15 years ago 2010-10-14 11:56:01
roeland.merks@cwi.nl
Commit changes

user: Roeland Merks <roeland.merks@cwi.nl>
branch merge
branch 'default'
changed src/ChangeLog
changed src/TutorialCode/Tutorial3/ChangeLog
changed src/TutorialCode/Tutorial3/tutorial3.h
changed src/TutorialCode/Tutorial4/ChangeLog
changed src/TutorialCode/Tutorial4/tutorial4.h
changed src/TutorialCode/Tutorial5/ChangeLog
changed src/TutorialCode/Tutorial5/tutorial5.h
changed src/VirtualLeafpar.tmpl
changed src/canvas.cpp
changed src/canvas.h
changed src/parameter.cpp
changed src/parameter.h
changed src/pardialog.cpp
changed src/pardialog.h
13 files changed with 39 insertions and 27 deletions:
0 comments (0 inline, 0 general)
src/TutorialCode/Tutorial3/ChangeLog
Show inline comments
 
2010-10-14    <guravage@caterpie.sen.cwi.nl>
 

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

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

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

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

	
 
	* tutorial3.pro: Corrected windows library path.
 

	
src/TutorialCode/Tutorial3/tutorial3.h
Show inline comments
 
@@ -44,17 +44,20 @@ public:
 
	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);
 
	
 
	// to be executed for coloring a cell
 
	virtual void SetCellColor(CellBase *c, QColor *color);	
 
	// return number of chemicals
 
	virtual int NChem(void);
 

	
 
	// default LeafML file
 
	virtual QString DefaultLeafML(void) { return QString("tutorial3_init.xml"); }
 
};
 

	
 

	
 

	
 

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

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

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

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

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

	
 
	* tutorial4.pro: Corrected windows library path.
 

	
src/TutorialCode/Tutorial4/tutorial4.h
Show inline comments
 
@@ -46,17 +46,20 @@ public:
 
	// 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);
 
	
 
	// to be executed for coloring a cell
 
	virtual void SetCellColor(CellBase *c, QColor *color);	
 
	// return number of chemicals
 
	virtual int NChem(void);
 
	
 
	virtual double PINflux(CellBase *this_cell, CellBase *adjacent_cell, Wall *w); 
 

	
 
	// default LeafML file
 
	virtual QString DefaultLeafML(void) { return QString("tutorial4_init.xml"); }
 
};
 

	
 

	
 

	
 

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

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

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

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

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

	
 
	* tutorial5.pro: Corrected windows library path.
 

	
src/TutorialCode/Tutorial5/tutorial5.h
Show inline comments
 
@@ -46,17 +46,20 @@ public:
 
	// 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);
 
	
 
	// to be executed for coloring a cell
 
	virtual void SetCellColor(CellBase *c, QColor *color);	
 
	// return number of chemicals
 
	virtual int NChem(void);
 
	
 
	virtual double PINflux(CellBase *this_cell, CellBase *adjacent_cell, Wall *w); 
 

	
 
	// default LeafML file
 
	virtual QString DefaultLeafML(void) { return QString("tutorial5_init.xml"); }
 
};
 

	
 

	
 

	
 

	
src/VirtualLeafpar.tmpl
Show inline comments
 
@@ -116,13 +116,13 @@ i3 = 0 / int
 
i4 = 0 / int
 
i5 = 0 / int
 
s1 =  / string
 
s2 =  / string
 
s3 =  / string
 
b1 = false / bool
 
b2 = false / bool
 
b3 = false / bool
 
b4 = false / bool
 
dir1 = . / directory
 
dir2 = . / directory
 
export_interval = 0 / int
 
export_fn_prefix = CellData_ / string
 
export_fn_prefix = cell. / string
src/canvas.cpp
Show inline comments
 
@@ -81,24 +81,25 @@
 

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

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

	
 
using namespace std;
 

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

	
 
#define FNAMESIZE 100
 
#define QUOTE_ME(s) QUOTE_ME_2NDLEV(s)
 
#define QUOTE_ME_2NDLEV(s) #s
 

	
 
static QColor dark_red("darkRed");
 

	
 

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

	
 
FigureEditor::FigureEditor(
 
@@ -471,25 +472,25 @@ Main::Main(QGraphicsScene& c, Mesh &m, Q
 

	
 
  Q3PopupMenu* file = new Q3PopupMenu( menu );
 

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

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

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

	
 
  Q3PopupMenu* edit = new Q3PopupMenu( menu );
 
  edit->insertItem("Reset Chemicals and Transporters", this, SLOT( CleanMesh()), Qt::CTRL+Qt::Key_R );
 
  edit->insertItem("Reset Chemicals", this, SLOT( CleanMeshChemicals()) );
 
  edit->insertItem("Reset Transporters", this, SLOT( CleanMeshTransporters()) );
 
  edit->insertItem("Randomize PIN1 Transporters", this, SLOT( RandomizeMesh()) );
 
@@ -1156,50 +1157,44 @@ void Main::print()
 
      pp.scale(vp.width()/(2*cw*Cell::Magnification()), vp.width()/(2*cw*Cell::Magnification()));
 
    } else {
 
      pp.scale(vp.height()/(2*ch*Cell::Magnification()), vp.height()/(2*ch*Cell::Magnification()));
 
    }
 
    canvas.render(&pp, QRectF(), QRectF(0.,0.,canvas.width(),canvas.height()));
 
  }
 
}
 

	
 

	
 
void Main::TimeStepWrap(void)
 
{
 
  static int t=0;
 
  stringstream fname;
 

	
 
  TimeStep();
 
  t++;
 

	
 
  if ((par.export_interval > 0) && ((t % par.export_interval) == 0)){
 
    this->exportCellData(QString(par.datadir) + QString('/') + QString(par.export_fn_prefix) + this->TimeStamp());
 
    fname << par.datadir << "/" << par.export_fn_prefix;
 
    fname.fill('0');
 
    fname.width(6);
 
    fname << t << ".csv";
 
    this->exportCellData(QString(fname.str().c_str()));
 
  }
 

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

	
 

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

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

	
 

	
 
void Main::RestartSim(void)
 
{
 

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

	
 
    cerr << "Restarting simulation" << endl;
src/canvas.h
Show inline comments
 
@@ -218,26 +218,24 @@ class Main : public Q3MainWindow, public
 

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

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

	
 
  void RandomizeMesh();
 

	
 
  QString TimeStamp();
 

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

	
 
 protected:
 
  Mesh &mesh;
 

	
 
 private:
 
  NodeSet *node_set;
 
  FigureEditor *editor;
 
  Q3PopupMenu* options;
 
  Q3PopupMenu *view;
src/parameter.cpp
Show inline comments
 
@@ -10,27 +10,27 @@
 
 *  VirtualLeaf is distributed in the hope that it will be useful,
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

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

	
 

	
 
#include "parameter.h"
 
#include <cstdio>
 
#include <cstring>
 
#include <cstdlib>
 
#include <cerrno>
 
#include <iostream>
 
#include <sstream>
 
#include "output.h"
 
#include "parse.h"
 
#include "xmlwrite.h"
 
#include "warning.h"
 
#include <QLocale>
 
@@ -177,26 +177,26 @@ Parameter::Parameter() {
 
  i3 = 0;
 
  i4 = 0;
 
  i5 = 0;
 
  s1 = strdup("");
 
  s2 = strdup("");
 
  s3 = strdup("");
 
  b1 = false;
 
  b2 = false;
 
  b3 = false;
 
  b4 = false;
 
  dir1 = strdup(".");
 
  dir2 = strdup(".");
 
  export_interval = 100;
 
  export_fn_prefix = strdup("CELLDATA");
 
  export_interval = 0;
 
  export_fn_prefix = strdup("cell.");
 
}
 

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

	
 
void Parameter::CleanUp(void) {
 
  if (arrowcolor) 
 
     free(arrowcolor);
 
@@ -338,26 +338,26 @@ void Parameter::Read(const char *filenam
 
  s2 = sgetpar(fp, "s2", "", true);
 
  s3 = sgetpar(fp, "s3", "", true);
 
  b1 = bgetpar(fp, "b1", false, true);
 
  b2 = bgetpar(fp, "b2", false, true);
 
  b3 = bgetpar(fp, "b3", false, true);
 
  b4 = bgetpar(fp, "b4", false, true);
 
  dir1 = sgetpar(fp, "dir1", ".", true);
 
  if (strcmp(dir1, "."))
 
    MakeDir(dir1);
 
  dir2 = sgetpar(fp, "dir2", ".", true);
 
  if (strcmp(dir2, "."))
 
    MakeDir(dir2);
 
  export_interval = igetpar(fp, "export_interval", 100, true);
 
  export_fn_prefix = sgetpar(fp, "export_fn_prefix", "CELLDATA", true);
 
  export_interval = igetpar(fp, "export_interval", 0, true);
 
  export_fn_prefix = sgetpar(fp, "export_fn_prefix", "cell.", true);
 
}
 

	
 
const char *sbool(const bool &p) {
 

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

	
 
@@ -1884,13 +1884,12 @@ if (!strcmp(namec, "k")) {
 
  vector<double>::const_iterator v=valarray.begin();
 
  while (v!=valarray.end() && i <= 14 ) {
 
     k[i++]=*(v++);
 
  }
 
}
 
}
 

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

	
 
/* finis */
src/parameter.h
Show inline comments
 
@@ -13,25 +13,25 @@
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

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

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

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

	
 
 class Parameter {
 
		
 
 public: 
src/pardialog.cpp
Show inline comments
 
@@ -10,24 +10,25 @@
 
 *  VirtualLeaf is distributed in the hope that it will be useful,
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

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

	
 
#include "pardialog.h"
 
#include "parameter.h"
 
#include <cstring>
 
#include <qdialog.h>
 
#include <qlabel.h>
 
#include <qlineedit.h>
 
#include <qmessagebox.h>
 

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

	
 
@@ -809,13 +810,12 @@ void ParameterDialog::Reset(void) {
 
  s2_edit->setText( QString("%1").arg(par.s2) );
 
  s3_edit->setText( QString("%1").arg(par.s3) );
 
  b1_edit->setText( QString("%1").arg(sbool(par.b1)));
 
  b2_edit->setText( QString("%1").arg(sbool(par.b2)));
 
  b3_edit->setText( QString("%1").arg(sbool(par.b3)));
 
  b4_edit->setText( QString("%1").arg(sbool(par.b4)));
 
  dir1_edit->setText( QString("%1").arg(par.dir1) );
 
  dir2_edit->setText( QString("%1").arg(par.dir2) );
 
  export_interval_edit->setText( QString("%1").arg(par.export_interval) );
 
  export_fn_prefix_edit->setText( QString("%1").arg(par.export_fn_prefix) );
 
}
 

	
 
/* finis */
src/pardialog.h
Show inline comments
 
@@ -13,25 +13,25 @@
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

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

	
 
#ifndef PARAMETER_DIALOG_H
 
#define PARAMETER_DIALOG_H
 
#include <qdialog.h>
 
#include <qspinbox.h>
 
#include <qlineedit.h>
 
#include <qlayout.h>
 
#include <qpushbutton.h>
 
#include <iostream>
 

	
 
class ParameterDialog : public QDialog {
 
    Q_OBJECT
 
@@ -139,13 +139,12 @@ class ParameterDialog : public QDialog {
 
  QLineEdit *s2_edit;
 
  QLineEdit *s3_edit;
 
  QLineEdit *b1_edit;
 
  QLineEdit *b2_edit;
 
  QLineEdit *b3_edit;
 
  QLineEdit *b4_edit;
 
  QLineEdit *dir1_edit;
 
  QLineEdit *dir2_edit;
 
  QLineEdit *export_interval_edit;
 
  QLineEdit *export_fn_prefix_edit;
 
};
 
#endif
 

	
0 comments (0 inline, 0 general)