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