| 6 |  | * redistribute this software in source and binary code form, provided | 
| 7 |  | * that the following conditions are met: | 
| 8 |  | * | 
| 9 | < | * 1. Acknowledgement of the program authors must be made in any | 
| 10 | < | *    publication of scientific results based in part on use of the | 
| 11 | < | *    program.  An acceptable form of acknowledgement is citation of | 
| 12 | < | *    the article in which the program was described (Matthew | 
| 13 | < | *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher | 
| 14 | < | *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented | 
| 15 | < | *    Parallel Simulation Engine for Molecular Dynamics," | 
| 16 | < | *    J. Comput. Chem. 26, pp. 252-271 (2005)) | 
| 17 | < | * | 
| 18 | < | * 2. Redistributions of source code must retain the above copyright | 
| 9 | > | * 1. Redistributions of source code must retain the above copyright | 
| 10 |  | *    notice, this list of conditions and the following disclaimer. | 
| 11 |  | * | 
| 12 | < | * 3. Redistributions in binary form must reproduce the above copyright | 
| 12 | > | * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 |  | *    notice, this list of conditions and the following disclaimer in the | 
| 14 |  | *    documentation and/or other materials provided with the | 
| 15 |  | *    distribution. | 
| 28 |  | * arising out of the use of or inability to use software, even if the | 
| 29 |  | * University of Notre Dame has been advised of the possibility of | 
| 30 |  | * such damages. | 
| 31 | + | * | 
| 32 | + | * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | + | * research, please cite the appropriate papers when you publish your | 
| 34 | + | * work.  Good starting points are: | 
| 35 | + | * | 
| 36 | + | * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). | 
| 37 | + | * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). | 
| 38 | + | * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). | 
| 39 | + | * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 | + | * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 |  | */ | 
| 42 |  |  | 
| 43 |  | /** | 
| 44 |  | * @file DataStorage.cpp | 
| 45 |  | * @author tlin | 
| 46 |  | * @date 10/26/2004 | 
| 46 | – | * @time 11:56am | 
| 47 |  | * @version 1.0 | 
| 48 |  | */ | 
| 49 |  |  | 
| 50 |  | #include "brains/DataStorage.hpp" | 
| 51 | + | using namespace std; | 
| 52 | + | namespace OpenMD { | 
| 53 |  |  | 
| 52 | – | namespace oopse { | 
| 53 | – |  | 
| 54 |  | DataStorage::DataStorage() : size_(0), storageLayout_(0){ | 
| 55 |  |  | 
| 56 |  | } | 
| 57 |  |  | 
| 58 | < | DataStorage::DataStorage(int size, int storageLayout) : size_(size){ | 
| 58 | > | DataStorage::DataStorage(std::size_t size, int storageLayout) : size_(size){ | 
| 59 |  | setStorageLayout(storageLayout); | 
| 60 |  | resize(size); | 
| 61 |  | } | 
| 62 |  |  | 
| 63 | < | int DataStorage::getSize() { | 
| 63 | > | std::size_t DataStorage::getSize() { | 
| 64 |  |  | 
| 65 |  | if (storageLayout_ & dslPosition && position.size() != size_) { | 
| 66 |  | //error | 
| 67 | < | std::cerr << "size does not match"<< std::endl; | 
| 67 | > | cerr << "size does not match"<< endl; | 
| 68 |  | } | 
| 69 |  |  | 
| 70 |  | if (storageLayout_ & dslVelocity && velocity.size() != size_) { | 
| 71 |  | //error | 
| 72 | < | std::cerr << "size does not match"<< std::endl; | 
| 72 | > | cerr << "size does not match"<< endl; | 
| 73 |  | } | 
| 74 |  |  | 
| 75 | + | if (storageLayout_ & dslForce && force.size() != size_) { | 
| 76 | + | //error | 
| 77 | + | cerr << "size does not match"<< endl; | 
| 78 | + | } | 
| 79 | + |  | 
| 80 |  | if (storageLayout_ & dslAmat && aMat.size() != size_) { | 
| 81 |  | //error | 
| 82 | < | std::cerr << "size does not match"<< std::endl; | 
| 82 | > | cerr << "size does not match"<< endl; | 
| 83 |  | } | 
| 84 |  |  | 
| 85 |  | if (storageLayout_ & dslAngularMomentum && angularMomentum.size() != size_) { | 
| 86 |  | //error | 
| 87 | < | std::cerr << "size does not match"<< std::endl; | 
| 87 | > | cerr << "size does not match"<< endl; | 
| 88 |  | } | 
| 89 |  |  | 
| 90 | < | if (storageLayout_ & dslElectroFrame && electroFrame.size() != size_) { | 
| 90 | > | if (storageLayout_ & dslTorque && torque.size() != size_) { | 
| 91 |  | //error | 
| 92 | < | std::cerr << "size does not match"<< std::endl; | 
| 92 | > | cerr << "size does not match"<< endl; | 
| 93 |  | } | 
| 94 |  |  | 
| 95 | < | if (storageLayout_ & dslZAngle && zAngle.size() != size_) { | 
| 95 | > | if (storageLayout_ & dslParticlePot && particlePot.size() != size_) { | 
| 96 |  | //error | 
| 97 | < | std::cerr << "size does not match"<< std::endl; | 
| 97 | > | cerr << "size does not match"<< endl; | 
| 98 |  | } | 
| 99 |  |  | 
| 100 | < | if (storageLayout_ & dslForce && force.size() != size_) { | 
| 100 | > | if (storageLayout_ & dslDensity && density.size() != size_) { | 
| 101 |  | //error | 
| 102 | < | std::cerr << "size does not match"<< std::endl; | 
| 102 | > | cerr << "size does not match"<< endl; | 
| 103 |  | } | 
| 104 |  |  | 
| 105 | < | if (storageLayout_ & dslTorque && torque.size() != size_) { | 
| 105 | > | if (storageLayout_ & dslFunctional && functional.size() != size_) { | 
| 106 |  | //error | 
| 107 | < | std::cerr << "size does not match"<< std::endl; | 
| 107 | > | cerr << "size does not match"<< endl; | 
| 108 |  | } | 
| 109 |  |  | 
| 110 | + | if (storageLayout_ & dslFunctionalDerivative && functionalDerivative.size() != size_) { | 
| 111 | + | //error | 
| 112 | + | cerr << "size does not match"<< endl; | 
| 113 | + | } | 
| 114 | + |  | 
| 115 | + | if (storageLayout_ & dslDipole && dipole.size() != size_) { | 
| 116 | + | //error | 
| 117 | + | cerr << "size does not match"<< endl; | 
| 118 | + | } | 
| 119 | + |  | 
| 120 | + | if (storageLayout_ & dslQuadrupole && quadrupole.size() != size_) { | 
| 121 | + | //error | 
| 122 | + | cerr << "size does not match"<< endl; | 
| 123 | + | } | 
| 124 | + |  | 
| 125 | + | if (storageLayout_ & dslElectricField && electricField.size() != size_) { | 
| 126 | + | //error | 
| 127 | + | cerr << "size does not match"<< endl; | 
| 128 | + | } | 
| 129 | + |  | 
| 130 | + | if (storageLayout_ & dslSkippedCharge && skippedCharge.size() != size_) { | 
| 131 | + | //error | 
| 132 | + | cerr << "size does not match"<< endl; | 
| 133 | + | } | 
| 134 | + |  | 
| 135 | + | if (storageLayout_ & dslFlucQPosition && flucQPos.size() != size_) { | 
| 136 | + | //error | 
| 137 | + | cerr << "size does not match"<< endl; | 
| 138 | + | } | 
| 139 | + |  | 
| 140 | + | if (storageLayout_ & dslFlucQVelocity && flucQVel.size() != size_) { | 
| 141 | + | //error | 
| 142 | + | cerr << "size does not match"<< endl; | 
| 143 | + | } | 
| 144 | + |  | 
| 145 | + | if (storageLayout_ & dslFlucQForce && flucQFrc.size() != size_) { | 
| 146 | + | //error | 
| 147 | + | cerr << "size does not match"<< endl; | 
| 148 | + | } | 
| 149 | + |  | 
| 150 | + | if (storageLayout_ & dslSitePotential && sitePotential.size() != size_) { | 
| 151 | + | //error | 
| 152 | + | cerr << "size does not match"<< endl; | 
| 153 | + | } | 
| 154 | + |  | 
| 155 |  | return size_; | 
| 156 |  |  | 
| 157 |  | } | 
| 158 |  |  | 
| 159 | < | void DataStorage::resize(int newSize) { | 
| 159 | > | void DataStorage::resize(std::size_t newSize) { | 
| 160 |  |  | 
| 161 |  | if (storageLayout_ & dslPosition) { | 
| 162 |  | internalResize(position, newSize); | 
| 166 |  | internalResize(velocity, newSize); | 
| 167 |  | } | 
| 168 |  |  | 
| 169 | + | if (storageLayout_ & dslForce) { | 
| 170 | + | internalResize(force, newSize); | 
| 171 | + | } | 
| 172 | + |  | 
| 173 |  | if (storageLayout_ & dslAmat) { | 
| 174 |  | internalResize(aMat, newSize); | 
| 175 |  | } | 
| 177 |  | if (storageLayout_ & dslAngularMomentum) { | 
| 178 |  | internalResize(angularMomentum, newSize); | 
| 179 |  | } | 
| 180 | + |  | 
| 181 | + | if (storageLayout_ & dslTorque) { | 
| 182 | + | internalResize(torque, newSize); | 
| 183 | + | } | 
| 184 |  |  | 
| 185 | < | if (storageLayout_ & dslElectroFrame) { | 
| 186 | < | internalResize(electroFrame, newSize); | 
| 185 | > | if (storageLayout_ & dslParticlePot) { | 
| 186 | > | internalResize(particlePot, newSize); | 
| 187 |  | } | 
| 188 | < |  | 
| 189 | < | if (storageLayout_ & dslZAngle) { | 
| 190 | < | internalResize(zAngle, newSize); | 
| 188 | > |  | 
| 189 | > | if (storageLayout_ & dslDensity) { | 
| 190 | > | internalResize(density, newSize); | 
| 191 |  | } | 
| 192 |  |  | 
| 193 | < | if (storageLayout_ & dslForce) { | 
| 194 | < | internalResize(force, newSize); | 
| 193 | > | if (storageLayout_ & dslFunctional) { | 
| 194 | > | internalResize(functional, newSize); | 
| 195 |  | } | 
| 196 |  |  | 
| 197 | < | if (storageLayout_ & dslTorque) { | 
| 198 | < | internalResize(torque, newSize); | 
| 197 | > | if (storageLayout_ & dslFunctionalDerivative) { | 
| 198 | > | internalResize(functionalDerivative, newSize); | 
| 199 |  | } | 
| 200 |  |  | 
| 201 | + | if (storageLayout_ & dslDipole) { | 
| 202 | + | internalResize(dipole, newSize); | 
| 203 | + | } | 
| 204 | + |  | 
| 205 | + | if (storageLayout_ & dslQuadrupole) { | 
| 206 | + | internalResize(quadrupole, newSize); | 
| 207 | + | } | 
| 208 | + |  | 
| 209 | + | if (storageLayout_ & dslElectricField) { | 
| 210 | + | internalResize(electricField, newSize); | 
| 211 | + | } | 
| 212 | + |  | 
| 213 | + | if (storageLayout_ & dslSkippedCharge) { | 
| 214 | + | internalResize(skippedCharge, newSize); | 
| 215 | + | } | 
| 216 | + |  | 
| 217 | + | if (storageLayout_ & dslFlucQPosition) { | 
| 218 | + | internalResize(flucQPos, newSize); | 
| 219 | + | } | 
| 220 | + |  | 
| 221 | + | if (storageLayout_ & dslFlucQVelocity) { | 
| 222 | + | internalResize(flucQVel, newSize); | 
| 223 | + | } | 
| 224 | + |  | 
| 225 | + | if (storageLayout_ & dslFlucQForce) { | 
| 226 | + | internalResize(flucQFrc, newSize); | 
| 227 | + | } | 
| 228 | + |  | 
| 229 | + | if (storageLayout_ & dslSitePotential) { | 
| 230 | + | internalResize(sitePotential, newSize); | 
| 231 | + | } | 
| 232 | + |  | 
| 233 |  | size_ = newSize; | 
| 234 |  | } | 
| 235 |  |  | 
| 236 | < | void DataStorage::reserve(int size) { | 
| 236 | > | void DataStorage::reserve(std::size_t size) { | 
| 237 |  | if (storageLayout_ & dslPosition) { | 
| 238 |  | position.reserve(size); | 
| 239 |  | } | 
| 242 |  | velocity.reserve(size); | 
| 243 |  | } | 
| 244 |  |  | 
| 245 | + | if (storageLayout_ & dslForce) { | 
| 246 | + | force.reserve(size); | 
| 247 | + | } | 
| 248 | + |  | 
| 249 |  | if (storageLayout_ & dslAmat) { | 
| 250 |  | aMat.reserve(size); | 
| 251 |  | } | 
| 254 |  | angularMomentum.reserve(size); | 
| 255 |  | } | 
| 256 |  |  | 
| 257 | < | if (storageLayout_ & dslElectroFrame) { | 
| 258 | < | electroFrame.reserve(size); | 
| 257 | > | if (storageLayout_ & dslTorque) { | 
| 258 | > | torque.reserve(size); | 
| 259 |  | } | 
| 260 |  |  | 
| 261 | < | if (storageLayout_ & dslZAngle) { | 
| 262 | < | zAngle.reserve(size); | 
| 261 | > | if (storageLayout_ & dslParticlePot) { | 
| 262 | > | particlePot.reserve(size); | 
| 263 |  | } | 
| 264 |  |  | 
| 265 | < | if (storageLayout_ & dslForce) { | 
| 266 | < | force.reserve(size); | 
| 267 | < | } | 
| 265 | > | if (storageLayout_ & dslDensity) { | 
| 266 | > | density.reserve(size); | 
| 267 | > | } | 
| 268 |  |  | 
| 269 | < | if (storageLayout_ & dslTorque) { | 
| 270 | < | torque.reserve(size); | 
| 269 | > | if (storageLayout_ & dslFunctional) { | 
| 270 | > | functional.reserve(size); | 
| 271 |  | } | 
| 272 |  |  | 
| 273 | + | if (storageLayout_ & dslFunctionalDerivative) { | 
| 274 | + | functionalDerivative.reserve(size); | 
| 275 | + | } | 
| 276 | + |  | 
| 277 | + | if (storageLayout_ & dslDipole) { | 
| 278 | + | dipole.reserve(size); | 
| 279 | + | } | 
| 280 | + |  | 
| 281 | + | if (storageLayout_ & dslQuadrupole) { | 
| 282 | + | quadrupole.reserve(size); | 
| 283 | + | } | 
| 284 | + |  | 
| 285 | + | if (storageLayout_ & dslElectricField) { | 
| 286 | + | electricField.reserve(size); | 
| 287 | + | } | 
| 288 | + |  | 
| 289 | + | if (storageLayout_ & dslSkippedCharge) { | 
| 290 | + | skippedCharge.reserve(size); | 
| 291 | + | } | 
| 292 | + |  | 
| 293 | + | if (storageLayout_ & dslFlucQPosition) { | 
| 294 | + | flucQPos.reserve(size); | 
| 295 | + | } | 
| 296 | + |  | 
| 297 | + | if (storageLayout_ & dslFlucQVelocity) { | 
| 298 | + | flucQVel.reserve(size); | 
| 299 | + | } | 
| 300 | + |  | 
| 301 | + | if (storageLayout_ & dslFlucQForce) { | 
| 302 | + | flucQFrc.reserve(size); | 
| 303 | + | } | 
| 304 | + |  | 
| 305 | + | if (storageLayout_ & dslSitePotential) { | 
| 306 | + | sitePotential.reserve(size); | 
| 307 | + | } | 
| 308 |  | } | 
| 309 |  |  | 
| 310 | < | void DataStorage::copy(int source, int num, int target) { | 
| 310 | > | void DataStorage::copy(int source, std::size_t num, std::size_t target) { | 
| 311 |  | if (num + target > size_ ) { | 
| 312 |  | //error | 
| 313 |  | } | 
| 320 |  | internalCopy(velocity, source, num, target); | 
| 321 |  | } | 
| 322 |  |  | 
| 323 | + | if (storageLayout_ & dslForce) { | 
| 324 | + | internalCopy(force, source, num, target); | 
| 325 | + | } | 
| 326 | + |  | 
| 327 |  | if (storageLayout_ & dslAmat) { | 
| 328 |  | internalCopy(aMat, source, num, target); | 
| 329 |  | } | 
| 332 |  | internalCopy(angularMomentum, source, num, target); | 
| 333 |  | } | 
| 334 |  |  | 
| 335 | < | if (storageLayout_ & dslElectroFrame) { | 
| 336 | < | internalCopy(electroFrame, source, num, target); | 
| 335 | > | if (storageLayout_ & dslTorque) { | 
| 336 | > | internalCopy(torque, source, num, target); | 
| 337 |  | } | 
| 338 | < |  | 
| 339 | < | if (storageLayout_ & dslZAngle) { | 
| 340 | < | internalCopy(zAngle, source, num, target); | 
| 338 | > |  | 
| 339 | > | if (storageLayout_ & dslParticlePot) { | 
| 340 | > | internalCopy(particlePot, source, num, target); | 
| 341 |  | } | 
| 342 |  |  | 
| 343 | < | if (storageLayout_ & dslForce) { | 
| 344 | < | internalCopy(force, source, num, target); | 
| 345 | < | } | 
| 343 | > | if (storageLayout_ & dslDensity) { | 
| 344 | > | internalCopy(density, source, num, target); | 
| 345 | > | } | 
| 346 |  |  | 
| 347 | < | if (storageLayout_ & dslTorque) { | 
| 348 | < | internalCopy(torque, source, num, target); | 
| 347 | > | if (storageLayout_ & dslFunctional) { | 
| 348 | > | internalCopy(functional, source, num, target); | 
| 349 |  | } | 
| 217 | – |  | 
| 350 |  |  | 
| 351 | + | if (storageLayout_ & dslFunctionalDerivative) { | 
| 352 | + | internalCopy(functionalDerivative, source, num, target); | 
| 353 | + | } | 
| 354 | + |  | 
| 355 | + | if (storageLayout_ & dslDipole) { | 
| 356 | + | internalCopy(dipole, source, num, target); | 
| 357 | + | } | 
| 358 | + |  | 
| 359 | + | if (storageLayout_ & dslQuadrupole) { | 
| 360 | + | internalCopy(quadrupole, source, num, target); | 
| 361 | + | } | 
| 362 | + |  | 
| 363 | + | if (storageLayout_ & dslElectricField) { | 
| 364 | + | internalCopy(electricField, source, num, target); | 
| 365 | + | } | 
| 366 | + |  | 
| 367 | + | if (storageLayout_ & dslSkippedCharge) { | 
| 368 | + | internalCopy(skippedCharge, source, num, target); | 
| 369 | + | } | 
| 370 | + |  | 
| 371 | + | if (storageLayout_ & dslFlucQPosition) { | 
| 372 | + | internalCopy(flucQPos, source, num, target); | 
| 373 | + | } | 
| 374 | + |  | 
| 375 | + | if (storageLayout_ & dslFlucQVelocity) { | 
| 376 | + | internalCopy(flucQVel, source, num, target); | 
| 377 | + | } | 
| 378 | + | if (storageLayout_ & dslFlucQForce) { | 
| 379 | + | internalCopy(flucQFrc, source, num, target); | 
| 380 | + | } | 
| 381 | + |  | 
| 382 | + | if (storageLayout_ & dslSitePotential) { | 
| 383 | + | internalCopy(sitePotential, source, num, target); | 
| 384 | + | } | 
| 385 |  | } | 
| 386 |  |  | 
| 387 |  | int DataStorage::getStorageLayout() { | 
| 393 |  | resize(size_); | 
| 394 |  | } | 
| 395 |  |  | 
| 396 | < | double* DataStorage::getArrayPointer(int whichArray) { | 
| 396 | > | RealType* DataStorage::getArrayPointer(int whichArray) { | 
| 397 |  |  | 
| 398 |  | switch (whichArray) { | 
| 399 |  | case dslPosition: | 
| 400 |  | return internalGetArrayPointer(position); | 
| 235 | – | break; | 
| 401 |  |  | 
| 402 |  | case dslVelocity: | 
| 403 |  | return internalGetArrayPointer(velocity); | 
| 239 | – | break; | 
| 404 |  |  | 
| 405 | + | case dslForce: | 
| 406 | + | return internalGetArrayPointer(force); | 
| 407 | + |  | 
| 408 |  | case dslAmat: | 
| 409 |  | return internalGetArrayPointer(aMat); | 
| 243 | – | break; | 
| 410 |  |  | 
| 411 |  | case dslAngularMomentum: | 
| 412 |  | return internalGetArrayPointer(angularMomentum); | 
| 247 | – | break; | 
| 413 |  |  | 
| 249 | – | case dslElectroFrame: | 
| 250 | – | return internalGetArrayPointer(electroFrame); | 
| 251 | – | break; | 
| 252 | – |  | 
| 253 | – | case dslZAngle: | 
| 254 | – | return internalGetArrayPointer(zAngle); | 
| 255 | – | break; | 
| 256 | – |  | 
| 257 | – | case dslForce: | 
| 258 | – | return internalGetArrayPointer(force); | 
| 259 | – | break; | 
| 260 | – |  | 
| 414 |  | case dslTorque: | 
| 415 |  | return internalGetArrayPointer(torque); | 
| 416 | < | break; | 
| 417 | < |  | 
| 416 | > |  | 
| 417 | > | case dslParticlePot: | 
| 418 | > | return internalGetArrayPointer(particlePot); | 
| 419 | > |  | 
| 420 | > | case dslDensity: | 
| 421 | > | return internalGetArrayPointer(density); | 
| 422 | > |  | 
| 423 | > | case dslFunctional: | 
| 424 | > | return internalGetArrayPointer(functional); | 
| 425 | > |  | 
| 426 | > | case dslFunctionalDerivative: | 
| 427 | > | return internalGetArrayPointer(functionalDerivative); | 
| 428 | > |  | 
| 429 | > | case dslDipole: | 
| 430 | > | return internalGetArrayPointer(dipole); | 
| 431 | > |  | 
| 432 | > | case dslQuadrupole: | 
| 433 | > | return internalGetArrayPointer(quadrupole); | 
| 434 | > |  | 
| 435 | > | case dslElectricField: | 
| 436 | > | return internalGetArrayPointer(electricField); | 
| 437 | > |  | 
| 438 | > | case dslSkippedCharge: | 
| 439 | > | return internalGetArrayPointer(skippedCharge); | 
| 440 | > |  | 
| 441 | > | case dslFlucQPosition: | 
| 442 | > | return internalGetArrayPointer(flucQPos); | 
| 443 | > |  | 
| 444 | > | case dslFlucQVelocity: | 
| 445 | > | return internalGetArrayPointer(flucQVel); | 
| 446 | > |  | 
| 447 | > | case dslFlucQForce: | 
| 448 | > | return internalGetArrayPointer(flucQFrc); | 
| 449 | > |  | 
| 450 | > | case dslSitePotential: | 
| 451 | > | return internalGetArrayPointer(sitePotential); | 
| 452 | > |  | 
| 453 |  | default: | 
| 454 |  | //error message | 
| 455 |  | return NULL; | 
| 268 | – |  | 
| 456 |  | } | 
| 457 |  | } | 
| 458 |  |  | 
| 459 | < | double* DataStorage::internalGetArrayPointer(std::vector<Vector3d>& v) { | 
| 460 | < | if (v.size() == 0) { | 
| 459 | > | RealType* DataStorage::internalGetArrayPointer(std::vector<Vector3d>& v) { | 
| 460 | > | if (v.empty()) { | 
| 461 |  | return NULL; | 
| 462 |  | } else { | 
| 463 |  | return v[0].getArrayPointer(); | 
| 464 |  | } | 
| 465 |  | } | 
| 466 |  |  | 
| 467 | < | double* DataStorage::internalGetArrayPointer(std::vector<RotMat3x3d>& v) { | 
| 468 | < | if (v.size() == 0) { | 
| 467 | > | RealType* DataStorage::internalGetArrayPointer(std::vector<Mat3x3d>& v) { | 
| 468 | > | if (v.empty()) { | 
| 469 |  | return NULL; | 
| 470 |  | } else { | 
| 471 |  | return v[0].getArrayPointer(); | 
| 473 |  |  | 
| 474 |  | } | 
| 475 |  |  | 
| 476 | < | double* DataStorage::internalGetArrayPointer(std::vector<double>& v) { | 
| 477 | < | if (v.size() == 0) { | 
| 476 | > | RealType* DataStorage::internalGetArrayPointer(std::vector<RealType>& v) { | 
| 477 | > | if (v.empty()) { | 
| 478 |  | return NULL; | 
| 479 |  | } else { | 
| 480 |  | return &(v[0]); | 
| 483 |  | } | 
| 484 |  |  | 
| 485 |  | template<typename T> | 
| 486 | < | void DataStorage::internalResize(std::vector<T>& v, int newSize){ | 
| 487 | < | int oldSize = v.size(); | 
| 486 | > | void DataStorage::internalResize(std::vector<T>& v, std::size_t newSize){ | 
| 487 | > | std::size_t oldSize = v.size(); | 
| 488 |  |  | 
| 489 |  | if (oldSize == newSize) { | 
| 490 |  | return; | 
| 499 |  | } | 
| 500 |  |  | 
| 501 |  | template<typename T> | 
| 502 | < | void DataStorage::internalCopy(std::vector<T>& v, int source,  int num, int target) { | 
| 502 | > | void DataStorage::internalCopy(std::vector<T>& v, int source, | 
| 503 | > | std::size_t num, std::size_t target) { | 
| 504 |  | typename std::vector<T>::iterator first; | 
| 505 |  | typename std::vector<T>::iterator last; | 
| 506 |  | typename std::vector<T>::iterator result; | 
| 517 |  | std::copy(first, last, result); | 
| 518 |  | } | 
| 519 |  |  | 
| 520 | < | int DataStorage::getBytesPerStuntDouble(int layout) { | 
| 521 | < | int bytes = 0; | 
| 520 | > | std::size_t DataStorage::getBytesPerStuntDouble(int layout) { | 
| 521 | > | std::size_t  bytes = 0; | 
| 522 |  | if (layout & dslPosition) { | 
| 523 |  | bytes += sizeof(Vector3d); | 
| 524 |  | } | 
| 525 |  | if (layout & dslVelocity) { | 
| 526 |  | bytes += sizeof(Vector3d); | 
| 527 |  | } | 
| 528 | + | if (layout & dslForce) { | 
| 529 | + | bytes += sizeof(Vector3d); | 
| 530 | + | } | 
| 531 |  | if (layout & dslAmat) { | 
| 532 | < | bytes += sizeof(Mat3x3d); | 
| 532 | > | bytes += sizeof(RotMat3x3d); | 
| 533 |  | } | 
| 534 |  | if (layout & dslAngularMomentum) { | 
| 535 |  | bytes += sizeof(Vector3d); | 
| 536 |  | } | 
| 537 | < | if (layout & dslElectroFrame) { | 
| 347 | < | bytes += sizeof(Mat3x3d); | 
| 348 | < | } | 
| 349 | < | if (layout & dslZAngle) { | 
| 537 | > | if (layout & dslTorque) { | 
| 538 |  | bytes += sizeof(Vector3d); | 
| 539 |  | } | 
| 540 | < | if (layout & dslForce) { | 
| 540 | > | if (layout & dslParticlePot) { | 
| 541 | > | bytes += sizeof(RealType); | 
| 542 | > | } | 
| 543 | > | if (layout & dslDensity) { | 
| 544 | > | bytes += sizeof(RealType); | 
| 545 | > | } | 
| 546 | > | if (layout & dslFunctional) { | 
| 547 | > | bytes += sizeof(RealType); | 
| 548 | > | } | 
| 549 | > | if (layout & dslFunctionalDerivative) { | 
| 550 | > | bytes += sizeof(RealType); | 
| 551 | > | } | 
| 552 | > | if (layout & dslDipole) { | 
| 553 |  | bytes += sizeof(Vector3d); | 
| 554 |  | } | 
| 555 | < | if (layout & dslTorque) { | 
| 555 | > | if (layout & dslQuadrupole) { | 
| 556 | > | bytes += sizeof(Mat3x3d); | 
| 557 | > | } | 
| 558 | > | if (layout & dslElectricField) { | 
| 559 |  | bytes += sizeof(Vector3d); | 
| 560 |  | } | 
| 561 | + | if (layout & dslSkippedCharge) { | 
| 562 | + | bytes += sizeof(RealType); | 
| 563 | + | } | 
| 564 | + | if (layout & dslFlucQPosition) { | 
| 565 | + | bytes += sizeof(RealType); | 
| 566 | + | } | 
| 567 | + | if (layout & dslFlucQVelocity) { | 
| 568 | + | bytes += sizeof(RealType); | 
| 569 | + | } | 
| 570 | + | if (layout & dslFlucQForce) { | 
| 571 | + | bytes += sizeof(RealType); | 
| 572 | + | } | 
| 573 | + | if (layout & dslSitePotential) { | 
| 574 | + | bytes += sizeof(RealType); | 
| 575 | + | } | 
| 576 | + |  | 
| 577 |  | return bytes; | 
| 578 |  | } | 
| 579 |  |  |