ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/DataStorage.cpp
(Generate patch)

Comparing trunk/src/brains/DataStorage.cpp (file contents):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1793 by gezelter, Fri Aug 31 21:16:10 2012 UTC

# Line 36 | Line 36
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, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
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   /**
# Line 48 | Line 49
49   */
50  
51   #include "brains/DataStorage.hpp"
52 <
52 > using namespace std;
53   namespace OpenMD {
54  
55    DataStorage::DataStorage() : size_(0), storageLayout_(0){
# Line 64 | Line 65 | namespace OpenMD {
65  
66      if (storageLayout_ & dslPosition && position.size() != size_) {
67        //error
68 <      std::cerr << "size does not match"<< std::endl;
68 >      cerr << "size does not match"<< endl;
69      }
70  
71      if (storageLayout_ & dslVelocity && velocity.size() != size_) {
72        //error
73 <      std::cerr << "size does not match"<< std::endl;        
73 >      cerr << "size does not match"<< endl;        
74      }
75  
76      if (storageLayout_ & dslAmat && aMat.size() != size_) {
77        //error
78 <      std::cerr << "size does not match"<< std::endl;        
78 >      cerr << "size does not match"<< endl;        
79      }
80  
81      if (storageLayout_ & dslAngularMomentum && angularMomentum.size() != size_) {
82        //error
83 <      std::cerr << "size does not match"<< std::endl;        
83 >      cerr << "size does not match"<< endl;        
84      }
85  
86      if (storageLayout_ & dslElectroFrame && electroFrame.size() != size_) {
87        //error
88 <      std::cerr << "size does not match"<< std::endl;        
88 >      cerr << "size does not match"<< endl;        
89      }
90  
90    if (storageLayout_ & dslZAngle && zAngle.size() != size_) {
91      //error
92      std::cerr << "size does not match"<< std::endl;        
93    }
94
91      if (storageLayout_ & dslForce && force.size() != size_) {
92        //error
93 <      std::cerr << "size does not match"<< std::endl;        
93 >      cerr << "size does not match"<< endl;        
94      }
95  
96      if (storageLayout_ & dslTorque && torque.size() != size_) {
97        //error
98 <      std::cerr << "size does not match"<< std::endl;        
98 >      cerr << "size does not match"<< endl;        
99      }
100 +
101      if (storageLayout_ & dslParticlePot && particlePot.size() != size_) {
102        //error
103 <      std::cerr << "size does not match"<< std::endl;        
103 >      cerr << "size does not match"<< endl;        
104      }
105 +
106 +    if (storageLayout_ & dslDensity && density.size() != size_) {
107 +      //error
108 +      cerr << "size does not match"<< endl;        
109 +    }
110 +
111 +    if (storageLayout_ & dslFunctional && functional.size() != size_) {
112 +      //error
113 +      cerr << "size does not match"<< endl;        
114 +    }
115 +
116 +    if (storageLayout_ & dslFunctionalDerivative && functionalDerivative.size() != size_) {
117 +      //error
118 +      cerr << "size does not match"<< endl;        
119 +    }
120 +
121 +    if (storageLayout_ & dslElectricField && electricField.size() != size_) {
122 +      //error
123 +      cerr << "size does not match"<< endl;        
124 +    }
125 +
126 +    if (storageLayout_ & dslSkippedCharge && skippedCharge.size() != size_) {
127 +      //error
128 +      cerr << "size does not match"<< endl;        
129 +    }
130 +
131 +    if (storageLayout_ & dslFlucQPosition && flucQPos.size() != size_) {
132 +      //error
133 +      cerr << "size does not match"<< endl;        
134 +    }
135 +
136 +    if (storageLayout_ & dslFlucQVelocity && flucQVel.size() != size_) {
137 +      //error
138 +      cerr << "size does not match"<< endl;        
139 +    }
140 +
141 +    if (storageLayout_ & dslFlucQForce && flucQFrc.size() != size_) {
142 +      //error
143 +      cerr << "size does not match"<< endl;        
144 +    }
145      
146      return size_;
147  
# Line 132 | Line 169 | namespace OpenMD {
169        internalResize(electroFrame, newSize);
170      }
171      
135    if (storageLayout_ & dslZAngle) {
136      internalResize(zAngle, newSize);
137    }
138
172      if (storageLayout_ & dslForce) {
173        internalResize(force, newSize);
174      }
# Line 148 | Line 181 | namespace OpenMD {
181        internalResize(particlePot, newSize);
182      }
183  
184 +    if (storageLayout_ & dslDensity) {
185 +      internalResize(density, newSize);
186 +    }
187 +
188 +    if (storageLayout_ & dslFunctional) {
189 +      internalResize(functional, newSize);
190 +    }
191 +
192 +    if (storageLayout_ & dslFunctionalDerivative) {
193 +      internalResize(functionalDerivative, newSize);
194 +    }
195 +
196 +    if (storageLayout_ & dslElectricField) {
197 +      internalResize(electricField, newSize);
198 +    }
199 +
200 +    if (storageLayout_ & dslSkippedCharge) {
201 +      internalResize(skippedCharge, newSize);
202 +    }
203 +
204 +    if (storageLayout_ & dslFlucQPosition) {
205 +      internalResize(flucQPos, newSize);
206 +    }
207 +
208 +    if (storageLayout_ & dslFlucQVelocity) {
209 +      internalResize(flucQVel, newSize);
210 +    }
211 +
212 +    if (storageLayout_ & dslFlucQForce) {
213 +      internalResize(flucQFrc, newSize);
214 +    }
215 +
216      size_ = newSize;
217    }
218  
# Line 172 | Line 237 | namespace OpenMD {
237        electroFrame.reserve(size);
238      }
239      
175    if (storageLayout_ & dslZAngle) {
176      zAngle.reserve(size);
177    }
178
240      if (storageLayout_ & dslForce) {
241        force.reserve(size);
242      }
# Line 188 | Line 249 | namespace OpenMD {
249        particlePot.reserve(size);
250      }
251  
252 +    if (storageLayout_ & dslDensity) {
253 +      density.reserve(size);
254 +    }
255 +
256 +    if (storageLayout_ & dslFunctional) {
257 +      functional.reserve(size);
258 +    }
259 +
260 +    if (storageLayout_ & dslFunctionalDerivative) {
261 +      functionalDerivative.reserve(size);
262 +    }
263 +
264 +    if (storageLayout_ & dslElectricField) {
265 +      electricField.reserve(size);
266 +    }
267 +
268 +    if (storageLayout_ & dslSkippedCharge) {
269 +      skippedCharge.reserve(size);
270 +    }
271 +
272 +    if (storageLayout_ & dslFlucQPosition) {
273 +      flucQPos.reserve(size);
274 +    }
275 +
276 +    if (storageLayout_ & dslFlucQVelocity) {
277 +      flucQVel.reserve(size);
278 +    }
279 +
280 +    if (storageLayout_ & dslFlucQForce) {
281 +      flucQFrc.reserve(size);
282 +    }
283    }
284  
285    void DataStorage::copy(int source, int num, int target) {
# Line 215 | Line 307 | namespace OpenMD {
307        internalCopy(electroFrame, source, num, target);
308      }
309      
218    if (storageLayout_ & dslZAngle) {
219      internalCopy(zAngle, source, num, target);
220    }
221
310      if (storageLayout_ & dslForce) {
311        internalCopy(force, source, num, target);
312      }
# Line 230 | Line 318 | namespace OpenMD {
318      if (storageLayout_ & dslParticlePot) {
319        internalCopy(particlePot, source, num, target);
320      }
233    
321  
322 +    if (storageLayout_ & dslDensity) {
323 +      internalCopy(density, source, num, target);
324 +    }
325 +
326 +    if (storageLayout_ & dslFunctional) {
327 +      internalCopy(functional, source, num, target);
328 +    }
329 +
330 +    if (storageLayout_ & dslFunctionalDerivative) {
331 +      internalCopy(functionalDerivative, source, num, target);
332 +    }
333 +
334 +    if (storageLayout_ & dslElectricField) {
335 +      internalCopy(electricField, source, num, target);
336 +    }
337 +
338 +    if (storageLayout_ & dslSkippedCharge) {
339 +      internalCopy(skippedCharge, source, num, target);
340 +    }
341 +
342 +    if (storageLayout_ & dslFlucQPosition) {
343 +      internalCopy(flucQPos, source, num, target);
344 +    }
345 +
346 +    if (storageLayout_ & dslFlucQVelocity) {
347 +      internalCopy(flucQVel, source, num, target);
348 +    }
349 +    if (storageLayout_ & dslFlucQForce) {
350 +      internalCopy(flucQFrc, source, num, target);
351 +    }
352    }
353  
354    int DataStorage::getStorageLayout() {
# Line 248 | Line 365 | namespace OpenMD {
365      switch (whichArray) {
366      case dslPosition:
367        return internalGetArrayPointer(position);
251      break;
368              
369      case dslVelocity:
370        return internalGetArrayPointer(velocity);
255      break;
371              
372      case dslAmat:
373        return internalGetArrayPointer(aMat);
259      break;            
374              
375      case dslAngularMomentum:
376        return internalGetArrayPointer(angularMomentum);
263      break;
377              
378      case dslElectroFrame:
379        return internalGetArrayPointer(electroFrame);
267      break;
380              
269    case dslZAngle:
270      return internalGetArrayPointer(zAngle);
271      break;
272
381      case dslForce:
382        return internalGetArrayPointer(force);
275      break;            
383  
384      case dslTorque:
385        return internalGetArrayPointer(torque);
279      break;
386  
387      case dslParticlePot:
388        return internalGetArrayPointer(particlePot);
389 <      break;
390 <            
389 >
390 >    case dslDensity:
391 >      return internalGetArrayPointer(density);
392 >
393 >    case dslFunctional:
394 >      return internalGetArrayPointer(functional);
395 >
396 >    case dslFunctionalDerivative:
397 >      return internalGetArrayPointer(functionalDerivative);
398 >
399 >    case dslElectricField:
400 >      return internalGetArrayPointer(electricField);
401 >
402 >    case dslSkippedCharge:
403 >      return internalGetArrayPointer(skippedCharge);
404 >
405 >    case dslFlucQPosition:
406 >      return internalGetArrayPointer(flucQPos);
407 >
408 >    case dslFlucQVelocity:
409 >      return internalGetArrayPointer(flucQVel);
410 >          
411 >    case dslFlucQForce:
412 >      return internalGetArrayPointer(flucQFrc);
413 >          
414      default:
415        //error message
416        return NULL;
# Line 366 | Line 495 | namespace OpenMD {
495      if (layout & dslElectroFrame) {
496        bytes += sizeof(Mat3x3d);
497      }
369    if (layout & dslZAngle) {
370      bytes += sizeof(RealType);
371    }
498      if (layout & dslForce) {
499        bytes += sizeof(Vector3d);
500      }
# Line 378 | Line 504 | namespace OpenMD {
504      if (layout & dslParticlePot) {
505        bytes += sizeof(RealType);
506      }
507 +    if (layout & dslDensity) {
508 +      bytes += sizeof(RealType);
509 +    }
510 +    if (layout & dslFunctional) {
511 +      bytes += sizeof(RealType);
512 +    }
513 +    if (layout & dslFunctionalDerivative) {
514 +      bytes += sizeof(RealType);
515 +    }
516 +    if (layout & dslElectricField) {
517 +      bytes += sizeof(Vector3d);
518 +    }
519 +    if (layout & dslSkippedCharge) {
520 +      bytes += sizeof(RealType);
521 +    }
522 +    if (layout & dslFlucQPosition) {
523 +      bytes += sizeof(RealType);
524 +    }
525 +    if (layout & dslFlucQVelocity) {
526 +      bytes += sizeof(RealType);
527 +    }
528 +    if (layout & dslFlucQForce) {
529 +      bytes += sizeof(RealType);
530 +    }
531 +
532      return bytes;
533    }
534  

Comparing trunk/src/brains/DataStorage.cpp (property svn:keywords):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1793 by gezelter, Fri Aug 31 21:16:10 2012 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines