ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/fasmodel.h
(Generate patch)

Comparing trunk/FAS/src/fasmodel.h (file contents):
Revision 66 by tim, Tue Aug 13 16:02:26 2002 UTC vs.
Revision 88 by tim, Mon Aug 19 20:49:08 2002 UTC

# Line 1 | Line 1
1 + /**********************************************************************
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   #ifndef FASMOL_H
21   #define FASMOL_H
22  
23   #include <iostream>
24   #include <vector>
25   #include <string>
26 < #include "namelist.h"
27 <
26 > #include "keylist.h"
27 > #include "animation.h"
28   using namespace std;
29  
30   class TFASAtom;
# Line 13 | Line 32 | class TFASMolecule;
32   class TFASBond;
33   class TFASMolecule;
34  
35 < class TFASModel
35 > /*******************************************************************************
36 >  In next version,I would like to declare TFASModel as template using class
37 >  partial specialization.So if you want to derived a class from TAnimation,( the
38 >  reason we want to do this is that if the trajectory file is too huge, we can
39 >  not load all the frames to memory at one time, we would like to load part of
40 >  it,and then we can doing the job of swapping as OS by ourself) and then we
41 >  can derive TFASmodel from the new Animation class easily.
42 >
43 >  declaration:
44 >
45 >  class TMyAnimation : public TAnimation
46 >  {
47 >    public:
48 >      vector<TFrames *> _frames
49 >      int _activeFrame;
50 >      int _totalFrames;
51 >      int _numFrames;
52 >      void SwapFromDisk();
53 >      void SwapToDisk();
54 >      GetCoor(int frameIndex, int frameNum)
55 >      {
56 >        if (frameNum = -1)
57 >          frameNum = _activeFrame;
58 >        if (framNum > frameNum && frameNum <totalNum)
59 >        {
60 >        //here we know that the frame we want to acces is not now in memory
61 >        //so we trigger a exception, and the exception handler will swap some
62 >        //frames in and some out or we can just hard code here
63 >          throw exception
64 >
65 >        }
66 >      }
67 >
68 >  }
69 >
70 >  template<class T> class TFASModel : public T
71 >  {
72 >    public:
73 >      vector<TFASAtom<T> *> _atomList;
74 >
75 >  };
76 >
77 >  template<class T> class TFASAtom
78 >  {
79 >    public:
80 >      TFASModel<T> _parent;
81 >      GetRX(int frameNum = -1)
82 >      {
83 >        _parent.GetCoor(frameIndex, frameNum);
84 >      }
85 >
86 >  };
87 >
88 >  so what we only need to do is
89 >
90 >  TFASModel<TMyAnimation> fasModel;
91 >  TFASAtom<TMyAnimation> fasAtom;
92 >  and then build up the structure of model
93 >  so if you want to get the coordinate of an atom,you can use below
94 >
95 >  fasAtom.GetRX();
96 >
97 >  Actually, we can declare the TFASModel without deriving from TAnimation, just
98 >  delegate the operation about coordinate to TAnimation.
99 >
100 >
101 > *******************************************************************************/
102 > class TFASModel : public TAnimation
103   {
104          protected:
105            string _modelName;
# Line 21 | Line 107 | class TFASModel
107                  unsigned int _nbonds;
108                  unsigned int _nresidues;
109                  unsigned int _nmols;
110 <                
110 >
111                  vector<TFASAtom *> _atomList;
112                  vector<TFASResidue *> _resList;
113                  vector<TFASBond *> _bondList;
114                  vector<TFASMolecule *> _molList;
115 <                
116 <                NameList<int> _atomNames;
117 <                NameList<int> _atomTypes;
118 <                NameList<int> _resNames;
119 <                NameList<int> _resIds;
120 <                NameList<int> _chainNames;
121 <                NameList<int> _segNames;
122 <                
115 >
116 >                TNameList _atomNames;
117 >                TNameList _atomTypes;
118 >                TNameList _resNames;
119 >                TNameList _resIds;
120 >                TNameList _chainNames;
121 >                TNameList _segNames;
122 >
123          public:
124 <        
124 >
125                  TFASModel();
126                  ~TFASModel();
127 <                
127 >
128                  string GetModelName() { return _modelName;}
129                  void SetModelName(string modelName) { _modelName = modelName;}
130 <                void SetModelName(char * modelName) {_modelName = new string(modelName);}
131 <                
130 >                void SetModelName(char * modelName) {_modelName = modelName;}
131 >
132                  void FindMolecules();
133   };
134  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines