PSCF v1.4.0
BdStepFactory.cpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2025, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "BdStepFactory.h"
9//#include <rpc/fts/brownian/BdSimulator.h>
10
11// Subclasses of BdStep
12#include "ExplicitBdStep.h"
13#include "PredCorrBdStep.h"
14#include "LMBdStep.h"
15
16namespace Pscf {
17namespace Rpc {
18
19 using namespace Util;
20
21 /*
22 * Constructor
23 */
24 template <int D>
26 : simulatorPtr_(&simulator)
27 {}
28
29 /*
30 * Return a pointer to a instance of BdStep subclass className.
31 */
32 template <int D>
33 BdStep<D>* BdStepFactory<D>::factory(const std::string &className) const
34 {
35 BdStep<D>* ptr = 0;
36
37 // Try subfactories first
38 ptr = trySubfactories(className);
39 if (ptr) return ptr;
40
41 // Try to match classname
42 if (className == "ExplicitBdStep" || className == "BdStep") {
43 ptr = new ExplicitBdStep<D>(*simulatorPtr_);
44 } else
45 if (className == "PredCorrBdStep") {
46 ptr = new PredCorrBdStep<D>(*simulatorPtr_);
47 } else
48 if (className == "LMBdStep") {
49 ptr = new LMBdStep<D>(*simulatorPtr_);
50 }
51
52 return ptr;
53 }
54
55 // Explicit instantiation definitions
56 template class BdStepFactory<1>;
57 template class BdStepFactory<2>;
58 template class BdStepFactory<3>;
59
60}
61}
Brownian dynamics simulator for PS-FTS.
Factory for subclasses of BdStep.
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.
Explicit Euler-Maruyama Brownian dynamics step.
Leimkuhler-Mathews Brownian dynamics time stepper.
Predictor-corrector Brownian dynamics time stepper.
BdStep< D > * trySubfactories(const std::string &className) const
Definition Factory.h:425
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.