Changeset - 137d9d3a313a
[Not reviewed]
default
0 19 0
Michael Guravage - 15 years ago 2010-06-15 13:44:36
michael.guravage@cwi.nl
Removed most compilation warnings; see ChangeLogs for details.

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'

changed .hgignore
changed src/ChangeLog
changed src/VirtualLeaf.cpp
changed src/apoplastitem.cpp
changed src/build_models/ChangeLog
changed src/build_models/auxingrowthplugin.cpp
changed src/build_models/meinhardtplugin.cpp
changed src/build_models/testplugin.cpp
changed src/canvas.cpp
changed src/cell.cpp
changed src/cellbase.h
changed src/forwardeuler.cpp
changed src/mainbase.h
changed src/mesh.cpp
changed src/nodeitem.cpp
changed src/output.cpp
changed src/qcanvasarrow.h
changed src/simitembase.cpp
changed src/xmlwrite.cpp
19 files changed with 103 insertions and 35 deletions:
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
@@ -8,17 +8,19 @@ syntax: glob
 
*.Debug
 
*.o
 
*.orig
 
*.out
 
*.Release
 
*.so
 
*.vars
 
*Makefile.*
 
*make.out
 
*moc_*.cpp
 
src/default.par
 
bin*
 
TAGS
 
BROWSE
 

	
 
# switch to regexp syntax.
 
syntax: regexp
 

	
 
# finis
src/ChangeLog
Show inline comments
 
2010-06-15    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mesh.cpp (findNextBoundaryNode): Initialize Node *next_boundary_node = NULL;
 

	
 
	* xmlwrite.cpp (XMLReadSimtime): Removed unused variable cur
 
	(XMLReadWalls): viz_flux need not be declared twice; default value of 0.0.
 
	(XMLReadCells): Removed unused count variable.
 
	(XMLReadSimtime): Removed unused cur variable.
 
	(XMLRead): Removed unused v_str variable.
 

	
 
	* simitembase.cpp (userMove): Use assignment merely to obviate compilation warning.
 
	(SimItemBase) Ditto.
 

	
 
	* qcanvasarrow.h (QGraphicsLineItem): Use assignment merely to obviate compilation warning.
 

	
 
	* output.cpp (OpenWriteFile): Removed unused par variable.
 

	
 
	* nodeitem.cpp (paint): Use assignment merely to obviate compilation warning.
 

	
 
	* forwardeuler.cpp (odeint): Use assignment merely to obviate compilation warning.
 

	
 
	* cell.cpp (DivideOverGivenLine): Use assignment merely to obviate compilation warning.
 

	
 
	* canvas.cpp (FigureEditor): Use assignments merely to obviate compilation errors.
 
	(mousePressEvent): Removed unused item variable.
 

	
 
	* apoplastitem.cpp
 
	(ApoplastItem): Removed unused par variable.
 
	(OnClick): Use NULL assignment merely to obviate compilation warning.
 

	
 
	* mainbase.h (MainBase): Use assignment merely to obviate compilation warning.
 

	
 
	* cellbase.h (CellsStaticDatamembers): Use assignment merely to obviate compilation warning.
 

	
 

	
 
	* cell.cpp: Wrapped diagnostic output in QDEBUG blocks.
 
	* VirtualLeaf.cpp ditto.
 
	* canvas.cpp ditto.
 
	* cell.cpp ditto.
 
	* cellbase.h
 
	* data_plot.cpp ditto.
 
	* forwardeuler.cpp ditto.
 
	* mesh.cpp ditto.
 
	* mesh.h
 
	* random.cpp ditto.
 
	* wall.cpp ditto.
 
	* wallbase.cpp ditto.
 
	* wallitem.cpp ditto.
 

	
 

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

	
src/VirtualLeaf.cpp
Show inline comments
 
@@ -113,37 +113,40 @@ public:
 
  }
 
};
 

	
 
double PINSum(Cell &c) {
 
  return c.Chemical(1) + c.SumTransporters(1);// + c.ReduceCellAndWalls<double>( complex_PijAj );
 
}
 

	
 

	
 
