ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/brains/Snapshot.hpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/brains/Snapshot.hpp (file contents):
Revision 1615 by tim, Wed Oct 20 05:52:25 2004 UTC vs.
Revision 1645 by tim, Tue Oct 26 17:28:53 2004 UTC

# Line 30 | Line 30
30    * @time 23:56am
31    * @version 1.0
32    */
33 +  
34   #ifndef BRAINS_SNAPSHOT_HPP
35   #define BRAINS_SNAPSHOT_HPP
36 +
37 + #include <vector>
38 +
39 + #include "math/Vector3.hpp"
40 + #include "math/SquareMatrix3.hpp"
41 +
42 + using namespace std;
43 +
44   namespace oopse{
45  
46 +
47 +    //forward declaration
48 +    class Snapshot;
49 +    class SnapshotManager;
50 +    class StuntDouble;
51 +    
52      /**
53 +     * @class DataStorage
54 +     * @warning do not try to insert element into (or ease element from) private member data
55 +     * of DataStorage directly.
56 +     */
57 +    class DataStorage {
58 +        public:
59 +
60 +            enum{
61 +                slPosition = 1,
62 +                slVelocity = 2,
63 +                slAmat = 4,
64 +                slAngularMomentum = 8,
65 +                slUnitVector = 16,
66 +                slZAngle = 32,
67 +                slForce = 64,
68 +                slTorque = 128
69 +            };
70 +            
71 +            DataStorage(int size);
72 +
73 +            /** return the size of this DataStorage */
74 +            int size();
75 +            void resize(int size);
76 +            void reserve(int size);
77 +
78 +            void move(int source, int num, int target);
79 +            int getStorageLayout();
80 +            void setStorageLayout(int layout);
81 +
82 +            double *getArrayPointer(int );
83 +
84 +            friend class StuntDouble;
85 +
86 +        private:
87 +            int size_;
88 +            int storageLayout_;
89 +            vector<Vector3d> position;               /** position array */
90 +            vector<Vector3d> velocity;               /** velocity array */
91 +            vector<RotMat3x3d> aMat;            /** rotation matrix array */
92 +            vector<Vector3d> angularMomentum;/** velocity array */
93 +            vector<Vector3d> unitVector;                /** the lab frame unit vector array*/
94 +            vector<double> zAngle;              /** z -angle array */        
95 +            vector<Vector3d> force;               /** force array */
96 +            vector<Vector3d> torque;               /** torque array */
97 +    };
98 +
99 +    /**
100       * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp"
101       * @brief Snapshot class is a repository class for storing dynamic data during
102       *  Simulation
103 +     * Every snapshot class will contain one DataStorage  for atoms and one DataStorage
104 +     *  for rigid bodies.
105       * @see SimData
106       */
107      class Snapshot {
108          public:
109              
110 <            PropertyMap properties_;
110 >            Snapshot(int nAtoms, int nRigidbodies) {
111 >                atomData.resize(nAtoms);
112 >                rigidbodyData.resize(nRigidbodies);
113 >            }
114 >
115 >            Snapshot(const Snapshot& s);
116 >
117 >            Snapshot& operator =(const Snapshot& s);
118              
119 <        private:
119 >            /** Returns the id of this Snapshot */
120 >            int getID() {
121 >                return id_;
122 >            }
123 >
124 >            /** Sets the id of this Snapshot */
125 >            void setID(int id) {
126 >                id_ = id;
127 >            }
128 >
129 >            //template<typename T>
130 >            //static typename T::ElemPointerType getArrayPointer(vector<T>& v) {
131 >            //    return v[0]->getArrayPointer();
132 >            //}
133 >
134 >            int getSize() {
135 >                return atomData.size() + rigidbodyData.size();
136 >            }
137 >
138 >            /** Returns the number of atoms */
139 >            int getNumberOfAtoms() {
140 >                return atomData.size();
141 >            }
142 >
143 >            /** Returns the number of rigid bodies */
144 >            int getNumberOfRigidBodies() {
145 >                return rigidbodyData.size();
146 >            }
147 >
148 >            /** Returns the H-Matrix */
149 >            Mat3x3d getHmat() {
150 >                return hmat_;
151 >            }
152 >
153 >            /** Sets the H-Matrix */
154 >            void setHamt(const Mat3x3d& m) {
155 >                hmat_ = m;
156 >                invHmat_ = hmat_.inverse();
157 >            }
158 >
159 >            /** Returns the inverse H-Matrix */
160 >            Mat3x3d getInvHmat() {
161 >                return invHmat_
162 >            }
163 >
164 >            double getTimeStamp() {
165 >                return timeStamp_;
166 >            }
167 >
168 >            void setTimeStamp(double timeStamp) {
169 >                timeStamp_ =timeStamp;
170 >            }
171 >
172 >
173 >            DataStorage atomData;
174 >            DataStorage rigidbodyData;
175              
176 +            friend class StuntDouble;
177 +            
178 +        private:
179 +            double timeStamp_;
180 +            Mat3x3d hmat_;
181 +            Mat3x3d invHmat_;
182 +            int id_; /**< identification number of the snapshot */
183      };
184  
185 +    typedef DataStorage (Snapshot::*DataStoragePointer);
186   }
187   #endif //BRAINS_SNAPSHOT_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines