swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with BatchSwarm and EZGraph


From: Marcus G. Daniels
Subject: Re: Problem with BatchSwarm and EZGraph
Date: 19 Apr 2001 12:41:12 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "MM" == Marian Mihalo <address@hidden> writes:

MM> When I set a "setFileOutput" on value 0 (without saving), my
MM> simulation in batch swarm are working correctly. But when I want a
MM> save to file, here is a problem -> Segmentation Fault...

MM> After it, I identificated, that problem is in :

MM> [foodGrapher createSequence: "minerals.output" withFeedFrom:
MM>    modelSwarm getBugList] andSelector: M(getFoodNumber)];

(Restating Paul...)
Is -getFoodNumber a method on a List subclass or on an agent in the list?
If it is an ordinary List, then you'd want to use a sequence method
like -createAverageSequence:withFeedFrom:andSelector:.

Here's an example of the simple sequence usage.

#import <simtools.h>
#import <analysis.h>
#import <objectbase/SwarmObject.h>

@interface Bug: SwarmObject
{
  double value;
}
+ create: aZone setValue: (double)value;
- (double)nextValue;
@end

@implementation Bug
+ create: aZone setValue: (double)theValue
{
  Bug *obj = [self create: aZone];

  obj->value = theValue;
  return obj;
}

- (double)nextValue
{
  return value += 1.0;
}
@end

int
main (int argc, const char **argv)
{
  initSwarmBatch (argc, argv);

  {
    id grapher = [EZGraph createBegin: globalZone];
    id obj = [Bug create: globalZone setValue: 0.0];

    [grapher setGraphics: NO];
    [grapher setFileOutput: YES];
    grapher = [grapher createEnd];

    [grapher createSequence: "out"
             withFeedFrom: obj
             andSelector: M(nextValue)];

    [grapher step];
    [grapher step];
    [grapher step];
    [grapher drop];
  }
  return 0;
}

/*
Local Variables:
compile-command: "PATH=/usr/bin:$PATH $SWARMHOME/bin/libtool-swarm --mode=link 
gcc -D_GNU_SOURCE -o TestEZGraph -O2 -g -Wno-import -I$SWARMHOME/include/swarm 
-L$SWARMHOME/lib/swarm TestEZGraph.m -lswarm -lobjc -ldl -lc"
End:
*/

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]