source: src/molecule_template.hpp@ 1fa107

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 1fa107 was e138de, checked in by Frederik Heber <heber@…>, 15 years ago

Huge change from ofstream * (const) out --> Log().

  • first shift was done via regular expressions
  • then via error messages from the code
  • note that class atom, class element and class molecule kept in parts their output stream, was they print to file.
  • make check runs fine
  • MISSING: Verbosity is not fixed for everything (i.e. if no endl; is present and next has Verbose(0) ...)

Signed-off-by: Frederik Heber <heber@…>

  • Property mode set to 100644
File size: 16.3 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
18/********************************************** declarations *******************************/
19
[e9f8f9]20// ================== Acting on all Vectors ========================== //
21
22// zero arguments
23template <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};
[49f802c]31template <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};
[e9f8f9]39// one argument
40template <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};
[49f802c]48template <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};
[e9f8f9]56// two arguments
57template <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};
[49f802c]65template <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};
[e9f8f9]73// three arguments
74template <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};
[49f802c]82template <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};
[e9f8f9]90
[266237]91// ========================= Summing over each Atoms =================================== //
92
93// zero arguments
[4455f4]94template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) const
[266237]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};
[4455f4]104template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() const ) const
[266237]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
[4455f4]115template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) const
[266237]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};
[4455f4]125template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) const
[266237]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
[e9f8f9]137// ================== Acting with each Atoms on same molecule ========================== //
138
139// zero arguments
140template <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};
[49f802c]148template <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};
[e9f8f9]156
157// ================== Acting with each Atoms on copy molecule ========================== //
158
159// zero arguments
[b453f9]160template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
[e9f8f9]161{
162 atom *Walker = start;
163 while (Walker->next != end) {
164 Walker = Walker->next;
165 (copy->*f)(Walker);
166 }
167};
[b453f9]168template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
[e9f8f9]169{
170 atom *Walker = start;
171 while (Walker->next != end) {
172 Walker = Walker->next;
173 (copy->*f)(Walker);
174 }
175};
[b453f9]176
177// ================== Acting with each Atoms on copy molecule if true ========================== //
178
179// zero arguments
180template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const
[e9f8f9]181{
182 atom *Walker = start;
183 while (Walker->next != end) {
184 Walker = Walker->next;
[b453f9]185 if ((Walker->*condition)())
186 (copy->*f)(Walker);
[e9f8f9]187 }
188};
[b453f9]189template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const
[49f802c]190{
191 atom *Walker = start;
192 while (Walker->next != end) {
193 Walker = Walker->next;
[b453f9]194 if ((Walker->*condition)())
195 (copy->*f)(Walker);
[49f802c]196 }
197};
[b453f9]198template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const
[e9f8f9]199{
200 atom *Walker = start;
201 while (Walker->next != end) {
202 Walker = Walker->next;
203 if ((Walker->*condition)())
204 (copy->*f)(Walker);
205 }
206};
[b453f9]207template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) () const ) const
[e9f8f9]208{
209 atom *Walker = start;
210 while (Walker->next != end) {
211 Walker = Walker->next;
[b453f9]212 if ((Walker->*condition)())
[e9f8f9]213 (copy->*f)(Walker);
214 }
215};
[b453f9]216// one argument
217template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const
[e9f8f9]218{
219 atom *Walker = start;
220 while (Walker->next != end) {
221 Walker = Walker->next;
[b453f9]222 if ((Walker->*condition)(t))
[e9f8f9]223 (copy->*f)(Walker);
224 }
225};
[b453f9]226template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const
[e9f8f9]227{
228 atom *Walker = start;
229 while (Walker->next != end) {
230 Walker = Walker->next;
[b453f9]231 if ((Walker->*condition)(t))
[e9f8f9]232 (copy->*f)(Walker);
233 }
234};
[b453f9]235template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T), T t ) const
[e9f8f9]236{
237 atom *Walker = start;
238 while (Walker->next != end) {
239 Walker = Walker->next;
[b453f9]240 if ((Walker->*condition)(t))
241 (copy->*f)(Walker);
[e9f8f9]242 }
243};
[b453f9]244template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T) const, T t ) const
[e9f8f9]245{
246 atom *Walker = start;
247 while (Walker->next != end) {
248 Walker = Walker->next;
[b453f9]249 if ((Walker->*condition)(t))
250 (copy->*f)(Walker);
[e9f8f9]251 }
252};
[b453f9]253// two arguments
254template <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]255{
256 atom *Walker = start;
257 while (Walker->next != end) {
258 Walker = Walker->next;
[b453f9]259 if ((Walker->*condition)(t,u))
260 (copy->*f)(Walker);
[e9f8f9]261 }
262};
[b453f9]263template <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]264{
265 atom *Walker = start;
266 while (Walker->next != end) {
267 Walker = Walker->next;
[b453f9]268 if ((Walker->*condition)(t,u))
269 (copy->*f)(Walker);
[49f802c]270 }
271};
[b453f9]272template <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]273{
274 atom *Walker = start;
275 while (Walker->next != end) {
276 Walker = Walker->next;
[b453f9]277 if ((Walker->*condition)(t,u))
278 (copy->*f)(Walker);
[e9f8f9]279 }
280};
[b453f9]281template <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]282{
283 atom *Walker = start;
284 while (Walker->next != end) {
285 Walker = Walker->next;
[b453f9]286 if ((Walker->*condition)(t,u))
287 (copy->*f)(Walker);
[e9f8f9]288 }
289};
[b453f9]290// three arguments
291template <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]292{
293 atom *Walker = start;
294 while (Walker->next != end) {
295 Walker = Walker->next;
[b453f9]296 if ((Walker->*condition)(t,u,v))
297 (copy->*f)(Walker);
[49f802c]298 }
299};
[b453f9]300template <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]301{
302 atom *Walker = start;
303 while (Walker->next != end) {
304 Walker = Walker->next;
[b453f9]305 if ((Walker->*condition)(t,u,v))
306 (copy->*f)(Walker);
[e9f8f9]307 }
308};
[b453f9]309template <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]310{
311 atom *Walker = start;
312 while (Walker->next != end) {
313 Walker = Walker->next;
[b453f9]314 if ((Walker->*condition)(t,u,v))
315 (copy->*f)(Walker);
[e9f8f9]316 }
317};
[b453f9]318template <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]319{
320 atom *Walker = start;
321 while (Walker->next != end) {
322 Walker = Walker->next;
[b453f9]323 if ((Walker->*condition)(t,u,v))
324 (copy->*f)(Walker);
[e9f8f9]325 }
326};
[b453f9]327
328// ================== Acting on all Atoms ========================== //
329
330// zero arguments
331template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const
[e9f8f9]332{
333 atom *Walker = start;
334 while (Walker->next != end) {
335 Walker = Walker->next;
[b453f9]336 (Walker->*f)();
[e9f8f9]337 }
338};
[b453f9]339template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const
[49f802c]340{
341 atom *Walker = start;
342 while (Walker->next != end) {
343 Walker = Walker->next;
[b453f9]344 (Walker->*f)();
[49f802c]345 }
346};
[b453f9]347// one argument
348template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const
[e9f8f9]349{
350 atom *Walker = start;
351 while (Walker->next != end) {
352 Walker = Walker->next;
[b453f9]353 (Walker->*f)(t);
[e9f8f9]354 }
355};
[b453f9]356template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const
[e9f8f9]357{
358 atom *Walker = start;
359 while (Walker->next != end) {
360 Walker = Walker->next;
[b453f9]361 (Walker->*f)(t);
[e9f8f9]362 }
363};
[b453f9]364// two argument
365template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const
[e9f8f9]366{
367 atom *Walker = start;
368 while (Walker->next != end) {
369 Walker = Walker->next;
[b453f9]370 (Walker->*f)(t, u);
[e9f8f9]371 }
372};
[b453f9]373template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const
[49f802c]374{
375 atom *Walker = start;
376 while (Walker->next != end) {
377 Walker = Walker->next;
[b453f9]378 (Walker->*f)(t, u);
[49f802c]379 }
380};
[b453f9]381// three argument
382template <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]383{
384 atom *Walker = start;
385 while (Walker->next != end) {
386 Walker = Walker->next;
[b453f9]387 (Walker->*f)(t, u, v);
[e9f8f9]388 }
389};
[b453f9]390template <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]391{
392 atom *Walker = start;
393 while (Walker->next != end) {
394 Walker = Walker->next;
[b453f9]395 (Walker->*f)(t, u, v);
[e9f8f9]396 }
397};
[b453f9]398// four arguments
[4455f4]399template <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]400{
401 atom *Walker = start;
402 while (Walker->next != end) {
403 Walker = Walker->next;
404 (Walker->*f)(t, u, v, w);
405 }
406};
[4455f4]407template <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]408{
409 atom *Walker = start;
410 while (Walker->next != end) {
411 Walker = Walker->next;
412 (Walker->*f)(t, u, v, w);
413 }
414};
[e9f8f9]415
[4a7776a]416// ===================== Accessing arrays indexed by some integer for each atom ======================
[e9f8f9]417
418// for atom ints
[b453f9]419template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const
[e9f8f9]420{
421 atom *Walker = start;
[5034e1]422 int inc = 1;
[e9f8f9]423 while (Walker->next != end) {
424 Walker = Walker->next;
[5034e1]425 (*Setor) (&array[(Walker->*index)], &inc);
[e9f8f9]426 }
427};
[b453f9]428template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const
[5034e1]429{
430 atom *Walker = start;
431 while (Walker->next != end) {
432 Walker = Walker->next;
433 (*Setor) (&array[(Walker->*index)], &value);
434 }
435};
[b453f9]436template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const
[e9f8f9]437{
438 atom *Walker = start;
439 while (Walker->next != end) {
440 Walker = Walker->next;
441 (*Setor) (&array[(Walker->*index)], value);
442 }
443};
[4455f4]444// for element ints
[b453f9]445template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const
[e9f8f9]446{
447 atom *Walker = start;
[5034e1]448 int inc = 1;
[e9f8f9]449 while (Walker->next != end) {
450 Walker = Walker->next;
[5034e1]451 (*Setor) (&array[(Walker->type->*index)], &inc);
[e9f8f9]452 }
453};
[b453f9]454template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const
[5034e1]455{
456 atom *Walker = start;
457 while (Walker->next != end) {
458 Walker = Walker->next;
459 (*Setor) (&array[(Walker->type->*index)], &value);
460 }
461};
[b453f9]462template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const
[e9f8f9]463{
464 atom *Walker = start;
465 while (Walker->next != end) {
466 Walker = Walker->next;
467 (*Setor) (&array[(Walker->type->*index)], value);
468 }
469};
[4455f4]470
[b453f9]471template <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};
479template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value ) const
[49f802c]480{
481 atom *Walker = start;
482 while (Walker->next != end) {
483 Walker = Walker->next;
484 array[(Walker->*index)] = (Walker->*Setor) (Walker->*value);
485 }
486};
[b453f9]487template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const
[49f802c]488{
489 atom *Walker = start;
490 while (Walker->next != end) {
491 Walker = Walker->next;
492 array[(Walker->*index)] = (Walker->*Setor) (vect);
493 }
494};
[b453f9]495template <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};
503template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const
[5034e1]504{
505 atom *Walker = start;
506 while (Walker->next != end) {
507 Walker = Walker->next;
508 Walker->*value = array[(Walker->*index)];
[e138de]509 //Log() << Verbose(2) << *Walker << " gets " << (Walker->*value); << endl;
[5034e1]510 }
511};
512
[b453f9]513template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) const
[df8b19]514{
515 atom *Walker = start;
516 while (Walker->next != end) {
517 Walker = Walker->next;
518 Walker->*ptr = value;
[e138de]519 //Log() << Verbose(2) << *Walker << " gets " << (Walker->*ptr) << endl;
[df8b19]520 }
521};
522
[5034e1]523
[e9f8f9]524#endif /* MOLECULE_TEMPLATE_HPP_ */
Note: See TracBrowser for help on using the repository browser.