Cantera  2.0
Crystal.h
Go to the documentation of this file.
1 /**
2  * @file Crystal.h
3  */
4 #ifndef CT_CRYSTAL_H
5 #define CT_CRYSTAL_H
6 
8 
9 namespace Cantera
10 {
11 
12 /// A class for crystals. Each crystal consists of one or more
13 /// sublattices, each represented by an object of type
14 /// LatticePhase.
15 
16 class Crystal : public MultiPhase
17 {
18 public:
19  /// Constructor. The constructor takes no arguments, since
20  /// phases are added using method addPhase.
22 
23  /// Destructor. Does nothing. Class MultiPhase does not take
24  /// "ownership" (i.e. responsibility for destroying) the
25  /// phase objects.
26  virtual ~Crystal() {}
27 
28  void addLattices(std::vector<LatticePhase*>& lattices,
29  const vector_fp& latticeSiteDensity);
30 
31  /// Add a phase to the mixture.
32  /// @param lattice pointer to the phase object
33  /// @param siteDensity total density of sites in this phase
34  void addLattice(LatticePhase* lattice, doublereal siteDensity) {
35  MultiPhase::addPhase(lattice, siteDensity);
36  }
37 
38  /// Return a reference to phase n. The state of phase n is
39  /// also updated to match the state stored locally in the
40  /// mixture object.
42  return *(LatticePhase*)&phase(n);
43  }
44 
45 protected:
46 
47 
48 };
49 
50 //! Prints out the current internal state of the Crystal ThermoPhase object
51 /*!
52  * Example of usage:
53  * s << x << endl;
54  *
55  * @param s Reference to the ostream to write to
56  * @param x Object of type Crystal that you are querying
57  *
58  * @return Returns a reference to the ostream.
59  */
60 inline std::ostream& operator<<(std::ostream& s, Cantera::Crystal& x)
61 {
62  size_t ip;
63  for (ip = 0; ip < x.nPhases(); ip++) {
64  s << "*************** Lattice " << ip << " *****************" << endl;
65  s << "SiteDensity: " << x.phaseMoles(ip) << endl;
66 
67  s << report(x.phase(ip)) << endl;
68  }
69  return s;
70 }
71 }
72 
73 #endif