1 |
< |
/* |
2 |
< |
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
< |
* |
4 |
< |
* Contact: oopse@oopse.org |
5 |
< |
* |
6 |
< |
* This program is free software; you can redistribute it and/or |
7 |
< |
* modify it under the terms of the GNU Lesser General Public License |
8 |
< |
* as published by the Free Software Foundation; either version 2.1 |
9 |
< |
* of the License, or (at your option) any later version. |
10 |
< |
* All we ask is that proper credit is given for our work, which includes |
11 |
< |
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
< |
* of your source code files, and to any copyright notice that you may distribute |
13 |
< |
* with programs based on this work. |
14 |
< |
* |
15 |
< |
* This program is distributed in the hope that it will be useful, |
16 |
< |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
< |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
< |
* GNU Lesser General Public License for more details. |
19 |
< |
* |
20 |
< |
* You should have received a copy of the GNU Lesser General Public License |
21 |
< |
* along with this program; if not, write to the Free Software |
22 |
< |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1 |
> |
/* |
2 |
> |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
+ |
* The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
* non-exclusive, royalty free, license to use, modify and |
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 |
19 |
+ |
* notice, this list of conditions and the following disclaimer. |
20 |
+ |
* |
21 |
+ |
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
* notice, this list of conditions and the following disclaimer in the |
23 |
+ |
* documentation and/or other materials provided with the |
24 |
+ |
* distribution. |
25 |
+ |
* |
26 |
+ |
* This software is provided "AS IS," without a warranty of any |
27 |
+ |
* kind. All express or implied conditions, representations and |
28 |
+ |
* warranties, including any implied warranty of merchantability, |
29 |
+ |
* fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
* excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
* be liable for any damages suffered by licensee as a result of |
32 |
+ |
* using, modifying or distributing the software or its |
33 |
+ |
* derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
* licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
* direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
* damages, however caused and regardless of the theory of liability, |
37 |
+ |
* arising out of the use of or inability to use software, even if the |
38 |
+ |
* University of Notre Dame has been advised of the possibility of |
39 |
+ |
* such damages. |
40 |
|
*/ |
41 |
|
|
42 |
|
/** |
81 |
|
std::cerr << "size does not match"<< std::endl; |
82 |
|
} |
83 |
|
|
84 |
< |
if (storageLayout_ & dslUnitVector && unitVector.size() != size_) { |
84 |
> |
if (storageLayout_ & dslElectroFrame && electroFrame.size() != size_) { |
85 |
|
//error |
86 |
|
std::cerr << "size does not match"<< std::endl; |
87 |
|
} |
123 |
|
internalResize(angularMomentum, newSize); |
124 |
|
} |
125 |
|
|
126 |
< |
if (storageLayout_ & dslUnitVector) { |
127 |
< |
internalResize(unitVector, newSize); |
126 |
> |
if (storageLayout_ & dslElectroFrame) { |
127 |
> |
internalResize(electroFrame, newSize); |
128 |
|
} |
129 |
|
|
130 |
|
if (storageLayout_ & dslZAngle) { |
159 |
|
angularMomentum.reserve(size); |
160 |
|
} |
161 |
|
|
162 |
< |
if (storageLayout_ & dslUnitVector) { |
163 |
< |
unitVector.reserve(size); |
162 |
> |
if (storageLayout_ & dslElectroFrame) { |
163 |
> |
electroFrame.reserve(size); |
164 |
|
} |
165 |
|
|
166 |
|
if (storageLayout_ & dslZAngle) { |
183 |
|
} |
184 |
|
|
185 |
|
if (storageLayout_ & dslPosition) { |
186 |
< |
interalCopy(position, source, num, target); |
186 |
> |
internalCopy(position, source, num, target); |
187 |
|
} |
188 |
|
|
189 |
|
if (storageLayout_ & dslVelocity) { |
190 |
< |
interalCopy(velocity, source, num, target); |
190 |
> |
internalCopy(velocity, source, num, target); |
191 |
|
} |
192 |
|
|
193 |
|
if (storageLayout_ & dslAmat) { |
194 |
< |
interalCopy(aMat, source, num, target); |
194 |
> |
internalCopy(aMat, source, num, target); |
195 |
|
} |
196 |
|
|
197 |
|
if (storageLayout_ & dslAngularMomentum) { |
198 |
< |
interalCopy(angularMomentum, source, num, target); |
198 |
> |
internalCopy(angularMomentum, source, num, target); |
199 |
|
} |
200 |
|
|
201 |
< |
if (storageLayout_ & dslUnitVector) { |
202 |
< |
interalCopy(unitVector, source, num, target); |
201 |
> |
if (storageLayout_ & dslElectroFrame) { |
202 |
> |
internalCopy(electroFrame, source, num, target); |
203 |
|
} |
204 |
|
|
205 |
|
if (storageLayout_ & dslZAngle) { |
206 |
< |
interalCopy(zAngle, source, num, target); |
206 |
> |
internalCopy(zAngle, source, num, target); |
207 |
|
} |
208 |
|
|
209 |
|
if (storageLayout_ & dslForce) { |
210 |
< |
interalCopy(force, source, num, target); |
210 |
> |
internalCopy(force, source, num, target); |
211 |
|
} |
212 |
|
|
213 |
|
if (storageLayout_ & dslTorque) { |
214 |
< |
interalCopy(torque, source, num, target); |
214 |
> |
internalCopy(torque, source, num, target); |
215 |
|
} |
216 |
|
|
217 |
|
|
230 |
|
|
231 |
|
switch (whichArray) { |
232 |
|
case dslPosition: |
233 |
< |
return internalGetArrayPointer(torque); |
233 |
> |
return internalGetArrayPointer(position); |
234 |
|
break; |
235 |
|
|
236 |
|
case dslVelocity: |
245 |
|
return internalGetArrayPointer(angularMomentum); |
246 |
|
break; |
247 |
|
|
248 |
< |
case dslUnitVector: |
249 |
< |
return internalGetArrayPointer(unitVector); |
248 |
> |
case dslElectroFrame: |
249 |
> |
return internalGetArrayPointer(electroFrame); |
250 |
|
break; |
251 |
|
|
252 |
|
case dslZAngle: |
311 |
|
} |
312 |
|
|
313 |
|
template<typename T> |
314 |
< |
void DataStorage::interalCopy(std::vector<T>& v, int source, int num, int target) { |
314 |
> |
void DataStorage::internalCopy(std::vector<T>& v, int source, int num, int target) { |
315 |
|
typename std::vector<T>::iterator first; |
316 |
|
typename std::vector<T>::iterator last; |
317 |
|
typename std::vector<T>::iterator result; |