48#include "utils/simError.h"
52 SimSnapshotManager::SimSnapshotManager(SimInfo* info,
int atomStorageLayout,
53 int rigidBodyStorageLayout,
54 int cutoffGroupStorageLayout) :
55 SnapshotManager(atomStorageLayout, rigidBodyStorageLayout,
56 cutoffGroupStorageLayout),
58 int nAtoms = info_->getNAtoms();
59 int nRigidBodies = info_->getNRigidBodies();
60 int nCutoffGroups = info_->getNCutoffGroups();
61 bool usePBC = info_->getSimParams()->getUsePeriodicBoundaryConditions();
65 new Snapshot(nAtoms, nRigidBodies, nCutoffGroups, atomStorageLayout,
66 rigidBodyStorageLayout, cutoffGroupStorageLayout, usePBC);
68 new Snapshot(nAtoms, nRigidBodies, nCutoffGroups, atomStorageLayout,
69 rigidBodyStorageLayout, cutoffGroupStorageLayout, usePBC);
72 SimSnapshotManager::~SimSnapshotManager() {
73 delete previousSnapshot_;
74 delete currentSnapshot_;
75 previousSnapshot_ = NULL;
76 currentSnapshot_ = NULL;
79 bool SimSnapshotManager::advance() {
80 *previousSnapshot_ = *currentSnapshot_;
81 currentSnapshot_->setID(currentSnapshot_->getID() + 1);
82 currentSnapshot_->clearDerivedProperties();
86 bool SimSnapshotManager::resetToPrevious() {
87 int prevID = previousSnapshot_->getID();
88 *currentSnapshot_ = *previousSnapshot_;
89 currentSnapshot_->setID(prevID);
93 Snapshot* SimSnapshotManager::getSnapshot(
int id) {
94 if (currentSnapshot_ != NULL && currentSnapshot_->getID() ==
id) {
95 return currentSnapshot_;
96 }
else if (previousSnapshot_ != NULL && previousSnapshot_->getID() ==
id) {
97 return previousSnapshot_;
103 int SimSnapshotManager::getCapacity() {
return 2; }
105 void SimSnapshotManager::setCapacity(
int) {
107 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
108 "SimSnapshotManager error: can not set capacity for "
109 "SimSnapshotManager.\n");
110 painCave.isFatal = 0;
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.