--- trunk/OOPSE-2.0/src/brains/Snapshot.hpp 2004/10/20 05:52:25 1615 +++ trunk/OOPSE-2.0/src/brains/Snapshot.hpp 2004/10/22 23:09:57 1639 @@ -30,24 +30,114 @@ * @time 23:56am * @version 1.0 */ + #ifndef BRAINS_SNAPSHOT_HPP #define BRAINS_SNAPSHOT_HPP + +#include + +#include "math/Vector3.hpp" +#include "math/SquareMatrix3.hpp" + +using namespace std; + namespace oopse{ + //forward declaration + class Snapshot; + class SnapshotManager; + /** + * @struct DataStorage + * @brief + */ + class DataStorage { + public: + DataStorage() {}; + DataStorage(size_t size); + void resize(size_t size); + void reserve(size_t size); + + //friend Snapshot; + //friend SnapshotManager; + //private: + vector position; /** position array */ + vector velocity; /** velocity array */ + vector Amat; /** rotation matrix array */ + vector angularMomentum;/** velocity array */ + vector ul; /** 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 + * Every snapshot class will contain one DataStorage for atoms and one DataStorage + * for rigid bodies. * @see SimData */ class Snapshot { public: - PropertyMap properties_; + Snapshot() {} + Snapshot(int i) { + + } + + Snapshot(const Snapshot& s); + + Snapshot& operator =(const Snapshot& s); - private: + /** Returns the id of this Snapshot */ + int getID() { + return id_; + } + + /** Sets the id of this Snapshot */ + void setID(int id) { + id_ = id; + } + + //template + //static typename T::ElemPointerType getArrayPointer(vector& v) { + // return v[0]->getArrayPointer(); + //} + + static double* getArrayPointer(vector& v) { + assert(v.size() > 0); + return v[0].getArrayPointer(); + } + static double* getArrayPointer(vector& v) { + assert(v.size() > 0); + return v[0].getArrayPointer(); + } + + static double* getArrayPointer(vector& v) { + assert(v.size() > 0); + return &(v[0]); + } + + /** */ + void resize(size_t size); + + + /** */ + void reserve(size_t size); + + DataStorage atomData; + DataStorage rigidbodyData; + + friend class SnapshotManager; + private: + + int id_; /**< identification number of the snapshot */ }; + typedef DataStorage* (Snapshot::*DataStoragePointer); } #endif //BRAINS_SNAPSHOT_HPP