Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103592636
interactingsystem.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 3, 05:39
Size
1 KB
Mime Type
text/x-c
Expires
Wed, Mar 5, 05:39 (2 d)
Engine
blob
Format
Raw Data
Handle
24594362
Attached To
rSYMKIT symkit
interactingsystem.cpp
View Options
#include "interactingsystem.h"
#include "actors/particles/newtonparticle.h"
#include "graphtools.h"
#include "skerror.h"
using namespace symkit;
void InteractingSystem::attach(Particle * particle)
{
if (!particle)
throw SKError( ERR_NULL_POINTER,
"attach",
"InteractingSystem",
"Passing a null pointer as parameter");
Evolvable * ev = dynamic_cast<Evolvable*>(particle);
if (!ev)
throw SKError( ERR_OTHERS,
"attach",
"InteractingSystem",
"Passing a non-evolvable parameter");
ParticleSystem::attach(particle);
}
/*
* Two times update call, for each particle
* updateForces then evolve
*/
void InteractingSystem::evolve(float dt)
{
Evolvable * ev[2];
/* Make particles interact each other */
for (iterator iter_0 = begin(); iter_0 != end(); ++iter_0)
{
ev[0] = dynamic_cast<Evolvable*>(*iter_0);
iterator iter_1 = iter_0;
for (++iter_1; iter_1 != end(); ++iter_1)
{
ev[1] = dynamic_cast<Evolvable*>(*iter_1);
if (ev[0]->isEvolving() && ev[1]->isEvolving())
{
ev[0]->evolve(dt);
ev[1]->evolve(dt);
interaction(*iter_0, *iter_1);
}
}
}
/* Call superclass method */
ParticleSystem::evolve(dt);
}
Event Timeline
Log In to Comment