--- trunk/OOPSE-2.0/src/brains/Snapshot.hpp 2004/10/21 21:31:39 1630 +++ trunk/OOPSE-2.0/src/brains/Snapshot.hpp 2004/10/26 22:19:22 1648 @@ -30,29 +30,34 @@ * @time 23:56am * @version 1.0 */ + #ifndef BRAINS_SNAPSHOT_HPP #define BRAINS_SNAPSHOT_HPP #include -#include "math/Vector3.hpp" -#include "math/SquareMatrix3.hpp" +#include "brains/DataStorage.hpp" using namespace std; namespace oopse{ + class StuntDouble; + /** * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" * @brief Snapshot class is a repository class for storing dynamic data during * Simulation + * Every snapshot class will contain one DataStorage for atoms and one DataStorage + * for rigid bodies. * @see SimData */ class Snapshot { public: - - Snapshot(int i) { - + + Snapshot(int nAtoms, int nRigidbodies) { + atomData.resize(nAtoms); + rigidbodyData.resize(nRigidbodies); } Snapshot(const Snapshot& s); @@ -69,43 +74,62 @@ namespace oopse{ id_ = id; } - /** */ - Snapshot* clone() { - return new Snapshot(*this); - } - - //template //static typename T::ElemPointerType getArrayPointer(vector& v) { // return v[0]->getArrayPointer(); //} - static double* getArrayPointer(vector& v) { - return v[0].getArrayPointer(); + int getSize() { + return atomData.getSize() + rigidbodyData.getSize(); } - - static double* getArrayPointer(vector& v) { - return v[0].getArrayPointer(); + + /** Returns the number of atoms */ + int getNumberOfAtoms() { + return atomData.getSize(); } - - static double* getArrayPointer(vector& v) { - assert(v.size() > 0); - return &(v[0]); + + /** Returns the number of rigid bodies */ + int getNumberOfRigidBodies() { + return rigidbodyData.getSize(); } + + /** Returns the H-Matrix */ + Mat3x3d getHmat() { + return hmat_; + } + + /** Sets the H-Matrix */ + void setHamt(const Mat3x3d& m) { + hmat_ = m; + invHmat_ = hmat_.inverse(); + } + + /** Returns the inverse H-Matrix */ + Mat3x3d getInvHmat() { + return invHmat_ + } + + double getTimeStamp() { + return timeStamp_; + } + + void setTimeStamp(double timeStamp) { + timeStamp_ =timeStamp; + } + + + DataStorage atomData; + DataStorage rigidbodyData; - vector pos; - vector vel; - vector frc; - vector trq; - vector Amat; - vector mu; - vector ul; - vector zAngle; + friend class StuntDouble; private: - + double timeStamp_; + Mat3x3d hmat_; + Mat3x3d invHmat_; int id_; /**< identification number of the snapshot */ }; + typedef DataStorage (Snapshot::*DataStoragePointer); } #endif //BRAINS_SNAPSHOT_HPP