Changes in src/molecule_template.hpp [5034e1:b453f9]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_template.hpp
r5034e1 rb453f9 21 21 22 22 // 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 };39 23 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const 40 24 { … … 54 38 }; 55 39 // one argument 56 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) 40 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const 57 41 { 58 42 atom *Walker = start; … … 62 46 } 63 47 }; 64 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) 48 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const 65 49 { 66 50 atom *Walker = start; … … 70 54 } 71 55 }; 72 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const73 {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 ) const81 {82 atom *Walker = start;83 while (Walker->next != end) {84 Walker = Walker->next;85 ((Walker->node)->*f)(t);86 }87 };88 56 // two arguments 89 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) 57 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const 90 58 { 91 59 atom *Walker = start; … … 95 63 } 96 64 }; 97 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) 65 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const 98 66 { 99 67 atom *Walker = start; … … 103 71 } 104 72 }; 105 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const106 {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 ) const114 {115 atom *Walker = start;116 while (Walker->next != end) {117 Walker = Walker->next;118 ((Walker->node)->*f)(t, u);119 }120 };121 73 // 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) 74 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 123 75 { 124 76 atom *Walker = start; … … 128 80 } 129 81 }; 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) 82 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 131 83 { 132 84 atom *Walker = start; … … 136 88 } 137 89 }; 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 94 template <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 }; 104 template <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 115 template <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 }; 125 template <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 154 136 155 137 // ================== Acting with each Atoms on same molecule ========================== // 156 138 157 139 // zero arguments 158 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) 140 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const 159 141 { 160 142 atom *Walker = start; … … 164 146 } 165 147 }; 166 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) 148 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const 167 149 { 168 150 atom *Walker = start; … … 172 154 } 173 155 }; 174 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const175 {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) const183 {184 atom *Walker = start;185 while (Walker->next != end) {186 Walker = Walker->next;187 (*f)(Walker);188 }189 };190 156 191 157 // ================== Acting with each Atoms on copy molecule ========================== // 192 158 193 159 // zero arguments 194 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) 160 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const 195 161 { 196 162 atom *Walker = start; … … 200 166 } 201 167 }; 202 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const , molecule *copy)168 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const 203 169 { 204 170 atom *Walker = start; … … 208 174 } 209 175 }; 210 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const211 {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) const219 {220 atom *Walker = start;221 while (Walker->next != end) {222 Walker = Walker->next;223 (copy->*f)(Walker);224 }225 };226 176 227 177 // ================== Acting with each Atoms on copy molecule if true ========================== // 228 178 229 179 // zero arguments 230 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) 180 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const 231 181 { 232 182 atom *Walker = start; … … 237 187 } 238 188 }; 189 template <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 }; 198 template <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 }; 207 template <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 }; 239 216 // one argument 240 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) 217 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const 241 218 { 242 219 atom *Walker = start; … … 247 224 } 248 225 }; 226 template <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 }; 235 template <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 }; 244 template <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 }; 249 253 // 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 ) 254 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 ) const 251 255 { 252 256 atom *Walker = start; … … 257 261 } 258 262 }; 263 template <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 }; 272 template <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 }; 281 template <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 }; 259 290 // 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 ) 291 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 ) const 261 292 { 262 293 atom *Walker = start; … … 267 298 } 268 299 }; 300 template <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 }; 309 template <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 }; 318 template <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 }; 269 327 270 328 // ================== Acting on all Atoms ========================== // 271 329 272 330 // zero arguments 273 template <typename res > void molecule::ActOnAllAtoms( res (atom::*f)())331 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const 274 332 { 275 333 atom *Walker = start; … … 279 337 } 280 338 }; 281 template <typename res > void molecule::ActOnAllAtoms( res (atom::*f)() const)339 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const 282 340 { 283 341 atom *Walker = start; … … 287 345 } 288 346 }; 289 template <typename res> void molecule::ActOnAllAtoms( res (atom::*f)()) const290 {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) const298 {299 atom *Walker = start;300 while (Walker->next != end) {301 Walker = Walker->next;302 (Walker->*f)();303 }304 };305 347 // one argument 306 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T), T t )348 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const 307 349 { 308 350 atom *Walker = start; … … 312 354 } 313 355 }; 314 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T) const, T t )356 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const 315 357 { 316 358 atom *Walker = start; … … 320 362 } 321 363 }; 322 template <typename res, typename T> void molecule::ActOnAllAtoms( res (atom::*f)(T), T t ) const323 {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 ) const331 {332 atom *Walker = start;333 while (Walker->next != end) {334 Walker = Walker->next;335 (Walker->*f)(t);336 }337 };338 364 // two argument 339 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U), T t, U u )365 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const 340 366 { 341 367 atom *Walker = start; … … 345 371 } 346 372 }; 347 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U) const, T t, U u )373 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const 348 374 { 349 375 atom *Walker = start; … … 353 379 } 354 380 }; 355 template <typename res, typename T, typename U> void molecule::ActOnAllAtoms( res (atom::*f)(T, U), T t, U u ) const356 {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 ) const364 {365 atom *Walker = start;366 while (Walker->next != end) {367 Walker = Walker->next;368 (Walker->*f)(t, u);369 }370 };371 381 // 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)382 template <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 373 383 { 374 384 atom *Walker = start; … … 378 388 } 379 389 }; 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)390 template <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 381 391 { 382 392 atom *Walker = start; … … 386 396 } 387 397 }; 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) const389 {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) const397 {398 atom *Walker = start;399 while (Walker->next != end) {400 Walker = Walker->next;401 (Walker->*f)(t, u, v);402 }403 };404 398 // 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)399 template <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 406 400 { 407 401 atom *Walker = start; … … 411 405 } 412 406 }; 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)407 template <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 414 408 { 415 409 atom *Walker = start; … … 419 413 } 420 414 }; 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) const422 {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) const430 {431 atom *Walker = start;432 while (Walker->next != end) {433 Walker = Walker->next;434 (Walker->*f)(t, u, v, w);435 }436 };437 415 438 416 // ===================== Accessing arrays indexed by some integer for each atom ====================== 439 417 440 418 // for atom ints 441 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, void (*Setor)(T *, T *) )419 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const 442 420 { 443 421 atom *Walker = start; … … 448 426 } 449 427 }; 450 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, void (*Setor)(T *, T *), T value )428 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const 451 429 { 452 430 atom *Walker = start; … … 456 434 } 457 435 }; 458 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, void (*Setor)(T *, T *), T *value )436 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const 459 437 { 460 438 atom *Walker = start; … … 464 442 } 465 443 }; 466 // for element ints inside atom class467 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) 444 // for element ints 445 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const 468 446 { 469 447 atom *Walker = start; … … 474 452 } 475 453 }; 476 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) 454 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const 477 455 { 478 456 atom *Walker = start; … … 482 460 } 483 461 }; 484 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) 462 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const 485 463 { 486 464 atom *Walker = start; … … 490 468 } 491 469 }; 492 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, T (atom::*Setor)(Vector &), Vector atom::*value ) 470 471 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const 493 472 { 494 473 atom *Walker = start; … … 498 477 } 499 478 }; 500 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int TesselPoint::*index, T (atom::*Setor)(Vector &), Vector &vect ) 479 template <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 }; 487 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const 501 488 { 502 489 atom *Walker = start; … … 506 493 } 507 494 }; 508 509 template <typename T> void molecule::SetAtomValueToIndexedArray ( T *array, int TesselPoint::*index, T atom::*value ) 495 template <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 }; 503 template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const 510 504 { 511 505 atom *Walker = start; … … 517 511 }; 518 512 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 }; 513 template <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 528 523 529 524 #endif /* MOLECULE_TEMPLATE_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.