75 |
|
storageLayout_ |= DataStorage::dslAngularMomentum; |
76 |
|
} |
77 |
|
} |
78 |
+ |
if(nRigidBodies > 0 && storageLayout_ & DataStorage::dslVelocity) { |
79 |
+ |
storageLayout_ |= DataStorage::dslAngularMomentum; |
80 |
+ |
} |
81 |
|
|
82 |
|
bsMan_ = new BlockSnapshotManager(info, dumpFilename_, storageLayout_); |
83 |
|
info_->setSnapshotManager(bsMan_); |
84 |
|
|
85 |
+ |
evaluator1_.loadScriptString(selectionScript1_); |
86 |
+ |
evaluator2_.loadScriptString(selectionScript2_); |
87 |
+ |
|
88 |
|
//if selection is static, we only need to evaluate it once |
89 |
|
if (!evaluator1_.isDynamic()) { |
90 |
|
seleMan1_.setSelectionSet(evaluator1_.evaluate()); |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
< |
/**@todo Fixed Me */ |
111 |
> |
/**@todo Fix Me */ |
112 |
|
Globals* simParams = info_->getSimParams(); |
113 |
|
if (simParams->haveSampleTime()){ |
114 |
|
deltaTime_ = simParams->getSampleTime(); |
139 |
|
|
140 |
|
for (int i = 0; i < nblocks; ++i) { |
141 |
|
bsMan_->loadBlock(i); |
142 |
+ |
|
143 |
|
for (int j = i; j < nblocks; ++j) { |
144 |
|
bsMan_->loadBlock(j); |
145 |
|
correlateBlocks(i, j); |
146 |
< |
|
140 |
< |
if (i != j) { |
141 |
< |
//if i equals to j, the block is still used, should not unload it |
142 |
< |
bsMan_->unloadBlock(j); |
143 |
< |
} |
146 |
> |
bsMan_->unloadBlock(j); |
147 |
|
} |
148 |
+ |
|
149 |
|
bsMan_->unloadBlock(i); |
150 |
|
} |
151 |
|
|
156 |
|
|
157 |
|
void TimeCorrFunc::correlateBlocks(int block1, int block2) { |
158 |
|
|
159 |
< |
int jstart, jend; |
156 |
< |
|
157 |
< |
assert(bsMan_->isBlockActive(block1) && bsMan_->isBlockActive(block2)); |
159 |
> |
int jstart, jend; |
160 |
|
|
161 |
< |
SnapshotBlock snapshotBlock1 = bsMan_->getSnapshotBlock(block1); |
160 |
< |
SnapshotBlock snapshotBlock2 = bsMan_->getSnapshotBlock(block2); |
161 |
> |
assert(bsMan_->isBlockActive(block1) && bsMan_->isBlockActive(block2)); |
162 |
|
|
163 |
< |
jend = snapshotBlock2.second; |
164 |
< |
|
164 |
< |
for (int i = snapshotBlock1.first; i < snapshotBlock1.second; ++i) { |
165 |
< |
|
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 |
163 |
> |
SnapshotBlock snapshotBlock1 = bsMan_->getSnapshotBlock(block1); |
164 |
> |
SnapshotBlock snapshotBlock2 = bsMan_->getSnapshotBlock(block2); |
165 |
|
|
166 |
< |
if (block1 == block2) |
167 |
< |
jstart = i; |
168 |
< |
else |
169 |
< |
jstart = snapshotBlock2.first; |
170 |
< |
|
171 |
< |
for(int j = jstart; j < jend; ++j) { |
172 |
< |
//evaluate selection |
173 |
< |
if (!evaluator2_.isDynamic()) { |
174 |
< |
seleMan2_.setSelectionSet(evaluator2_.evaluate()); |
175 |
< |
validateSelection(seleMan2_); |
176 |
< |
} |
177 |
< |
//update the position or velocity of the atoms belong to rigid bodies |
178 |
< |
updateFrame(j); |
179 |
< |
|
180 |
< |
correlateFrames(i, j); |
166 |
> |
jend = snapshotBlock2.second; |
167 |
> |
|
168 |
> |
for (int i = snapshotBlock1.first; i < snapshotBlock1.second; ++i) { |
169 |
> |
|
170 |
> |
//update the position or velocity of the atoms belong to rigid bodies |
171 |
> |
updateFrame(i); |
172 |
> |
|
173 |
> |
// if the two blocks are the same, we don't want to correlate |
174 |
> |
// backwards in time, so start j at the same frame as i |
175 |
> |
if (block1 == block2) { |
176 |
> |
jstart = i; |
177 |
> |
} else { |
178 |
> |
jstart = snapshotBlock2.first; |
179 |
> |
} |
180 |
> |
|
181 |
> |
for(int j = jstart; j < jend; ++j) { |
182 |
> |
//update the position or velocity of the atoms belong to rigid bodies |
183 |
> |
updateFrame(j); |
184 |
> |
|
185 |
> |
correlateFrames(i, j); |
186 |
> |
} |
187 |
|
} |
194 |
– |
} |
188 |
|
} |
189 |
|
|
190 |
|
void TimeCorrFunc::updateFrame(int frame){ |