class DrawCell {
 
public:
 
  void operator() (Cell &c,QGraphicsScene &canvas, MainBase &m) const {
 
    if (m.ShowBorderCellsP() || c.Boundary()==Cell::None) {
 
      if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) 
 
      if (!m.ShowBoundaryOnlyP() && !m.HideCellsP()) {
 
	if (m.ShowToolTipsP()) {
 
	  QString info_string=QString("Cell %1, chemicals: ( %2, %3, %4, %5, %6)\n %7 of PIN1 at walls.\n Area is %8\n PIN sum is %9\n Circumference is %10\n Boundary type is %11").arg(c.Index()).arg(c.Chemical(0)).arg(c.Chemical(1)).arg(c.Chemical(2)).arg(c.Chemical(3)).arg(c.Chemical(4)).arg(c.SumTransporters(1)).arg(c.Area()).arg(PINSum(c)).arg(c.Circumference()).arg(c.BoundaryStr());
 
					
 
	  info_string += "\n" + c.printednodelist();
 
	  c.Draw(&canvas, info_string);
 
	} else {
 
	  c.Draw(&canvas);
 
	}
 
      if (m.ShowCentersP())
 
      }
 
      if (m.ShowCentersP()){
 
	c.DrawCenter(&canvas);
 
      if (m.ShowFluxesP())
 
      }
 
      if (m.ShowFluxesP()){
 
	c.DrawFluxes(&canvas, par.arrowsize);
 
      }
 
    }
 
  }
 
};
 

	
 
Mesh mesh;
 
bool batch=false;
 

	
 
void MainBase::Plot(int resize_stride) {
 
	
 
  clear();
 
	
 
  static int count=0;
 
@@ -310,24 +313,27 @@ TIMESTEP {
 
			
 
  }
 
		
 
  i++;
 
  return mesh.getTime();
 
		
 
}
 
		
 
		
 
				
 
/* Called if a cell is clicked */
 
