PSCF v1.2
rpg/fts/perturbation/PerturbationFactory.tpp
1#ifndef RPG_PERTURBATION_FACTORY_TPP
2#define RPG_PERTURBATION_FACTORY_TPP
3
4#include "PerturbationFactory.h"
5
6// Subclasses of Perturbation
7#include "EinsteinCrystalPerturbation.h"
8
9#include <rpg/fts/simulator/Simulator.h>
10
11namespace Pscf {
12namespace Rpg {
13
14 using namespace Util;
15
16 /*
17 * Constructor
18 */
19 template <int D>
21 : simulatorPtr_(&simulator)
22 {}
23
24 /*
25 * Return a pointer to a instance of Perturbation subclass className.
26 */
27 template <int D>
29 PerturbationFactory<D>::factory(const std::string & className) const
30 {
31 Perturbation<D>* ptr = 0;
32
33 // Try subfactories first
34 ptr = trySubfactories(className);
35 if (ptr) return ptr;
36
37 // Try to match classname
38 if (className == "EinsteinCrystal" ||
39 className == "EinsteinCrystalPerturbation") {
40 ptr = new EinsteinCrystalPerturbation<D>(*simulatorPtr_);
41 }
42
43 return ptr;
44 }
45
46}
47}
48#endif
Perturbation for Einstein crystal thermodynamic integration method.
Perturbation< D > * factory(const std::string &className) const
Method to create any Perturbation supplied with PSCF.
PerturbationFactory(Simulator< D > &simulator)
Constructor.
Base class for additive perturbations of standard FTS Hamiltonian.
Field theoretic simulator (base class).
Definition rpg/System.h:41
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.