PSCF v1.2
rpc/fts/montecarlo/McMoveFactory.tpp
1#ifndef RPC_MC_MOVE_FACTORY_TPP
2#define RPC_MC_MOVE_FACTORY_TPP
3
4#include "McMoveFactory.h"
5#include <rpc/fts/montecarlo/McSimulator.h>
6
7// Subclasses of McMove
8#include "RealMove.h"
9#include "ForceBiasMove.h"
10
11namespace Pscf {
12namespace Rpc {
13
14 using namespace Util;
15
16 /*
17 * Constructor
18 */
19 template <int D>
21 : simulatorPtr_(&simulator)
22 {}
23
24 /*
25 * Return a pointer to a instance of McMove subclass className.
26 */
27 template <int D>
28 McMove<D>* McMoveFactory<D>::factory(const std::string &className) const
29 {
30 McMove<D>* ptr = 0;
31
32 // Try subfactories first
33 ptr = trySubfactories(className);
34 if (ptr) return ptr;
35
36
37 // Try to match classname
38 if (className == "RealMove") {
39 ptr = new RealMove<D>(*simulatorPtr_);
40 } else if (className == "ForceBiasMove") {
41 ptr = new ForceBiasMove<D>(*simulatorPtr_);
42 }
43
44 return ptr;
45 }
46
47}
48}
49#endif
ForceBiasMove attempts a Brownian dynamics move.
McMoveFactory(McSimulator< D > &simulator)
Constructor.
McMove< D > * factory(const std::string &className) const
Method to create any McMove supplied with PSCF.
McMove is an abstract base class for Monte Carlo moves.
Monte-Carlo simulation coordinator.
RealMove generates spatially uncorrelated random field changes.
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.