Revision: 8266
http://playerstage.svn.sourceforge.net/playerstage/?rev=8266&view=rev
Author: rtv
Date: 2009-09-27 03:10:35 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
energy dissipation vis now uses vector instead of array
Modified Paths:
--------------
code/stage/trunk/libstage/powerpack.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/worlds/benchmark/hospital.world
Modified: code/stage/trunk/libstage/powerpack.cc
===================================================================
--- code/stage/trunk/libstage/powerpack.cc 2009-09-27 02:25:50 UTC (rev
8265)
+++ code/stage/trunk/libstage/powerpack.cc 2009-09-27 03:10:35 UTC (rev
8266)
@@ -272,15 +272,13 @@
rows(height/cellsize),
width(width),
height(height),
- cells( new stg_joules_t[columns*rows] ),
+ cells( columns*rows ),
peak_value(0),
cellsize(cellsize)
{ /* nothing to do */ }
PowerPack::DissipationVis::~DissipationVis()
{
- if( cells )
- delete[] cells;
}
void PowerPack::DissipationVis::Visualize( Model* mod, Camera* cam )
@@ -325,15 +323,15 @@
// don't accumulate if we're outside the grid
if( ix < 0 || ix >= columns || iy < 0 || iy >= rows )
return;
-
- stg_joules_t* j = cells + (iy*columns + ix );
-
- (*j) += amount;
- if( (*j) > peak_value )
+
+ stg_joules_t& j = cells[ ix + (iy*columns) ];
+
+ j += amount;
+ if( j > peak_value )
{
- peak_value = (*j);
-
- if( peak_value > global_peak_value )
- global_peak_value = peak_value;
+ peak_value = j;
+
+ if( peak_value > global_peak_value )
+ global_peak_value = peak_value;
}
}
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-09-27 02:25:50 UTC (rev 8265)
+++ code/stage/trunk/libstage/stage.hh 2009-09-27 03:10:35 UTC (rev 8266)
@@ -1498,10 +1498,12 @@
private:
unsigned int columns, rows;
stg_meters_t width, height;
- stg_joules_t* cells;
- stg_joules_t peak_value;
- double cellsize;
-
+
+ std::vector<stg_joules_t> cells;
+
+ stg_joules_t peak_value;
+ double cellsize;
+
static stg_joules_t global_peak_value;
public:
Modified: code/stage/trunk/worlds/benchmark/hospital.world
===================================================================
--- code/stage/trunk/worlds/benchmark/hospital.world 2009-09-27 02:25:50 UTC
(rev 8265)
+++ code/stage/trunk/worlds/benchmark/hospital.world 2009-09-27 03:10:35 UTC
(rev 8266)
@@ -13,7 +13,7 @@
paused 1
# threads may help or hurt performance depending on your worldfile, machine
and load
- threads 7
+# threads 7
# quit_time 60
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit