PSCF v1.4.0
RampFactory.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 "RampFactory.h"
9
10// Subclasses of Ramp
11#include "LinearRamp.h"
12
13//#include <rpc/fts/simulator/Simulator.h>
14
15namespace Pscf {
16namespace Rpc {
17
18 using namespace Util;
19
20 /*
21 * Constructor
22 */
23 template <int D>
25 : simulatorPtr_(&simulator)
26 {}
27
28 /*
29 * Return a pointer to a instance of Ramp subclass className.
30 */
31 template <int D>
32 Ramp<D>* RampFactory<D>::factory(const std::string & className) const
33 {
34 Ramp<D>* ptr = 0;
35
36 // Try subfactories first
37 ptr = trySubfactories(className);
38 if (ptr) return ptr;
39
40 // Try to match classname
41 if (className == "LinearRamp") {
42 ptr = new LinearRamp<D>(*simulatorPtr_);
43 }
44
45 return ptr;
46 }
47
48 // Explcit instantiation definitions
49 template class RampFactory<1>;
50 template class RampFactory<2>;
51 template class RampFactory<3>;
52}
53}
Ramp that varies parameters linearly with index.
Factory for subclasses of Ramp.
Ramp< D > * factory(const std::string &className) const
Method to create any Ramp supplied with PSCF.
RampFactory(Simulator< D > &simulator)
Constructor.
Ramp that varies parameters linearly with index.
Field theoretic simulator (base class).
Ramp< 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.