Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_template.hpp

    r5034e1 rb453f9  
    2121
    2222// zero arguments
    23 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() )
    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 )
    32 {
    33   atom *Walker = start;
    34   while (Walker->next != end) {
    35     Walker = Walker->next;
    36     ((Walker->node)->*f)();
    37   }
    38 };
    3923template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const
    4024    {
     
    5438};
    5539// one argument
    56 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t )
     40template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
    5741{
    5842  atom *Walker = start;
     
    6246  }
    6347};
    64 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t )
     48template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
    6549{
    6650  atom *Walker = start;
     
    7054  }
    7155};
    72 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
    73 {
    74   atom *Walker = start;
    75   while (Walker->next != end) {
    76     Walker = Walker->next;
    77     ((Walker->node)->*f)(t);
    78   }
    79 };
    80 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
    81 {
    82   atom *Walker = start;
    83   while (Walker->next != end) {
    84     Walker = Walker->next;
    85     ((Walker->node)->*f)(t);
    86   }
    87 };
    8856// two arguments
    89 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u )
     57template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
    9058{
    9159  atom *Walker = start;
     
    9563  }
    9664};
    97 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u )
     65template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
    9866{
    9967  atom *Walker = start;
     
    10371  }
    10472};
    105 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
    106 {
    107   atom *Walker = start;
    108   while (Walker->next != end) {
    109     Walker = Walker->next;
    110     ((Walker->node)->*f)(t, u);
    111   }
    112 };
    113 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
    114 {
    115   atom *Walker = start;
    116   while (Walker->next != end) {
    117     Walker = Walker->next;
    118     ((Walker->node)->*f)(t, u);
    119   }
    120 };
    12173// three arguments
    122 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v)
     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
    12375{
    12476  atom *Walker = start;
     
    12880  }
    12981};
    130 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)
     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
    13183{
    13284  atom *Walker = start;
     
    13688  }
    13789};
    138 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
    139 {
    140   atom *Walker = start;
    141   while (Walker->next != end) {
    142     Walker = Walker->next;
    143     ((Walker->node)->*f)(t, u, v);
    144   }
    145 };
    146 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
    147 {
    148   atom *Walker = start;
    149   while (Walker->next != end) {
    150     Walker = Walker->next;
    151     ((Walker->node)->*f)(t, u, v);
    152   }
    153 };
     90
     91// ========================= Summing over each Atoms =================================== //
     92
     93// zero arguments
     94template <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};
     104template <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
     115template <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};
     125template <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
    154136
    155137// ================== Acting with each Atoms on same molecule ========================== //
    156138
    157139// zero arguments
    158 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *))
     140template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const
    159141{
    160142  atom *Walker = start;
     
    164146  }
    165147};
    166 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const)
     148template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const
    167149{
    168150  atom *Walker = start;
     
    172154  }
    173155};
    174 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const
    175 {
    176   atom *Walker = start;
    177   while (Walker->next != end) {
    178     Walker = Walker->next;
    179     (*f)(Walker);
    180   }
    181 };
    182 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const
    183 {
    184   atom *Walker = start;
    185   while (Walker->next != end) {
    186     Walker = Walker->next;
    187     (*f)(Walker);
    188   }
    189 };
    190156
    191157// ================== Acting with each Atoms on copy molecule ========================== //
    192158
    193159// zero arguments
    194 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy)
     160template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
    195161{
    196162  atom *Walker = start;
     
    200166  }
    201167};
    202 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const , molecule *copy)
     168template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
    203169{
    204170  atom *Walker = start;
     
    208174  }
    209175};
    210 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
    211 {
    212   atom *Walker = start;
    213   while (Walker->next != end) {
    214     Walker = Walker->next;
    215     (copy->*f)(Walker);
    216   }
    217 };
    218 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
    219 {
    220   atom *Walker = start;
    221   while (Walker->next != end) {
    222     Walker = Walker->next;
    223     (copy->*f)(Walker);
    224   }
    225 };
    226176
    227177// ================== Acting with each Atoms on copy molecule if true ========================== //
    228178
    229179// zero arguments
    230 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () )
     180template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const
    231181{
    232182  atom *Walker = start;
     
    237187  }
    238188};
     189template <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};
     198template <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};
     207template <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};
    239216// one argument
    240 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t )
     217template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const
    241218{
    242219  atom *Walker = start;
     
    247224  }
    248225};
     226template <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};
     235template <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};
     244template <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};
    249253// two arguments
    250 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 )
     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
    251255{
    252256  atom *Walker = start;
     
    257261  }
    258262};
     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
     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};
     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
     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};
     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
     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};
    259290// three arguments
    260 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 )
     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
    261292{
    262293  atom *Walker = start;
     
    267298  }
    268299};
     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
     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};
     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
     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};
     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
     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};
    269327
    270328// ================== Acting on all Atoms ========================== //
    271329
    272330// zero arguments
    273 template <typename res> void molecule::ActOnAllAtoms( res (atom::*f)())
     331template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const
    274332{
    275333  atom *Walker = start;
     
    279337  }
    280338};
    281 template <typename res> void molecule::ActOnAllAtoms( res (atom::*f)() const)
     339template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const
    282340{
    283341  atom *Walker = start;
     
    287345  }
    288346};
    289 template <typename res> void molecule::ActOnAllAtoms( res (atom::*f)()) const
    290 {
    291   atom *Walker = start;
    292   while (Walker->next != end) {
    293     Walker = Walker->next;
    294     (Walker->*f)();
    295   }
    296 };
    297 template <typename res> void molecule::ActOnAllAtoms( res (atom::*f)() const) const
    298 {
    299   atom *Walker = start;
    300   while (Walker->next != end) {
    301     Walker = Walker->next;
    302     (Walker->*f)();
    303   }
    304 };
    305347// one argument
    306 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T), T t )
     348template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const
    307349{
    308350  atom *Walker = start;
     
    312354  }
    313355};
    314 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T) const, T t )
     356template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const
    315357{
    316358  atom *Walker = start;
     
    320362  }
    321363};
    322 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T), T t ) const
    323 {
    324   atom *Walker = start;
    325   while (Walker->next != end) {
    326     Walker = Walker->next;
    327     (Walker->*f)(t);
    328   }
    329 };
    330 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T) const, T t ) const
    331 {
    332   atom *Walker = start;
    333   while (Walker->next != end) {
    334     Walker = Walker->next;
    335     (Walker->*f)(t);
    336   }
    337 };
    338364// two argument
    339 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U), T t, U u )
     365template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const
    340366{
    341367  atom *Walker = start;
     
    345371  }
    346372};
    347 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U) const, T t, U u )
     373template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const
    348374{
    349375  atom *Walker = start;
     
    353379  }
    354380};
    355 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U), T t, U u ) const
    356 {
    357   atom *Walker = start;
    358   while (Walker->next != end) {
    359     Walker = Walker->next;
    360     (Walker->*f)(t, u);
    361   }
    362 };
    363 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U) const, T t, U u ) const
    364 {
    365   atom *Walker = start;
    366   while (Walker->next != end) {
    367     Walker = Walker->next;
    368     (Walker->*f)(t, u);
    369   }
    370 };
    371381// three argument
    372 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V), T t, U u, V v)
     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
    373383{
    374384  atom *Walker = start;
     
    378388  }
    379389};
    380 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V) const, T t, U u, V v)
     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
    381391{
    382392  atom *Walker = start;
     
    386396  }
    387397};
    388 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V), T t, U u, V v) const
    389 {
    390   atom *Walker = start;
    391   while (Walker->next != end) {
    392     Walker = Walker->next;
    393     (Walker->*f)(t, u, v);
    394   }
    395 };
    396 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V) const, T t, U u, V v) const
    397 {
    398   atom *Walker = start;
    399   while (Walker->next != end) {
    400     Walker = Walker->next;
    401     (Walker->*f)(t, u, v);
    402   }
    403 };
    404398// four arguments
    405 template <typename res, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V, W), T t, U u, V v, W w)
     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
    406400{
    407401  atom *Walker = start;
     
    411405  }
    412406};
    413 template <typename res, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V, W) const, T t, U u, V v, W w)
     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
    414408{
    415409  atom *Walker = start;
     
    419413  }
    420414};
    421 template <typename res, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V, W), T t, U u, V v, W w) const
    422 {
    423   atom *Walker = start;
    424   while (Walker->next != end) {
    425     Walker = Walker->next;
    426     (Walker->*f)(t, u, v, w);
    427   }
    428 };
    429 template <typename res, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (atom::*f)(T, U, V, W) const, T t, U u, V v, W w) const
    430 {
    431   atom *Walker = start;
    432   while (Walker->next != end) {
    433     Walker = Walker->next;
    434     (Walker->*f)(t, u, v, w);
    435   }
    436 };
    437415
    438416// ===================== Accessing arrays indexed by some integer for each atom ======================
    439417
    440418// for atom ints
    441 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, void (*Setor)(T *, T *) )
     419template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const
    442420{
    443421  atom *Walker = start;
     
    448426  }
    449427};
    450 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, void (*Setor)(T *, T *), T value )
     428template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const
    451429{
    452430  atom *Walker = start;
     
    456434  }
    457435};
    458 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, void (*Setor)(T *, T *), T *value )
     436template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const
    459437{
    460438  atom *Walker = start;
     
    464442  }
    465443};
    466 // for element ints inside atom class
    467 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) )
     444// for element ints
     445template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const
    468446{
    469447  atom *Walker = start;
     
    474452  }
    475453};
    476 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value )
     454template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const
    477455{
    478456  atom *Walker = start;
     
    482460  }
    483461};
    484 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value )
     462template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const
    485463{
    486464  atom *Walker = start;
     
    490468  }
    491469};
    492 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, T (atom::*Setor)(Vector &), Vector atom::*value )
     470
     471template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const
    493472{
    494473  atom *Walker = start;
     
    498477  }
    499478};
    500 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, T (atom::*Setor)(Vector &), Vector &vect )
     479template <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};
     487template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const
    501488{
    502489  atom *Walker = start;
     
    506493  }
    507494};
    508 
    509 template <typename T> void molecule::SetAtomValueToIndexedArray ( T *array, int TesselPoint::*index, T atom::*value )
     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
    510504{
    511505  atom *Walker = start;
     
    517511};
    518512
    519 template <typename T> void molecule::SetAtomValueToIndexedArray ( T *array, int element::*index, T atom::*value )
    520 {
    521   atom *Walker = start;
    522   while (Walker->next != end) {
    523     Walker = Walker->next;
    524     Walker->*value = array[(Walker->type->*index)];
    525     //cout << Verbose(2) << *Walker << " gets " << (Walker->*value) << endl;
    526   }
    527 };
     513template <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    //cout << Verbose(2) << *Walker << " gets " << (Walker->*ptr) << endl;
     520  }
     521};
     522
    528523
    529524#endif /* MOLECULE_TEMPLATE_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.