1 |
/* |
2 |
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
* |
4 |
* Contact: oopse@oopse.org |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public License |
8 |
* as published by the Free Software Foundation; either version 2.1 |
9 |
* of the License, or (at your option) any later version. |
10 |
* All we ask is that proper credit is given for our work, which includes |
11 |
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
* of your source code files, and to any copyright notice that you may distribute |
13 |
* with programs based on this work. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU Lesser General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU Lesser General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
* |
24 |
*/ |
25 |
|
26 |
/** |
27 |
* @file Snapshot.hpp |
28 |
* @author tlin |
29 |
* @date 10/20/2004 |
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 "brains/DataStorage.hpp" |
40 |
#include "brains/Stats.hpp" |
41 |
#include "UseTheForce/DarkSide/simulation_interface.h" |
42 |
|
43 |
namespace oopse{ |
44 |
|
45 |
/** |
46 |
* @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" |
47 |
* @brief Snapshot class is a repository class for storing dynamic data during |
48 |
* Simulation |
49 |
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
50 |
* for rigid bodies. |
51 |
*/ |
52 |
class Snapshot { |
53 |
public: |
54 |
|
55 |
Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), rigidbodyData(nRigidbodies), |
56 |
currentTime_(0), chi_(0.0), integralOfChiDt_(0.0), eta_(0.0), orthoRhombic_(0) { |
57 |
|
58 |
} |
59 |
|
60 |
|
61 |
/** Returns the id of this Snapshot */ |
62 |
int getID() { |
63 |
return id_; |
64 |
} |
65 |
|
66 |
/** Sets the id of this Snapshot */ |
67 |
void setID(int id) { |
68 |
id_ = id; |
69 |
} |
70 |
|
71 |
int getSize() { |
72 |
return atomData.getSize() + rigidbodyData.getSize(); |
73 |
} |
74 |
|
75 |
/** Returns the number of atoms */ |
76 |
int getNumberOfAtoms() { |
77 |
return atomData.getSize(); |
78 |
} |
79 |
|
80 |
/** Returns the number of rigid bodies */ |
81 |
int getNumberOfRigidBodies() { |
82 |
return rigidbodyData.getSize(); |
83 |
} |
84 |
|
85 |
/** Returns the H-Matrix */ |
86 |
Mat3x3d getHmat() { |
87 |
return hmat_; |
88 |
} |
89 |
|
90 |
/** Sets the H-Matrix */ |
91 |
void setHmat(const Mat3x3d& m); |
92 |
|
93 |
double getVolume() { |
94 |
return hmat_.determinant(); |
95 |
} |
96 |
|
97 |
/** Returns the inverse H-Matrix */ |
98 |
Mat3x3d getInvHmat() { |
99 |
return invHmat_; |
100 |
} |
101 |
|
102 |
/** Wrapping the vector according to periodic boundary condition*/ |
103 |
void wrapVector(Vector3d& v); |
104 |
|
105 |
|
106 |
double getTime() { |
107 |
return currentTime_; |
108 |
} |
109 |
|
110 |
void increaseTime(double dt) { |
111 |
setTime(getTime() + dt); |
112 |
} |
113 |
|
114 |
void setTime(double time) { |
115 |
currentTime_ =time; |
116 |
//time at statData is redundant |
117 |
statData[Stats::TIME] = currentTime_; |
118 |
} |
119 |
|
120 |
double getChi() { |
121 |
return chi_; |
122 |
} |
123 |
|
124 |
void setChi(double chi) { |
125 |
chi_ = chi; |
126 |
} |
127 |
|
128 |
double getIntegralOfChiDt() { |
129 |
return integralOfChiDt_; |
130 |
} |
131 |
|
132 |
void setIntegralOfChiDt(double integralOfChiDt) { |
133 |
integralOfChiDt_ = integralOfChiDt; |
134 |
} |
135 |
|
136 |
Mat3x3d getEta() { |
137 |
return eta_; |
138 |
} |
139 |
|
140 |
void setEta(const Mat3x3d& eta) { |
141 |
eta_ = eta; |
142 |
} |
143 |
|
144 |
DataStorage atomData; |
145 |
DataStorage rigidbodyData; |
146 |
Stats statData; |
147 |
|
148 |
private: |
149 |
double currentTime_; |
150 |
|
151 |
Mat3x3d hmat_; |
152 |
Mat3x3d invHmat_; |
153 |
int orthoRhombic_; |
154 |
|
155 |
double chi_; |
156 |
double integralOfChiDt_; |
157 |
Mat3x3d eta_; |
158 |
|
159 |
int id_; /**< identification number of the snapshot */ |
160 |
}; |
161 |
|
162 |
typedef DataStorage (Snapshot::*DataStoragePointer); |
163 |
} |
164 |
#endif //BRAINS_SNAPSHOT_HPP |