source: src/molecule_template.hpp@ 36166d

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 36166d was a7b761b, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Merge branch 'MoleculeStartEndSwitch' into StructureRefactoring

Conflicts:

molecuilder/src/Helpers/Assert.cpp
molecuilder/src/Helpers/Assert.hpp
molecuilder/src/Legacy/oldmenu.cpp
molecuilder/src/Makefile.am
molecuilder/src/Patterns/Cacheable.hpp
molecuilder/src/Patterns/Observer.cpp
molecuilder/src/Patterns/Observer.hpp
molecuilder/src/analysis_correlation.cpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule.hpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/ObserverTest.cpp
molecuilder/src/unittests/ObserverTest.hpp

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