PSCF v1.2
rpg/scft/sweep/SweepFactory.tpp
1#ifndef RPG_SWEEP_FACTORY_TPP
2#define RPG_SWEEP_FACTORY_TPP
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "SweepFactory.h"
12
13#include "LinearSweep.h"
14
15namespace Pscf{
16namespace Rpg{
17
18 using namespace Util;
19
20 template <int D>
22 : systemPtr_(&system)
23 {}
24
25 /*
26 * Return a pointer to a Sweep subclass with name className
27 */
28 template <int D>
29 Sweep<D>* SweepFactory<D>::factory(std::string const & className) const
30 {
31 Sweep<D> *ptr = 0;
32
33 // First check if name is known by any subfactories
34 ptr = trySubfactories(className);
35 if (ptr) return ptr;
36
37 // Explicit class names
38 if (className == "Sweep" || className == "LinearSweep") {
39 ptr = new LinearSweep<D>(*systemPtr_);
40 }
41
42 return ptr;
43 }
44
45}
46}
47
48
49#endif
Base class for a sweep in parameter space where parameters change linearly with the sweep variable.
Sweep< D > * factory(std::string const &className) const
Method to create any Sweep subclass.
SweepFactory(System< D > &system)
Constructor.
Solve a sequence of problems along a line in parameter space.
Definition rpg/System.h:39
Main class for calculations that represent one system.
Definition rpg/System.h:107
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.