PSCF v1.3
rpc/environment/EnvironmentFactory.tpp
1#ifndef RPC_ENVIRONMENT_FACTORY_TPP
2#define RPC_ENVIRONMENT_FACTORY_TPP
3
4#include "EnvironmentFactory.h"
5#include "FilmEnvironment.h"
6
7namespace Pscf {
8namespace Rpc {
9
10 using namespace Util;
11
12 /*
13 * Constructor
14 */
15 template <int D>
17 : sysPtr_(&system)
18 {}
19
20 /*
21 * Return a pointer to a instance of Environment subclass className.
22 */
23 template <int D>
24 Environment* EnvironmentFactory<D>::factory(const std::string &className)
25 const
26 {
27 Environment* ptr = nullptr;
28
29 // Try subfactories first
30 ptr = trySubfactories(className);
31 if (ptr) return ptr;
32
33 // Try to match classname
34 if (className == "FilmEnvironment") {
35 ptr = new FilmEnvironment<D>(*sysPtr_);
36 }
37
38 return ptr;
39 }
40
41}
42}
43#endif
Base class mask and external field generator for variable-cell SCFT.
Definition Environment.h:59
Environment * factory(const std::string &className) const
Method to create any Environment supplied with PSCF.
EnvironmentFactory(System< D > &system)
Constructor.
Class defining mask & external fields for thin-film systems.
Main class, representing one complete system.
Environment * 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.
Definition param_pc.dox:1