PSCF v1.1
pspg/sweep/SweepFactory.tpp
1#ifndef PSPG_SWEEP_FACTORY_TPP
2#define PSPG_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 Pspg{
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.
Main class in SCFT simulation of one system.
Definition: pspg/System.h:71
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1