179 |
|
public: |
180 |
|
typedef std::map<string, IntegratorCreator*> CreatorMapType; |
181 |
|
|
182 |
< |
bool registerIntegrator(IntegratorCreator* creator); |
182 |
> |
bool registerIntegrator(IntegratorCreator* creator) { |
183 |
> |
return creatorMap_.insert(creator->getIdent(), creator).second; |
184 |
> |
} |
185 |
|
|
186 |
< |
Integrator* createIntegrator(const string& id, SimInfo* info); |
186 |
> |
Integrator* createIntegrator(const string& id, SimInfo* info) { |
187 |
> |
Integrator* result = NULL; |
188 |
> |
CreatorMapType::iterator i = creatorMap_.find(id); |
189 |
> |
if (i != creatorMap_.end()) { |
190 |
> |
result = (i->second)->create(info); |
191 |
> |
} |
192 |
> |
return result; |
193 |
> |
} |
194 |
|
|
195 |
|
private: |
196 |
|
CreatorMapType creatorMap_; |
197 |
|
}; |
189 |
– |
|
198 |
|
\end{lstlisting} |
199 |
< |
|
192 |
< |
\begin{lstlisting}[float,caption={[The implementation of Factory pattern (II)].},label={appendixScheme:factoryDeclarationImplementation}] |
193 |
< |
|
194 |
< |
bool IntegratorFactory::unregisterIntegrator(const string& id) { |
195 |
< |
return creatorMap_.erase(id) == 1; |
196 |
< |
} |
197 |
< |
|
198 |
< |
Integrator* IntegratorFactory::createIntegrator(const string& id, |
199 |
< |
SimInfo* info) { |
200 |
< |
CreatorMapType::iterator i = creatorMap_.find(id); |
201 |
< |
if (i != creatorMap_.end()) { |
202 |
< |
return (i->second)->create(info); |
203 |
< |
} else { |
204 |
< |
return NULL; |
205 |
< |
} |
206 |
< |
} |
207 |
< |
|
208 |
< |
\end{lstlisting} |
209 |
< |
|
210 |
< |
\begin{lstlisting}[float,caption={[The implementation of Factory pattern (III)].},label={appendixScheme:integratorCreator}] |
199 |
> |
\begin{lstlisting}[float,caption={[The implementation of Factory pattern (III)]Souce code of creator classes.},label={appendixScheme:integratorCreator}] |
200 |
|
|
201 |
|
class IntegratorCreator { |
202 |
|
public: |
279 |
|
}; |
280 |
|
|
281 |
|
\end{lstlisting} |
282 |
+ |
|
283 |
|
\section{\label{appendixSection:concepts}Concepts} |
284 |
|
|
295 |
– |
\begin{figure} |
296 |
– |
\centering |
297 |
– |
\includegraphics[width=\linewidth]{heirarchy.eps} |
298 |
– |
\caption[Class heirarchy for StuntDoubles in {\sc OOPSE}]{ The class |
299 |
– |
heirarchy of StuntDoubles in {\sc OOPSE}.} |
300 |
– |
\label{oopseFig:heirarchy} |
301 |
– |
\end{figure} |
302 |
– |
|
285 |
|
OOPSE manipulates both traditional atoms as well as some objects |
286 |
|
that {\it behave like atoms}. These objects can be rigid |
287 |
|
collections of atoms or atoms which have orientational degrees of |
288 |
|
freedom. A diagram of the class heirarchy is illustrated in |
289 |
< |
Fig.~\ref{oopseFig:heirarchy}. |
290 |
< |
|
291 |
< |
|
289 |
> |
Fig.~\ref{oopseFig:heirarchy}. Every Molecule, Atom and |
290 |
> |
DirectionalAtom in {\sc OOPSE} have their own names which are |
291 |
> |
specified in the {\tt .md} file. In contrast, RigidBodies are |
292 |
> |
denoted by their membership and index inside a particular molecule: |
293 |
> |
[MoleculeName]\_RB\_[index] (the contents inside the brackets depend |
294 |
> |
on the specifics of the simulation). The names of rigid bodies are |
295 |
> |
generated automatically. For example, the name of the first rigid |
296 |
> |
body in a DMPC molecule is DMPC\_RB\_0. |
297 |
> |
\begin{figure} |
298 |
> |
\centering |
299 |
> |
\includegraphics[width=\linewidth]{heirarchy.eps} |
300 |
> |
\caption[Class heirarchy for ojects in {\sc OOPSE}]{ A diagram of |
301 |
> |
the class heirarchy. |
302 |
|
\begin{itemize} |
303 |
|
\item A {\bf StuntDouble} is {\it any} object that can be manipulated by the |
304 |
|
integrators and minimizers. |
307 |
|
\item A {\bf RigidBody} is a collection of {\bf Atom}s or {\bf |
308 |
|
DirectionalAtom}s which behaves as a single unit. |
309 |
|
\end{itemize} |
310 |
< |
|
311 |
< |
Every Molecule, Atom and DirectionalAtom in {\sc OOPSE} have their |
320 |
< |
own names which are specified in the {\tt .md} file. In contrast, |
321 |
< |
RigidBodies are denoted by their membership and index inside a |
322 |
< |
particular molecule: [MoleculeName]\_RB\_[index] (the contents |
323 |
< |
inside the brackets depend on the specifics of the simulation). The |
324 |
< |
names of rigid bodies are generated automatically. For example, the |
325 |
< |
name of the first rigid body in a DMPC molecule is DMPC\_RB\_0. |
310 |
> |
} \label{oopseFig:heirarchy} |
311 |
> |
\end{figure} |
312 |
|
|
313 |
|
\section{\label{appendixSection:syntax}Syntax of the Select Command} |
314 |
|
|