Loading [MathJax]/extensions/TeX/AMSsymbols.js
PSCF v1.2
rpg/scft/iterator/IteratorFactory.tpp
1#ifndef RPG_ITERATOR_FACTORY_TPP
2#define RPG_ITERATOR_FACTORY_TPP
3
4#include "IteratorFactory.h"
5
6// Subclasses of Iterator
7#include "AmIteratorBasis.h"
8#include "AmIteratorGrid.h"
9
10namespace Pscf {
11namespace Rpg {
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 == "AmIteratorBasis") {
37 ptr = new AmIteratorBasis<D>(*sysPtr_);
38 } else
39 if (className == "AmIteratorGrid") {
40 ptr = new AmIteratorGrid<D>(*sysPtr_);
41 }
42
43 return ptr;
44 }
45
46}
47}
48#endif
Rpg implementation of the Anderson Mixing iterator.
Rpg implementation of the Anderson Mixing iterator.
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.
Definition rpg/System.h:37
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.