PSCF v1.5.0
BdStepFactory.tpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "BdStepFactory.h"
9
10// Subclasses of BdStep
11#include <rp/fts/brownian/ExplicitBdStep.h>
12#include <rp/fts/brownian/PredCorrBdStep.h>
13#include <rp/fts/brownian/LMBdStep.h>
14
15namespace Pscf {
16namespace Rp {
17
18 using namespace Util;
19
20 /*
21 * Constructor
22 */
23 template <int D, class T>
25 : simulatorPtr_(&simulator)
26 {}
27
28 /*
29 * Return a pointer to a instance of BdStep subclass className.
30 */
31 template <int D, class T>
32 BdStep<D,T>* BdStepFactory<D,T>::factory(const std::string &className) const
33 {
34 BdStep<D,T>* ptr = 0;
35
36 // Try subfactories first
37 ptr = trySubfactories(className);
38 if (ptr) return ptr;
39
40 // Try to match classname. The generic label "BdStep" selects the
41 // default algorithm, LMBdStep.
42 if (className == "ExplicitBdStep") {
43 ptr = new ExplicitBdStep<D,T>(*simulatorPtr_);
44 } else
45 if (className == "PredCorrBdStep") {
46 ptr = new PredCorrBdStep<D,T>(*simulatorPtr_);
47 } else
48 if (className == "LMBdStep" || className == "BdStep") {
49 ptr = new LMBdStep<D,T>(*simulatorPtr_);
50 }
51
52 return ptr;
53 }
54
55}
56}
Brownian dynamics simulator for PS-FTS.
Definition BdSimulator.h:52
BdStepFactory(BdSimulator< D, T > &simulator)
Constructor.
BdStep< D, T > * factory(const std::string &className) const
Method to create any BdStep supplied with PSCF.
Template for abstract base class for Brownian dynamics (BD) steps.
Definition BdStep.h:52
ExplicitBdStep(BdSimulator< D, T > &simulator)
Constructor.
LMBdStep(BdSimulator< D, T > &simulator)
Constructor.
Definition LMBdStep.tpp:34
PredCorrBdStep(BdSimulator< D, T > &simulator)
Constructor.
BdStep< D, T > * trySubfactories(const std::string &className) const
Definition Factory.h:427
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.