114
X-Machines for Agent-Based Modeling: FLAME Perspectives
5.2.4 Creating Local Dynamic Arrays
//Extract from a function showing a local int dynamic array
int_array actor_view;
//Calculate the actors in my area that I am not connected to
actor_location_message=get_first_actor_location_message();
while(actor_location_message)
{
if(actor_location_message->actor_id!=ID)
{
for(i=0;i
{
found=0;
if(MYBONDS.array[i].to==actor_location_message->actor_id)
{
//if I am already connected
found=1;
}
}
if(found==0)
{
//if not found then add to my local list
add_int(&actors_view, actor_location_message->actor_id);
}
}
actor_location_message=get_next_actor_location_message
(actor_location_message);
}
free_int_array(&actors_view);
The local integer array is created by ‘int array actor view’. These arrays
are useful to record information locally, for immediate calculation where total
number of variables is not known. It is important to free all arrays used at
the end of the function, otherwise the memory allocated to them does not
automatically free itself.
5.3 Modeling Pedestrians in Crowds
Crowd modeling can help study crowd behaviors in situations to help construct or plan safe building and pathways, or to include collision avoidance in
panic situations or motion planning for exit planning in crowded venues. Thalmann [124] described the difference in individual person behavior as opposed
X-Machines for Agent-Based Modeling: FLAME Perspectives
5.2.4 Creating Local Dynamic Arrays
//Extract from a function showing a local int dynamic array
int_array actor_view;
//Calculate the actors in my area that I am not connected to
actor_location_message=get_first_actor_location_message();
while(actor_location_message)
{
if(actor_location_message->actor_id!=ID)
{
for(i=0;i
found=0;
if(MYBONDS.array[i].to==actor_location_message->actor_id)
{
//if I am already connected
found=1;
}
}
if(found==0)
{
//if not found then add to my local list
add_int(&actors_view, actor_location_message->actor_id);
}
}
actor_location_message=get_next_actor_location_message
(actor_location_message);
}
free_int_array(&actors_view);
The local integer array is created by ‘int array actor view’. These arrays
are useful to record information locally, for immediate calculation where total
number of variables is not known. It is important to free all arrays used at
the end of the function, otherwise the memory allocated to them does not
automatically free itself.
5.3 Modeling Pedestrians in Crowds
Crowd modeling can help study crowd behaviors in situations to help construct or plan safe building and pathways, or to include collision avoidance in
panic situations or motion planning for exit planning in crowded venues. Thalmann [124] described the difference in individual person behavior as opposed
