PSCF v1.2
rpc/fts/compressor/CompressorFactory.tpp
1#ifndef RPC_COMPRESSOR_FACTORY_TPP
2#define RPC_COMPRESSOR_FACTORY_TPP
3
4#include "CompressorFactory.h"
5
6// Subclasses of Compressor
7#include "AmCompressor.h"
8#include "LrCompressor.h"
9#include "LrAmCompressor.h"
10
11namespace Pscf {
12namespace Rpc {
13
14 using namespace Util;
15
16 /*
17 * Constructor
18 */
19 template <int D>
21 : sysPtr_(&system)
22 {}
23
24 /*
25 * Return a pointer to a instance of Compressor subclass className.
26 */
27 template <int D>
29 CompressorFactory<D>::factory(std::string const &className) const
30 {
31 Compressor<D>* ptr = 0;
32
33 // Try subfactories first
34 ptr = trySubfactories(className);
35 if (ptr) return ptr;
36
37 // Try to match classname
38 if (className == "Compressor" || className == "LrAmCompressor") {
39 ptr = new LrAmCompressor<D>(*sysPtr_);
40 } else if (className == "AmCompressor") {
41 ptr = new AmCompressor<D>(*sysPtr_);
42 } else if (className == "LrCompressor") {
43 ptr = new LrCompressor<D>(*sysPtr_);
44 }
45
46 return ptr;
47 }
48
49}
50}
51#endif
Compressor< D > * factory(const std::string &className) const
Method to create any Compressor supplied with PSCF.
CompressorFactory(System< D > &system)
Constructor.
Base class for iterators that impose incompressibility.
Anderson Mixing compressor with linear-response mixing step.
Main class for SCFT or PS-FTS simulation of one system.
Definition rpc/System.h:100
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.