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

Comparing:
trunk/OOPSE-3.0/src/brains/Snapshot.hpp (file contents), Revision 1642 by tim, Mon Oct 25 04:08:14 2004 UTC vs.
branches/new_design/OOPSE-3.0/src/brains/Snapshot.hpp (file contents), Revision 1727 by tim, Thu Nov 11 16:41:58 2004 UTC

# Line 36 | Line 36
36  
37   #include <vector>
38  
39 < #include "math/Vector3.hpp"
40 < #include "math/SquareMatrix3.hpp"
39 > #include "brains/DataStorage.hpp"
40 > #include "brains/Stats.hpp"
41  
42   using namespace std;
43  
44   namespace oopse{
45  
46    enum DataStorageLayout {
47        dslPosition = 1,
48        dslVelocity = 2,
49        dslAMat = 4,
50        dslAngularMomentum = 8,
51        dslUnitVector = 16,
52        dslZAngle = 32,
53        dslForce = 64,
54        dslTorque = 128
55    };
56    //forward declaration
57    class Snapshot;
58    class SnapshotManager;
59    class StuntDouble;
60    
46      /**
62     * @class DataStorage
63     * @brief
64     * @warning do not try to insert element into (or ease element from) private member data
65     * of DataStorage directly.
66     */
67    class DataStorage {
68        public:
69            DataStorage() {};
70            DataStorage(size_t size);
71
72            int size();
73            void resize(size_t size);
74            void reserve(size_t size);
75            
76            friend class Snapshot;
77            friend class StuntDouble;
78        private:
79            vector<Vector3d> position;               /** position array */
80            vector<Vector3d> velocity;               /** velocity array */
81            vector<RotMat3x3d> aMat;            /** rotation matrix array */
82            vector<Vector3d> angularMomentum;/** velocity array */
83            vector<Vector3d> unitVector;                /** the lab frame unit vector array*/
84            vector<double> zAngle;              /** z -angle array */        
85            vector<Vector3d> force;               /** force array */
86            vector<Vector3d> torque;               /** torque array */
87
88    };
89
90    /**
47       * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp"
48       * @brief Snapshot class is a repository class for storing dynamic data during
49       *  Simulation
50       * Every snapshot class will contain one DataStorage  for atoms and one DataStorage
51       *  for rigid bodies.
96     * @see SimData
52       */
53      class Snapshot {
54          public:
# Line 117 | Line 72 | namespace oopse{
72                  id_ = id;
73              }
74  
75 <            //template<typename T>
76 <            //static typename T::ElemPointerType getArrayPointer(vector<T>& v) {
77 <            //    return v[0]->getArrayPointer();
123 <            //}
75 >            int getSize() {
76 >                return atomData.getSize() + rigidbodyData.getSize();
77 >            }
78  
79 <            static double* getArrayPointer(vector<Vector3d>& v) {
80 <                assert(v.size() > 0);
81 <                return v[0].getArrayPointer();
79 >            /** Returns the number of atoms */
80 >            int getNumberOfAtoms() {
81 >                return atomData.getSize();
82              }
83 <            
84 <            static double* getArrayPointer(vector<RotMat3x3d>& v) {
85 <                assert(v.size() > 0);
86 <                return v[0].getArrayPointer();
83 >
84 >            /** Returns the number of rigid bodies */
85 >            int getNumberOfRigidBodies() {
86 >                return rigidbodyData.getSize();
87              }
88 <            
89 <            static double* getArrayPointer(vector<double>& v) {
90 <                assert(v.size() > 0);
91 <                return &(v[0]);
88 >
89 >            /** Returns the H-Matrix */
90 >            Mat3x3d getHmat() {
91 >                return hmat_;
92              }
93  
94 <            int getSize() {
95 <                return atomData.size() + rigidbodyData.size();
94 >            /** Sets the H-Matrix */
95 >            void setHmat(const Mat3x3d& m) {
96 >                hmat_ = m;
97 >                invHmat_ = hmat_.inverse();
98 >                
99 >                //notify fortran Hmat is changed
100 >                double fortranHmat[9];
101 >                double fortranInvHmat[9];
102 >                hmat_.getArray(fortranHmat);
103 >                invHmat_.getArray(fortranInvHmat);
104 >                setFortranBox(fortranHmat, fortranInvHmat, &orthoRhombic_);
105              }
106 +
107 +            void getVolume() {
108 +                return hmat_.determinant();
109 +            }
110 +
111 +            /** Returns the inverse H-Matrix */
112 +            Mat3x3d getInvHmat() {
113 +                return invHmat_;
114 +            }
115 +
116 +            /** Wrapping the vector according to periodic boundary condition*/
117 +            void wrapVector(Vector3d& v);
118 +
119              
120 <            int getSizeOfAtoms() {
121 <                return atomData.size();
120 >            double getTimeStamp() {
121 >                return timeStamp_;
122              }
123 +
124 +            void setTimeStamp(double timeStamp) {
125 +                timeStamp_ =timeStamp;
126 +                //time at statData is redundant
127 +                statData[Stats::TIME] = timeStamp_;
128 +            }
129 +
130 +            double getChi() {
131 +                return chi_;
132 +            }
133 +
134 +            void setChi(double chi) {
135 +                chi_ = chi;
136 +            }
137 +
138 +            double getIntegralOfChiDt() {
139 +                return integralOfChiDt_;
140 +            }
141 +
142 +            void setIntegralOfChiDt(double integralOfChiDt) {
143 +                integralOfChiDt_ = integralOfChiDt;
144 +            }
145              
146 <            int getSizeOfRigidBodies() {
147 <                return rigidbodyData.size();
146 >            Mat3x3d getEta() {
147 >                return eta_;
148              }
149 +
150 +            void setEta(const Mat3x3d& eta) {
151 +                eta_ = eta;
152 +            }
153              
154              DataStorage atomData;
155              DataStorage rigidbodyData;
156 <
157 <            friend class StuntDouble;
156 >            Stats statData;
157 >            
158          private:
159 +            double timeStamp_;
160  
161 +            Mat3x3d hmat_;
162 +            Mat3x3d invHmat_;
163 +            int orthoRhombic_;
164 +
165 +            double chi_;
166 +            double integralOfChiDt_;
167 +            Mat3x3d eta_;
168 +            
169              int id_; /**< identification number of the snapshot */
170      };
171  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines