Files @ 6bcb69712a0e
Branch filter:

Location: EI/VirtualLeaf/src/cell.h - annotation

Roeland Merks
In response to referee's comment:

"However, (although it is probably not important for model developers), I was
still unable to load the model ‘Meinhardt 1976 with growth’ example from the
‘Models’ drop down menu, I got the ‘Fatal error’ message ‘stepwise underflow in

rkqs, with h=0.000000 and htry = 0.100000’. The model did work when I selected
the Meinhardt model in both the Models and the File -> Read leaf menus together,
it would be preferable if the models loaded from the Models menu worked

automatically. I am not sure that the update referred to in the author’s
response permits the loading of ‘My First Model in Virtual Leaf’ from the
‘Models’ drop down menu; I only got a cell that wiggled."

I made the following changes:

- meinhardt_plugin now reads "meinhardt_init.xml" by default
- changed the name of 'My First Model in Virtual Leaf’ to '0: Empty model template (does nothing)' to make it clear that the wiggle cell is the intended behavior for this model example.
- Added default parameter files for Tutorial1A-D and Tutorial2 to prevent variable behavior depending on the last parameter settings used.


--
user: Roeland Merks <roeland.merks@cwi.nl>
branch 'default'
added data/leaves/tutorial1_init.xml
added data/leaves/tutorial2_init.xml
changed data/leaves/auxin_growth.xml
changed data/leaves/meinhardt_init.xml
changed src/TutorialCode/Tutorial0/tutorial0.cpp
changed src/TutorialCode/Tutorial1A/tutorial1A.h
changed src/TutorialCode/Tutorial1B/tutorial1B.h
changed src/TutorialCode/Tutorial1C/tutorial1C.h
changed src/TutorialCode/Tutorial1D/tutorial1D.h
changed src/TutorialCode/Tutorial2/tutorial2.h
changed src/build_models/meinhardtplugin.h
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
15d600891648
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
15d600891648
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
782330072e62
/*
 *
 *  $Id$
 *
 *  This file is part of the Virtual Leaf.
 *
 *  VirtualLeaf is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  VirtualLeaf is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Copyright 2010 Roeland Merks.
 *
 */

#ifndef _CELL_H_
#define _CELL_H_

#include <list>
#include <vector>
#include <iostream>
#include <QString>
#include "vector.h"
#include "parameter.h"
#include "wall.h"
#include "warning.h"
#include "cellbase.h"
#include "cell.h"

#include <QGraphicsScene>
#include <qcolor.h>
#include <QObject>

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

class Cell : public CellBase 
{

  Q_OBJECT
    friend class Mesh;
  friend class FigureEditor;

 public:
  Cell(double x, double y, double z = 0.);
  Cell(void);
  Cell(const Cell &src);
  Cell operator=(const Cell &src);
  bool Cmp(Cell*) const;
  bool Eq(Cell*) const;

  inline bool IndexEquals(int i) { return i == index; }

  static void SetMagnification(const double &magn) {
    factor=magn;
  }
  static Vector Offset(void) {
    Vector offs;
    offs.x=offset[0];
    offs.y=offset[1];
    return offs;
  }

  static void Translate(const double &tx,const double &ty) {
    offset[0]+=tx;
    offset[1]+=ty;
  }

  inline static double Factor(void) {
    return factor;
  }
  static void setOffset(double ox, double oy) {
    offset[0]=ox;
    offset[1]=oy;
  }
  static double Magnification(void) {
    return factor;
  }

  static double Scale(const double scale) {
    factor*=scale;
    return factor;
  }

  void DivideOverAxis(Vector axis); // divide cell over axis

  // divide over the line (if line and cell intersect)
  bool DivideOverGivenLine(const Vector v1, const Vector v2, bool wall_fixed = false, NodeSet *node_set = 0);

  void Divide(void) { // Divide cell over short axis

    Vector long_axis; 
    Length(&long_axis); 
    DivideOverAxis(long_axis.Perp2D()); 
  }

  //void CheckForGFDrivenDivision(void);
  inline int NNodes(void) const { return nodes.size(); }

  void Move(Vector T);
  void Move(double dx, double dy, double dz=0) {
    Move( Vector (dx, dy, dz) );
  }

  double Displace(double dx, double dy, double dh);
  void Displace(void);
  double Energy(void) const;
  bool SelfIntersect(void);
  bool MoveSelfIntersectsP(Node *nid, Vector new_pos);
  bool IntersectsWithLineP(const Vector v1, const Vector v2);

  void XMLAdd(xmlNodePtr cells_node) const;

  void ConstructWalls(void);
  void Flux(double *flux, double *D);

  void OnClick(QMouseEvent *e);
  inline Mesh& getMesh(void) const { return *m; }
  double MeanArea(void);

  void Apoptose(void); // Cell kills itself
  list<Wall *>::iterator RemoveWall( Wall *w );
  void AddWall( Wall *w );

  void Draw(QGraphicsScene *c, QString tooltip = QString::Null());

  // Draw a text in the cell's center
  void DrawText(QGraphicsScene *c, const QString &text) const;
  void DrawIndex(QGraphicsScene *c) const;
  void DrawCenter(QGraphicsScene *c) const;
  void DrawNodes(QGraphicsScene *c) const;

  void DrawAxis(QGraphicsScene *c) const;
  void DrawStrain(QGraphicsScene *c) const;
  void DrawFluxes(QGraphicsScene *c, double arrowsize = 1.);
  void DrawWalls(QGraphicsScene *c) const;
  void DrawValence(QGraphicsScene *c) const;
  void EmitValues(double t);

 signals:
  void ChemMonValue(double t, double *x);

 protected:
  void XMLAddCore(xmlNodePtr xmlcell) const;
  int XMLRead(xmlNode *cur);
  void DivideWalls(ItList new_node_locations, const Vector from, const Vector to, bool wall_fixed = false, NodeSet *node_set = 0);

 private:

  static QPen *cell_outline_pen;
  static double offset[3];
  static double factor;
  Mesh *m;
  void ConstructConnections(void);
  void SetWallLengths(void);
};


// Boundarypolygon is a special cell; will not increase ncells
//  and will not be part of Mesh::cells
class BoundaryPolygon : public Cell {

 public:
 BoundaryPolygon(void) : Cell() {
    NCells()--;
    index=-1;
  }

 BoundaryPolygon(double x,double y,double z=0) : Cell (x,y,z) {
    NCells()--;
    index=-1;
  }

  BoundaryPolygon &operator=(Cell &src) {
    Cell::operator=(src);
    index=-1;
    return *this;
  }
  virtual void Draw(QGraphicsScene *c, QString tooltip = QString::Null());

  virtual void XMLAdd(xmlNodePtr parent_node) const;

  virtual bool BoundaryPolP(void) const { return true; } 
};

#endif

/* finis */