PSCF v1.4.0
AnalyzerFactory.cpp
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 "AnalyzerFactory.h"
9
10// Subclasses of Analyzer
11#include "StepLogger.h"
12#include "TrajectoryWriter.h"
13#include "ConcentrationWriter.h"
14#include "HamiltonianAnalyzer.h"
15#include "BinaryStructureFactor.h"
16#include "MaxOrderParameter.h"
17#include "FourthOrderParameter.h"
18#include "BinaryChiDerivative.h"
19#include "CubicLengthDerivative.h"
20#include "ConcentrationDerivative.h"
21#include "PerturbationDerivative.h"
22
23namespace Pscf {
24namespace Rpc {
25
26 using namespace Util;
27
28 /*
29 * Constructor
30 */
31 template <int D>
33 System<D>& system)
34 : simPtr_(&simulator),
35 sysPtr_(&system)
36 {}
37
38 /*
39 * Return a pointer to a instance of Analyzer subclass className.
40 */
41 template <int D>
42 Analyzer<D>* AnalyzerFactory<D>::factory(const std::string &className)
43 const
44 {
45 Analyzer<D>* ptr = nullptr;
46
47 // Try subfactories first
48 ptr = trySubfactories(className);
49 if (ptr) return ptr;
50
51
52 // Try to match classname
53 if (className == "StepLogger") {
54 ptr = new StepLogger<D>(*simPtr_, *sysPtr_);
55 } else if (className == "TrajectoryWriter") {
56 ptr = new TrajectoryWriter<D>(*simPtr_, *sysPtr_);
57 } else if (className == "ConcentrationWriter") {
58 ptr = new ConcentrationWriter<D>(*simPtr_, *sysPtr_);
59 } else if (className == "HamiltonianAnalyzer") {
60 ptr = new HamiltonianAnalyzer<D>(*simPtr_, *sysPtr_);
61 } else if (className == "BinaryStructureFactor") {
62 ptr = new BinaryStructureFactor<D>(*simPtr_, *sysPtr_);
63 } else if (className == "PerturbationDerivative") {
64 ptr = new PerturbationDerivative<D>(*simPtr_, *sysPtr_);
65 } else if (className == "BinaryChiDerivative") {
66 ptr = new BinaryChiDerivative<D>(*simPtr_, *sysPtr_);
67 } else if (className == "CubicLengthDerivative") {
68 ptr = new CubicLengthDerivative<D>(*simPtr_, *sysPtr_);
69 } else if (className == "ConcentrationDerivative") {
70 ptr = new ConcentrationDerivative<D>(*simPtr_, *sysPtr_);
71 } else if (className == "MaxOrderParameter") {
72 ptr = new MaxOrderParameter<D>(*simPtr_, *sysPtr_);
73 } else if (className == "FourthOrderParameter") {
74 ptr = new FourthOrderParameter<D>(*simPtr_, *sysPtr_);
75 }
76
77 return ptr;
78 }
79
80 // Explicit instantiation definitions
81 template class AnalyzerFactory<1>;
82 template class AnalyzerFactory<2>;
83 template class AnalyzerFactory<3>;
84
85}
86}
Factory for subclasses of Analyzer.
AnalyzerFactory(Simulator< D > &simulator, System< D > &system)
Constructor.
Analyzer< D > * factory(const std::string &className) const
Method to create any Analyzer supplied with PSCF.
Abstract base for periodic output and/or analysis actions.
Evaluate the derivative of H with respect to chi.
Spherically averaged structure factor for a two-monomer system.
Evaluate the derivative of H with respect to chi.
Periodically write c-field snapshots to a trajectory file.
Evaluate the derivative of H with respect to cubic box length.
FourthOrderParameter is used to detect an order-disorder transition.
Compute averages and output block averages of Hamiltonian components.
Evaluates maximum squared Fourier amplitude for W_{-} field.
Evaluate derivative of H w/ respect to perturbation parameter lambda.
Field theoretic simulator (base class).
Periodically write the step index to a log file.
A complete physical system.
Evaluate the derivative of H with respect to chi.
Analyzer< D > * trySubfactories(const std::string &className) const
Definition Factory.h:425
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.