Changeset 94d0ad for molecuilder/src/molecule_template.hpp
- Timestamp:
- Oct 27, 2009, 8:54:44 AM (16 years ago)
- Children:
- 8b6ee4
- Parents:
- 2e6aa1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule_template.hpp
r2e6aa1 r94d0ad 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) const139 {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) const147 {148 atom *Walker = start;149 while (Walker->next != end) {150 Walker = Walker->next;151 ((Walker->node)->*f)(t, u, v);152 }153 };154 90 155 91 // ========================= Summing over each Atoms =================================== // 156 92 157 93 // zero arguments 158 template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) 94 template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) const 159 95 { 160 96 res result = 0; … … 166 102 return result; 167 103 }; 168 template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() const ) 104 template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() const ) const 169 105 { 170 106 res result = 0; … … 176 112 return result; 177 113 }; 178 template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) const 114 // one argument 115 template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) const 179 116 { 180 117 res result = 0; … … 182 119 while (Walker->next != end) { 183 120 Walker = Walker->next; 184 result += (Walker->*f)( );121 result += (Walker->*f)(t); 185 122 } 186 123 return result; 187 124 }; 188 template <typename res, typename typ > res molecule::SumPerAtom(res (typ::*f)() const ) const125 template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) const 189 126 { 190 127 res result = 0; … … 192 129 while (Walker->next != end) { 193 130 Walker = Walker->next; 194 result += (Walker->*f)( );131 result += (Walker->*f)(t); 195 132 } 196 133 return result; 197 134 }; 135 136 137 // ================== Acting with each Atoms on same molecule ========================== // 138 139 // zero arguments 140 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const 141 { 142 atom *Walker = start; 143 while (Walker->next != end) { 144 Walker = Walker->next; 145 (*f)(Walker); 146 } 147 }; 148 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const 149 { 150 atom *Walker = start; 151 while (Walker->next != end) { 152 Walker = Walker->next; 153 (*f)(Walker); 154 } 155 }; 156 157 // ================== Acting with each Atoms on copy molecule ========================== // 158 159 // zero arguments 160 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const 161 { 162 atom *Walker = start; 163 while (Walker->next != end) { 164 Walker = Walker->next; 165 (copy->*f)(Walker); 166 } 167 }; 168 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const 169 { 170 atom *Walker = start; 171 while (Walker->next != end) { 172 Walker = Walker->next; 173 (copy->*f)(Walker); 174 } 175 }; 176 177 // ================== Acting with each Atoms on copy molecule if true ========================== // 178 179 // zero arguments 180 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const 181 { 182 atom *Walker = start; 183 while (Walker->next != end) { 184 Walker = Walker->next; 185 if ((Walker->*condition)()) 186 (copy->*f)(Walker); 187 } 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 }; 198 216 // one argument 199 template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) 200 { 201 res result = 0; 202 atom *Walker = start; 203 while (Walker->next != end) { 204 Walker = Walker->next; 205 result += (Walker->*f)(t); 206 } 207 return result; 208 }; 209 template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) 210 { 211 res result = 0; 212 atom *Walker = start; 213 while (Walker->next != end) { 214 Walker = Walker->next; 215 result += (Walker->*f)(t); 216 } 217 return result; 218 }; 219 template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) const 220 { 221 res result = 0; 222 atom *Walker = start; 223 while (Walker->next != end) { 224 Walker = Walker->next; 225 result += (Walker->*f)(t); 226 } 227 return result; 228 }; 229 template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) const 230 { 231 res result = 0; 232 atom *Walker = start; 233 while (Walker->next != end) { 234 Walker = Walker->next; 235 result += (Walker->*f)(t); 236 } 237 return result; 238 }; 239 240 241 // ================== Acting with each Atoms on same molecule ========================== // 217 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const 218 { 219 atom *Walker = start; 220 while (Walker->next != end) { 221 Walker = Walker->next; 222 if ((Walker->*condition)(t)) 223 (copy->*f)(Walker); 224 } 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 }; 253 // two arguments 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 255 { 256 atom *Walker = start; 257 while (Walker->next != end) { 258 Walker = Walker->next; 259 if ((Walker->*condition)(t,u)) 260 (copy->*f)(Walker); 261 } 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 }; 290 // three arguments 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 292 { 293 atom *Walker = start; 294 while (Walker->next != end) { 295 Walker = Walker->next; 296 if ((Walker->*condition)(t,u,v)) 297 (copy->*f)(Walker); 298 } 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 }; 327 328 // ================== Acting on all Atoms ========================== // 242 329 243 330 // zero arguments 244 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) 245 { 246 atom *Walker = start; 247 while (Walker->next != end) { 248 Walker = Walker->next; 249 (*f)(Walker); 250 } 251 }; 252 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) 253 { 254 atom *Walker = start; 255 while (Walker->next != end) { 256 Walker = Walker->next; 257 (*f)(Walker); 258 } 259 }; 260 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const 261 { 262 atom *Walker = start; 263 while (Walker->next != end) { 264 Walker = Walker->next; 265 (*f)(Walker); 266 } 267 }; 268 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const 269 { 270 atom *Walker = start; 271 while (Walker->next != end) { 272 Walker = Walker->next; 273 (*f)(Walker); 274 } 275 }; 276 277 // ================== Acting with each Atoms on copy molecule ========================== // 278 279 // zero arguments 280 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) 281 { 282 atom *Walker = start; 283 while (Walker->next != end) { 284 Walker = Walker->next; 285 (copy->*f)(Walker); 286 } 287 }; 288 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const , molecule *copy) 289 { 290 atom *Walker = start; 291 while (Walker->next != end) { 292 Walker = Walker->next; 293 (copy->*f)(Walker); 294 } 295 }; 296 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const 297 { 298 atom *Walker = start; 299 while (Walker->next != end) { 300 Walker = Walker->next; 301 (copy->*f)(Walker); 302 } 303 }; 304 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const 305 { 306 atom *Walker = start; 307 while (Walker->next != end) { 308 Walker = Walker->next; 309 (copy->*f)(Walker); 310 } 311 }; 312 313 // ================== Acting with each Atoms on copy molecule if true ========================== // 314 315 // zero arguments 316 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) 317 { 318 atom *Walker = start; 319 while (Walker->next != end) { 320 Walker = Walker->next; 321 if ((Walker->*condition)()) 322 (copy->*f)(Walker); 331 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const 332 { 333 atom *Walker = start; 334 while (Walker->next != end) { 335 Walker = Walker->next; 336 (Walker->*f)(); 337 } 338 }; 339 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const 340 { 341 atom *Walker = start; 342 while (Walker->next != end) { 343 Walker = Walker->next; 344 (Walker->*f)(); 323 345 } 324 346 }; 325 347 // one argument 326 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) 327 { 328 atom *Walker = start; 329 while (Walker->next != end) { 330 Walker = Walker->next; 331 if ((Walker->*condition)(t)) 332 (copy->*f)(Walker); 333 } 334 }; 335 // two arguments 336 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 ) 337 { 338 atom *Walker = start; 339 while (Walker->next != end) { 340 Walker = Walker->next; 341 if ((Walker->*condition)(t,u)) 342 (copy->*f)(Walker); 343 } 344 }; 345 // three arguments 346 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 ) 347 { 348 atom *Walker = start; 349 while (Walker->next != end) { 350 Walker = Walker->next; 351 if ((Walker->*condition)(t,u,v)) 352 (copy->*f)(Walker); 353 } 354 }; 355 356 // ================== Acting on all Atoms ========================== // 357 358 // zero arguments 359 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) 360 { 361 atom *Walker = start; 362 while (Walker->next != end) { 363 Walker = Walker->next; 364 (Walker->*f)(); 365 } 366 }; 367 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) 368 { 369 atom *Walker = start; 370 while (Walker->next != end) { 371 Walker = Walker->next; 372 (Walker->*f)(); 373 } 374 }; 375 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const 376 { 377 atom *Walker = start; 378 while (Walker->next != end) { 379 Walker = Walker->next; 380 (Walker->*f)(); 381 } 382 }; 383 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const 384 { 385 atom *Walker = start; 386 while (Walker->next != end) { 387 Walker = Walker->next; 388 (Walker->*f)(); 389 } 390 }; 391 // one argument 392 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) 348 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const 393 349 { 394 350 atom *Walker = start; … … 398 354 } 399 355 }; 400 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) 356 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const 401 357 { 402 358 atom *Walker = start; … … 406 362 } 407 363 }; 408 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const409 {410 atom *Walker = start;411 while (Walker->next != end) {412 Walker = Walker->next;413 (Walker->*f)(t);414 }415 };416 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const417 {418 atom *Walker = start;419 while (Walker->next != end) {420 Walker = Walker->next;421 (Walker->*f)(t);422 }423 };424 364 // two argument 425 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*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 426 366 { 427 367 atom *Walker = start; … … 431 371 } 432 372 }; 433 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*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 434 374 { 435 375 atom *Walker = start; … … 439 379 } 440 380 }; 441 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const442 {443 atom *Walker = start;444 while (Walker->next != end) {445 Walker = Walker->next;446 (Walker->*f)(t, u);447 }448 };449 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const450 {451 atom *Walker = start;452 while (Walker->next != end) {453 Walker = Walker->next;454 (Walker->*f)(t, u);455 }456 };457 381 // three argument 458 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) 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 459 383 { 460 384 atom *Walker = start; … … 464 388 } 465 389 }; 466 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) 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 467 391 { 468 392 atom *Walker = start; … … 472 396 } 473 397 }; 474 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) const475 {476 atom *Walker = start;477 while (Walker->next != end) {478 Walker = Walker->next;479 (Walker->*f)(t, u, v);480 }481 };482 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) const483 {484 atom *Walker = start;485 while (Walker->next != end) {486 Walker = Walker->next;487 (Walker->*f)(t, u, v);488 }489 };490 398 // four arguments 491 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) 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 492 400 { 493 401 atom *Walker = start; … … 497 405 } 498 406 }; 499 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) 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 500 408 { 501 409 atom *Walker = start; … … 505 413 } 506 414 }; 507 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) const508 {509 atom *Walker = start;510 while (Walker->next != end) {511 Walker = Walker->next;512 (Walker->*f)(t, u, v, w);513 }514 };515 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) const516 {517 atom *Walker = start;518 while (Walker->next != end) {519 Walker = Walker->next;520 (Walker->*f)(t, u, v, w);521 }522 };523 415 524 416 // ===================== Accessing arrays indexed by some integer for each atom ====================== 525 417 526 418 // for atom ints 527 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) 419 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const 528 420 { 529 421 atom *Walker = start; … … 534 426 } 535 427 }; 536 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*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 537 429 { 538 430 atom *Walker = start; … … 542 434 } 543 435 }; 544 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*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 545 437 { 546 438 atom *Walker = start; … … 551 443 }; 552 444 // for element ints 553 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) 445 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const 554 446 { 555 447 atom *Walker = start; … … 560 452 } 561 453 }; 562 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 563 455 { 564 456 atom *Walker = start; … … 568 460 } 569 461 }; 570 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 571 463 { 572 464 atom *Walker = start; … … 577 469 }; 578 470 579 template <typename T > void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(Vector &), Vector atom::*value )471 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const 580 472 { 581 473 atom *Walker = start; … … 585 477 } 586 478 }; 587 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*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 588 488 { 589 489 atom *Walker = start; … … 593 493 } 594 494 }; 595 596 template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*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 597 504 { 598 505 atom *Walker = start; … … 604 511 }; 605 512 606 template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) 513 template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) const 607 514 { 608 515 atom *Walker = start;
Note:
See TracChangeset
for help on using the changeset viewer.