PSCF v1.1
fd1d/iterator/IteratorFactory.cpp
1#include "IteratorFactory.h"
2
3// Subclasses of Iterator
4#include "NrIterator.h"
5#include "AmIterator.h"
6#include "BinaryRelaxIterator.h"
7
8namespace Pscf {
9namespace Fd1d {
10
11 using namespace Util;
12
13 /*
14 * Constructor
15 */
17 : sysPtr_(&system)
18 {}
19
20 /*
21 * Return a pointer to a instance of Iterator subclass className.
22 */
23 Iterator* IteratorFactory::factory(const std::string &className) const
24 {
25 Iterator* ptr = 0;
26
27 // Try subfactories first
28 ptr = trySubfactories(className);
29 if (ptr) return ptr;
30
31 // Try to match classname
32 if (className == "Iterator" || className == "AmIterator") {
33 ptr = new AmIterator(*sysPtr_);
34 } else if (className == "NrIterator") {
35 ptr = new NrIterator(*sysPtr_);
36 } else if (className == "BinaryRelaxIterator") {
37 ptr = new BinaryRelaxIterator(*sysPtr_);
38 }
39
40 return ptr;
41 }
42
43}
44}
Anderson-Mixing iterator.
Relaxation iterator for SCF equations for two-monomer system.
IteratorFactory(System &system)
Constructor.
Iterator * factory(const std::string &className) const
Method to create any Iterator supplied with PSCF.
Base class for iterative solvers for SCF equations.
Newton-Raphson Iterator for SCF equations.
Definition: NrIterator.h:30
Main class in SCFT simulation of one system.
Definition: fd1d/System.h:63
Iterator * trySubfactories(const std::string &className) const
Search through subfactories for match.
Definition: Factory.h:425
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1