| 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 | #ifndef BRAINS_SNAPSHOT_HPP | 
| 34 | #define BRAINS_SNAPSHOT_HPP | 
| 35 |  | 
| 36 | #include <vector> | 
| 37 |  | 
| 38 | #include "math/Vector3.hpp" | 
| 39 | #include "math/SquareMatrix3.hpp" | 
| 40 |  | 
| 41 | using namespace std; | 
| 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 | * @see SimData | 
| 50 | */ | 
| 51 | class Snapshot { | 
| 52 | public: | 
| 53 |  | 
| 54 | Snapshot(int i) { | 
| 55 |  | 
| 56 | } | 
| 57 |  | 
| 58 | Snapshot(const Snapshot& s); | 
| 59 |  | 
| 60 | Snapshot& operator =(const Snapshot& s); | 
| 61 |  | 
| 62 | /** Returns the id of this Snapshot */ | 
| 63 | int getID() { | 
| 64 | return id_; | 
| 65 | } | 
| 66 |  | 
| 67 | /** Sets the id of this Snapshot */ | 
| 68 | void setID(int id) { | 
| 69 | id_ = id; | 
| 70 | } | 
| 71 |  | 
| 72 | /** */ | 
| 73 | Snapshot* clone() { | 
| 74 | return new Snapshot(*this); | 
| 75 | } | 
| 76 |  | 
| 77 |  | 
| 78 | //template<typename T> | 
| 79 | //static typename T::ElemPointerType getArrayPointer(vector<T>& v) { | 
| 80 | //    return v[0]->getArrayPointer(); | 
| 81 | //} | 
| 82 |  | 
| 83 | static double* getArrayPointer(vector<Vector3d>& v) { | 
| 84 | return v[0].getArrayPointer(); | 
| 85 | } | 
| 86 |  | 
| 87 | static double* getArrayPointer(vector<RotMat3x3d>& v) { | 
| 88 | return v[0].getArrayPointer(); | 
| 89 | } | 
| 90 |  | 
| 91 | static double* getArrayPointer(vector<double>& v) { | 
| 92 | assert(v.size() > 0); | 
| 93 | return &(v[0]); | 
| 94 | } | 
| 95 |  | 
| 96 | vector<Vector3d> pos; | 
| 97 | vector<Vector3d> vel; | 
| 98 | vector<Vector3d> frc; | 
| 99 | vector<Vector3d> trq; | 
| 100 | vector<RotMat3x3d> Amat; | 
| 101 | vector<Vector3d> mu; | 
| 102 | vector<Vector3d> ul; | 
| 103 | vector<double> zAngle; | 
| 104 |  | 
| 105 | private: | 
| 106 |  | 
| 107 | int id_; /**< identification number of the snapshot */ | 
| 108 | }; | 
| 109 |  | 
| 110 | } | 
| 111 | #endif //BRAINS_SNAPSHOT_HPP |