--- trunk/OOPSE-2.0/src/brains/Snapshot.hpp 2004/10/25 04:08:14 1642 +++ trunk/OOPSE-2.0/src/brains/Snapshot.hpp 2004/10/26 22:19:22 1648 @@ -36,58 +36,15 @@ #include -#include "math/Vector3.hpp" -#include "math/SquareMatrix3.hpp" +#include "brains/DataStorage.hpp" using namespace std; namespace oopse{ - enum DataStorageLayout { - dslPosition = 1, - dslVelocity = 2, - dslAMat = 4, - dslAngularMomentum = 8, - dslUnitVector = 16, - dslZAngle = 32, - dslForce = 64, - dslTorque = 128 - }; - //forward declaration - class Snapshot; - class SnapshotManager; class StuntDouble; /** - * @class DataStorage - * @brief - * @warning do not try to insert element into (or ease element from) private member data - * of DataStorage directly. - */ - class DataStorage { - public: - DataStorage() {}; - DataStorage(size_t size); - - int size(); - void resize(size_t size); - void reserve(size_t size); - - friend class Snapshot; - friend class StuntDouble; - private: - vector position; /** position array */ - vector velocity; /** velocity array */ - vector aMat; /** rotation matrix array */ - vector angularMomentum;/** velocity array */ - vector unitVector; /** the lab frame unit vector array*/ - vector zAngle; /** z -angle array */ - vector force; /** force array */ - vector torque; /** torque array */ - - }; - - /** * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" * @brief Snapshot class is a repository class for storing dynamic data during * Simulation @@ -122,39 +79,54 @@ namespace oopse{ // return v[0]->getArrayPointer(); //} - static double* getArrayPointer(vector& v) { - assert(v.size() > 0); - return v[0].getArrayPointer(); + int getSize() { + return atomData.getSize() + rigidbodyData.getSize(); } - - static double* getArrayPointer(vector& v) { - assert(v.size() > 0); - 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(); } - int getSize() { - return atomData.size() + rigidbodyData.size(); + /** Returns the H-Matrix */ + Mat3x3d getHmat() { + return hmat_; } - - int getSizeOfAtoms() { - return atomData.size(); + + /** Sets the H-Matrix */ + void setHamt(const Mat3x3d& m) { + hmat_ = m; + invHmat_ = hmat_.inverse(); } - - int getSizeOfRigidBodies() { - return rigidbodyData.size(); + + /** Returns the inverse H-Matrix */ + Mat3x3d getInvHmat() { + return invHmat_ } - + + double getTimeStamp() { + return timeStamp_; + } + + void setTimeStamp(double timeStamp) { + timeStamp_ =timeStamp; + } + + DataStorage atomData; DataStorage rigidbodyData; - + friend class StuntDouble; + private: - + double timeStamp_; + Mat3x3d hmat_; + Mat3x3d invHmat_; int id_; /**< identification number of the snapshot */ };