Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Solver.cpp

Go to the documentation of this file.
00001 
00006 #include "Solver.h"
00007 
00008 using namespace GraphicsLib;
00009 using namespace ParticleSystems;
00010 using namespace std;
00011 
00012 Solver::Solver(Force *f) {
00013         forces.insert(forces.begin(),f);
00014 }
00015 
00016 Solver::Solver() {
00017 }
00018 
00019 Solver::~Solver() {
00020 }
00021 
00022 void Solver::listForces() {
00023         int size = forces.size();
00024         forcesItt = forces.begin();
00025         for(int i = 0; i < size; i++) {
00026                 cout << "Method not yet implemented" << endl;
00027                 //cout << i << " " << (forcesItt->force) << endl;
00028         }
00029 }
00030 
00031 void Solver::addForce(Force *f) {
00032         forces.push_back(f);
00033         //need to be sorted inorder to remove forces
00034         std::sort(forces.begin(),forces.end());
00035 }
00036 
00037 void Solver::removeForce(Force *f) {
00038         //find the given Force.
00039         forcesItt = std::find(forces.begin(),forces.end(),f);
00040         //If it matches the last element we know that
00041         //it didnt find the given force.
00042         if(forcesItt != forces.end()) {
00043                 forces.erase(forcesItt);
00044         }
00045 }

Generated on Thu Mar 24 11:05:02 2005 for ParticleSystem by  doxygen 1.4.1