ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/extradata.h
Revision: 83
Committed: Fri Aug 16 15:30:40 2002 UTC (22 years, 1 month ago) by tim
Content type: text/plain
File size: 5067 byte(s)
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 tim 83 /**********************************************************************
2     * Copyright (C) 2002-2003 by Gezelter's Group
3     *This program is free software; you can redistribute it and/or modify
4     *it under the terms of the GNU General Public License as published by
5     *the Free Software Foundation version 2 of the License.
6     *
7     *This program is distributed in the hope that it will be useful,
8     *but WITHOUT ANY WARRANTY; without even the implied warranty of
9     *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10     *GNU General Public License for more details.
11     *
12     ************************************************************************
13     *Author: Teng Lin Email: tlin@nd.edu
14     *Date: 08/13/2002 Version: 1.0
15     *
16     ************************************************************************
17     *Description:
18     *
19     ***********************************************************************/
20 tim 66 #ifndef EXTRADATA_H
21     #define EXTRADATA_H
22     #include <iostream>
23 tim 83 #include <vector>
24 tim 66 #include <map>
25 tim 83 #include "fasatom.h"
26     #include "fasbond.h"
27     #include "fasresidue.h"
28     #include "fasmolecule.h"
29 tim 66
30 tim 83
31 tim 66 using namespace std;
32    
33     // the advantage of using namespace over enum type is that you can
34     // add the new type as you want but make sure do not have conflict value
35 tim 83
36 tim 66 namespace TExtraDataType
37     {
38     const int UNKNOWN = 0;
39 tim 83 const int COMMENT = 1;
40     const int ENERGY = 2;
41     const int FORCE = 3;
42     const int DISTANCE = 4;
43     const int ANGLE = 5;
44     const int DIHE = 6;
45     const int IMPR = 7;
46     const int IC = 8;
47 tim 66 };
48    
49    
50 tim 83
51     class TExtraData
52     {
53     protected:
54     string _ident;
55     int _type;
56     public:
57     TExtraData();
58     TExtraData(const TExtraData &extraData);
59     TExtraData& operator =(const TExtraData &extraData);
60     virtual ~TExtraData() {}
61    
62     string GetIdent() { return _ident;}
63     int GetType() { return _type;}
64    
65     void SetIdent(string ident) { _ident = ident;}
66     void SetType(int type) { _type = type;}
67     };
68    
69     class TExtraDataList
70     {
71     protected:
72     vector<TExtraData *> _extraDataList;
73    
74     public:
75     void AddExtraData(TExtraData *extraData);
76     void RemoveExtraData(TExtraData *extraData);
77     TExtraData *GetExtraData(int extraDataType);
78     TExtraData *GetExtraData(string attr);
79     vector<TExtraData *> &GetExraDataList() { return _extraDataList;}
80     void SetExraDataList(vector<TExtraData *> &extraDataList)
81     { _extraDataList = extraDataList;}
82    
83     };
84    
85     class TMatchExtraData : public unary_function<TExtraData, bool>
86     {
87     private:
88     string _attr;
89     int _type;
90    
91     enum TMatchExtraType {meAttr, meType} _matchExtraType;
92     public:
93     TMatchExtraData(const string &attr) : _attr(attr){ _matchExtraType = meAttr;}
94     TMatchExtraData(const int &type) : _type(type){ _matchExtraType = meType;}
95    
96     bool operator ()(const TExtraData & extraData) const
97     {
98     switch (_matchExtraType)
99     {
100     case meAttr:
101     return extraData.GetIdent() == _attr;
102     break;
103     case meType: ;
104     return extraData.GetType() == _type;
105     break;
106     default:
107     //Error
108     ;
109     }
110    
111    
112     }
113    
114    
115     };
116    
117 tim 66 namespace TEnergyDataType
118     {
119     const int BOND = 1;
120     const int ANGEL = 2;
121     const int DIHE = 3;
122     const int IMPR = 4;
123     const int VDW = 5;
124     const int COUL = 6;
125     const int HBOND = 7;
126     const int KE = 8;
127     const int PE = 9;
128     const int TEMP = 10;
129     const int TOTAL = 11;
130     const int VOLUME = 12;
131     const int PRESSURE = 13;
132     const int EFILED = 14;
133     const int UREY_BRADLEY = 15;
134 tim 83 const int RESTRAINT = 16;
135 tim 66 };
136    
137     class TEnergyData : public TExtraData
138     {
139     protected:
140     map<int, float> _energy;
141     map<int, float>::iterator FindEnergy(int energyType);
142     public:
143     TEnergyData();
144 tim 83 TEnergyData(const TEnergyData &energyData);
145     TEnergyData &operator =(const TEnergyData &energyData);
146 tim 66 ~TEnergyData();
147    
148 tim 67 void AddEnergy(int energyType, float value);
149 tim 66 void DeleteEnergy(int energyType);
150     void ReplaceEnergy(int energyType, float value);
151     bool IsEnergyExist(int energyType);
152 tim 83 float *GetEnergy(int energyType);
153 tim 66
154     };
155    
156 tim 83 class TDistance
157     {
158     protected:
159     pair<TFASAtom *,TFASAtom*> ;
160     float _dist;
161    
162     public:
163    
164     };
165    
166     class TDistData
167     {
168     protected:
169     vector<TDistance *> _distList;
170    
171     public:
172    
173    
174     };
175    
176     class TAngle
177     {
178     protected:
179     TFASAtom * _vertex;
180     pair<TFASAtom *, TFASAtom *> _termin;
181     float _angle; //angle ranges from 0-180
182    
183     float CalcAngleFromCoor();
184     void SetAngle(float angle) { _angle = angle;}
185     public:
186     TAngle();
187     TAngle(const TAngle &src);
188     TAngle(const TFASAtom *vertex,
189     pair<TFASAtom *, TFASAtom *> termin, float angle = -1);
190     ~TAngle();
191    
192     float GetAngle(bool reCalc = false);
193     };
194    
195     class TAngleData : public TExtraData
196     {
197     protected:
198     vector<TAngle *> _angleList;
199     public:
200     TAngleData();
201     TAngleData(const TAngleData &src);
202     ~TAngleData();
203     };
204    
205     class TDIHE
206     {
207    
208     };
209    
210     class TDIHEData : public TExtraData
211     {
212     protected:
213     vector<TDIHE *> _diheList;
214     };
215    
216     class TIMPR
217     {
218    
219     };
220    
221     class TIMPRData : public TExtraData
222     {
223     protected:
224     vector<TIMPR *> _imprList;
225     };
226    
227     class TIC
228     {
229    
230     };
231    
232     class TICData : public TExtraData
233     {
234     protected:
235     vector<TIC *> _icList;
236     };
237 tim 66 #endif