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

Comparing trunk/src/brains/BlockSnapshotManager.hpp (file contents):
Revision 322 by tim, Sun Feb 13 08:05:33 2005 UTC vs.
Revision 1105 by gezelter, Fri Dec 29 21:51:42 2006 UTC

# Line 40 | Line 40
40   */
41   #ifndef BRAINS_BLOCKSNAPSHOTMANAGER_HPP
42   #define BRAINS_BLOCKSNAPSHOTMANAGER_HPP
43 + #include <vector>
44  
45   #include "brains/SnapshotManager.hpp"
46   namespace oopse {
47  
48 < class SimInfo;
49 < class DumpReader;
48 >  class SimInfo;
49 >  class DumpReader;
50  
51 < typedef std::pair<int, int> SnapshotBlock;
51 >  typedef std::pair<int, int> SnapshotBlock;
52  
53 < /**
54 < * @class BlockSnapshotManager
55 < * @todo document
56 < */
57 < class BlockSnapshotMananger : public SnapshotManager{
53 >  /**
54 >   * @class BlockSnapshotManager
55 >   * @todo document
56 >   */
57 >  class BlockSnapshotManager : public SnapshotManager{
58  
59 <    public:
60 <        BlockSnapshotMananger(SimInfo* info, const std::string& filename, int storageLayout, int blockCapacity = 2);
61 <        ~BlockSnapshotMananger();
59 >  public:
60 >    BlockSnapshotManager(SimInfo* info, const std::string& filename, int storageLayout, int blockCapacity = 2);
61 >    ~BlockSnapshotManager();
62          
63 <        virtual Snapshot* getSnapshot(int id);
63 >    virtual Snapshot* getSnapshot(int id) { return snapshots_[id]; }
64  
65 <        /** Returns number of snapshot blocks in this BlockSnapshotManager*/
66 <        int getNBlocks() {
67 <            return blocks_.size();
68 <        }
65 >    /** Returns number of snapshot blocks in this BlockSnapshotManager*/
66 >    int getNBlocks() {
67 >      return blocks_.size();
68 >    }
69  
70 <        SnapshotBlock getSnapshotBlock(int block) {
71 <            return blocks_.at(block);
72 <        }
70 >    void needCOMprops(bool ncp) {
71 >      reader_->setNeedCOMprops(ncp);
72 >    }
73 >
74 >    SnapshotBlock getSnapshotBlock(int block) {
75 >      return blocks_.at(block);
76 >    }
77          
78 <        int getNActiveBlocks();
78 >    int getNActiveBlocks();
79          
80 <        bool isBlockActive(int block);
80 >
81 >    bool isBlockActive(int block) {
82 >      return  findActiveBlock(block) != activeBlocks_.end() ? true : false;
83 >    }        
84 >
85 >    bool loadBlock(int block);
86          
87 <        bool loadBlock(int block);
78 <        
79 <        bool unloadBlock(int block);
87 >    bool unloadBlock(int block);
88  
89 <        std::vector<int> getActiveBlocks();
89 >    std::vector<int> getActiveBlocks();
90  
91 <        int getBlockCapacity() {
92 <            return blockCapacity_;                
93 <        }
91 >    int getBlockCapacity() {
92 >      return blockCapacity_;                
93 >    }
94  
95 <        int getNFrames();
95 >    int getNFrames();
96          
97 <    private:
97 >  private:
98  
99 <        Snapshot* loadFrame(int frame);
99 >    std::vector<int>::iterator findActiveBlock(int block) {
100 >      return std::find(activeBlocks_.begin(), activeBlocks_.end(), block);
101 >    }
102 >
103 >    bool hasZeroRefBlock();
104 >
105 >    int getFirstZeroRefBlock();
106 >
107 >    void internalLoad(int block);
108 >    void internalUnload(int block);
109 >    Snapshot* loadFrame(int frame);
110          
111 <        SimInfo* info_;
112 <        int storageLayout_;
95 <        int blockCapacity_;
111 >    SimInfo* info_;
112 >    int blockCapacity_;
113  
114 <        std::vector<Snapshot*> snapshots_;
115 <        std::vector<SnapshotBlock> blocks_;        
116 <        std::vector<int> activeBlocks_;
114 >    std::vector<Snapshot*> snapshots_;
115 >    std::vector<SnapshotBlock> blocks_;        
116 >    std::vector<int> activeBlocks_;
117 >    std::vector<int> activeRefCount_;
118          
119 <        int nAtoms_;
120 <        int nRigidBodies_;
119 >    int nAtoms_;
120 >    int nRigidBodies_;
121      
122 <        DumpReader* reader_;
123 <        int nframes_;
124 <        int nSnapshotPerBlock_;
122 >    DumpReader* reader_;
123 >    int nframes_;
124 >    int nSnapshotPerBlock_;
125  
126 < };
126 >  };
127  
128   }
129  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines