source: src/molecule_template.hpp@ d3347e

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 d3347e was 9879f6, checked in by Frederik Heber <heber@…>, 15 years ago

Huge Refactoring due to class molecule now being an STL container.

  • molecule::start and molecule::end were dropped. Hence, the usual construct Walker = start while (Walker->next != end) {

Walker = walker->next
...

}
was changed to
for (molecule::iterator iter = begin(); iter != end(); ++iter) {

...

}
and (*iter) used instead of Walker.

  • Two build errors remain (beside some more in folder Actions, Patterns and unittest) in molecule_pointcloud.cpp and molecule.cpp
  • lists.cpp was deleted as specialization of atom* was not needed anymore
  • link, unlink, add, remove, removewithoutcheck all are not needed for atoms anymore, just for bonds (where first, last entries remain in molecule)
  • CreateFatherLookupTable() was put back into class molecule.
  • molecule::InternalPointer is now an iterator
  • class PointCloud: GoToPrevious() and GetTerminalPoint() were dropped as not needed.
  • some new STL functions in class molecule: size(), empty(), erase(), find() and insert()
  • Property mode set to 100644
File size: 15.9 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 {
[9879f6]26 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
27 (((*iter)->node)->*f)();
[e9f8f9]28 }
29};
[49f802c]30template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() const ) const
31 {
[9879f6]32 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
33 (((*iter)->node)->*f)();
[49f802c]34 }
35};
[e9f8f9]36// one argument
37template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
38{
[9879f6]39 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
40 (((*iter)->node)->*f)(t);
[e9f8f9]41 }
42};
[49f802c]43template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
44{
[9879f6]45 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
46 (((*iter)->node)->*f)(t);
[49f802c]47 }
48};
[e9f8f9]49// two arguments
50template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
51{
[9879f6]52 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
53 (((*iter)->node)->*f)(t, u);
[e9f8f9]54 }
55};
[49f802c]56template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
57{
[9879f6]58 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
59 (((*iter)->node)->*f)(t, u);
[49f802c]60 }
61};
[e9f8f9]62// three arguments
63template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const
64{
[9879f6]65 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
66 (((*iter)->node)->*f)(t, u, v);
[e9f8f9]67 }
68};
[49f802c]69template <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
70{
[9879f6]71 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
72 (((*iter)->node)->*f)(t, u, v);
[49f802c]73 }
74};
[e9f8f9]75
[266237]76// ========================= Summing over each Atoms =================================== //
77
78// zero arguments
[4455f4]79template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) const
[266237]80{
81 res result = 0;
[9879f6]82 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
83 result += ((*iter)->*f)();
[266237]84 }
85 return result;
86};
[4455f4]87template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() const ) const
[266237]88{
89 res result = 0;
[9879f6]90 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
91 result += ((*iter)->*f)();
[266237]92 }
93 return result;
94};
95// one argument
[4455f4]96template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) const
[266237]97{
98 res result = 0;
[9879f6]99 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
100 result += ((*iter)->*f)(t);
[266237]101 }
102 return result;
103};
[4455f4]104template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) const
[266237]105{
106 res result = 0;
[9879f6]107 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
108 result += ((*iter)->*f)(t);
[266237]109 }
110 return result;
111};
112
113
[e9f8f9]114// ================== Acting with each Atoms on same molecule ========================== //
115
116// zero arguments
117template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const
118{
[9879f6]119 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
120 (*f)((*iter));
[e9f8f9]121 }
122};
[49f802c]123template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const
124{
[9879f6]125 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
126 (*f)((*iter));
[49f802c]127 }
128};
[e9f8f9]129
130// ================== Acting with each Atoms on copy molecule ========================== //
131
132// zero arguments
[b453f9]133template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
[e9f8f9]134{
[9879f6]135 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
136 (copy->*f)((*iter));
[e9f8f9]137 }
138};
[b453f9]139template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
[e9f8f9]140{
[9879f6]141 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
142 (copy->*f)((*iter));
[e9f8f9]143 }
144};
[b453f9]145
146// ================== Acting with each Atoms on copy molecule if true ========================== //
147
148// zero arguments
149template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const
[e9f8f9]150{
[9879f6]151 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
152 if (((*iter)->*condition)())
153 (copy->*f)((*iter));
[e9f8f9]154 }
155};
[b453f9]156template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const
[49f802c]157{
[9879f6]158 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
159 if (((*iter)->*condition)())
160 (copy->*f)((*iter));
[49f802c]161 }
162};
[b453f9]163template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const
[e9f8f9]164{
[9879f6]165 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
166 if (((*iter)->*condition)())
167 (copy->*f)((*iter));
[e9f8f9]168 }
169};
[b453f9]170template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) () const ) const
[e9f8f9]171{
[9879f6]172 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
173 if (((*iter)->*condition)())
174 (copy->*f)((*iter));
[e9f8f9]175 }
176};
[b453f9]177// one argument
178template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const
[e9f8f9]179{
[9879f6]180 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
181 if (((*iter)->*condition)(t))
182 (copy->*f)((*iter));
[e9f8f9]183 }
184};
[b453f9]185template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const
[e9f8f9]186{
[9879f6]187 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
188 if (((*iter)->*condition)(t))
189 (copy->*f)((*iter));
[e9f8f9]190 }
191};
[b453f9]192template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T), T t ) const
[e9f8f9]193{
[9879f6]194 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
195 if (((*iter)->*condition)(t))
196 (copy->*f)((*iter));
[e9f8f9]197 }
198};
[b453f9]199template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T) const, T t ) const
[e9f8f9]200{
[9879f6]201 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
202 if (((*iter)->*condition)(t))
203 (copy->*f)((*iter));
[e9f8f9]204 }
205};
[b453f9]206// two arguments
207template <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]208{
[9879f6]209 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
210 if (((*iter)->*condition)(t,u))
211 (copy->*f)((*iter));
[e9f8f9]212 }
213};
[b453f9]214template <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]215{
[9879f6]216 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
217 if (((*iter)->*condition)(t,u))
218 (copy->*f)((*iter));
[49f802c]219 }
220};
[b453f9]221template <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]222{
[9879f6]223 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
224 if (((*iter)->*condition)(t,u))
225 (copy->*f)((*iter));
[e9f8f9]226 }
227};
[b453f9]228template <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]229{
[9879f6]230 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
231 if (((*iter)->*condition)(t,u))
232 (copy->*f)((*iter));
[e9f8f9]233 }
234};
[b453f9]235// three arguments
236template <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]237{
[9879f6]238 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
239 if (((*iter)->*condition)(t,u,v))
240 (copy->*f)((*iter));
[49f802c]241 }
242};
[b453f9]243template <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]244{
[9879f6]245 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
246 if (((*iter)->*condition)(t,u,v))
247 (copy->*f)((*iter));
[e9f8f9]248 }
249};
[b453f9]250template <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]251{
[9879f6]252 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
253 if (((*iter)->*condition)(t,u,v))
254 (copy->*f)((*iter));
[e9f8f9]255 }
256};
[b453f9]257template <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]258{
[9879f6]259 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
260 if (((*iter)->*condition)(t,u,v))
261 (copy->*f)((*iter));
[e9f8f9]262 }
263};
[b453f9]264
265// ================== Acting on all Atoms ========================== //
266
267// zero arguments
268template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const
[e9f8f9]269{
[9879f6]270 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
271 ((*iter)->*f)();
[e9f8f9]272 }
273};
[b453f9]274template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const
[49f802c]275{
[9879f6]276 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
277 ((*iter)->*f)();
[49f802c]278 }
279};
[b453f9]280// one argument
281template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const
[e9f8f9]282{
[9879f6]283 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
284 ((*iter)->*f)(t);
[e9f8f9]285 }
286};
[b453f9]287template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const
[e9f8f9]288{
[9879f6]289 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
290 ((*iter)->*f)(t);
[e9f8f9]291 }
292};
[b453f9]293// two argument
294template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const
[e9f8f9]295{
[9879f6]296 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
297 ((*iter)->*f)(t, u);
[e9f8f9]298 }
299};
[b453f9]300template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const
[49f802c]301{
[9879f6]302 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
303 ((*iter)->*f)(t, u);
[49f802c]304 }
305};
[b453f9]306// three argument
307template <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]308{
[9879f6]309 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
310 ((*iter)->*f)(t, u, v);
[e9f8f9]311 }
312};
[b453f9]313template <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]314{
[9879f6]315 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
316 ((*iter)->*f)(t, u, v);
[e9f8f9]317 }
318};
[b453f9]319// four arguments
[4455f4]320template <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]321{
[9879f6]322 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
323 ((*iter)->*f)(t, u, v, w);
[e9f8f9]324 }
325};
[4455f4]326template <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]327{
[9879f6]328 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
329 ((*iter)->*f)(t, u, v, w);
[49f802c]330 }
331};
[e9f8f9]332
[4a7776a]333// ===================== Accessing arrays indexed by some integer for each atom ======================
[e9f8f9]334
335// for atom ints
[b453f9]336template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const
[e9f8f9]337{
[5034e1]338 int inc = 1;
[9879f6]339 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
340 (*Setor) (&array[((*iter)->*index)], &inc);
[e9f8f9]341 }
342};
[b453f9]343template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const
[5034e1]344{
[9879f6]345 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
346 (*Setor) (&array[((*iter)->*index)], &value);
[5034e1]347 }
348};
[b453f9]349template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const
[e9f8f9]350{
[9879f6]351 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
352 (*Setor) (&array[((*iter)->*index)], value);
[e9f8f9]353 }
354};
[4455f4]355// for element ints
[b453f9]356template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const
[e9f8f9]357{
[5034e1]358 int inc = 1;
[9879f6]359 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
360 (*Setor) (&array[((*iter)->type->*index)], &inc);
[e9f8f9]361 }
362};
[b453f9]363template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const
[5034e1]364{
[9879f6]365 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
366 (*Setor) (&array[((*iter)->type->*index)], &value);
[5034e1]367 }
368};
[b453f9]369template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const
[e9f8f9]370{
[9879f6]371 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
372 (*Setor) (&array[((*iter)->type->*index)], value);
[e9f8f9]373 }
374};
[4455f4]375
[b453f9]376template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const
377{
[9879f6]378 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
379 array[((*iter)->*index)] = ((*iter)->*Setor) ((*iter)->*value);
[b453f9]380 }
381};
382template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value ) const
[49f802c]383{
[9879f6]384 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
385 array[((*iter)->*index)] = ((*iter)->*Setor) ((*iter)->*value);
[49f802c]386 }
387};
[b453f9]388template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const
[49f802c]389{
[9879f6]390 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
391 array[((*iter)->*index)] = ((*iter)->*Setor) (vect);
[49f802c]392 }
393};
[b453f9]394template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const
395{
[9879f6]396 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
397 array[((*iter)->*index)] = ((*iter)->*Setor) (vect);
[b453f9]398 }
399};
400template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const
[5034e1]401{
[9879f6]402 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
403 (*iter)->*value = array[((*iter)->*index)];
404 //Log() << Verbose(2) << *(*iter) << " gets " << ((*iter)->*value); << endl;
[5034e1]405 }
406};
407
[b453f9]408template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) const
[df8b19]409{
[9879f6]410 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
411 (*iter)->*ptr = value;
412 //Log() << Verbose(2) << *(*iter) << " gets " << ((*iter)->*ptr) << endl;
[df8b19]413 }
414};
415
[5034e1]416
[e9f8f9]417#endif /* MOLECULE_TEMPLATE_HPP_ */
Note: See TracBrowser for help on using the repository browser.