PSCF v1.4.0
IteratorFactory.cu
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2025, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "IteratorFactory.h"
9
10// Subclasses of Iterator
11#include "AmIteratorBasis.h"
12#include "AmIteratorGrid.h"
13
14namespace Pscf {
15namespace Rpg {
16
17 using namespace Util;
18
19 /*
20 * Constructor
21 */
22 template <int D>
24 : sysPtr_(&system)
25 {}
26
27 /*
28 * Return a pointer to a instance of Iterator subclass className.
29 */
30 template <int D>
31 Iterator<D>* IteratorFactory<D>::factory(std::string const& className)
32 const
33 {
34 Iterator<D>* ptr = 0;
35
36 // Try subfactories first
37 ptr = trySubfactories(className);
38 if (ptr) return ptr;
39
40 // Try to match classname
41 if (className == "Iterator" || className == "AmIteratorBasis") {
42 ptr = new AmIteratorBasis<D>(*sysPtr_);
43 } else
44 if (className == "AmIteratorGrid") {
45 ptr = new AmIteratorGrid<D>(*sysPtr_);
46 }
47
48 return ptr;
49 }
50
51}
52}
53
54// Explicit instantiation definitions
55namespace Pscf {
56 namespace Rpg {
57 template class IteratorFactory<1>;
58 template class IteratorFactory<2>;
59 template class IteratorFactory<3>;
60 }
61}
Anderson mixing iterator with imposed space-group symmetry).
Anderson Mixing iterator on grid (no space-group symmetry).
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 in Rpg.
Main class, representing a complete physical system.
Iterator< D > * trySubfactories(const std::string &className) const
Definition Factory.h:425
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.