PSCF v1.4.0
TrajectoryReaderFactory.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 "TrajectoryReaderFactory.h"
9//#include <rpc/system/System.h>
10
11// Subclasses of TrajectoryReader
12#include "RGridTrajectoryReader.h"
13
14namespace Pscf {
15namespace Rpc {
16
17 using namespace Util;
18
19 /*
20 * Constructor
21 */
22 template <int D>
26
27 /*
28 * Return a pointer to a instance of Trajectory subclass className.
29 */
30 template <int D>
32 TrajectoryReaderFactory<D>::factory(const std::string &className) const
33 {
34 TrajectoryReader<D> *ptr = 0;
35
36 // Try subfactories first
37 ptr = trySubfactories(className);
38 if (ptr) return ptr;
39
40 if (className == "RGridTrajectoryReader"
41 || className == "TrajectoryReader") {
42 ptr = new RGridTrajectoryReader<D>(*sysPtr_);
43 }
44
45 return ptr;
46 }
47
48 // Explicit instantiation definitions
49 template class TrajectoryReaderFactory<1>;
50 template class TrajectoryReaderFactory<2>;
51 template class TrajectoryReaderFactory<3>;
52
53}
54}
A complete physical system.
Factory for subclasses of TrajectoryReader.
TrajectoryReader< D > * factory(const std::string &className) const
Method to create any TrajectoryReader supplied with PSCF.
TrajectoryReaderFactory(System< D > &system)
Constructor.
Trajectory file reader (base class).
TrajectoryReader< 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.