Crile,
I remember having similar problems myself a while back (in 1997!) and
I created some extensions to Grid2d for the purpose. These may be of
use to you. They are found in the 'contrib' directory for Swarm
contributions, but the file is so small I just appended it here. Hope
you find it useful. (You should be able to extend the procedures that
calculate neighborhoods to figure your slopes ...) Of course, the
code may need to be tweaked a little to work with the latest release of
Swarm.
Cheers,
Sven Thommesen
At 11:23 AM 8/24/2005, you wrote:
Hi there SwarmList,
I'm trying to work out multiple agents in a cell using lists, as
suggested by some previous posts (if that doesn't work, I'll try
using MultiGrid2D). The primary agents are volumes of water
flowing over a riverbed (the cell surface, a Discrete2d which
contains the cells), so I need each cell to hold an elevation value
as well as a list of agents. I have borrowed some methods from
MultiGrid2d (my thanks to Paul Johnson and Opinion2.0). The
elevation values come from an ascii file originating as a GIS
raster grid and are read into each cell after the agent list has
been created but before any agents are added (the collection is
created when the cell is created, well, during -createEnd a la
Opinion, to be exact). During runtime, a method gets called from
the agent to the cell surface that determines which cell is the
best to move to by calculating local slopes from that particular
cell. The problem is that where before I could easily read in the
elevations, calculate the slopes and move the agents around (until
two ended up in one cell, of course), I now get NaN returned when
the cell surface queries a cells for its elevation values (and a
subsequent crash). A -getCellAtX: Y: method is used to access the
cell's elevation value - this worked fine prior to implementing the
list. It seems like creating the list has either made the
elevation value inaccessible, or perhaps the list has overwritten them.
So, have I been sloppy in creating my lists? My gut feeling is
that my cells should be able to hold both elevations and lists and
I simply haven't implemented this well. Could the order in which
the list is added and elevation values read in be causing a
problem? Any thoughts?
Thanks -
Crile
Dr Crile Doscher
Natural Resources Engineering
Lincoln University
Canterbury
New Zealand
"What if the hokey pokey is what it's all about?"
_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support