PSCF v1.5.0
RampFactory.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 "RampFactory.h"
9
10// Subclasses of Ramp
11#include "LinearRamp.h"
12
13namespace Pscf {
14namespace Rp {
15
16 using namespace Util;
17
18 /*
19 * Constructor
20 */
21 template <int D, class T>
23 : simulatorPtr_(&simulator)
24 {}
25
26 /*
27 * Return a pointer to a instance of Ramp subclass className.
28 */
29 template <int D, class T>
30 Ramp<D, T >* RampFactory<D,T>::factory(const std::string & className) const
31 {
32 Ramp<D,T>* ptr = 0;
33
34 // Try subfactories first
35 ptr = trySubfactories(className);
36 if (ptr) return ptr;
37
38 // Try to match classname. The generic label "Ramp" selects the
39 // default algorithm, LinearRamp.
40 if (className == "LinearRamp" || className == "Ramp") {
41 ptr = new LinearRamp<D,T>(*simulatorPtr_);
42 }
43
44 return ptr;
45 }
46
47}
48}
LinearRamp(Simulator< D, T > &simulator)
Constructor.
RampFactory(Simulator< D, T > &simulator)
Constructor.
Ramp< D, T > * factory(const std::string &className) const
Method to create any Ramp supplied with PSCF.
Class that varies parameters during a simulation (abstract).
Definition Ramp.h:35
Base class for field theoretic PS-FTS simulator.
Definition Simulator.h:93
Ramp< 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.