PSCF v1.4.0
PerturbationFactory.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 "PerturbationFactory.h"
9//#include <rpc/fts/simulator/Simulator.h>
10
11// Subclasses of Perturbation
12#include "EinsteinCrystalPerturbation.h"
13
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 Perturbation subclass className.
30 */
31 template <int D>
33 PerturbationFactory<D>::factory(const std::string & className) const
34 {
35 Perturbation<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 == "EinsteinCrystal" ||
43 className == "EinsteinCrystalPerturbation") {
44 ptr = new EinsteinCrystalPerturbation<D>(*simulatorPtr_);
45 }
46
47 return ptr;
48 }
49
50 // Explicit instantiation definitions
51 template class PerturbationFactory<1>;
52 template class PerturbationFactory<2>;
53 template class PerturbationFactory<3>;
54
55}
56}
Perturbation for Einstein crystal thermodynamic integration.
Factory for subclasses of Perturbation.
PerturbationFactory(Simulator< D > &simulator)
Constructor.
Perturbation< D > * factory(const std::string &className) const
Method to create any Perturbation supplied with PSCF.
Additive perturbation of standard FTS Hamiltonian (base class).
Field theoretic simulator (base class).
Perturbation< 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.