51#include "utils/simError.h"
55 SimSnapshotManager::SimSnapshotManager(
SimInfo* info,
int atomStorageLayout,
56 int rigidBodyStorageLayout,
57 int cutoffGroupStorageLayout) :
59 cutoffGroupStorageLayout),
61 int nAtoms = info_->getNAtoms();
62 int nRigidBodies = info_->getNRigidBodies();
63 int nCutoffGroups = info_->getNCutoffGroups();
64 bool usePBC = info_->getSimParams()->getUsePeriodicBoundaryConditions();
68 new Snapshot(nAtoms, nRigidBodies, nCutoffGroups, atomStorageLayout,
69 rigidBodyStorageLayout, cutoffGroupStorageLayout, usePBC);
71 new Snapshot(nAtoms, nRigidBodies, nCutoffGroups, atomStorageLayout,
72 rigidBodyStorageLayout, cutoffGroupStorageLayout, usePBC);
75 SimSnapshotManager::~SimSnapshotManager() {
76 delete previousSnapshot_;
77 delete currentSnapshot_;
78 previousSnapshot_ = NULL;
79 currentSnapshot_ = NULL;
82 bool SimSnapshotManager::advance() {
83 *previousSnapshot_ = *currentSnapshot_;
84 currentSnapshot_->setID(currentSnapshot_->getID() + 1);
85 currentSnapshot_->clearDerivedProperties();
89 bool SimSnapshotManager::resetToPrevious() {
90 int prevID = previousSnapshot_->getID();
91 *currentSnapshot_ = *previousSnapshot_;
92 currentSnapshot_->setID(prevID);
96 Snapshot* SimSnapshotManager::getSnapshot(
int id) {
97 if (currentSnapshot_ != NULL && currentSnapshot_->getID() ==
id) {
98 return currentSnapshot_;
99 }
else if (previousSnapshot_ != NULL && previousSnapshot_->getID() ==
id) {
100 return previousSnapshot_;
106 int SimSnapshotManager::getCapacity() {
return 2; }
108 void SimSnapshotManager::setCapacity(
int) {
110 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
111 "SimSnapshotManager error: can not set capacity for "
112 "SimSnapshotManager.\n");
113 painCave.isFatal = 0;
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
SnapshotManager class is an abstract class which maintains a series of snapshots.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.