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 1639 by tim, Fri Oct 22 23:09:57 2004 UTC vs.
Revision 1645 by tim, Tue Oct 26 17:28:53 2004 UTC

# Line 43 | Line 43 | namespace oopse{
43  
44   namespace oopse{
45  
46 +
47      //forward declaration
48      class Snapshot;
49      class SnapshotManager;
50 <
50 >    class StuntDouble;
51 >    
52      /**
53 <     * @struct DataStorage
54 <     * @brief
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 <            DataStorage() {};
60 <            DataStorage(size_t size);
61 <            void resize(size_t size);
62 <            void reserve(size_t size);
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 <        //friend Snapshot;
72 <        //friend SnapshotManager;
73 <        //private:
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 */
91 >            vector<RotMat3x3d> aMat;            /** rotation matrix array */
92              vector<Vector3d> angularMomentum;/** velocity array */
93 <            vector<Vector3d> ul;                /** the lab frame unit vector 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 */
72
97      };
98  
99      /**
# Line 83 | Line 107 | namespace oopse{
107      class Snapshot {
108          public:
109              
110 <            Snapshot() {}
111 <            Snapshot(int i) {
112 <
110 >            Snapshot(int nAtoms, int nRigidbodies) {
111 >                atomData.resize(nAtoms);
112 >                rigidbodyData.resize(nRigidbodies);
113              }
114  
115              Snapshot(const Snapshot& s);
# Line 107 | Line 131 | namespace oopse{
131              //    return v[0]->getArrayPointer();
132              //}
133  
134 <            static double* getArrayPointer(vector<Vector3d>& v) {
135 <                assert(v.size() > 0);
112 <                return v[0].getArrayPointer();
134 >            int getSize() {
135 >                return atomData.size() + rigidbodyData.size();
136              }
137 <            
138 <            static double* getArrayPointer(vector<RotMat3x3d>& v) {
139 <                assert(v.size() > 0);
140 <                return v[0].getArrayPointer();
137 >
138 >            /** Returns the number of atoms */
139 >            int getNumberOfAtoms() {
140 >                return atomData.size();
141              }
142 <            
143 <            static double* getArrayPointer(vector<double>& v) {
144 <                assert(v.size() > 0);
145 <                return &(v[0]);
142 >
143 >            /** Returns the number of rigid bodies */
144 >            int getNumberOfRigidBodies() {
145 >                return rigidbodyData.size();
146              }
124            
125            /** */
126            void resize(size_t size);
147  
148 +            /** Returns the H-Matrix */
149 +            Mat3x3d getHmat() {
150 +                return hmat_;
151 +            }
152  
153 <            /** */
154 <            void reserve(size_t size);
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 SnapshotManager;
175 >            
176 >            friend class StuntDouble;
177 >            
178          private:
179 <
179 >            double timeStamp_;
180 >            Mat3x3d hmat_;
181 >            Mat3x3d invHmat_;
182              int id_; /**< identification number of the snapshot */
183      };
184  
185 <    typedef DataStorage* (Snapshot::*DataStoragePointer);
185 >    typedef DataStorage (Snapshot::*DataStoragePointer);
186   }
187   #endif //BRAINS_SNAPSHOT_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines