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 SimInfo.hpp |
28 |
* @author tlin |
29 |
* @date 11/02/2004 |
30 |
* @version 1.0 |
31 |
*/ |
32 |
|
33 |
#ifndef BRAINS_SIMMODEL_HPP |
34 |
#define BRAINS_SIMMODEL_HPP |
35 |
#include <vector> |
36 |
#include <iostream> |
37 |
|
38 |
#include "brains/fSimulation.h" |
39 |
#include "primitives/Molecule.hpp" |
40 |
#include "utils/PropertyMap.hpp" |
41 |
|
42 |
namespace oopse{ |
43 |
|
44 |
/** |
45 |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
46 |
* @brief |
47 |
*/ |
48 |
class SimInfo { |
49 |
public: |
50 |
SimInfo(); |
51 |
virtual ~SimInfo(); |
52 |
|
53 |
/** |
54 |
* Adds a molecule |
55 |
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
56 |
* @param mol molecule to be added |
57 |
*/ |
58 |
bool addMolecule(Molecule* mol); |
59 |
|
60 |
/** |
61 |
* Removes a molecule from SimInfo |
62 |
* @return true if removing successfully, return false if molecule is not in this SimInfo |
63 |
*/ |
64 |
bool removeMolecule(Molecule* mol); |
65 |
|
66 |
/** |
67 |
* Returns the number of molecules. |
68 |
* @return the number of molecules in this SimInfo |
69 |
*/ |
70 |
int getNMolecules() { |
71 |
return molecules_.size(); |
72 |
} |
73 |
|
74 |
/** Returns the total number of atoms in this SimInfo */ |
75 |
unsigned int getNAtoms() { |
76 |
return nAtoms_; |
77 |
} |
78 |
|
79 |
/** Returns the total number of bonds in this SimInfo */ |
80 |
unsigned int getNBonds(){ |
81 |
return nBonds_; |
82 |
} |
83 |
|
84 |
/** Returns the total number of bends in this SimInfo */ |
85 |
unsigned int getNBends() { |
86 |
return nBends_; |
87 |
} |
88 |
|
89 |
/** Returns the total number of torsions in this SimInfo */ |
90 |
unsigned int getNTorsions() { |
91 |
return nTorsions_; |
92 |
} |
93 |
|
94 |
/** Returns the total number of rigid bodies in this SimInfo */ |
95 |
unsigned int getNRigidBodies() { |
96 |
return nRigidBodies_; |
97 |
} |
98 |
|
99 |
/** Returns the total number of integrable objects in this SimInfo */ |
100 |
unsigned int getNIntegrableObjects() { |
101 |
return nIntegrableObjects_; |
102 |
} |
103 |
|
104 |
/** Returns the total number of cutoff groups in this SimInfo */ |
105 |
unsigned int getNCutoffGroups() { |
106 |
return nCutoffGroups_; |
107 |
} |
108 |
|
109 |
/** Returns the total number of constraints in this SimInfo */ |
110 |
unsigned int getNConstraints() { |
111 |
return nConstraints_; |
112 |
} |
113 |
|
114 |
/** |
115 |
* Returns the first molecule in this SimInfo and intialize the iterator. |
116 |
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
117 |
* @param i the iterator of molecule array (user shouldn't change it) |
118 |
*/ |
119 |
Molecule* beginMolecule(std::vector<Molecule*>::iterator& i); |
120 |
|
121 |
/** |
122 |
* Returns the next avaliable Molecule based on the iterator. |
123 |
* @return the next avaliable molecule, return NULL if reaching the end of the array |
124 |
* @param i the iterator of molecule array |
125 |
*/ |
126 |
Molecule* nextMolecule(std::vector<Molecule*>::iterator& i); |
127 |
|
128 |
/** Returns the number of degrees of freedom */ |
129 |
int getNDF() { |
130 |
return ndf_; |
131 |
} |
132 |
|
133 |
/** Returns the number of raw degrees of freedom */ |
134 |
int getNDFRaw() { |
135 |
return ndfRaw_; |
136 |
} |
137 |
|
138 |
/** Returns the number of translational degrees of freedom */ |
139 |
int getNDFTrans() { |
140 |
return ndfTrans_; |
141 |
} |
142 |
|
143 |
/** Returns the snapshot manager. */ |
144 |
SnapshotManager* getSnapshotManager() { |
145 |
return sman_; |
146 |
} |
147 |
|
148 |
/** Sets the snapshot manager. */ |
149 |
void setSnapshotManager(SnapshotManager* sman) { |
150 |
sman_ = sman; |
151 |
} |
152 |
|
153 |
private: |
154 |
|
155 |
void calcNDF(); |
156 |
void calcNDFRaw(); |
157 |
void calcNDFTrans(); |
158 |
|
159 |
int ndf_; |
160 |
int ndfRaw_; |
161 |
int ndfTrans_; |
162 |
|
163 |
int nAtoms_; |
164 |
int nBonds_; |
165 |
int nBends_; |
166 |
int nTorsions_; |
167 |
int nRigidBodies_; |
168 |
int nIntegrableObjects_; |
169 |
int nCutoffGroups_; |
170 |
int nConstraints_; |
171 |
|
172 |
simtype fInfo; |
173 |
Exclude excludeList; |
174 |
|
175 |
|
176 |
std::vector<Molecule*> molecules_; /**< Molecule array */ |
177 |
PropertyMap properties_; /** Generic Property */ |
178 |
SnapshotManager* sman_; /** SnapshotManager */ |
179 |
|
180 |
}; |
181 |
|
182 |
} //namespace oopse |
183 |
#endif //BRAINS_SIMMODEL_HPP |