1 | /*
|
---|
2 | * molecule_template.hpp
|
---|
3 | *
|
---|
4 | * Created on: Oct 6, 2009
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef MOLECULE_TEMPLATE_HPP_
|
---|
9 | #define MOLECULE_TEMPLATE_HPP_
|
---|
10 |
|
---|
11 | /*********************************************** includes ***********************************/
|
---|
12 |
|
---|
13 | // include config.h
|
---|
14 | #ifdef HAVE_CONFIG_H
|
---|
15 | #include <config.h>
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | /********************************************** declarations *******************************/
|
---|
19 |
|
---|
20 | // ================== Acting on all Vectors ========================== //
|
---|
21 |
|
---|
22 | // zero arguments
|
---|
23 | template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const
|
---|
24 | {
|
---|
25 | atom *Walker = start;
|
---|
26 | while (Walker->next != end) {
|
---|
27 | Walker = Walker->next;
|
---|
28 | ((Walker->node)->*f)();
|
---|
29 | }
|
---|
30 | };
|
---|
31 | template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() const ) const
|
---|
32 | {
|
---|
33 | atom *Walker = start;
|
---|
34 | while (Walker->next != end) {
|
---|
35 | Walker = Walker->next;
|
---|
36 | ((Walker->node)->*f)();
|
---|
37 | }
|
---|
38 | };
|
---|
39 | // one argument
|
---|
40 | template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
|
---|
41 | {
|
---|
42 | atom *Walker = start;
|
---|
43 | while (Walker->next != end) {
|
---|
44 | Walker = Walker->next;
|
---|
45 | ((Walker->node)->*f)(t);
|
---|
46 | }
|
---|
47 | };
|
---|
48 | template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
|
---|
49 | {
|
---|
50 | atom *Walker = start;
|
---|
51 | while (Walker->next != end) {
|
---|
52 | Walker = Walker->next;
|
---|
53 | ((Walker->node)->*f)(t);
|
---|
54 | }
|
---|
55 | };
|
---|
56 | // two arguments
|
---|
57 | template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
|
---|
58 | {
|
---|
59 | atom *Walker = start;
|
---|
60 | while (Walker->next != end) {
|
---|
61 | Walker = Walker->next;
|
---|
62 | ((Walker->node)->*f)(t, u);
|
---|
63 | }
|
---|
64 | };
|
---|
65 | template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
|
---|
66 | {
|
---|
67 | atom *Walker = start;
|
---|
68 | while (Walker->next != end) {
|
---|
69 | Walker = Walker->next;
|
---|
70 | ((Walker->node)->*f)(t, u);
|
---|
71 | }
|
---|
72 | };
|
---|
73 | // three arguments
|
---|
74 | template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const
|
---|
75 | {
|
---|
76 | atom *Walker = start;
|
---|
77 | while (Walker->next != end) {
|
---|
78 | Walker = Walker->next;
|
---|
79 | ((Walker->node)->*f)(t, u, v);
|
---|
80 | }
|
---|
81 | };
|
---|
82 | template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const
|
---|
83 | {
|
---|
84 | atom *Walker = start;
|
---|
85 | while (Walker->next != end) {
|
---|
86 | Walker = Walker->next;
|
---|
87 | ((Walker->node)->*f)(t, u, v);
|
---|
88 | }
|
---|
89 | };
|
---|
90 |
|
---|
91 | // ========================= Summing over each Atoms =================================== //
|
---|
92 |
|
---|
93 | // zero arguments
|
---|
94 | template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) const
|
---|
95 | {
|
---|
96 | res result = 0;
|
---|
97 | atom *Walker = start;
|
---|
98 | while (Walker->next != end) {
|
---|
99 | Walker = Walker->next;
|
---|
100 | result += (Walker->*f)();
|
---|
101 | }
|
---|
102 | return result;
|
---|
103 | };
|
---|
104 | template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() const ) const
|
---|
105 | {
|
---|
106 | res result = 0;
|
---|
107 | atom *Walker = start;
|
---|
108 | while (Walker->next != end) {
|
---|
109 | Walker = Walker->next;
|
---|
110 | result += (Walker->*f)();
|
---|
111 | }
|
---|
112 | return result;
|
---|
113 | };
|
---|
114 | // one argument
|
---|
115 | template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) const
|
---|
116 | {
|
---|
117 | res result = 0;
|
---|
118 | atom *Walker = start;
|
---|
119 | while (Walker->next != end) {
|
---|
120 | Walker = Walker->next;
|
---|
121 | result += (Walker->*f)(t);
|
---|
122 | }
|
---|
123 | return result;
|
---|
124 | };
|
---|
125 | template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) const
|
---|
126 | {
|
---|
127 | res result = 0;
|
---|
128 | atom *Walker = start;
|
---|
129 | while (Walker->next != end) {
|
---|
130 | Walker = Walker->next;
|
---|
131 | result += (Walker->*f)(t);
|
---|
132 | }
|
---|
133 | return result;
|
---|
134 | };
|
---|
135 |
|
---|
136 |
|
---|
137 | // ================== Acting with each Atoms on same molecule ========================== //
|
---|
138 |
|
---|
139 | // zero arguments
|
---|
140 | template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const
|
---|
141 | {
|
---|
142 | atom *Walker = start;
|
---|
143 | while (Walker->next != end) {
|
---|
144 | Walker = Walker->next;
|
---|
145 | (*f)(Walker);
|
---|
146 | }
|
---|
147 | };
|
---|
148 | template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const
|
---|
149 | {
|
---|
150 | atom *Walker = start;
|
---|
151 | while (Walker->next != end) {
|
---|
152 | Walker = Walker->next;
|
---|
153 | (*f)(Walker);
|
---|
154 | }
|
---|
155 | };
|
---|
156 |
|
---|
157 | // ================== Acting with each Atoms on copy molecule ========================== //
|
---|
158 |
|
---|
159 | // zero arguments
|
---|
160 | template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
|
---|
161 | {
|
---|
162 | atom *Walker = start;
|
---|
163 | while (Walker->next != end) {
|
---|
164 | Walker = Walker->next;
|
---|
165 | (copy->*f)(Walker);
|
---|
166 | }
|
---|
167 | };
|
---|
168 | template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
|
---|
169 | {
|
---|
170 | atom *Walker = start;
|
---|
171 | while (Walker->next != end) {
|
---|
172 | Walker = Walker->next;
|
---|
173 | (copy->*f)(Walker);
|
---|
174 | }
|
---|
175 | };
|
---|
176 |
|
---|
177 | // ================== Acting with each Atoms on copy molecule if true ========================== //
|
---|
178 |
|
---|
179 | // zero arguments
|
---|
180 | template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const
|
---|
181 | {
|
---|
182 | atom *Walker = start;
|
---|
183 | while (Walker->next != end) {
|
---|
184 | Walker = Walker->next;
|
---|
185 | if ((Walker->*condition)())
|
---|
186 | (copy->*f)(Walker);
|
---|
187 | }
|
---|
188 | };
|
---|
189 | template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const
|
---|
190 | {
|
---|
191 | atom *Walker = start;
|
---|
192 | while (Walker->next != end) {
|
---|
193 | Walker = Walker->next;
|
---|
194 | if ((Walker->*condition)())
|
---|
195 | (copy->*f)(Walker);
|
---|
196 | }
|
---|
197 | };
|
---|
198 | template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const
|
---|
199 | {
|
---|
200 | atom *Walker = start;
|
---|
201 | while (Walker->next != end) {
|
---|
202 | Walker = Walker->next;
|
---|
203 | if ((Walker->*condition)())
|
---|
204 | (copy->*f)(Walker);
|
---|
205 | }
|
---|
206 | };
|
---|
207 | template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) () const ) const
|
---|
208 | {
|
---|
209 | atom *Walker = start;
|
---|
210 | while (Walker->next != end) {
|
---|
211 | Walker = Walker->next;
|
---|
212 | if ((Walker->*condition)())
|
---|
213 | (copy->*f)(Walker);
|
---|
214 | }
|
---|
215 | };
|
---|
216 | // one argument
|
---|
217 | template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const
|
---|
218 | {
|
---|
219 | atom *Walker = start;
|
---|
220 | while (Walker->next != end) {
|
---|
221 | Walker = Walker->next;
|
---|
222 | if ((Walker->*condition)(t))
|
---|
223 | (copy->*f)(Walker);
|
---|
224 | }
|
---|
225 | };
|
---|
226 | template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const
|
---|
227 | {
|
---|
228 | atom *Walker = start;
|
---|
229 | while (Walker->next != end) {
|
---|
230 | Walker = Walker->next;
|
---|
231 | if ((Walker->*condition)(t))
|
---|
232 | (copy->*f)(Walker);
|
---|
233 | }
|
---|
234 | };
|
---|
235 | template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T), T t ) const
|
---|
236 | {
|
---|
237 | atom *Walker = start;
|
---|
238 | while (Walker->next != end) {
|
---|
239 | Walker = Walker->next;
|
---|
240 | if ((Walker->*condition)(t))
|
---|
241 | (copy->*f)(Walker);
|
---|
242 | }
|
---|
243 | };
|
---|
244 | template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T) const, T t ) const
|
---|
245 | {
|
---|
246 | atom *Walker = start;
|
---|
247 | while (Walker->next != end) {
|
---|
248 | Walker = Walker->next;
|
---|
249 | if ((Walker->*condition)(t))
|
---|
250 | (copy->*f)(Walker);
|
---|
251 | }
|
---|
252 | };
|
---|
253 | // two arguments
|
---|
254 | template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const
|
---|
255 | {
|
---|
256 | atom *Walker = start;
|
---|
257 | while (Walker->next != end) {
|
---|
258 | Walker = Walker->next;
|
---|
259 | if ((Walker->*condition)(t,u))
|
---|
260 | (copy->*f)(Walker);
|
---|
261 | }
|
---|
262 | };
|
---|
263 | template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const
|
---|
264 | {
|
---|
265 | atom *Walker = start;
|
---|
266 | while (Walker->next != end) {
|
---|
267 | Walker = Walker->next;
|
---|
268 | if ((Walker->*condition)(t,u))
|
---|
269 | (copy->*f)(Walker);
|
---|
270 | }
|
---|
271 | };
|
---|
272 | template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const
|
---|
273 | {
|
---|
274 | atom *Walker = start;
|
---|
275 | while (Walker->next != end) {
|
---|
276 | Walker = Walker->next;
|
---|
277 | if ((Walker->*condition)(t,u))
|
---|
278 | (copy->*f)(Walker);
|
---|
279 | }
|
---|
280 | };
|
---|
281 | template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const
|
---|
282 | {
|
---|
283 | atom *Walker = start;
|
---|
284 | while (Walker->next != end) {
|
---|
285 | Walker = Walker->next;
|
---|
286 | if ((Walker->*condition)(t,u))
|
---|
287 | (copy->*f)(Walker);
|
---|
288 | }
|
---|
289 | };
|
---|
290 | // three arguments
|
---|
291 | template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const
|
---|
292 | {
|
---|
293 | atom *Walker = start;
|
---|
294 | while (Walker->next != end) {
|
---|
295 | Walker = Walker->next;
|
---|
296 | if ((Walker->*condition)(t,u,v))
|
---|
297 | (copy->*f)(Walker);
|
---|
298 | }
|
---|
299 | };
|
---|
300 | template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const
|
---|
301 | {
|
---|
302 | atom *Walker = start;
|
---|
303 | while (Walker->next != end) {
|
---|
304 | Walker = Walker->next;
|
---|
305 | if ((Walker->*condition)(t,u,v))
|
---|
306 | (copy->*f)(Walker);
|
---|
307 | }
|
---|
308 | };
|
---|
309 | template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const
|
---|
310 | {
|
---|
311 | atom *Walker = start;
|
---|
312 | while (Walker->next != end) {
|
---|
313 | Walker = Walker->next;
|
---|
314 | if ((Walker->*condition)(t,u,v))
|
---|
315 | (copy->*f)(Walker);
|
---|
316 | }
|
---|
317 | };
|
---|
318 | template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const
|
---|
319 | {
|
---|
320 | atom *Walker = start;
|
---|
321 | while (Walker->next != end) {
|
---|
322 | Walker = Walker->next;
|
---|
323 | if ((Walker->*condition)(t,u,v))
|
---|
324 | (copy->*f)(Walker);
|
---|
325 | }
|
---|
326 | };
|
---|
327 |
|
---|
328 | // ================== Acting on all Atoms ========================== //
|
---|
329 |
|
---|
330 | // zero arguments
|
---|
331 | template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const
|
---|
332 | {
|
---|
333 | atom *Walker = start;
|
---|
334 | while (Walker->next != end) {
|
---|
335 | Walker = Walker->next;
|
---|
336 | (Walker->*f)();
|
---|
337 | }
|
---|
338 | };
|
---|
339 | template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const
|
---|
340 | {
|
---|
341 | atom *Walker = start;
|
---|
342 | while (Walker->next != end) {
|
---|
343 | Walker = Walker->next;
|
---|
344 | (Walker->*f)();
|
---|
345 | }
|
---|
346 | };
|
---|
347 | // one argument
|
---|
348 | template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const
|
---|
349 | {
|
---|
350 | atom *Walker = start;
|
---|
351 | while (Walker->next != end) {
|
---|
352 | Walker = Walker->next;
|
---|
353 | (Walker->*f)(t);
|
---|
354 | }
|
---|
355 | };
|
---|
356 | template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const
|
---|
357 | {
|
---|
358 | atom *Walker = start;
|
---|
359 | while (Walker->next != end) {
|
---|
360 | Walker = Walker->next;
|
---|
361 | (Walker->*f)(t);
|
---|
362 | }
|
---|
363 | };
|
---|
364 | // two argument
|
---|
365 | template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const
|
---|
366 | {
|
---|
367 | atom *Walker = start;
|
---|
368 | while (Walker->next != end) {
|
---|
369 | Walker = Walker->next;
|
---|
370 | (Walker->*f)(t, u);
|
---|
371 | }
|
---|
372 | };
|
---|
373 | template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const
|
---|
374 | {
|
---|
375 | atom *Walker = start;
|
---|
376 | while (Walker->next != end) {
|
---|
377 | Walker = Walker->next;
|
---|
378 | (Walker->*f)(t, u);
|
---|
379 | }
|
---|
380 | };
|
---|
381 | // three argument
|
---|
382 | template <typename res, typename typ, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V), T t, U u, V v) const
|
---|
383 | {
|
---|
384 | atom *Walker = start;
|
---|
385 | while (Walker->next != end) {
|
---|
386 | Walker = Walker->next;
|
---|
387 | (Walker->*f)(t, u, v);
|
---|
388 | }
|
---|
389 | };
|
---|
390 | template <typename res, typename typ, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V) const, T t, U u, V v) const
|
---|
391 | {
|
---|
392 | atom *Walker = start;
|
---|
393 | while (Walker->next != end) {
|
---|
394 | Walker = Walker->next;
|
---|
395 | (Walker->*f)(t, u, v);
|
---|
396 | }
|
---|
397 | };
|
---|
398 | // four arguments
|
---|
399 | template <typename res, typename typ, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V, W), T t, U u, V v, W w) const
|
---|
400 | {
|
---|
401 | atom *Walker = start;
|
---|
402 | while (Walker->next != end) {
|
---|
403 | Walker = Walker->next;
|
---|
404 | (Walker->*f)(t, u, v, w);
|
---|
405 | }
|
---|
406 | };
|
---|
407 | template <typename res, typename typ, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V, W) const, T t, U u, V v, W w) const
|
---|
408 | {
|
---|
409 | atom *Walker = start;
|
---|
410 | while (Walker->next != end) {
|
---|
411 | Walker = Walker->next;
|
---|
412 | (Walker->*f)(t, u, v, w);
|
---|
413 | }
|
---|
414 | };
|
---|
415 |
|
---|
416 | // ===================== Accessing arrays indexed by some integer for each atom ======================
|
---|
417 |
|
---|
418 | // for atom ints
|
---|
419 | template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const
|
---|
420 | {
|
---|
421 | atom *Walker = start;
|
---|
422 | int inc = 1;
|
---|
423 | while (Walker->next != end) {
|
---|
424 | Walker = Walker->next;
|
---|
425 | (*Setor) (&array[(Walker->*index)], &inc);
|
---|
426 | }
|
---|
427 | };
|
---|
428 | template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const
|
---|
429 | {
|
---|
430 | atom *Walker = start;
|
---|
431 | while (Walker->next != end) {
|
---|
432 | Walker = Walker->next;
|
---|
433 | (*Setor) (&array[(Walker->*index)], &value);
|
---|
434 | }
|
---|
435 | };
|
---|
436 | template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const
|
---|
437 | {
|
---|
438 | atom *Walker = start;
|
---|
439 | while (Walker->next != end) {
|
---|
440 | Walker = Walker->next;
|
---|
441 | (*Setor) (&array[(Walker->*index)], value);
|
---|
442 | }
|
---|
443 | };
|
---|
444 | // for element ints
|
---|
445 | template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const
|
---|
446 | {
|
---|
447 | atom *Walker = start;
|
---|
448 | int inc = 1;
|
---|
449 | while (Walker->next != end) {
|
---|
450 | Walker = Walker->next;
|
---|
451 | (*Setor) (&array[(Walker->type->*index)], &inc);
|
---|
452 | }
|
---|
453 | };
|
---|
454 | template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const
|
---|
455 | {
|
---|
456 | atom *Walker = start;
|
---|
457 | while (Walker->next != end) {
|
---|
458 | Walker = Walker->next;
|
---|
459 | (*Setor) (&array[(Walker->type->*index)], &value);
|
---|
460 | }
|
---|
461 | };
|
---|
462 | template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const
|
---|
463 | {
|
---|
464 | atom *Walker = start;
|
---|
465 | while (Walker->next != end) {
|
---|
466 | Walker = Walker->next;
|
---|
467 | (*Setor) (&array[(Walker->type->*index)], value);
|
---|
468 | }
|
---|
469 | };
|
---|
470 |
|
---|
471 | template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const
|
---|
472 | {
|
---|
473 | atom *Walker = start;
|
---|
474 | while (Walker->next != end) {
|
---|
475 | Walker = Walker->next;
|
---|
476 | array[(Walker->*index)] = (Walker->*Setor) (Walker->*value);
|
---|
477 | }
|
---|
478 | };
|
---|
479 | template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value ) const
|
---|
480 | {
|
---|
481 | atom *Walker = start;
|
---|
482 | while (Walker->next != end) {
|
---|
483 | Walker = Walker->next;
|
---|
484 | array[(Walker->*index)] = (Walker->*Setor) (Walker->*value);
|
---|
485 | }
|
---|
486 | };
|
---|
487 | template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const
|
---|
488 | {
|
---|
489 | atom *Walker = start;
|
---|
490 | while (Walker->next != end) {
|
---|
491 | Walker = Walker->next;
|
---|
492 | array[(Walker->*index)] = (Walker->*Setor) (vect);
|
---|
493 | }
|
---|
494 | };
|
---|
495 | template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const
|
---|
496 | {
|
---|
497 | atom *Walker = start;
|
---|
498 | while (Walker->next != end) {
|
---|
499 | Walker = Walker->next;
|
---|
500 | array[(Walker->*index)] = (Walker->*Setor) (vect);
|
---|
501 | }
|
---|
502 | };
|
---|
503 | template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const
|
---|
504 | {
|
---|
505 | atom *Walker = start;
|
---|
506 | while (Walker->next != end) {
|
---|
507 | Walker = Walker->next;
|
---|
508 | Walker->*value = array[(Walker->*index)];
|
---|
509 | //Log() << Verbose(2) << *Walker << " gets " << (Walker->*value); << endl;
|
---|
510 | }
|
---|
511 | };
|
---|
512 |
|
---|
513 | template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) const
|
---|
514 | {
|
---|
515 | atom *Walker = start;
|
---|
516 | while (Walker->next != end) {
|
---|
517 | Walker = Walker->next;
|
---|
518 | Walker->*ptr = value;
|
---|
519 | //Log() << Verbose(2) << *Walker << " gets " << (Walker->*ptr) << endl;
|
---|
520 | }
|
---|
521 | };
|
---|
522 |
|
---|
523 |
|
---|
524 | #endif /* MOLECULE_TEMPLATE_HPP_ */
|
---|