ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/Snapshot.hpp
Revision: 1710
Committed: Thu Nov 4 19:48:22 2004 UTC (19 years, 7 months ago) by tim
File size: 3711 byte(s)
Log Message:
adding Stats class

File Contents

# Content
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
42 using namespace std;
43
44 namespace oopse{
45
46 /**
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.
52 * @see SimData
53 */
54 class Snapshot {
55 public:
56
57 Snapshot(int nAtoms, int nRigidbodies) {
58 atomData.resize(nAtoms);
59 rigidbodyData.resize(nRigidbodies);
60 }
61
62 Snapshot(const Snapshot& s);
63
64 Snapshot& operator =(const Snapshot& s);
65
66 /** Returns the id of this Snapshot */
67 int getID() {
68 return id_;
69 }
70
71 /** Sets the id of this Snapshot */
72 void setID(int id) {
73 id_ = id;
74 }
75
76 int getSize() {
77 return atomData.getSize() + rigidbodyData.getSize();
78 }
79
80 /** Returns the number of atoms */
81 int getNumberOfAtoms() {
82 return atomData.getSize();
83 }
84
85 /** Returns the number of rigid bodies */
86 int getNumberOfRigidBodies() {
87 return rigidbodyData.getSize();
88 }
89
90 /** Returns the H-Matrix */
91 Mat3x3d getHmat() {
92 return hmat_;
93 }
94
95 /** Sets the H-Matrix */
96 void setHamt(const Mat3x3d& m) {
97 hmat_ = m;
98 invHmat_ = hmat_.inverse();
99 }
100
101 /** Returns the inverse H-Matrix */
102 Mat3x3d getInvHmat() {
103 return invHmat_;
104 }
105
106 double getTimeStamp() {
107 return timeStamp_;
108 }
109
110 void setTimeStamp(double timeStamp) {
111 timeStamp_ =timeStamp;
112 }
113
114 DataStorage atomData;
115 DataStorage rigidbodyData;
116 Stats statData;
117
118 private:
119 double timeStamp_;
120 Mat3x3d hmat_;
121 Mat3x3d invHmat_;
122 int id_; /**< identification number of the snapshot */
123 };
124
125 typedef DataStorage (Snapshot::*DataStoragePointer);
126 }
127 #endif //BRAINS_SNAPSHOT_HPP