source: src/molecule_template.hpp@ 2cbe97

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 2cbe97 was 273382, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Prepared interface of Vector Class for transition to VectorComposites

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