ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/applications/dynamicProps/TimeCorrFunc.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/applications/dynamicProps/TimeCorrFunc.cpp (file contents):
Revision 2017 by tim, Mon Feb 14 17:35:25 2005 UTC vs.
Revision 2035 by tim, Tue Feb 15 19:36:07 2005 UTC

# Line 79 | Line 79 | TimeCorrFunc::TimeCorrFunc(SimInfo* info, const std::s
79      bsMan_ = new BlockSnapshotManager(info, dumpFilename_, storageLayout_);
80      info_->setSnapshotManager(bsMan_);
81  
82 +    evaluator1_.loadScriptString(selectionScript1_);
83 +    evaluator2_.loadScriptString(selectionScript2_);
84 +    
85      //if selection is static, we only need to evaluate it once
86      if (!evaluator1_.isDynamic()) {
87          seleMan1_.setSelectionSet(evaluator1_.evaluate());
# Line 102 | Line 105 | TimeCorrFunc::TimeCorrFunc(SimInfo* info, const std::s
105      
106  
107      
108 <    /**@todo Fixed Me */
108 >    /**@todo Fix Me */
109      Globals* simParams = info_->getSimParams();
110      if (simParams->haveSampleTime()){
111          deltaTime_ = simParams->getSampleTime();
# Line 133 | Line 136 | void TimeCorrFunc::doCorrelate() {
136  
137      for (int i = 0; i < nblocks; ++i) {
138          bsMan_->loadBlock(i);
139 +
140          for (int j = i; j < nblocks; ++j) {
141              bsMan_->loadBlock(j);
142              correlateBlocks(i, j);
143 <
140 <            if (i != j) {
141 <                //if i equals to j, the block is still used, should not unload it
142 <                bsMan_->unloadBlock(j);
143 <            }
143 >            bsMan_->unloadBlock(j);
144          }
145 +        
146          bsMan_->unloadBlock(i);
147      }
148      
# Line 152 | Line 153 | void TimeCorrFunc::correlateBlocks(int block1, int blo
153  
154   void TimeCorrFunc::correlateBlocks(int block1, int block2) {
155  
156 <  int jstart, jend;
156 <  
157 <  assert(bsMan_->isBlockActive(block1) && bsMan_->isBlockActive(block2));
156 >    int jstart, jend;
157  
158 <  SnapshotBlock snapshotBlock1 = bsMan_->getSnapshotBlock(block1);
160 <  SnapshotBlock snapshotBlock2 = bsMan_->getSnapshotBlock(block2);
158 >    assert(bsMan_->isBlockActive(block1) && bsMan_->isBlockActive(block2));
159  
160 <  jend = snapshotBlock2.second;
161 <  
162 <  for (int i = snapshotBlock1.first; i < snapshotBlock1.second; ++i) {
163 <    
166 <    //evaluate selection if it is dynamic
167 <    if (evaluator1_.isDynamic()) {
168 <      seleMan1_.setSelectionSet(evaluator1_.evaluate());
169 <      validateSelection(seleMan1_);
170 <    }
171 <    
172 <    //update the position or velocity of the atoms belong to rigid bodies
173 <    updateFrame(i);
174 <    
175 <    // if the two blocks are the same, we don't want to correlate
176 <    // backwards in time, so start j at the same frame as i
160 >    SnapshotBlock snapshotBlock1 = bsMan_->getSnapshotBlock(block1);
161 >    SnapshotBlock snapshotBlock2 = bsMan_->getSnapshotBlock(block2);
162 >
163 >    jend = snapshotBlock2.second;
164  
165 <    if (block1 == block2)
166 <      jstart = i;
167 <    else
168 <      jstart = snapshotBlock2.first;
169 <    
170 <    for(int j  = jstart; j < jend; ++j) {
171 <      //evaluate selection
172 <      if (!evaluator2_.isDynamic()) {
173 <        seleMan2_.setSelectionSet(evaluator2_.evaluate());
174 <        validateSelection(seleMan2_);
175 <      }  
176 <      //update the position or velocity of the atoms belong to rigid bodies
177 <      updateFrame(j);
178 <      
179 <      correlateFrames(i, j);
165 >    for (int i = snapshotBlock1.first; i < snapshotBlock1.second; ++i) {
166 >
167 >        //update the position or velocity of the atoms belong to rigid bodies
168 >        updateFrame(i);
169 >
170 >        // if the two blocks are the same, we don't want to correlate
171 >        // backwards in time, so start j at the same frame as i
172 >        if (block1 == block2) {
173 >        jstart = i;
174 >        } else {
175 >            jstart = snapshotBlock2.first;
176 >        }
177 >        
178 >        for(int j  = jstart; j < jend; ++j) {
179 >            //update the position or velocity of the atoms belong to rigid bodies
180 >            updateFrame(j);
181 >
182 >            correlateFrames(i, j);
183 >        }
184      }
194  }
185   }
186  
187   void TimeCorrFunc::updateFrame(int frame){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines