Simpatico  v1.10
tools/trajectory/TrajectoryReaderFactory.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, 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 
10 // Subclasses of TrajectoryReader
11 #include "LammpsDumpReader.h"
12 #include "DdMdTrajectoryReader.h"
13 
14 namespace Tools
15 {
16 
17  using namespace Util;
18 
19  /*
20  * Constructor
21  */
23  : configurationPtr_(&configuration)
24  {}
25 
26  /*
27  * Return a pointer to a instance of TrajectoryReader subclass className.
28  */
29  TrajectoryReader* TrajectoryReaderFactory::factory(const std::string &className) const
30  {
31  TrajectoryReader *ptr = 0;
32 
33  // Try subfactories first.
34  ptr = trySubfactories(className);
35  if (ptr) return ptr;
36 
37  if (className == "LammpsDumpReader") {
38  ptr = new LammpsDumpReader(*configurationPtr_);
39  } else
40  if (className == "DdMdTrajectoryReader") {
41  ptr = new DdMdTrajectoryReader(*configurationPtr_);
42  }
43 
44  return ptr;
45  }
46 
47 }
Reader for lammps dump trajectory file format.
Abstract trajectory file reader.
An instantaneous molecular dynamics configuration.
Definition: Configuration.h:40
TrajectoryReader * trySubfactories(const std::string &className) const
Search through subfactories for match.
Utility classes for scientific computation.
Definition: accumulators.mod:1
TrajectoryReaderFactory(Configuration &configuration)
Constructor.
Single-processor classes for pre- and post-processing MD trajectories.
Reader for lammps dump trajectory file format.
TrajectoryReader * factory(const std::string &subclassName) const
Create an instance of a specified subclass of TrajectoryReader.