PSCF v1.4.0
RampFactory.cu
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#include <rpg/fts/simulator/Simulator.h>
10
11// Subclasses of Ramp
12#include "LinearRamp.h"
13
14namespace Pscf {
15namespace Rpg {
16
17 using namespace Util;
18
19 /*
20 * Constructor
21 */
22 template <int D>
24 : simulatorPtr_(&simulator)
25 {}
26
27 /*
28 * Return a pointer to a instance of Ramp subclass className.
29 */
30 template <int D>
31 Ramp<D>* RampFactory<D>::factory(const std::string & className) const
32 {
33 Ramp<D>* ptr = 0;
34
35 // Try subfactories first
36 ptr = trySubfactories(className);
37 if (ptr) return ptr;
38
39 // Try to match classname
40 if (className == "LinearRamp") {
41 ptr = new LinearRamp<D>(*simulatorPtr_);
42 }
43
44 return ptr;
45 }
46
47
48 // Explicit instantiation definitions
49 template class RampFactory<1>;
50 template class RampFactory<2>;
51 template class RampFactory<3>;
52
53}
54}
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
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.