Simpatico  v1.10
ConfigWriterFactory.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 "ConfigWriterFactory.h"
9 
10 // Subclasses of ConfigWriter
11 #include "DdMdConfigWriter.h"
12 #include "HoomdConfigWriter.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 ConfigWriter subclass className.
28  */
29  ConfigWriter* ConfigWriterFactory::factory(const std::string &className) const
30  {
31  ConfigWriter *ptr = 0;
32 
33  // Try subfactories first.
34  ptr = trySubfactories(className);
35  if (ptr) return ptr;
36 
37  if (className == "DdMdConfigWriter") {
38  ptr = new DdMdConfigWriter(*configurationPtr_);
39  } else
40  if (className == "DdMdConfigWriter_Molecule") {
41  bool hasMolecules = true;
42  ptr = new DdMdConfigWriter(*configurationPtr_, hasMolecules);
43  } else
44  if (className == "HoomdConfigWriter") {
45  ptr = new HoomdConfigWriter(*configurationPtr_);
46  }
47 
48  return ptr;
49  }
50 
51 }
Hoomd-blue XML format for configuration files.
ConfigWriterFactory(Configuration &configuration)
Constructor.
An instantaneous molecular dynamics configuration.
Definition: Configuration.h:40
Abstract reader/writer for configuration files.
ConfigWriter * trySubfactories(const std::string &className) const
Search through subfactories for match.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Single-processor classes for pre- and post-processing MD trajectories.
Native / default DdMd format for configuration files.
ConfigWriter * factory(const std::string &subclassName) const
Create an instance of a specified subclass of ConfigWriter.