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 87 by tim, Fri Aug 16 17:02:19 2002 UTC vs.
Revision 88 by tim, Mon Aug 19 20:49:08 2002 UTC

# Line 32 | Line 32 | class TFASMolecule;
32   class TFASBond;
33   class TFASMolecule;
34  
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:
# Line 40 | Line 107 | class TFASModel : public TAnimation
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 <                
115 >
116                  TNameList _atomNames;
117                  TNameList _atomTypes;
118                  TNameList _resNames;
# Line 61 | Line 128 | class TFASModel : public TAnimation
128                  string GetModelName() { return _modelName;}
129                  void SetModelName(string modelName) { _modelName = modelName;}
130                  void SetModelName(char * modelName) {_modelName = modelName;}
131 <                
131 >
132                  void FindMolecules();
133   };
134  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines