Changeset - b85aa64a84ee
[Not reviewed]
default
0 4 0
Michael Guravage - 15 years ago 2010-10-18 10:05:10
michael.guravage@cwi.nl
Replaced getIterations() with getTime().

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/VirtualLeaf.cpp
changed src/canvas.cpp
changed src/mesh.h
4 files changed with 12 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/ChangeLog
Show inline comments
 
2010-10-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* VirtualLeaf.cpp (TIMESTEP): Removed getIterations().
 

	
 
	* mesh.h (Mesh): Removed {increment,get}Iterations().
 

	
 
	* canvas.cpp (TimeStepWrap): Replaced getIterations() with getTime().
 

	
 
2010-10-15    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mesh.h (Mesh): Added iterations. incrementIterations() and
 
	getIterations().
 

	
 
	* VirtualLeaf.cpp (Plot): Replaced local frame counter with
 
	mesh.incrementIterations().
 

	
 
	* canvas.cpp (TimeStepWrap): Replaced local counter with
 
	mesh.incrementIterations().
 

	
 
2010-10-14    <guravage@caterpie.sen.cwi.nl>
src/VirtualLeaf.cpp
Show inline comments
 
@@ -183,42 +183,40 @@ void MainBase::Plot(int resize_stride)
 
     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 << ".jpg";
 
      if (par.storage_stride <= par.xml_storage_stride) {
 
	//frame = (int)mesh.getTime();
 
	frame = mesh.getIterations();
 
	frame = (int)mesh.getTime();
 
      }
 

	
 
      // 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 = (int)mesh.getTime();
 
	frame = mesh.getIterations();
 
	frame = (int)mesh.getTime();
 
      }
 
      // Write XML file every ten plot steps
 
      mesh.XMLSave(fname.str().c_str(), XMLSettingsTree());
 
    }
 
  }
 
 count++;
 
}
 

	
 

	
 

	
 
INIT {
 

	
 
@@ -275,25 +273,24 @@ TIMESTEP {
 
      //mesh.LoopCurrentCells(mem_fun(&plugin->CellHouseKeeping)); // this includes cell division
 

	
 
      // Reaction diffusion	
 
      mesh.ReactDiffuse(par.rd_dt);
 
      t++;
 
      Plot(par.resize_stride);
 
    }
 
  } else {
 
    mesh.ReactDiffuse(par.rd_dt);
 
    Plot(par.resize_stride);
 
  }
 
  i++;
 
  mesh.incrementIterations(); // WHERE SHOULD THIS GO?!
 
  return mesh.getTime();
 
}
 

	
 

	
 

	
 
/* Called if a cell is clicked */
 
void Cell::OnClick(QMouseEvent *e){}
 

	
 

	
 
/* Custom message handler - Default appends a newline character to the end of each line. */ 
 
void vlMessageOutput(QtMsgType type, const char *msg)
 
{
src/canvas.cpp
Show inline comments
 
@@ -1162,27 +1162,25 @@ void Main::print()
 
    canvas.render(&pp, QRectF(), QRectF(0.,0.,canvas.width(),canvas.height()));
 
  }
 
}
 

	
 

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

	
 
  TimeStep();
 

	
 
  //mesh.incrementIterations();
 
  t = mesh.getIterations();
 
  //t = (int)mesh.getTime();
 
  t = (int)mesh.getTime();
 

	
 
  if ((par.export_interval > 0) && !(t%par.export_interval)){
 
    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();
src/mesh.h
Show inline comments
 
@@ -74,25 +74,25 @@ class Mesh {
 
    // Make sure the reserved value is large enough if a cell is added
 
    // in "Divide" when the capacity is insufficient, "cells" might be
 
    // relocated including the current Cell (i.e. the value of *this)
 
    // calling "Mesh::IncreaseCapacityIfNecessary" (from another
 
    // object than Cell, e.g. Mesh) before entering Divide will solve
 
    // this issue (solved now).
 
    cells.reserve(2);
 
    nodes.reserve(500);
 

	
 
    time = 0.;
 
    plugin = 0;
 
    boundary_polygon=0;
 
    iterations = 0;
 

	
 
  };
 
  ~Mesh(void) {
 
    if (boundary_polygon) {
 
      delete boundary_polygon;
 
      boundary_polygon=0;
 
    }
 
  };
 

	
 
  void Clean(void);
 
  Cell &EllipticCell(double xc, double yc, double ra, double rb, int nnodes=10, double rotation=0);
 
  Cell &CircularCell(double xc, double yc, double r, int nnodes=10) {
 
    return EllipticCell(xc, yc, r, r, nnodes, 0);
 
@@ -383,28 +383,24 @@ class Mesh {
 
  QVector< QPair<qreal,int> > VertexAnglesValues(void);
 
  void SetSimPlugin(SimPluginInterface *new_plugin) {
 
    plugin=new_plugin;
 
  }
 
  QString ModelID(void) { return plugin?plugin->ModelID():QString("undefined"); }
 
  void StandardInit(void);	
 
  double Compactness(double *res_compactness=0, double *res_area=0, double *res_cell_area=0, double *hull_circumference=0);
 
  void CSVExportCellData(QTextStream &csv_stream) const;
 
  void CSVExportMeshData(QTextStream &csv_stream);
 
  
 
  Node* findNextBoundaryNode(Node*);
 

	
 
  int iterations;
 
  int getIterations(){return this->iterations;}
 
  void incrementIterations(){this->iterations++;}
 

	
 
 private:
 

	
 
  // Data members
 
  vector<Cell *> cells;
 
  vector<Node *> nodes;
 
  list<Wall *> walls; // we need to erase elements from this container frequently, hence a list.
 
 public:
 
  vector<NodeSet *> node_sets;
 
 private:
 
  vector<Node *> shuffled_nodes;
 
  vector<Cell *> shuffled_cells;
 
  unique_queue<Edge> node_insertion_queue;
0 comments (0 inline, 0 general)