Files @ 6bcb69712a0e
Branch filter:

Location: EI/VirtualLeaf/src/node.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
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
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
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
782330072e62
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
79f94eaa3b9e
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 _NODE_H_
#define _NODE_H_

#include <list>
//#include <pair>

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

#ifdef QTGRAPHICS
#include <QGraphicsScene>
#include <qcolor.h>
#include <iostream>
#endif
#include "vector.h"
#include "random.h"
#include "parameter.h"
#include "cell.h"
#include "modelelement.h"

#include <QVector>

#include "Neighbor.h"

extern Parameter par;

class Edge {

 public:

  Edge(void) {
    first=0;
    second=0;
  }

  Edge(Node *f, Node *s) {
    first=f;
    second=s;
  }

  // Copy Constructor
  Edge(const Edge &src) {
    first=src.first;
    second=src.second;
  }

  // Ambidextrous equivalence 
  inline bool operator==(const Edge &e) {
    return ( (first==e.first && second==e.second) ||
	     (first==e.second && second==e.first) );
  }


  // Output the Edge
  ostream &print(ostream &os) const;

  Node *first, *second;
};


class NodeSet;

// this class is a node in a cell wall
class Node : public Vector {

  friend class Mesh;
  friend class CellBase;
  friend class Cell;
  friend class WallBase;
  friend class Wall;
  friend class NodeSet;
  friend class FigureEditor;

 public:
  Node(void);

  Node(int index); // if want to construct a node, and not increase nnodes

  Node(double x,double y, double z=0);

  Node(const Node &src);

  explicit Node(const Vector &src); // "nonconverting" - explicit constructor syntax required

  virtual ~Node() {}

  inline int Index(void) const { return index; }

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

  inline bool BoundaryP(void) const { return boundary; }

  inline void SetBoundary(void) { boundary = true; }

  inline void UnsetBoundary(void) { boundary = false; }

  inline void SetSAM(void) { sam = true; }

  inline void toggleBoundary(void) {
    boundary = !boundary;
  }


  Cell &getCell(const Neighbor &i);

  ostream &print(ostream &os) const;
  void XMLAdd(xmlNodePtr nodes_node) const;

#ifdef QTGRAPHICS
  void Draw(QGraphicsScene &c, QColor color=QColor("black"), int size = 10) const;
  void DrawIndex(QGraphicsScene *c) const;
  void DrawOwners(QGraphicsScene *c) const;
#endif

  // temporary function for easier debugging
  inline int CellsSize(void) const { return owners.size(); }

  inline int Value(void) const { return owners.size(); }

  void Fix(void) { fixed=true; }

  inline bool Fixed(void) const { return fixed; }

  inline void Unfix(void) { fixed=false; }

  inline void MarkDead(void) { dead=true; }

  inline bool DeadP(void) { return dead; }

  inline void Mark(void) { marked=true; }

  inline void Unmark(void) { marked=false; }

  inline bool Marked(void) const { return marked; }

  inline void setPos( Vector p ) { 
    x = p.x;
    y = p.y;
    z = p.z;
  }

  inline bool SamP(void) const { return sam; }

  //!\brief Calculate angles with neighboring vertices
  //! Sum of angles should be 2*Pi
  QVector<qreal> NeighbourAngles(void);
 private:

  // "owners" lists the cells to which this cell belong
  // and the two neighboring nodes relative to each cell
  list< Neighbor > owners;

  Mesh *m;
  int index;
  static int nnodes;
  static double target_length;

  // if the node belongs to a NodeSet, node_set contains the pointer. Otherwise it is 0.
  NodeSet *node_set; 
  // fixed nodes cannot move. E.g. to represent the petiole
  bool fixed;
  bool boundary; // true if node is at the edge of the leaf
  bool sam; // true if node is connected to the shoot
  bool dead;
  bool marked;
};

ostream &operator<<(ostream &os, const Node &n);

inline ostream &operator<<(ostream &os, const Edge &e) {
  e.print(os);
  return os;
}

#endif

/* finis */