PSCF v1.2
rpg/fts/brownian/BdStepFactory.tpp
1#ifndef RPG_BD_STEP_FACTORY_TPP
2#define RPG_BD_STEP_FACTORY_TPP
3
4#include "BdStepFactory.h"
5#include <rpg/fts/brownian/BdSimulator.h>
6
7// Subclasses of BdStep
8#include "ExplicitBdStep.h"
9#include "PredCorrBdStep.h"
10#include "LMBdStep.h"
11
12namespace Pscf {
13namespace Rpg {
14
15 using namespace Util;
16
17 /*
18 * Constructor
19 */
20 template <int D>
22 : simulatorPtr_(&simulator)
23 {}
24
25 /*
26 * Return a pointer to a instance of BdStep subclass className.
27 */
28 template <int D>
29 BdStep<D>* BdStepFactory<D>::factory(const std::string &className) const
30 {
31 BdStep<D>* ptr = 0;
32
33 // Try subfactories first
34 ptr = trySubfactories(className);
35 if (ptr) return ptr;
36
37
38 // Try to match classname
39 if (className == "ExplicitBdStep" || className == "BdStep") {
40 ptr = new ExplicitBdStep<D>(*simulatorPtr_);
41 } else
42 if (className == "PredCorrBdStep") {
43 ptr = new PredCorrBdStep<D>(*simulatorPtr_);
44 } else
45 if (className == "LMBdStep") {
46 ptr = new LMBdStep<D>(*simulatorPtr_);
47 }
48
49 return ptr;
50 }
51
52}
53}
54#endif
Brownian dynamics simulator.
BdStepFactory(BdSimulator< D > &simulator)
Constructor.
BdStep< D > * factory(const std::string &className) const
Method to create any BdStep supplied with PSCF.
BdStep is an abstract base class for Brownian dynamics steps.
BdStep is an abstract base class for Brownian dynamics steps.
Leimkuhler-Matthews Brownian dynamics stepper.
Predictor-corrector Brownian dynamics stepper.
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.