PSCF v1.1
pspc/iterator/IteratorFactory.tpp
1#ifndef PSPC_ITERATOR_FACTORY_TPP
2#define PSPC_ITERATOR_FACTORY_TPP
3
4#include "IteratorFactory.h"
5
6// Subclasses of Iterator
7#include "AmIterator.h"
8#include "FilmIterator.h"
9
10namespace Pscf {
11namespace Pspc {
12
13 using namespace Util;
14
15 /*
16 * Constructor
17 */
18 template <int D>
20 : sysPtr_(&system)
21 {}
22
23 /*
24 * Return a pointer to a instance of Iterator subclass className.
25 */
26 template <int D>
27 Iterator<D>* IteratorFactory<D>::factory(const std::string &className) const
28 {
29 Iterator<D>* ptr = 0;
30
31 // Try subfactories first
32 ptr = trySubfactories(className);
33 if (ptr) return ptr;
34
35 // Try to match classname
36 if (className == "Iterator" || className == "AmIterator") {
37 ptr = new AmIterator<D>(*sysPtr_);
38 } else if (className == "AmIteratorFilm") {
39 ptr = new FilmIterator<D, AmIterator<D> >(*sysPtr_);
40 }
41
42 return ptr;
43 }
44
45}
46}
47#endif
Pspc implementation of the Anderson Mixing iterator.
Iterator for a thin film (empty base template).
Definition: FilmIterator.h:51
Iterator< D > * factory(const std::string &className) const
Method to create any Iterator supplied with PSCF.
IteratorFactory(System< D > &system)
Constructor.
Base class for iterative solvers for SCF equations.
Main class for SCFT simulation of one system.
Definition: pspc/System.h:76
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1