| 65 |
|
class IndexListContainer{ |
| 66 |
|
public: |
| 67 |
|
static const int MAX_INTEGER = 2147483647; |
| 68 |
< |
typedef std::list<std::pair<int, int> >::iterator IndexListContainerIterator; |
| 68 |
> |
typedef std::list<std::pair<int, int> >::iterator IndexListContainerIterator; |
| 69 |
|
|
| 70 |
– |
|
| 70 |
|
IndexListContainer(int minIndex = 0, int maxIndex = MAX_INTEGER) |
| 71 |
|
:minIndex_(minIndex), maxIndex_(maxIndex) { |
| 72 |
< |
|
| 73 |
< |
indexContainer_.push_back(std::make_pair(minIndex, maxIndex)); |
| 75 |
< |
} |
| 72 |
> |
indexContainer_.push_back(std::make_pair(minIndex, maxIndex)); |
| 73 |
> |
} |
| 74 |
|
|
| 75 |
< |
int pop() { |
| 78 |
< |
|
| 75 |
> |
int pop() { |
| 76 |
|
if (indexContainer_.empty()) { |
| 77 |
|
std::cerr << "" << std::endl; |
| 78 |
|
} |
| 83 |
|
|
| 84 |
|
if (indexContainer_.front().first == indexContainer_.front().second) { |
| 85 |
|
indexContainer_.pop_front(); |
| 86 |
< |
} else if (indexContainer_.front().first < indexContainer_.front().second) { |
| 86 |
> |
} else if (indexContainer_.front().first < |
| 87 |
> |
indexContainer_.front().second) { |
| 88 |
|
++indexContainer_.front().first; |
| 89 |
|
} else { |
| 90 |
|
std::cerr << "" << std::endl; |
| 91 |
|
} |
| 92 |
< |
|
| 92 |
> |
|
| 93 |
|
return result; |
| 94 |
|
} |
| 95 |
|
|
| 98 |
|
* |
| 99 |
|
*/ |
| 100 |
|
void insert(int index) { |
| 101 |
< |
IndexListContainerIterator insertPos = internalInsert(index, index); |
| 101 |
> |
IndexListContainerIterator insertPos = internalInsert(index, index); |
| 102 |
|
merge(insertPos); |
| 103 |
|
} |
| 104 |
|
|
| 108 |
|
* @param endIndex |
| 109 |
|
*/ |
| 110 |
|
void insert(int beginIndex, int endIndex) { |
| 111 |
< |
IndexListContainerIterator insertPos = internalInsert(beginIndex, endIndex); |
| 111 |
> |
IndexListContainerIterator insertPos = internalInsert(beginIndex, |
| 112 |
> |
endIndex); |
| 113 |
|
merge(insertPos); |
| 114 |
|
} |
| 115 |
|
|
| 160 |
|
indexContainer_.erase(indexContainer_.begin(), i); |
| 161 |
|
break; |
| 162 |
|
} else { |
| 164 |
– |
|
| 163 |
|
for (int j = (*i).first; j < index; ++j) { |
| 164 |
|
result.push_back(j); |
| 165 |
< |
} |
| 168 |
< |
|
| 165 |
> |
} |
| 166 |
|
(*i).first = index; |
| 167 |
|
indexContainer_.erase(indexContainer_.begin(), i); |
| 168 |
|
break; |
| 169 |
|
} |
| 173 |
– |
|
| 170 |
|
} |
| 175 |
– |
|
| 171 |
|
return result; |
| 177 |
– |
|
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
int getMaxIndex() { |
| 302 |
|
void releaseCutoffGroupIndex(std::vector<int> indices) { |
| 303 |
|
cutoffGroupIndexContainer_.insert(indices); |
| 304 |
|
} |
| 305 |
< |
|
| 305 |
> |
|
| 306 |
> |
int getNextBondIndex() { |
| 307 |
> |
return bondIndexContainer_.pop(); |
| 308 |
> |
} |
| 309 |
> |
|
| 310 |
> |
std::vector<int> getBondIndicesBefore(int index) { |
| 311 |
> |
return bondIndexContainer_.getIndicesBefore(index); |
| 312 |
> |
} |
| 313 |
> |
|
| 314 |
> |
void releaseBondIndex(int index) { |
| 315 |
> |
bondIndexContainer_.insert(index); |
| 316 |
> |
} |
| 317 |
> |
|
| 318 |
> |
void releaseBondIndex(int beginIndex, int endIndex) { |
| 319 |
> |
bondIndexContainer_.insert(beginIndex, endIndex); |
| 320 |
> |
} |
| 321 |
> |
|
| 322 |
> |
void releaseBondIndex(std::vector<int> indices) { |
| 323 |
> |
bondIndexContainer_.insert(indices); |
| 324 |
> |
} |
| 325 |
> |
|
| 326 |
> |
int getNextBendIndex() { |
| 327 |
> |
return bendIndexContainer_.pop(); |
| 328 |
> |
} |
| 329 |
> |
|
| 330 |
> |
std::vector<int> getBendIndicesBefore(int index) { |
| 331 |
> |
return bendIndexContainer_.getIndicesBefore(index); |
| 332 |
> |
} |
| 333 |
> |
|
| 334 |
> |
void releaseBendIndex(int index) { |
| 335 |
> |
bendIndexContainer_.insert(index); |
| 336 |
> |
} |
| 337 |
> |
|
| 338 |
> |
void releaseBendIndex(int beginIndex, int endIndex) { |
| 339 |
> |
bendIndexContainer_.insert(beginIndex, endIndex); |
| 340 |
> |
} |
| 341 |
> |
|
| 342 |
> |
void releaseBendIndex(std::vector<int> indices) { |
| 343 |
> |
bendIndexContainer_.insert(indices); |
| 344 |
> |
} |
| 345 |
> |
|
| 346 |
> |
int getNextTorsionIndex() { |
| 347 |
> |
return torsionIndexContainer_.pop(); |
| 348 |
> |
} |
| 349 |
> |
|
| 350 |
> |
std::vector<int> getTorsionIndicesBefore(int index) { |
| 351 |
> |
return torsionIndexContainer_.getIndicesBefore(index); |
| 352 |
> |
} |
| 353 |
> |
|
| 354 |
> |
void releaseTorsionIndex(int index) { |
| 355 |
> |
torsionIndexContainer_.insert(index); |
| 356 |
> |
} |
| 357 |
> |
|
| 358 |
> |
void releaseTorsionIndex(int beginIndex, int endIndex) { |
| 359 |
> |
torsionIndexContainer_.insert(beginIndex, endIndex); |
| 360 |
> |
} |
| 361 |
> |
|
| 362 |
> |
void releaseTorsionIndex(std::vector<int> indices) { |
| 363 |
> |
torsionIndexContainer_.insert(indices); |
| 364 |
> |
} |
| 365 |
> |
|
| 366 |
> |
int getNextInversionIndex() { |
| 367 |
> |
return inversionIndexContainer_.pop(); |
| 368 |
> |
} |
| 369 |
> |
|
| 370 |
> |
std::vector<int> getInversionIndicesBefore(int index) { |
| 371 |
> |
return inversionIndexContainer_.getIndicesBefore(index); |
| 372 |
> |
} |
| 373 |
> |
|
| 374 |
> |
void releaseInversionIndex(int index) { |
| 375 |
> |
inversionIndexContainer_.insert(index); |
| 376 |
> |
} |
| 377 |
> |
|
| 378 |
> |
void releaseInversionIndex(int beginIndex, int endIndex) { |
| 379 |
> |
inversionIndexContainer_.insert(beginIndex, endIndex); |
| 380 |
> |
} |
| 381 |
> |
|
| 382 |
> |
void releaseInversionIndex(std::vector<int> indices) { |
| 383 |
> |
inversionIndexContainer_.insert(indices); |
| 384 |
> |
} |
| 385 |
> |
|
| 386 |
|
private: |
| 387 |
|
|
| 388 |
|
IndexListContainer atomIndexContainer_; |
| 389 |
|
IndexListContainer rigidBodyIndexContainer_; |
| 390 |
|
IndexListContainer cutoffGroupIndexContainer_; |
| 391 |
+ |
IndexListContainer bondIndexContainer_; |
| 392 |
+ |
IndexListContainer bendIndexContainer_; |
| 393 |
+ |
IndexListContainer torsionIndexContainer_; |
| 394 |
+ |
IndexListContainer inversionIndexContainer_; |
| 395 |
|
}; |
| 396 |
|
|
| 397 |
|
} //end namespace OpenMD |