00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef SUB_FIELD_ASSIGN_DEFS_H
00012 #define SUB_FIELD_ASSIGN_DEFS_H
00013
00014
00015 #include "Field/AssignDefs.h"
00016
00017
00018 template<class T, unsigned int D, class S> class SubFieldIter;
00019
00020
00022
00023
00024
00026
00027 struct DomainCompressed {
00028 typedef bool PETE_Return_t;
00029 };
00030
00031 template<class T, class S, class C, unsigned int D>
00032 inline bool
00033 for_each(SubFieldIter<T,D,S> &p, DomainCompressed, C)
00034 {
00035 return p.DomainCompressed();
00036 }
00037
00038 #ifdef __MWERKS__
00039
00040 template<class T, class C, unsigned int D>
00041 inline bool
00042 for_each(SubFieldIter<T,D,SIndex<D> > &p, DomainCompressed, C)
00043 {
00044 return p.DomainCompressed();
00045 }
00046
00047 template<class T, class C, unsigned int D>
00048 inline bool
00049 for_each(SubFieldIter<T,D,NDIndex<D> > &p, DomainCompressed, C)
00050 {
00051 return p.DomainCompressed();
00052 }
00053
00054 template<class T, class C, unsigned int D>
00055 inline bool
00056 for_each(SubFieldIter<T,D,SOffset<D> > &p, DomainCompressed, C)
00057 {
00058 return p.DomainCompressed();
00059 }
00060 #endif // __MWERKS__
00061
00062 template<class T, class C, unsigned int D>
00063 inline bool
00064 for_each(typename BareField<T,D>::iterator&, DomainCompressed, C)
00065 {
00066 return true;
00067 }
00068
00069 template<class C>
00070 inline bool
00071 for_each(Index::cursor&, DomainCompressed, C)
00072 {
00073 return false;
00074 }
00075
00076 template<class T, class C>
00077 inline bool
00078 for_each(PETE_Scalar<T>&, DomainCompressed, C)
00079 {
00080 return true;
00081 }
00082
00083
00085
00086
00087
00089
00090 struct SameSubsetType {
00091 typedef bool PETE_Return_t;
00092 int ID;
00093 SameSubsetType(int id) : ID(id) {}
00094 };
00095
00096 template<class T, class S, class C, unsigned int D>
00097 inline bool
00098 for_each(SubFieldIter<T,D,S> &p, SameSubsetType s, C)
00099 {
00100 return p.matchType(s.ID);
00101 }
00102
00103 #ifdef __MWERKS__
00104
00105 template<class T, class C, unsigned int D>
00106 inline bool
00107 for_each(SubFieldIter<T,D,SIndex<D> > &p, SameSubsetType s, C)
00108 {
00109 return p.matchType(s.ID);
00110 }
00111
00112 template<class T, class C, unsigned int D>
00113 inline bool
00114 for_each(SubFieldIter<T,D,NDIndex<D> > &p, SameSubsetType s, C)
00115 {
00116 return p.matchType(s.ID);
00117 }
00118
00119 template<class T, class C, unsigned int D>
00120 inline bool
00121 for_each(SubFieldIter<T,D,SOffset<D> > &p, SameSubsetType s, C)
00122 {
00123 return p.matchType(s.ID);
00124 }
00125 #endif // __MWERKS__
00126
00127 template<class T, class C, unsigned int D>
00128 inline bool
00129 for_each(typename BareField<T,D>::iterator&, SameSubsetType s, C)
00130 {
00131 return false;
00132 }
00133
00134 template<class C>
00135 inline bool
00136 for_each(Index::cursor&, SameSubsetType, C)
00137 {
00138 return true;
00139 }
00140
00141 template<class T, class C>
00142 inline bool
00143 for_each(PETE_Scalar<T>&, SameSubsetType, C)
00144 {
00145 return true;
00146 }
00147
00148
00150
00151
00152
00154
00155 struct SubsetInit {
00156 typedef int PETE_Return_t;
00157 };
00158
00159 template<class T, class S, class C, unsigned int D>
00160 inline int
00161 for_each(SubFieldIter<T,D,S> &p, SubsetInit, C)
00162 {
00163 p.initialize();
00164 return 0;
00165 }
00166
00167 #ifdef __MWERKS__
00168
00169 template<class T, class C, unsigned int D>
00170 inline int
00171 for_each(SubFieldIter<T,D,SIndex<D> > &p, SubsetInit, C)
00172 {
00173 p.initialize();
00174 return 0;
00175 }
00176
00177 template<class T, class C, unsigned int D>
00178 inline int
00179 for_each(SubFieldIter<T,D,NDIndex<D> > &p, SubsetInit, C)
00180 {
00181 p.initialize();
00182 return 0;
00183 }
00184
00185 template<class T, class C, unsigned int D>
00186 inline int
00187 for_each(SubFieldIter<T,D,SOffset<D> > &p, SubsetInit, C)
00188 {
00189 p.initialize();
00190 return 0;
00191 }
00192 #endif // __MWERKS__
00193
00194 template<class T, class C, unsigned int D>
00195 inline int
00196 for_each(typename BareField<T,D>::iterator &p, SubsetInit, C)
00197 {
00198 return 0;
00199 }
00200
00201 template<class C>
00202 inline int
00203 for_each(Index::cursor&, SubsetInit, C)
00204 {
00205 return 0;
00206 }
00207
00208 template<class T, class C>
00209 inline int
00210 for_each(PETE_Scalar<T>&, SubsetInit, C)
00211 {
00212 return 0;
00213 }
00214
00215
00217
00218
00219
00221
00222 struct SubsetNextLField {
00223 typedef int PETE_Return_t;
00224 };
00225
00226 template<class T, class S, class C, unsigned int D>
00227 inline int
00228 for_each(SubFieldIter<T,D,S> &p, SubsetNextLField, C)
00229 {
00230 p.nextLField();
00231 return 0;
00232 }
00233
00234 #ifdef __MWERKS__
00235
00236 template<class T, class C, unsigned int D>
00237 inline int
00238 for_each(SubFieldIter<T,D,SIndex<D> > &p, SubsetNextLField, C)
00239 {
00240 p.nextLField();
00241 return 0;
00242 }
00243
00244 template<class T, class C, unsigned int D>
00245 inline int
00246 for_each(SubFieldIter<T,D,NDIndex<D> > &p, SubsetNextLField, C)
00247 {
00248 p.nextLField();
00249 return 0;
00250 }
00251
00252 template<class T, class C, unsigned int D>
00253 inline int
00254 for_each(SubFieldIter<T,D,SOffset<D> > &p, SubsetNextLField, C)
00255 {
00256 p.nextLField();
00257 return 0;
00258 }
00259 #endif // __MWERKS__
00260
00261 template<class T, class C, unsigned int D>
00262 inline int
00263 for_each(typename BareField<T,D>::iterator&, SubsetNextLField, C)
00264 {
00265 return 0;
00266 }
00267
00268 template<class C>
00269 inline int
00270 for_each(Index::cursor&, SubsetNextLField, C)
00271 {
00272 return 0;
00273 }
00274
00275 template<class T, class C>
00276 inline int
00277 for_each(PETE_Scalar<T>&, SubsetNextLField, C)
00278 {
00279 return 0;
00280 }
00281
00282
00284
00285
00286
00288
00289 template<class T, class S, class C, unsigned int D>
00290 inline bool
00291 for_each(SubFieldIter<T,D,S> &p, SameFieldID s, C)
00292 {
00293 return p.getBareField().get_Id() == s.ID;
00294 }
00295
00296 #ifdef __MWERKS__
00297
00298 template<class T, class C, unsigned int D>
00299 inline bool
00300 for_each(const SubFieldIter<T,D,SIndex<D> > &p, const SameFieldID &s, C)
00301 {
00302 return p.getBareField().get_Id() == s.ID;
00303 }
00304
00305 template<class T, class C, unsigned int D>
00306 inline bool
00307 for_each(const SubFieldIter<T,D,NDIndex<D> > &p, const SameFieldID &s, C)
00308 {
00309 return p.getBareField().get_Id() == s.ID;
00310 }
00311
00312 template<class T, class C, unsigned int D>
00313 inline bool
00314 for_each(const SubFieldIter<T,D,SOffset<D> > &p, const SameFieldID &s, C)
00315 {
00316 return p.getBareField().get_Id() == s.ID;
00317 }
00318 #endif // __MWERKS__
00319
00321
00322
00323
00325
00326 template<class T, unsigned D, class S, class C>
00327 inline bool
00328 for_each(SubFieldIter<T,D,S> &p, const PlugBase<D>& f, C)
00329 {
00330 return p.plugBase(f.Domain);
00331 }
00332
00333 #ifdef __MWERKS__
00334
00335 template<class T, unsigned D, class C>
00336 inline bool
00337 for_each(SubFieldIter<T,D,SIndex<D> > &p, const PlugBase<D>& f, C)
00338 {
00339 return p.plugBase(f.Domain);
00340 }
00341
00342 template<class T, unsigned D, class C>
00343 inline bool
00344 for_each(SubFieldIter<T,D,NDIndex<D> > &p, const PlugBase<D>& f, C)
00345 {
00346 return p.plugBase(f.Domain);
00347 }
00348
00349 template<class T, unsigned D, class C>
00350 inline bool
00351 for_each(SubFieldIter<T,D,SOffset<D> > &p, const PlugBase<D>& f, C)
00352 {
00353 return p.plugBase(f.Domain);
00354 }
00355 #endif // __MWERKS__
00356
00358
00359
00360
00362
00363 template<class T, class S, class C, unsigned int D>
00364 inline bool
00365 for_each(SubFieldIter<T,D,S> &p, IsCompressed, C)
00366 {
00367 return p.IsCompressed();
00368 }
00369
00370 #ifdef __MWERKS__
00371
00372 template<class T, class C, unsigned int D>
00373 inline bool
00374 for_each(SubFieldIter<T,D,SIndex<D> > &p, IsCompressed, C)
00375 {
00376 return p.IsCompressed();
00377 }
00378
00379 template<class T, class C, unsigned int D>
00380 inline bool
00381 for_each(SubFieldIter<T,D,NDIndex<D> > &p, IsCompressed, C)
00382 {
00383 return p.IsCompressed();
00384 }
00385
00386 template<class T, class C, unsigned int D>
00387 inline bool
00388 for_each(SubFieldIter<T,D,SOffset<D> > &p, IsCompressed, C)
00389 {
00390 return p.IsCompressed();
00391 }
00392 #endif // __MWERKS__
00393
00395
00396
00397
00398
00400
00401 template<class T, class S, unsigned int D>
00402 inline T&
00403 for_each(SubFieldIter<T,D,S> &p, EvalFunctor_0)
00404 {
00405 return *p;
00406 }
00407
00408 #ifdef __MWERKS__
00409
00410 template<class T, unsigned int D>
00411 inline T&
00412 for_each(SubFieldIter<T,D,SIndex<D> > &p, EvalFunctor_0)
00413 {
00414 return *p;
00415 }
00416
00417 template<class T, unsigned int D>
00418 inline T&
00419 for_each(SubFieldIter<T,D,NDIndex<D> > &p, EvalFunctor_0)
00420 {
00421 return *p;
00422 }
00423
00424 template<class T, unsigned int D>
00425 inline T&
00426 for_each(SubFieldIter<T,D,SOffset<D> > &p, EvalFunctor_0)
00427 {
00428 return *p;
00429 }
00430 #endif // __MWERKS__
00431
00433
00434
00435
00436
00438
00439 template<class T, class S, unsigned int D>
00440 inline T&
00441 for_each(SubFieldIter<T,D,S> &p, const EvalFunctor_1& e)
00442 {
00443 return p.offset(e.I);
00444 }
00445
00446 #ifdef __MWERKS__
00447
00448 template<class T, unsigned int D>
00449 inline T&
00450 for_each(SubFieldIter<T,D,SIndex<D> > &p, const EvalFunctor_1& e)
00451 {
00452 return p.offset(e.I);
00453 }
00454
00455 template<class T, unsigned int D>
00456 inline T&
00457 for_each(SubFieldIter<T,D,NDIndex<D> > &p, const EvalFunctor_1& e)
00458 {
00459 return p.offset(e.I);
00460 }
00461
00462 template<class T, unsigned int D>
00463 inline T&
00464 for_each(SubFieldIter<T,D,SOffset<D> > &p, const EvalFunctor_1& e)
00465 {
00466 return p.offset(e.I);
00467 }
00468 #endif // __MWERKS__
00469
00471
00472
00473
00474
00476
00477 template<class T, class S, unsigned int D>
00478 inline T&
00479 for_each(SubFieldIter<T,D,S> &p, const EvalFunctor_2& e)
00480 {
00481 return p.offset(e.I,e.J);
00482 }
00483
00484 #ifdef __MWERKS__
00485
00486 template<class T, unsigned int D>
00487 inline T&
00488 for_each(SubFieldIter<T,D,SIndex<D> > &p, const EvalFunctor_2& e)
00489 {
00490 return p.offset(e.I,e.J);
00491 }
00492
00493 template<class T, unsigned int D>
00494 inline T&
00495 for_each(SubFieldIter<T,D,NDIndex<D> > &p, const EvalFunctor_2& e)
00496 {
00497 return p.offset(e.I,e.J);
00498 }
00499
00500 template<class T, unsigned int D>
00501 inline T&
00502 for_each(SubFieldIter<T,D,SOffset<D> > &p, const EvalFunctor_2& e)
00503 {
00504 return p.offset(e.I,e.J);
00505 }
00506 #endif // __MWERKS__
00507
00509
00510
00511
00512
00514
00515 template<class T, class S, unsigned int D>
00516 inline T&
00517 for_each(SubFieldIter<T,D,S> &p, const EvalFunctor_3& e)
00518 {
00519 return p.offset(e.I,e.J,e.K);
00520 }
00521
00522 #ifdef __MWERKS__
00523
00524 template<class T, unsigned int D>
00525 inline T&
00526 for_each(SubFieldIter<T,D,SIndex<D> > &p, const EvalFunctor_3& e)
00527 {
00528 return p.offset(e.I,e.J,e.K);
00529 }
00530
00531 template<class T, unsigned int D>
00532 inline T&
00533 for_each(SubFieldIter<T,D,NDIndex<D> > &p, const EvalFunctor_3& e)
00534 {
00535 return p.offset(e.I,e.J,e.K);
00536 }
00537
00538 template<class T, unsigned int D>
00539 inline T&
00540 for_each(SubFieldIter<T,D,SOffset<D> > &p, const EvalFunctor_3& e)
00541 {
00542 return p.offset(e.I,e.J,e.K);
00543 }
00544 #endif // __MWERKS__
00545
00547
00548
00549
00551
00552 template<class T, class S, class C, unsigned int D>
00553 inline int
00554 for_each(SubFieldIter<T,D,S> &p, StepFunctor s, C)
00555 {
00556 p.step(s.D);
00557 return 0;
00558 }
00559
00560 #ifdef __MWERKS__
00561
00562 template<class T, class C, unsigned int D>
00563 inline int
00564 for_each(SubFieldIter<T,D,SIndex<D> > &p, StepFunctor s, C)
00565 {
00566 p.step(s.D);
00567 return 0;
00568 }
00569
00570 template<class T, class C, unsigned int D>
00571 inline int
00572 for_each(SubFieldIter<T,D,NDIndex<D> > &p, StepFunctor s, C)
00573 {
00574 p.step(s.D);
00575 return 0;
00576 }
00577
00578 template<class T, class C, unsigned int D>
00579 inline int
00580 for_each(SubFieldIter<T,D,SOffset<D> > &p, StepFunctor s, C)
00581 {
00582 p.step(s.D);
00583 return 0;
00584 }
00585 #endif // __MWERKS__
00586
00588
00589
00590
00592
00593 template<class T, class S, class C, unsigned int D>
00594 inline int
00595 for_each(SubFieldIter<T,D,S> &p, RewindFunctor s, C)
00596 {
00597 p.rewind(s.D);
00598 return 0;
00599 }
00600
00601 #ifdef __MWERKS__
00602
00603 template<class T, class C, unsigned int D>
00604 inline int
00605 for_each(SubFieldIter<T,D,SIndex<D> > &p, RewindFunctor s, C)
00606 {
00607 p.rewind(s.D);
00608 return 0;
00609 }
00610
00611 template<class T, class C, unsigned int D>
00612 inline int
00613 for_each(SubFieldIter<T,D,NDIndex<D> > &p, RewindFunctor s, C)
00614 {
00615 p.rewind(s.D);
00616 return 0;
00617 }
00618
00619 template<class T, class C, unsigned int D>
00620 inline int
00621 for_each(SubFieldIter<T,D,SOffset<D> > &p, RewindFunctor s, C)
00622 {
00623 p.rewind(s.D);
00624 return 0;
00625 }
00626 #endif // __MWERKS__
00627
00629
00630
00631
00632
00634
00635 template<class T, unsigned int D, class S, class C>
00636 inline bool
00637 for_each(SubFieldIter<T,D,S> &p, HasUnitStride, C)
00638 {
00639 return false;
00640 }
00641
00642 #ifdef __MWERKS__
00643
00644 template<class T, unsigned int D, class C>
00645 inline bool
00646 for_each(SubFieldIter<T,D,SIndex<D> > &p, HasUnitStride, C)
00647 {
00648 return false;
00649 }
00650
00651 template<class T, unsigned int D, class C>
00652 inline bool
00653 for_each(SubFieldIter<T,D,NDIndex<D> > &p, HasUnitStride, C)
00654 {
00655 return false;
00656 }
00657
00658 template<class T, unsigned int D, class C>
00659 inline bool
00660 for_each(SubFieldIter<T,D,SOffset<D> > &p, HasUnitStride, C)
00661 {
00662 return false;
00663 }
00664 #endif // __MWERKS__
00665
00667
00668
00669
00671
00672 template<class T, unsigned int D, class S, class C, class T1>
00673 inline int
00674 for_each(SubFieldIter<T,D,S> &p, const FillGCIfNecessaryTag<D,T1> &f, C)
00675 {
00676
00677 p.FillGCIfNecessary();
00678 return 0;
00679 }
00680
00681 #ifdef __MWERKS__
00682
00683 template<class T, unsigned int D, class C, class T1>
00684 inline int
00685 for_each(SubFieldIter<T,D,SIndex<D> > &p, const FillGCIfNecessaryTag<D,T1> &f, C)
00686 {
00687
00688 p.FillGCIfNecessary();
00689 return 0;
00690 }
00691
00692 template<class T, unsigned int D, class C, class T1>
00693 inline int
00694 for_each(SubFieldIter<T,D,NDIndex<D> > &p, const FillGCIfNecessaryTag<D,T1> &f, C)
00695 {
00696
00697 p.FillGCIfNecessary();
00698 return 0;
00699 }
00700
00701 template<class T, unsigned int D, class C, class T1>
00702 inline int
00703 for_each(SubFieldIter<T,D,SOffset<D> > &p, const FillGCIfNecessaryTag<D,T1> &f, C)
00704 {
00705
00706 p.FillGCIfNecessary();
00707 return 0;
00708 }
00709
00710 #endif // __MWERKS__
00711
00712
00713 #endif // SUB_FIELD_ASSIGN_DEFS_H
00714
00715
00716
00717
00718
00719