ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/GenericData.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/GenericData.hpp (file contents):
Revision 658 by tim, Thu Jul 31 15:35:07 2003 UTC vs.
Revision 1118 by tim, Mon Apr 19 03:52:27 2004 UTC

# Line 1 | Line 1
1   #ifndef __GENERICDATA_H__
2   #define __GENERICDATA_H__
3  
4 + #include <algorithm>
5   #include <string>
6   #include <vector>
7  
8 + #define ZCONSTIME_ID            "ZCONSTIME"
9 + #define ZCONSPARADATA_ID    "ZCONSPARA"
10 + #define ZCONSFILENAME_ID     "ZCONSFILENAME"
11 + #define ZCONSTOL_ID              "ZCONSTOL"
12 + #define ZCONSFORCEPOLICY_ID "ZCONSFORCEPOLICY"
13 + #define ZCONSGAP_ID "ZCONSGAP"
14 + #define ZCONSFIXTIME_ID "ZCONSFIXTIME"
15 + #define ZCONSUSINGSMD_ID "ZCONSUSINGSMD"
16 +
17 + #define CHIVALUE_ID "CHIVALUE"
18 + #define INTEGRALOFCHIDT_ID "INTEGRALOFCHIDT"
19 + #define ETAVALUE_ID "ETAVALUE"
20 +
21   using namespace std;
22  
23   class GenericData
# Line 13 | Line 27 | class GenericData
27      GenericData(const GenericData& rhs)  {  id = rhs.getID(); }
28      GenericData& operator =(const GenericData& rhs);
29      virtual ~GenericData() {}
30 <    
30 >
31      const string& getID() const {  return id; }
32 <    void setID(string rhs)     {  id = rhs;  }
33 <    
32 >    void setID(string rhs)     {  id = rhs;  }
33 >
34    protected:
35      string id;
36   };
37  
38   /** Something we can improve it here is to use template
39 < **
39 > **
40   */
41 < class IndexData : public GenericData
42 < {
41 >
42 > class IntData : public GenericData{
43 >
44    public:
45 <    IndexData();
46 <    IndexData(const IndexData& rhs);
47 <    IndexData& operator = (const IndexData& rhs);
48 <    
34 <    const vector<int>& getIndexData() const   {  return indexData; }
35 <    void setIndexData(const vector<int>& rhs) {  indexData = rhs;  }
45 >
46 >    double getData()         { return data; }
47 >    void setData(int rhs) { data = rhs;  }
48 >
49    protected:
50 <    vector<int> indexData;  
50 >    int data;
51   };
52  
53   class DoubleData : public GenericData{
# Line 43 | Line 56 | class DoubleData : public GenericData{
56  
57      double getData()         { return data; }
58      void setData(double rhs) { data = rhs;  }
59 <            
59 >
60    protected:
61      double data;
62   };
63  
64   class StringData : public GenericData{
65 <
66 <  public:  
65 >
66 >  public:
67      const string& getData() const  {  return data; }
68      void setData(const string& rhs) {  data = rhs;  }
69    protected:
70 <    string data;
70 >    string data;
71   };
72 +
73 + struct ZConsParaItem {
74 +  int zconsIndex;
75 +  bool havingZPos;
76 +  double zPos;
77 +  double kRatio;
78 +  bool havingCantVel;
79 +  double cantVel;
80 + };
81 +
82 + class ZConsParaData : public GenericData{
83 +
84 +  public:
85 +    ZConsParaData();
86 +    void addItem(ZConsParaItem& item) {data.push_back(item);}
87 +    vector<ZConsParaItem>* getData() {return &data;}
88 +    void setData(vector<ZConsParaItem>& theData) {data = theData;}
89 +    void sortByIndex();
90 +    bool isIndexUnique();
91 +
92 +  private:
93 +    vector<ZConsParaItem> data;
94 +  };
95 +
96 + class ZConsParaSortCriterion{
97 +  public:
98 +    bool operator ()(const ZConsParaItem& item1, const ZConsParaItem& item2){
99 +      return item1.zconsIndex < item2.zconsIndex;
100 +    }
101 +
102 + };
103 +
104 + class DoubleArrayData : public GenericData{
105 +
106 + public:
107 +   vector<double> getData() const  {  return data; }
108 +   void setData(double* source, int num){
109 +    data.clear();
110 +    for(int i = 0; i < num; i++)
111 +     data.push_back(source[i]);
112 +   }
113 + protected:
114 +   vector<double> data;
115 + };
116 +
117 + struct AtomInfo : public GenericData{
118 +  public:
119 +    string AtomType;
120 +    double pos[3];
121 +    double dipole[3];  
122 + };
123 +
124 + class AtomData : public GenericData{
125 +  public:
126 +    ~AtomData();
127 +    void addAtomInfo(AtomInfo* info) {data.push_back(info);}
128 +    void clearAllAtomInfo();
129 +    AtomInfo* beginAtomInfo(vector<AtomInfo*>::iterator& i){
130 +      i = data.begin();
131 +      return i != data.end()? *i : NULL;
132 +    }
133 +    AtomInfo* nextAtomInfo(vector<AtomInfo*>::iterator& i){
134 +      i++;
135 +      return i != data.end()? *i: NULL;
136 +    }
137 +    vector<AtomInfo*> getData() {return data;}
138 +    int getSize() {return data.size();}
139 +  protected:
140 +    vector<AtomInfo*> data;
141 + };
142 +
143 +
144 +
145   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines