63 std::size_t DataStorage::getSize() {
64 if (storageLayout_ & dslPosition && position.size() != size_) {
66 cerr <<
"size does not match" << endl;
69 if (storageLayout_ & dslVelocity && velocity.size() != size_) {
71 cerr <<
"size does not match" << endl;
74 if (storageLayout_ & dslForce && force.size() != size_) {
76 cerr <<
"size does not match" << endl;
79 if (storageLayout_ & dslAmat && aMat.size() != size_) {
81 cerr <<
"size does not match" << endl;
84 if (storageLayout_ & dslAngularMomentum &&
85 angularMomentum.size() != size_) {
87 cerr <<
"size does not match" << endl;
90 if (storageLayout_ & dslTorque && torque.size() != size_) {
92 cerr <<
"size does not match" << endl;
95 if (storageLayout_ & dslParticlePot && particlePot.size() != size_) {
97 cerr <<
"size does not match" << endl;
100 if (storageLayout_ & dslDensity && density.size() != size_) {
102 cerr <<
"size does not match" << endl;
105 if (storageLayout_ & dslFunctional && functional.size() != size_) {
107 cerr <<
"size does not match" << endl;
110 if (storageLayout_ & dslFunctionalDerivative &&
111 functionalDerivative.size() != size_) {
113 cerr <<
"size does not match" << endl;
116 if (storageLayout_ & dslDipole && dipole.size() != size_) {
118 cerr <<
"size does not match" << endl;
121 if (storageLayout_ & dslQuadrupole && quadrupole.size() != size_) {
123 cerr <<
"size does not match" << endl;
126 if (storageLayout_ & dslElectricField && electricField.size() != size_) {
128 cerr <<
"size does not match" << endl;
131 if (storageLayout_ & dslSkippedCharge && skippedCharge.size() != size_) {
133 cerr <<
"size does not match" << endl;
136 if (storageLayout_ & dslFlucQPosition && flucQPos.size() != size_) {
138 cerr <<
"size does not match" << endl;
141 if (storageLayout_ & dslFlucQVelocity && flucQVel.size() != size_) {
143 cerr <<
"size does not match" << endl;
146 if (storageLayout_ & dslFlucQForce && flucQFrc.size() != size_) {
148 cerr <<
"size does not match" << endl;
151 if (storageLayout_ & dslSitePotential && sitePotential.size() != size_) {
153 cerr <<
"size does not match" << endl;
159 void DataStorage::resize(std::size_t newSize) {
160 if (storageLayout_ & dslPosition) { internalResize(position, newSize); }
162 if (storageLayout_ & dslVelocity) { internalResize(velocity, newSize); }
164 if (storageLayout_ & dslForce) { internalResize(force, newSize); }
166 if (storageLayout_ & dslAmat) { internalResize(aMat, newSize); }
168 if (storageLayout_ & dslAngularMomentum) {
169 internalResize(angularMomentum, newSize);
172 if (storageLayout_ & dslTorque) { internalResize(torque, newSize); }
174 if (storageLayout_ & dslParticlePot) {
175 internalResize(particlePot, newSize);
178 if (storageLayout_ & dslDensity) { internalResize(density, newSize); }
180 if (storageLayout_ & dslFunctional) { internalResize(functional, newSize); }
182 if (storageLayout_ & dslFunctionalDerivative) {
183 internalResize(functionalDerivative, newSize);
186 if (storageLayout_ & dslDipole) { internalResize(dipole, newSize); }
188 if (storageLayout_ & dslQuadrupole) { internalResize(quadrupole, newSize); }
190 if (storageLayout_ & dslElectricField) {
191 internalResize(electricField, newSize);
194 if (storageLayout_ & dslSkippedCharge) {
195 internalResize(skippedCharge, newSize);
198 if (storageLayout_ & dslFlucQPosition) {
199 internalResize(flucQPos, newSize);
202 if (storageLayout_ & dslFlucQVelocity) {
203 internalResize(flucQVel, newSize);
206 if (storageLayout_ & dslFlucQForce) { internalResize(flucQFrc, newSize); }
208 if (storageLayout_ & dslSitePotential) {
209 internalResize(sitePotential, newSize);
215 void DataStorage::reserve(std::size_t size) {
216 if (storageLayout_ & dslPosition) { position.reserve(size); }
218 if (storageLayout_ & dslVelocity) { velocity.reserve(size); }
220 if (storageLayout_ & dslForce) { force.reserve(size); }
222 if (storageLayout_ & dslAmat) { aMat.reserve(size); }
224 if (storageLayout_ & dslAngularMomentum) { angularMomentum.reserve(size); }
226 if (storageLayout_ & dslTorque) { torque.reserve(size); }
228 if (storageLayout_ & dslParticlePot) { particlePot.reserve(size); }
230 if (storageLayout_ & dslDensity) { density.reserve(size); }
232 if (storageLayout_ & dslFunctional) { functional.reserve(size); }
234 if (storageLayout_ & dslFunctionalDerivative) {
235 functionalDerivative.reserve(size);
238 if (storageLayout_ & dslDipole) { dipole.reserve(size); }
240 if (storageLayout_ & dslQuadrupole) { quadrupole.reserve(size); }
242 if (storageLayout_ & dslElectricField) { electricField.reserve(size); }
244 if (storageLayout_ & dslSkippedCharge) { skippedCharge.reserve(size); }
246 if (storageLayout_ & dslFlucQPosition) { flucQPos.reserve(size); }
248 if (storageLayout_ & dslFlucQVelocity) { flucQVel.reserve(size); }
250 if (storageLayout_ & dslFlucQForce) { flucQFrc.reserve(size); }
252 if (storageLayout_ & dslSitePotential) { sitePotential.reserve(size); }
255 void DataStorage::copy(
int source, std::size_t num, std::size_t target) {
256 if (num + target > size_) {
260 if (storageLayout_ & dslPosition) {
261 internalCopy(position, source, num, target);
264 if (storageLayout_ & dslVelocity) {
265 internalCopy(velocity, source, num, target);
268 if (storageLayout_ & dslForce) { internalCopy(force, source, num, target); }
270 if (storageLayout_ & dslAmat) { internalCopy(aMat, source, num, target); }
272 if (storageLayout_ & dslAngularMomentum) {
273 internalCopy(angularMomentum, source, num, target);
276 if (storageLayout_ & dslTorque) {
277 internalCopy(torque, source, num, target);
280 if (storageLayout_ & dslParticlePot) {
281 internalCopy(particlePot, source, num, target);
284 if (storageLayout_ & dslDensity) {
285 internalCopy(density, source, num, target);
288 if (storageLayout_ & dslFunctional) {
289 internalCopy(functional, source, num, target);
292 if (storageLayout_ & dslFunctionalDerivative) {
293 internalCopy(functionalDerivative, source, num, target);
296 if (storageLayout_ & dslDipole) {
297 internalCopy(dipole, source, num, target);
300 if (storageLayout_ & dslQuadrupole) {
301 internalCopy(quadrupole, source, num, target);
304 if (storageLayout_ & dslElectricField) {
305 internalCopy(electricField, source, num, target);
308 if (storageLayout_ & dslSkippedCharge) {
309 internalCopy(skippedCharge, source, num, target);
312 if (storageLayout_ & dslFlucQPosition) {
313 internalCopy(flucQPos, source, num, target);
316 if (storageLayout_ & dslFlucQVelocity) {
317 internalCopy(flucQVel, source, num, target);
319 if (storageLayout_ & dslFlucQForce) {
320 internalCopy(flucQFrc, source, num, target);
323 if (storageLayout_ & dslSitePotential) {
324 internalCopy(sitePotential, source, num, target);
335 RealType* DataStorage::getArrayPointer(
int whichArray) {
336 switch (whichArray) {
338 return internalGetArrayPointer(position);
341 return internalGetArrayPointer(velocity);
344 return internalGetArrayPointer(force);
347 return internalGetArrayPointer(aMat);
349 case dslAngularMomentum:
350 return internalGetArrayPointer(angularMomentum);
353 return internalGetArrayPointer(torque);
356 return internalGetArrayPointer(particlePot);
359 return internalGetArrayPointer(density);
362 return internalGetArrayPointer(functional);
364 case dslFunctionalDerivative:
365 return internalGetArrayPointer(functionalDerivative);
368 return internalGetArrayPointer(dipole);
371 return internalGetArrayPointer(quadrupole);
373 case dslElectricField:
374 return internalGetArrayPointer(electricField);
376 case dslSkippedCharge:
377 return internalGetArrayPointer(skippedCharge);
379 case dslFlucQPosition:
380 return internalGetArrayPointer(flucQPos);
382 case dslFlucQVelocity:
383 return internalGetArrayPointer(flucQVel);
386 return internalGetArrayPointer(flucQFrc);
388 case dslSitePotential:
389 return internalGetArrayPointer(sitePotential);
456 std::size_t DataStorage::getBytesPerStuntDouble(
int layout) {
457 std::size_t bytes = 0;
458 if (layout & dslPosition) { bytes +=
sizeof(
Vector3d); }
459 if (layout & dslVelocity) { bytes +=
sizeof(
Vector3d); }
460 if (layout & dslForce) { bytes +=
sizeof(
Vector3d); }
461 if (layout & dslAmat) { bytes +=
sizeof(
RotMat3x3d); }
462 if (layout & dslAngularMomentum) { bytes +=
sizeof(
Vector3d); }
463 if (layout & dslTorque) { bytes +=
sizeof(
Vector3d); }
464 if (layout & dslParticlePot) { bytes +=
sizeof(RealType); }
465 if (layout & dslDensity) { bytes +=
sizeof(RealType); }
466 if (layout & dslFunctional) { bytes +=
sizeof(RealType); }
467 if (layout & dslFunctionalDerivative) { bytes +=
sizeof(RealType); }
468 if (layout & dslDipole) { bytes +=
sizeof(
Vector3d); }
469 if (layout & dslQuadrupole) { bytes +=
sizeof(
Mat3x3d); }
470 if (layout & dslElectricField) { bytes +=
sizeof(
Vector3d); }
471 if (layout & dslSkippedCharge) { bytes +=
sizeof(RealType); }
472 if (layout & dslFlucQPosition) { bytes +=
sizeof(RealType); }
473 if (layout & dslFlucQVelocity) { bytes +=
sizeof(RealType); }
474 if (layout & dslFlucQForce) { bytes +=
sizeof(RealType); }
475 if (layout & dslSitePotential) { bytes +=
sizeof(RealType); }