23 |
|
* |
24 |
|
*/ |
25 |
|
|
26 |
+ |
#include "brains/SimInfo.hpp" |
27 |
+ |
#include "brains/SimSnapshotManager.hpp" |
28 |
+ |
|
29 |
|
namespace oopse { |
30 |
|
|
31 |
< |
SimSnapshotManager::SimSnapshotManager(){ |
31 |
> |
SimSnapshotManager::SimSnapshotManager(SimInfo* info) : info_(info){ |
32 |
> |
int nAtoms = info_->getNAtoms(); |
33 |
> |
int nRigidBodies = info_->getNRigidBodies(); |
34 |
> |
|
35 |
|
//allocate memory for snapshots |
36 |
< |
previousSnapshot_ = new Snapshot(); |
37 |
< |
currentSnapshot_ = new Snapshot(); |
36 |
> |
previousSnapshot_ = new Snapshot(nAtoms, nRigidBodies); |
37 |
> |
currentSnapshot_ = new Snapshot(nAtoms, nRigidBodies); |
38 |
|
} |
39 |
|
|
40 |
|
bool SimSnapshotManager::advance() { |
41 |
|
|
42 |
|
*previousSnapshot_ = *currentSnapshot_; |
43 |
+ |
currentSnapshot_->setID(currentSnapshot_->getID() + 1); |
44 |
+ |
return true; |
45 |
|
} |
46 |
|
|
47 |
|
Snapshot* SimSnapshotManager::getSnapshot(int id) { |