Simpatico  v1.10
mcMd/configIos/ConfigIo.h
1 #ifndef MCMD_CONFIG_IO_H
2 #define MCMD_CONFIG_IO_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <simp/boundary/Boundary.h>
12 #include <util/global.h>
13 
14 #include <iostream>
15 
16 namespace McMd
17 {
18 
19  class Simulation;
20  class System;
21 
22  using namespace Util;
23  using namespace Simp;
24 
46  class ConfigIo
47  {
48 
49  public:
50 
52  ConfigIo(System& system);
53 
55  virtual ~ConfigIo();
56 
62  virtual void read(std::istream &in) = 0;
63 
69  virtual void write(std::ostream& out) = 0;
70 
71  protected:
72 
74  System &system() const;
75 
77  Simulation &simulation() const;
78 
80  Boundary &boundary() const;
81 
82  private:
83 
85  Boundary *boundaryPtr_;
86 
88  System *systemPtr_;
89 
91  Simulation *simulationPtr_;
92 
93  }; // end class ConfigIo
94 
95 
96  // Inline functions
97 
98  /*
99  * Get the parent System.
100  */
101  inline System& ConfigIo::system() const
102  {
103  assert(systemPtr_);
104  return *systemPtr_;
105  }
106 
107  /*
108  * Get the parent Simulation.
109  */
111  {
112  assert(simulationPtr_);
113  return *simulationPtr_;
114  }
115 
116  /*
117  * Get the Boundary.
118  */
119  inline Boundary& ConfigIo::boundary() const
120  {
121  assert(boundaryPtr_);
122  return *boundaryPtr_;
123  }
124 
125 
126 }
127 #endif
void write(std::ostream &out, Type data)
Function template for output in a standard format.
Definition: write.h:80
Boundary & boundary() const
Get the Boundary.
An orthorhombic periodic unit cell.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
The main object in a simulation, which coordinates others.
Utility classes for scientific computation.
Definition: accumulators.mod:1
System & system() const
Get a reference to the parent System.
Simulation & simulation() const
Get a reference to the parent Simulation.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
System configuration file reader and writer.