void Cell::OnClick(QMouseEvent *e) {
 

	
 
  e = NULL; // use assignment merely to obviate compilation warning
 

	
 
  /* #ifdef HAVE_QWT
 
  // Launch DataPlot window
 
  QStringList curvenames;
 
  for (int i=0;i<NChem();i++) {
 
  curvenames += QString("Chem #%1").arg(i);
 
  }
 
  PlotDialog *plot = new PlotDialog((Main *)main_window, QString("Monitor for Cell %1").arg(Index()), curvenames);
 
  QObject::connect(this, SIGNAL(ChemMonValue(double, double *)),
 
  plot, SLOT(AddValue(double,double *)));
 
  #endif
 
  */
 
  //getMesh().plugin->OnClick(*this);
src/apoplastitem.cpp
Show inline comments
 
@@ -25,26 +25,24 @@
 
#include <string>
 
#include <QGraphicsScene>
 
#include "canvas.h"
 
#include "parameter.h"
 
#include "node.h"
 
#include "apoplastitem.h"
 

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

	
 
ApoplastItem::ApoplastItem( Wall *w, QGraphicsScene *canvas )
 
: QGraphicsLineItem( 0, canvas ), SimItemBase( w, canvas){
 
		
 
	extern Parameter par;
 
	
 
	setColor();
 
	
 
	// line with "PIN1"is a bit inside the cell wall
 
	Vector edgevec = (*(w->N2())) - (*(w->N1()));
 
	Vector perp = edgevec.Normalised().Perp2D();
 
	
 
	Vector offs = Cell::Offset();
 
	double factor = Cell::Factor();
 
	
 
	Vector from = ( offs + *(w->N1()) ) * factor;// + (wn==1?-1:1) * par.outlinewidth;// * 0.2 * factor * perp;
 
	Vector to = ( offs + *(w->N2()) ) *factor;// + (wn==1?-1:1) * par.outlinewidth;// * 0.2 * factor * perp;
 
	
 
@@ -63,16 +61,15 @@ void ApoplastItem::setColor(void) {
 
	static const QColor purple("Purple");
 
	static const QColor blue("blue");
 
	
 
	Wall *w=&getWall();
 
	double val = w->getApoplast(2);
 

	
 
	diffcolor.setRgb( 0,0,(int)( ( val / (1 + val) )*255.));
 
	setPen (QPen(diffcolor, 20) );
 

	
 
}
 

	
 
void ApoplastItem::OnClick(QMouseEvent *e) {
 
	
 
	
 
  e = NULL; // merely to obviate compile time warning
 
}
 

	
src/build_models/ChangeLog
Show inline comments
 
2010-06-15    <guravage@caterpie.sen.cwi.nl>
 

	
 

	
 
	* testplugin.cpp (CelltoCellTransport) Use NULL assignment merely to obviate compilation warnings.
 
	(WallDynamics): Ditto.
 
	(CellDynamics): Ditto.
 
	(OnDivide): Ditto.
 

	
 
	* meinhardtplugin.cpp (OnDivide): Use NULL assignment merely to obviate compilation warnings.
 
	* (WallDynamics): Ditto.
 

	
 
	* auxingrowthplugin.cpp (OnDivide): Use NULL assignment merely to obviate compilation warnings.
 

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

	
 
	* Makefile: Added top-level Makefile.
 

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

	
 
	* plugin_test.pro: Added -fPIC option to QMAKE_CXXFLAGS.
 
	* plugin_meinhardt.pro: ditto
 
	* plugin_auxingrowth.pro: ditto
 

	
 

	
src/build_models/auxingrowthplugin.cpp
Show inline comments
 
@@ -29,24 +29,26 @@
 
#include "cellbase.h"
 
#include "auxingrowthplugin.h"
 

	
 
#include "far_mem_5.h"
 

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

	
 
bool batch = false;
 

	
 

	
 
// To be executed after cell division
 
void AuxinGrowthPlugin::OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2) {
 
  parent_info = NULL; // merely to obviate compile time error
 

	
 
	// Auxin distributes between parent and daughter according to area
 
	double area1 = daughter1->Area(), area2 = daughter2->Area();
 
	double tot_area = area1 + area2;
 
	
 
	daughter1->SetChemical(0,daughter1->Chemical(0)*(area1/tot_area));
 
	daughter2->SetChemical(0,daughter2->Chemical(0)*(area2/tot_area));
 
	
 
	// After divisions, parent and daughter cells get a standard stock of PINs.
 
	daughter1->SetChemical(1, par->initval[1]);
 
	daughter2->SetChemical(1, par->initval[1]);
 
	
 
	
src/build_models/meinhardtplugin.cpp
Show inline comments
 
@@ -26,25 +26,26 @@
 
#include "parameter.h"
 
#include "warning.h"
 
#include "wallbase.h"
 
#include "cellbase.h"
 
#include "meinhardtplugin.h"
 

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

	
 
bool batch = false;
 

	
 
// To be executed after cell division
 
void MeinhardtPlugin::OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2) {
 
	
 
  parent_info = NULL;
 
  daughter1 = daughter2 = NULL;
 
}
 

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

	
 
	if (fpclassify(c->Chemical(0))==FP_NAN) {
 
		// somehow the function isnan doesn't work properly on my system... SuSE Linux
 
		// 10.0 64-bits (isnan seems not be implemented using fpclassify).
 
		MyWarning::warning("Whoops! Numerical instability!!");
 
		color->setNamedColor("red");
 
	} else {
 
		double range_min = 0.;//, range_max = 1.;
 
		if (c->Chemical(0)<range_min) {
 
@@ -95,24 +96,25 @@ void MeinhardtPlugin::CelltoCellTranspor
 

	
 
    // Passive fluxes (Fick's law)
 
    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;
 
	}
 
   
 

	
 
}
 

	
 
void MeinhardtPlugin::WallDynamics(Wall *w, double *dw1, double *dw2) {
 
  w = NULL;
 
	for (int c = 0;c<NChem();c++) {
 
		dw1[c] = 0.; dw2[c] = 0.;
 
    }
 
}
 

	
 
void MeinhardtPlugin::CellDynamics(CellBase *c, double *dchem) {
 

	
 
	double Y = c->Chemical(0);
 
	double A = c->Chemical(1);
 
	double H = c->Chemical(2);
 
	double S = c->Chemical(3);
 
	//double expansin = c->Chemical(4);
src/build_models/testplugin.cpp
Show inline comments
 
@@ -27,40 +27,51 @@
 
#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) {
 
	
 
  parent_info = NULL;
 
  daughter1 = daughter2 = NULL;
 
}
 

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

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

	
 

	
 

	
 
void TestPlugin::CellHouseKeeping(CellBase *c) {
 
	
 
	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) { }
 
void TestPlugin::CelltoCellTransport(Wall *w, double *dchem_c1, double *dchem_c2) {
 
  w = NULL;
 
  dchem_c1 = dchem_c2 = NULL;
 
}
 

	
 
void TestPlugin::WallDynamics(Wall *w, double *dw1, double *dw2) {
 
  w = NULL;
 
  dw1 = dw2 = NULL;
 
}
 

	
 
void TestPlugin::CellDynamics(CellBase *c, double *dchem) {
 
  c = NULL;
 
  dchem=NULL;
 
}
 

	
 
Q_EXPORT_PLUGIN2(testplugin, TestPlugin)
src/canvas.cpp
Show inline comments
 
@@ -92,24 +92,27 @@ 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(
 
			   QGraphicsScene& c, Mesh &m, QWidget* parent,
 
			   const char* name, Qt::WindowFlags f) :
 
  QGraphicsView(&c,parent), mesh(m)
 
{
 
  name = NULL; // use these two assignments merely to obviate compile time warnings
 
  f = Qt::Widget;
 

	
 
  intersection_line = 0;
 
  //angle_line = 0;
 
  setInteractive(true);
 
  moving = 0;  
 
  rotation_mode = false;
 
}
 

	
 

	
 
void FigureEditor::clear()
 
{
 
  QList<QGraphicsItem *> list = scene()->items();
 
  QList<QGraphicsItem *>::Iterator it = list.begin();
 
@@ -144,26 +147,24 @@ void FigureEditor::Save(const char *fnam
 
    delete image;
 
}
 

	
 
//void FigureEditor::contentsMousePressEvent(QMouseEvent* e)
 
void FigureEditor::mousePressEvent(QMouseEvent* e)
 
{
 
  static QList<Node*> selected;
 
  emit MousePressed();
 

	
 
  //QPointF p = matrix().inverted().map(e->pos());
 
  QPointF p = mapToScene(e->pos());
 

	
 
  NodeItem *item;
 

	
 
#ifdef QDEBUG  
 
  qDebug() << endl << "MousePressEvent location: (" << p.x() << "," << p.y() << ")." << endl;
 
  qDebug() << "Magnification:  " << Cell::Magnification() << endl;
 
  qDebug() << "Offsets:  " << Cell::Offset() << endl;
 
#endif
 
  
 

	
 
  /*  if (dynamic_cast<Main *>(parent())->RotationModeP()) {
 
  // if in rotation mode, exit it upon a mouse click
 
  dynamic_cast<Main *>(parent())->ExitRotationMode();
 
  }*/
 
  
 
@@ -222,25 +223,25 @@ void FigureEditor::mousePressEvent(QMous
 
      intersection_line->setZValue( 100 );
 
      intersection_line->show();
 
    }
 
  
 
    for (QList<QGraphicsItem *>::Iterator it=l.begin(); it!=l.end(); ++it) {
 
      /*if ( (*it)->rtti() == imageRTTI ) {
 
	ImageItem *item= (ImageItem*)(*it);
 
	if ( !item->hit( p ) )
 
	continue;
 
	}*/
 
      #ifdef QDEBUG
 
      qDebug() << typeid(**it).name() << endl;
 
      #endif QDEBUG
 
      #endif
 

	
 
      if ( !strcmp(typeid(**it).name(),"8NodeItem")) {
 
	//moving = dynamic_cast<NodeItem*>(*it);
 
	//moving = *it;
 
	//moving_start = p;
 
      
 
	stringstream data_strstream;
 
	data_strstream << (dynamic_cast<NodeItem*>(*it))->getNode();
 
	dynamic_cast<Main *>(parent())->UserMessage(QString(data_strstream.str().c_str()));
 
      
 
	(dynamic_cast<NodeItem*>(*it))->OnClick(e->button());
 
      }
src/cell.cpp
Show inline comments
 
@@ -1804,25 +1804,25 @@ void Cell::DrawAxis(QGraphicsScene *c) c
 
	line->setZValue(2);
 
    
 
	line->setLine( ( (offset[0]+from.x)*factor ),
 
				  ( (offset[1]+from.y)*factor ), 
 
				  ( (offset[0]+to.x)*factor ),
 
				  ( (offset[1]+to.y)*factor ) );
 
	line->setZValue(10);
 
	line->show();
 
	
 
}
 

	
 
void Cell::DrawStrain(QGraphicsScene *c) const {
 
	></i>
 
  c = NULL; // assignment merely to obviate compilation warning
 
	MyWarning::warning("Sorry, Cell::DrawStrain temporarily not implemented.");
 
	/* Vector long_axis;
 
	double width;
 
	Length(&long_axis, &width);
 
	
 
	//cerr << "Length is "  << length << endl;
 
	long_axis.Normalise();
 
	Vector short_axis=long_axis.Perp2D();
 
    
 
	//  To test method "Strain" temporarily substitute "short_axis" for "strain" 
 
	Vector strain = Strain();
 
	//strain.Normalise();
src/cellbase.h
Show inline comments
 
@@ -481,22 +481,23 @@ protected:
 
    // PRIVATE MEMBER FUNCTIONS
 
    inline static void ClearNCells(void) {
 
      NCells()=0;
 
    }
 
    
 
    bool marked;
 
    int div_counter;
 
};
 

	
 
ostream &operator<<(ostream &os, const CellBase &v);
 

	
 
inline Vector PINdir(CellBase *here, CellBase *nb, Wall *w) {
 
	return w->getTransporter( here, 1)  *  w->getInfluxVector(here);
 
	  nb = NULL; // assignment merely to obviate compilation warning
 
	  return w->getTransporter( here, 1)  *  w->getInfluxVector(here);
 
}
 

	
 

	
 
#endif
 

	
 

	
 

	
 

	
 

	
src/forwardeuler.cpp
Show inline comments
 
@@ -58,24 +58,28 @@ const double ForwardEuler::Tiny = 1.0e-3
 
   the calling program.*/
 

	
 
void ForwardEuler::odeint(double *ystart, int nvar, double x1, double x2, double eps, double h1, double hmin, int *nok, int *nbad)
 
/* Runge-Kutta driver with adaptive stepsize control. Integrate starting values ystart[1..nvar]
 
  from x1 to x2 with accuracy eps, storing intermediate results in global variables. h1 should
 
  be set as a guessed first stepsize, hmin as the minimum allowed stepsize (can be zero). On
 
  output nok and nbad are the number of good and bad (but retried and fixed) steps taken, and
 
  ystart is replaced byv alues at the end of the integration interval. derivs is the user-supplied
 
  routine for calculating the right-hand side derivative, while rkqs is the name of the stepper
 
  routine to be used. */
 
{
 
  static bool warning_issued = false;
 

	
 
  eps = hmin = 0.0; // use assignment merely to obviate compilation warning
 
  nbad = nok = NULL;
 

	
 
  if (!warning_issued) {
 
    cerr << "Using inaccurate method ForwardEuler\n";
 
    warning_issued=true;
 
    //MyWarning::warning("Using inaccurate method ForwardEuler");
 
  }
 
  // N.B. Not for serious use and not fully usage compatible with RungeKutta
 
  // simply for testing API of integrator.
 
  
 
  double *y,*dydx;
 
  y=new double[nvar];
 
  dydx=new double[nvar];
 
  double x=x1;
src/mainbase.h
Show inline comments
 
@@ -111,24 +111,25 @@ class MainBase  {
 
    canvas.render(&im, QRectF(0,0,canvas.width(),canvas.height()) );
 
    //im.end();      
 
    image->save(QString(fname), format);
 
    }*/
 
    
 

	
 
    void Save(const char *fname, const char *format, int sizex=640, int sizey=480);
 
    void CutSAM(void);
 
	
 
    void Plot(int resize_stride=10);
 

	
 
    virtual void UserMessage(QString message, int timeout = 0) {
 
      timeout = 0; // merely to obviate 'warning unused parameter' message
 
      cerr << message.toAscii().constData() << endl;
 
    }
 
    Mesh &mesh;
 
	
 
 protected:
 
    QGraphicsScene &canvas;
 
    virtual xmlNode *XMLSettingsTree(void) const;
 

	
 
 protected:
 
    bool showcentersp;
 
    bool showmeshp;
 
    bool showbordercellp;
src/mesh.cpp
Show inline comments
 
@@ -1649,25 +1649,25 @@ void Mesh::RepairBoundaryPolygon(void) {
 
  foreach(Cell* cell, cells) {
 
    qDebug() << *cell;
 
  }
 
  qDebug() << endl;
 
  #endif
 
#endif
 

	
 
}
 

	
 

	
 
Node* Mesh::findNextBoundaryNode(Node* boundary_node) {
 
  bool found_next_boundary_node = false;
 
  Node *next_boundary_node;
 
  Node *next_boundary_node = NULL;
 
  set<int> boundary_node_owners; // This is a list of the current boundary node's owners' Ids
 
  vector<int> neighborIds; // A list of the current boundary node's owners' 2nd neighbor Ids
 
  vector<set<int> *>  nodeOwners; // A vector of set pointers where each set contains the owner Ids of the nodes in the neighborIds list.
 
  vector<int> intersection; // set intersection result
 

	
 
  // The next boundary node is that which has only one owner in common with the current boundary node
 
  for (list<Neighbor>::iterator it=boundary_node->owners.begin(); it!=boundary_node->owners.end(); ++it) {
 
    if (it->cell->Index() != -1) boundary_node_owners.insert(it->cell->Index()); // Save each of the current boundary node's owners' Ids - except the boundary polygon 
 
    set<int> *owners = new set<int>; // create a set to hold a 2nd neighbor's owners' Ids
 
    nodeOwners.push_back(owners);
 
    neighborIds.push_back(it->nb2->Index());
 
    foreach(Neighbor neighbor, it->nb2->owners){
src/nodeitem.cpp
Show inline comments
 
@@ -63,24 +63,25 @@ void NodeItem::paint(QPainter *painter, 
 
     
 
  if (option->state & QStyle::State_Sunken) {
 
  gradient.setCenter(30, 30);
 
  gradient.setFocalPoint(30, 30);
 
  gradient.setColorAt(1, QColor(Qt::yellow).light(120));
 
  gradient.setColorAt(0, QColor(Qt::darkYellow).light(120));
 
  } else {
 
  gradient.setColorAt(0, Qt::yellow);
 
  gradient.setColorAt(1, Qt::darkYellow);
 
  }
 
  
 
  painter->setBrush(gradient); */
 
  option = NULL; // use assignment merely to obviate compilation warning
 
  
 
  painter->setBrush(brush);
 
  painter->setPen(Qt::NoPen);
 
  // const static double mag=20.;
 
  painter->drawEllipse(ellipsesize);
 
}
 

	
 

	
 
QPainterPath NodeItem::shape() const
 
{
 
    QPainterPath path;
 
    path.addEllipse(ellipsesize);
src/output.cpp
Show inline comments
 
@@ -108,25 +108,24 @@ int YesNoP(const char *message) {
 
//   }
 
	
 
//   return fp;
 
// }
 
*/
 
 
FILE *OpenWriteFile(const char *filename) 
 
{
 
 
  char fname[FNAMESIZE];
 
 
  FILE *fp;
 
  extern Parameter par;
 
 
  fprintf(stderr,"Opening %s for writing\n",filename);
 
	
 
  if(FileExistsP(filename)==TRUE) {
 
  
 
    if (false/*par.interactive*/) {
 
      char *message=(char *)malloc(2000*sizeof(char));
 
      if (!YesNoP("File exists, overwrite?")) {
 
	sprintf(message," Could not open file %s for writing, exiting... \n"
 
		,filename);
 
	//exit(0);
 
	throw(message);
 
@@ -201,28 +200,26 @@ FILE *OpenWriteFile(const char *filename
 
  return fp;
 
}
 
*/
 
 
FILE *OpenReadFile(const char *filename) 
 
{
 
  FILE *fp;
 
 
  fprintf(stderr,"Opening %s for reading\n",filename);
 
  
 
  if((OpenFileAndCheckExistance(&fp,filename,"r"))==FALSE) {	
 
    char *message=(char *)malloc(2000*sizeof(char));
 
    sprintf(message," File %s not found or empty, exiting... \n"
 
			,filename);
 
    sprintf(message," File %s not found or empty, exiting... \n" ,filename);
 
    throw(message);
 
	  
 
  }
 
  return fp;
 
}
 
 
 
char *ReadLine(FILE *fp) 
 
{
 
  /* does almost the same as fgetln(), but DEC Unix doesn't understand
 
	 fgetln(). Also I want my function to return a real C string,
 
	 terminated by a \0. */
 
 
  /* The function reads a line from file *fp, and returns a pointer to the
src/qcanvasarrow.h
Show inline comments
 
@@ -26,25 +26,28 @@
 
#define _QCANVASARROW_H_
 

	
 
#include <QGraphicsScene>
 

	
 
class QGraphicsArrowItem : public QGraphicsLineItem {
 

	
 
 public:
 
  QGraphicsArrowItem(QGraphicsItem *parent, QGraphicsScene *c) : QGraphicsLineItem(parent, c) {
 
  };
 
    
 
    void paint ( QPainter *p, const QStyleOptionGraphicsItem *option,
 
		 QWidget *widget ) {
 
      
 

	
 
      widget = NULL; //use assignment merely to obviate compilation warning
 
      option = NULL;
 

	
 
      // construct arrow head
 
      QPointF start=line().p1();
 
      QPointF end=line().p2();
 
      QPointF mid=start + (3./4.)*(end-start);
 
      
 
      double vx=end.x()-start.x();
 
      double vy=end.y()-start.y();
 

	
 
      double length = sqrt(vx*vx+vy*vy);
 
      if (length==0) return;
 
      
 
      // perpendicular vector
src/simitembase.cpp
Show inline comments
 
@@ -17,21 +17,22 @@
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

	
 
#include <string>
 
#include <QBrush>
 
#include "simitembase.h"
 

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

	
 
SimItemBase::SimItemBase( void *v, QGraphicsScene *canvas ) {
 
  canvas = NULL; // use assignment merely to obviate compilation warning
 
    obj=v;
 
};
 

	
 
SimItemBase::~SimItemBase(void) {};
 

	
 

	
 
void SimItemBase::userMove(double dx, double dy) {
 

	
 
  dx = dy = 0.0; // use assignment merely to obviate compilation warning
 
};
src/xmlwrite.cpp
Show inline comments
 
@@ -342,25 +342,25 @@ int Cell::XMLRead(xmlNode *cur)  {
 
  int nnodes = tmp_nodes.size();
 
  for (int i=0;i<nnodes;i++) {
 
    m->AddNodeToCell( this, 
 
		      m->nodes[tmp_nodes[i]], 
 
		      m->nodes[tmp_nodes[(nnodes+i-1)%nnodes]],
 
		      m->nodes[tmp_nodes[(i+1)%nnodes]] );
 
	
 
  }
 

	
 
  n = cur->xmlChildrenNode;
 
  while(n!=NULL) {
 
	  if ((!xmlStrcmp(n->name, (const xmlChar *)"chem"))) {
 
	    xmlChar *v_str = xmlGetProp(n, BAD_CAST "n");
 

	
 
	    xmlNode *v_node = n->xmlChildrenNode;
 
	    int nv=0;
 
	    while (v_node!=NULL) {
 
	      if ((!xmlStrcmp(v_node->name, (const xmlChar *)"val"))) {
 
		
 
		
 
		if (nv>=Cell::NChem()) {
 
		  {
 
		    stringstream text;
 
		    text << "Exception in Mesh::XMLRead: Too many chemical values given for cell(s). Ignoring remaining values.";
 
		    //ThrowStringStream(text);
 
		    unique_warning(text.str().c_str());
 
@@ -898,25 +898,24 @@ void Mesh::XMLSave(const char *docname, 
 
	/*
 
	 * this is to debug memory for regression tests
 
	 */
 
	//xmlMemoryDump();
 
}
 

	
 

	
 

	
 
void Mesh::XMLReadSimtime(const xmlNode *a_node) {
 
	
 
  xmlNode *root_node;
 
  root_node = (xmlNode *)a_node;
 
  xmlNode *cur;
 
  xmlChar *strsimtime = xmlGetProp(root_node, BAD_CAST "simtime");
 
  
 
  
 
  if (strsimtime) {
 
    //double simtime = strtod((const char *)strsimtime, 0);
 
    QLocale standardlocale(QLocale::C);
 
    bool ok;
 
    
 
    double simtime=standardlocale.toDouble((char *)strsimtime, &ok);
 
    if (!ok) MyWarning::error("Could not convert \"%s\" to double in XMLRead.",(char *)strsimtime);
 
      time = simtime;
 
		cerr << "Simtime = " << strsimtime << endl;
 
@@ -1214,34 +1213,29 @@ void Mesh::XMLReadWalls(xmlNode *root, v
 
	if (	nc==0) {
 
	  unique_warning("Token \"length\" not found in xmlwrite.cpp at or around line no. 809");
 
	}
 
	//double length = strtod( (char *)nc, 0);
 
	double length = standardlocale.toDouble((const char *)nc, &ok);
 
	if (!ok) MyWarning::error("Could not convert \"%s\" to double in XMLRead.",(const char *)nc);
 

	
 
	xmlFree(nc);
 
				
 
				
 
	nc = xmlGetProp(cur, BAD_CAST "viz_flux");
 
				
 
	double viz_flux;
 
	double viz_flux = 0.0;
 
	if (nc!=0) {
 
	  //viz_flux = strtod( (char *)nc, 0);
 
	  double viz_flux = standardlocale.toDouble((const char *)nc, &ok);
 
	  viz_flux = standardlocale.toDouble((const char *)nc, &ok);
 
	  if (!ok) MyWarning::error("Could not convert \"%s\" to double in XMLRead.",(const char *)nc);
 

	
 
	} else {
 
	  // if the info is not there, we really don't care.
 
	  // It is just for visualization anyhow.
 
	  viz_flux = 0.;
 
	}
 
	xmlFree(nc);
 
				
 
	Wall::WallType wall_type;
 
	{
 
	  xmlChar *v_str = xmlGetProp(cur, BAD_CAST "wall_type");
 
					
 
	  if (v_str != 0) {
 
						
 
	    if (!xmlStrcmp(v_str, (const xmlChar *)"aux_source")) {
 
	      wall_type = Wall::AuxSource;
 
	    } else {
 
@@ -1535,25 +1529,25 @@ void Mesh::XMLReadCells(xmlNode *root) {
 
	
 
	cells.clear();
 
	Cell::NCells() = 0;
 
	
 
	delete boundary_polygon;
 
	
 
	
 
	xmlNode *cur = root->xmlChildrenNode;
 
	
 
	while (cur!=NULL) {
 
		
 
		Cell *new_cell=0;
 
		static int count=0;
 

	
 
		if ((!xmlStrcmp(cur->name, (const xmlChar *)"cell"))){
 
			
 
			new_cell = new Cell(0,0);
 
			new_cell->m = this;
 
			cells.push_back(new_cell);
 
		} else {
 
			if ((!xmlStrcmp(cur->name, (const xmlChar *)"boundary_polygon"))) {
 
				new_cell = boundary_polygon = new BoundaryPolygon(0,0);
 
				boundary_polygon->m = this;
 
			}
 
		}
 
		
0 comments (0 inline, 0 general)