ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/Stats.hpp
(Generate patch)

Comparing trunk/src/brains/Stats.hpp (file contents):
Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 998 by chrisfen, Mon Jul 3 13:18:43 2006 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 39 | Line 39
39   * such damages.
40   */
41    
42 < /**
43 <  * @file Stats.hpp
44 <  * @author tlin
45 <  * @date 11/04/2004
46 <  * @time 23:56am
47 <  * @version 1.0
48 <  */
42 > /**
43 > * @file Stats.hpp
44 > * @author tlin
45 > * @date 11/04/2004
46 > * @time 23:56am
47 > * @version 1.0
48 > */
49  
50   #ifndef BRAINS_STATS_HPP
51   #define BRAINS_STATS_HPP
52  
53   #include <string>
54 + #include <map>
55  
56   #include "math/SquareMatrix3.hpp"
57   namespace oopse {
58  
59 < /**
60 < * @class Stats Stats.hpp "brains/Stats.hpp"
61 < */
62 < class Stats{
63 <    public:
64 <        enum StatsIndex {
65 <            BEGININDEX = 0,  //internal use
66 <            TIME = BEGININDEX,            
67 <            TOTAL_ENERGY,
68 <            POTENTIAL_ENERGY,
69 <            KINETIC_ENERGY,
70 <            TEMPERATURE,
71 <            PRESSURE,
72 <            VOLUME,
73 <            CONSERVED_QUANTITY,            
74 <            TRANSLATIONAL_KINETIC,
75 <            ROTATIONAL_KINETIC,
76 <            LONG_RANGE_POTENTIAL,  
77 <            SHORT_RANGE_POTENTIAL,
78 <            VANDERWAALS_POTENTIAL,
79 <            ELECTROSTATIC_POTENTIAL,
80 <            BOND_POTENTIAL,
81 <            BEND_POTENTIAL,
82 <            DIHEDRAL_POTENTIAL,
83 <            IMPROPER_POTENTIAL,
84 <            VRAW,
85 <            VHARM,
86 <            ENDINDEX  //internal use
87 <        };
59 >  /**
60 >   * @class Stats Stats.hpp "brains/Stats.hpp"
61 >   */
62 >  class Stats{
63 >  public:
64 >    enum StatsIndex {
65 >      BEGININDEX = 0,  //internal use
66 >      TIME = BEGININDEX,            
67 >      TOTAL_ENERGY,
68 >      POTENTIAL_ENERGY,
69 >      KINETIC_ENERGY,
70 >      TEMPERATURE,
71 >      PRESSURE,
72 >      VOLUME,
73 >      CONSERVED_QUANTITY,            
74 >      TRANSLATIONAL_KINETIC,
75 >      ROTATIONAL_KINETIC,
76 >      LONG_RANGE_POTENTIAL,  
77 >      SHORT_RANGE_POTENTIAL,
78 >      VANDERWAALS_POTENTIAL,
79 >      ELECTROSTATIC_POTENTIAL,
80 >      BOND_POTENTIAL,
81 >      BEND_POTENTIAL,
82 >      DIHEDRAL_POTENTIAL,
83 >      IMPROPER_POTENTIAL,
84 >      VRAW,
85 >      VHARM,
86 >      PRESSURE_TENSOR_X,
87 >      PRESSURE_TENSOR_Y,
88 >      PRESSURE_TENSOR_Z,  
89 >      BOX_DIPOLE_X,
90 >      BOX_DIPOLE_Y,
91 >      BOX_DIPOLE_Z,
92 >      ENDINDEX  //internal use
93 >    };
94  
95 <        Stats();
96 <        const double& operator [](int index) const {
97 <            assert(index >=0 && index < ENDINDEX);
98 <            return data_[index];
99 <        }
95 >    Stats();
96 >    const RealType& operator [](int index) const {
97 >      assert(index >=0 && index < ENDINDEX);
98 >      return data_[index];
99 >    }
100  
101 <        double& operator [](int index){
102 <            assert(index >=0 && index < ENDINDEX);            
103 <            return data_[index];
104 <        }
101 >    RealType& operator [](int index){
102 >      assert(index >=0 && index < ENDINDEX);            
103 >      return data_[index];
104 >    }
105          
106 <        static std::string getTitle(int index) {
107 <            assert(index >=0 && index < ENDINDEX);
108 <            return title_[index];
109 <        }
106 >    static std::string getTitle(int index) {
107 >      assert(index >=0 && index < ENDINDEX);
108 >      return title_[index];
109 >    }
110  
111 <        static std::string getUnits(int index) {
112 <            assert(index >=0 && index < ENDINDEX);
113 <            return units_[index];
114 <        }
111 >    static std::string getUnits(int index) {
112 >      assert(index >=0 && index < ENDINDEX);
113 >      return units_[index];
114 >    }
115  
116 <        Mat3x3d getTau() {
117 <            return tau_;
118 <        }
116 >    Mat3x3d getTau() {
117 >      return tau_;
118 >    }
119          
120 <        void setTau(const Mat3x3d& tau) {
121 <            tau_ = tau;
122 <        }
116 <        
117 <    private:
118 <        static void init();
119 <        static bool isInit_;
120 <        double data_[ENDINDEX - BEGININDEX];
121 <        static std::string title_[ENDINDEX - BEGININDEX];
122 <        static std::string units_[ENDINDEX - BEGININDEX];
123 <        Mat3x3d tau_;
124 < };
120 >    void setTau(const Mat3x3d& tau) {
121 >      tau_ = tau;
122 >    }
123  
124 +    typedef std::map<std::string, Stats::StatsIndex> StatsMapType;
125 +    static  StatsMapType statsMap;
126 +  
127 +  private:
128 +    static void init();
129 +    static bool isInit_;
130 +    RealType data_[ENDINDEX - BEGININDEX];
131 +    static std::string title_[ENDINDEX - BEGININDEX];
132 +    static std::string units_[ENDINDEX - BEGININDEX];
133 +    Mat3x3d tau_;
134 +  };
135 +
136 +
137 +
138   } //end namespace oopse
139   #endif //BRAINS_STATS_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines