SpatialOps
NeboCond.h
1 /* This file was generated by fulmar version 0.9.2. */
2 
3 /*
4  * Copyright (c) 2014 The University of Utah
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 
25 #ifndef NEBO_COND_H
26  #define NEBO_COND_H
27 
28  namespace SpatialOps {
29  struct NeboNil {
30  #ifdef ENABLE_THREADS
31  NeboNil typedef ResizeType;
32  #endif
33  /* ENABLE_THREADS */
34 
35  NeboNil typedef SeqWalkType;
36 
37  #ifdef __CUDACC__
38  NeboNil typedef GPUWalkType;
39  #endif
40  /* __CUDACC__ */
41 
42  NeboNil() {}
43 
44  template<typename FieldType>
45  struct Convert { NeboNil typedef Result; };
46 
47  template<typename FieldType>
48  inline NeboNil convert(void) const { return NeboNil(); }
49  };
50 
51  template<typename CurrentMode,
52  typename Test,
53  typename Expr,
54  typename FieldType>
55  struct NeboClause;
56  template<typename Test, typename Expr, typename FieldType>
57  struct NeboClause<Initial, Test, Expr, FieldType> {
58  public:
59  FieldType typedef field_type;
60 
61  NeboClause<SeqWalk,
62  typename Test::SeqWalkType,
63  typename Expr::SeqWalkType,
64  FieldType> typedef SeqWalkType;
65 
66  #ifdef ENABLE_THREADS
67  NeboClause<Resize,
68  typename Test::ResizeType,
69  typename Expr::ResizeType,
70  FieldType> typedef ResizeType;
71  #endif
72  /* ENABLE_THREADS */
73 
74  #ifdef __CUDACC__
75  NeboClause<GPUWalk,
76  typename Test::GPUWalkType,
77  typename Expr::GPUWalkType,
78  FieldType> typedef GPUWalkType;
79  #endif
80  /* __CUDACC__ */
81 
82  NeboClause(Test const & t, Expr const & e)
83  : test_(t), expr_(e)
84  {}
85 
86  inline GhostData ghosts_with_bc(void) const {
87  return min(test_.ghosts_with_bc(), expr_.ghosts_with_bc());
88  }
89 
90  inline GhostData ghosts_without_bc(void) const {
91  return min(test_.ghosts_without_bc(), expr_.ghosts_without_bc());
92  }
93 
94  inline bool has_extents(void) const {
95  return test_.has_extents() || expr_.has_extents();
96  }
97 
98  inline IntVec extents(void) const {
99  #ifndef NDEBUG
100  if(test_.has_extents() && expr_.has_extents()) {
101  assert(test_.extents() == expr_.extents());
102  }
103  #endif
104  /* NDEBUG */;
105 
106  return (test_.has_extents() ? test_.extents() : expr_.extents());
107  }
108 
109  inline IntVec has_bc(void) const {
110  return test_.has_bc() || expr_.has_bc();
111  }
112 
113  inline SeqWalkType init(IntVec const & extents,
114  GhostData const & ghosts,
115  IntVec const & hasBC) const {
116  return SeqWalkType(test_.init(extents, ghosts, hasBC),
117  expr_.init(extents, ghosts, hasBC));
118  }
119 
120  #ifdef ENABLE_THREADS
121  inline ResizeType resize(void) const {
122  return ResizeType(test_.resize(), expr_.resize());
123  }
124  #endif
125  /* ENABLE_THREADS */
126 
127  #ifdef __CUDACC__
128  inline bool cpu_ready(void) const {
129  return test_.cpu_ready() && expr_.cpu_ready();
130  }
131 
132  inline bool gpu_ready(int const deviceIndex) const {
133  return test_.gpu_ready(deviceIndex) && expr_.gpu_ready(deviceIndex);
134  }
135 
136  inline GPUWalkType gpu_init(IntVec const & extents,
137  GhostData const & ghosts,
138  IntVec const & hasBC,
139  int const deviceIndex,
140  cudaStream_t const & lhsStream) const {
141  return GPUWalkType(test_.gpu_init(extents,
142  ghosts,
143  hasBC,
144  deviceIndex,
145  lhsStream),
146  expr_.gpu_init(extents,
147  ghosts,
148  hasBC,
149  deviceIndex,
150  lhsStream));
151  }
152 
153  inline void stream_wait_event(cudaEvent_t const & event) const {
154  test_.stream_wait_event(event);
155 
156  expr_.stream_wait_event(event);
157  }
158 
159  #ifdef NEBO_GPU_TEST
160  inline void gpu_prep(int const deviceIndex) const {
161  test_.gpu_prep(deviceIndex);
162 
163  expr_.gpu_prep(deviceIndex);
164  }
165  #endif
166  /* NEBO_GPU_TEST */
167  #endif
168  /* __CUDACC__ */
169 
170  private:
171  Test const test_;
172 
173  Expr const expr_;
174  };
175  #ifdef ENABLE_THREADS
176  template<typename Test, typename Expr, typename FieldType>
177  struct NeboClause<Resize, Test, Expr, FieldType> {
178  public:
179  FieldType typedef field_type;
180 
181  NeboClause<SeqWalk,
182  typename Test::SeqWalkType,
183  typename Expr::SeqWalkType,
184  FieldType> typedef SeqWalkType;
185 
186  NeboClause(Test const & test, Expr const & expr)
187  : test_(test), expr_(expr)
188  {}
189 
190  inline SeqWalkType init(IntVec const & extents,
191  GhostData const & ghosts,
192  IntVec const & hasBC) const {
193  return SeqWalkType(test_.init(extents, ghosts, hasBC),
194  expr_.init(extents, ghosts, hasBC));
195  }
196 
197  private:
198  Test const test_;
199 
200  Expr const expr_;
201  }
202  #endif
203  /* ENABLE_THREADS */;
204  template<typename Test, typename Expr, typename FieldType>
205  struct NeboClause<SeqWalk, Test, Expr, FieldType> {
206  public:
207  FieldType typedef field_type;
208 
209  typename field_type::value_type typedef value_type;
210 
211  NeboClause(Test const & test, Expr const & expr)
212  : test_(test), expr_(expr)
213  {}
214 
215  inline value_type eval(int const x, int const y, int const z) const {
216  return expr_.eval(x, y, z);
217  }
218 
219  inline bool check(int const x, int const y, int const z) const {
220  return test_.eval(x, y, z);
221  }
222 
223  private:
224  Test test_;
225 
226  Expr expr_;
227  };
228  #ifdef __CUDACC__
229  template<typename Test, typename Expr, typename FieldType>
230  struct NeboClause<GPUWalk, Test, Expr, FieldType> {
231  public:
232  FieldType typedef field_type;
233 
234  typename field_type::value_type typedef value_type;
235 
236  NeboClause(Test const & test, Expr const & expr)
237  : test_(test), expr_(expr)
238  {}
239 
240  __device__ inline value_type eval(int const x,
241  int const y,
242  int const z) const {
243  return expr_.eval(x, y, z);
244  }
245 
246  __device__ inline bool check(int const x, int const y, int const z) const {
247  return test_.eval(x, y, z);
248  }
249 
250  private:
251  Test test_;
252 
253  Expr expr_;
254  }
255  #endif
256  /* __CUDACC__ */;
257 
258  template<typename CurrentMode,
259  typename ClauseType,
260  typename Otherwise,
261  typename FieldType>
262  struct NeboCond;
263  template<typename ClauseType, typename Otherwise, typename FieldType>
264  struct NeboCond<Initial, ClauseType, Otherwise, FieldType> {
265  public:
266  FieldType typedef field_type;
267 
268  NeboCond<SeqWalk,
269  typename ClauseType::SeqWalkType,
270  typename Otherwise::SeqWalkType,
271  FieldType> typedef SeqWalkType;
272 
273  #ifdef ENABLE_THREADS
274  NeboCond<Resize,
275  typename ClauseType::ResizeType,
276  typename Otherwise::ResizeType,
277  FieldType> typedef ResizeType;
278  #endif
279  /* ENABLE_THREADS */
280 
281  #ifdef __CUDACC__
282  NeboCond<GPUWalk,
283  typename ClauseType::GPUWalkType,
284  typename Otherwise::GPUWalkType,
285  FieldType> typedef GPUWalkType;
286  #endif
287  /* __CUDACC__ */
288 
289  NeboCond(ClauseType const & c, Otherwise const & e)
290  : clause_(c), otherwise_(e)
291  {}
292 
293  inline GhostData ghosts_with_bc(void) const {
294  return min(clause_.ghosts_with_bc(), otherwise_.ghosts_with_bc());
295  }
296 
297  inline GhostData ghosts_without_bc(void) const {
298  return min(clause_.ghosts_without_bc(), otherwise_.ghosts_without_bc());
299  }
300 
301  inline bool has_extents(void) const {
302  return clause_.has_extents() || otherwise_.has_extents();
303  }
304 
305  inline IntVec extents(void) const {
306  #ifndef NDEBUG
307  if(clause_.has_extents() && otherwise_.has_extents()) {
308  assert(clause_.extents() == otherwise_.extents());
309  }
310  #endif
311  /* NDEBUG */;
312 
313  return (clause_.has_extents() ? clause_.extents() : otherwise_.extents());
314  }
315 
316  inline IntVec has_bc(void) const {
317  return clause_.has_bc() || otherwise_.has_bc();
318  }
319 
320  inline SeqWalkType init(IntVec const & extents,
321  GhostData const & ghosts,
322  IntVec const & hasBC) const {
323  return SeqWalkType(clause_.init(extents, ghosts, hasBC),
324  otherwise_.init(extents, ghosts, hasBC));
325  }
326 
327  #ifdef ENABLE_THREADS
328  inline ResizeType resize(void) const {
329  return ResizeType(clause_.resize(), otherwise_.resize());
330  }
331  #endif
332  /* ENABLE_THREADS */
333 
334  #ifdef __CUDACC__
335  inline bool cpu_ready(void) const {
336  return clause_.cpu_ready() && otherwise_.cpu_ready();
337  }
338 
339  inline bool gpu_ready(int const deviceIndex) const {
340  return clause_.gpu_ready(deviceIndex) && otherwise_.gpu_ready(deviceIndex);
341  }
342 
343  inline GPUWalkType gpu_init(IntVec const & extents,
344  GhostData const & ghosts,
345  IntVec const & hasBC,
346  int const deviceIndex,
347  cudaStream_t const & lhsStream) const {
348  return GPUWalkType(clause_.gpu_init(extents,
349  ghosts,
350  hasBC,
351  deviceIndex,
352  lhsStream),
353  otherwise_.gpu_init(extents,
354  ghosts,
355  hasBC,
356  deviceIndex,
357  lhsStream));
358  }
359 
360  inline void stream_wait_event(cudaEvent_t const & event) const {
361  clause_.stream_wait_event(event);
362 
363  otherwise_.stream_wait_event(event);
364  }
365 
366  #ifdef NEBO_GPU_TEST
367  inline void gpu_prep(int const deviceIndex) const {
368  clause_.gpu_prep(deviceIndex);
369 
370  otherwise_.gpu_prep(deviceIndex);
371  }
372  #endif
373  /* NEBO_GPU_TEST */
374  #endif
375  /* __CUDACC__ */
376 
377  inline ClauseType const & clause(void) const { return clause_; }
378 
379  inline Otherwise const & otherwise(void) const { return otherwise_; }
380 
381  private:
382  ClauseType const clause_;
383 
384  Otherwise const otherwise_;
385  };
386  #ifdef ENABLE_THREADS
387  template<typename ClauseType, typename Otherwise, typename FieldType>
388  struct NeboCond<Resize, ClauseType, Otherwise, FieldType> {
389  public:
390  FieldType typedef field_type;
391 
392  NeboCond<SeqWalk,
393  typename ClauseType::SeqWalkType,
394  typename Otherwise::SeqWalkType,
395  FieldType> typedef SeqWalkType;
396 
397  NeboCond(ClauseType const & clause, Otherwise const & otherwise)
398  : clause_(clause), otherwise_(otherwise)
399  {}
400 
401  inline SeqWalkType init(IntVec const & extents,
402  GhostData const & ghosts,
403  IntVec const & hasBC) const {
404  return SeqWalkType(clause_.init(extents, ghosts, hasBC),
405  otherwise_.init(extents, ghosts, hasBC));
406  }
407 
408  private:
409  ClauseType const clause_;
410 
411  Otherwise const otherwise_;
412  }
413  #endif
414  /* ENABLE_THREADS */;
415  template<typename ClauseType, typename Otherwise, typename FieldType>
416  struct NeboCond<SeqWalk, ClauseType, Otherwise, FieldType> {
417  public:
418  FieldType typedef field_type;
419 
420  typename field_type::value_type typedef value_type;
421 
422  NeboCond(ClauseType const & clause, Otherwise const & otherwise)
423  : clause_(clause), otherwise_(otherwise)
424  {}
425 
426  inline value_type eval(int const x, int const y, int const z) const {
427  return (clause_.check(x, y, z) ? clause_.eval(x, y, z) : otherwise_.eval(x,
428  y,
429  z));
430  }
431 
432  private:
433  ClauseType clause_;
434 
435  Otherwise otherwise_;
436  };
437  #ifdef __CUDACC__
438  template<typename ClauseType, typename Otherwise, typename FieldType>
439  struct NeboCond<GPUWalk, ClauseType, Otherwise, FieldType> {
440  public:
441  FieldType typedef field_type;
442 
443  typename field_type::value_type typedef value_type;
444 
445  NeboCond(ClauseType const & clause, Otherwise const & otherwise)
446  : clause_(clause), otherwise_(otherwise)
447  {}
448 
449  __device__ inline value_type eval(int const x,
450  int const y,
451  int const z) const {
452  return (clause_.check(x, y, z) ? clause_.eval(x, y, z) :
453  otherwise_.eval(x, y, z));
454  }
455 
456  private:
457  ClauseType clause_;
458 
459  Otherwise otherwise_;
460  }
461  #endif
462  /* __CUDACC__ */;
463 
464  template<typename CurrentMode, typename Test, typename Expr, typename T>
466  template<typename Test, typename Expr, typename T>
467  struct NeboSingleValueClause<Initial, Test, Expr, T> {
468  public:
470  field_type;
471 
472  NeboSingleValueClause<SeqWalk,
473  typename Test::SeqWalkType,
474  typename Expr::SeqWalkType,
475  T> typedef SeqWalkType;
476 
477  #ifdef ENABLE_THREADS
478  NeboSingleValueClause<Resize,
479  typename Test::ResizeType,
480  typename Expr::ResizeType,
481  T> typedef ResizeType;
482  #endif
483  /* ENABLE_THREADS */
484 
485  #ifdef __CUDACC__
486  NeboSingleValueClause<GPUWalk,
487  typename Test::GPUWalkType,
488  typename Expr::GPUWalkType,
489  T> typedef GPUWalkType;
490  #endif
491  /* __CUDACC__ */
492 
493  NeboSingleValueClause(Test const & t, Expr const & e)
494  : test_(t), expr_(e)
495  {}
496 
497  inline GhostData ghosts_with_bc(void) const {
498  return GhostData(GHOST_MAX);
499  }
500 
501  inline GhostData ghosts_without_bc(void) const {
502  return GhostData(GHOST_MAX);
503  }
504 
505  inline bool has_extents(void) const { return false; }
506 
507  inline IntVec extents(void) const { return IntVec(0, 0, 0); }
508 
509  inline IntVec has_bc(void) const { return IntVec(0, 0, 0); }
510 
511  inline SeqWalkType init(IntVec const & extents,
512  GhostData const & ghosts,
513  IntVec const & hasBC) const {
514  return SeqWalkType(test_.init(extents, ghosts, hasBC),
515  expr_.init(extents, ghosts, hasBC));
516  }
517 
518  #ifdef ENABLE_THREADS
519  inline ResizeType resize(void) const {
520  return ResizeType(test_.resize(), expr_.resize());
521  }
522  #endif
523  /* ENABLE_THREADS */
524 
525  #ifdef __CUDACC__
526  inline bool cpu_ready(void) const {
527  return test_.cpu_ready() && expr_.cpu_ready();
528  }
529 
530  inline bool gpu_ready(int const deviceIndex) const {
531  return test_.gpu_ready(deviceIndex) && expr_.gpu_ready(deviceIndex);
532  }
533 
534  inline GPUWalkType gpu_init(IntVec const & extents,
535  GhostData const & ghosts,
536  IntVec const & hasBC,
537  int const deviceIndex,
538  cudaStream_t const & lhsStream) const {
539  return GPUWalkType(test_.gpu_init(extents,
540  ghosts,
541  hasBC,
542  deviceIndex,
543  lhsStream),
544  expr_.gpu_init(extents,
545  ghosts,
546  hasBC,
547  deviceIndex,
548  lhsStream));
549  }
550 
551  inline void stream_wait_event(cudaEvent_t const & event) const {
552  test_.stream_wait_event(event);
553 
554  expr_.stream_wait_event(event);
555  }
556 
557  #ifdef NEBO_GPU_TEST
558  inline void gpu_prep(int const deviceIndex) const {
559  test_.gpu_prep(deviceIndex);
560 
561  expr_.gpu_prep(deviceIndex);
562  }
563  #endif
564  /* NEBO_GPU_TEST */
565  #endif
566  /* __CUDACC__ */
567 
568  template<typename FieldType>
569  struct Convert {
571 
572  static inline Result convert(Test const & t, Expr const & e) {
573  return Result(t, e);
574  }
575  };
576 
577  inline Test const & test(void) const { return test_; }
578 
579  inline Expr const & expr(void) const { return expr_; }
580 
581  private:
582  Test const test_;
583 
584  Expr const expr_;
585  };
586  #ifdef ENABLE_THREADS
587  template<typename Test, typename Expr, typename T>
588  struct NeboSingleValueClause<Resize, Test, Expr, T> {
589  public:
591  field_type;
592 
593  NeboSingleValueClause<SeqWalk,
594  typename Test::SeqWalkType,
595  typename Expr::SeqWalkType,
596  T> typedef SeqWalkType;
597 
598  NeboSingleValueClause(Test const & test, Expr const & expr)
599  : test_(test), expr_(expr)
600  {}
601 
602  inline SeqWalkType init(IntVec const & extents,
603  GhostData const & ghosts,
604  IntVec const & hasBC) const {
605  return SeqWalkType(test_.init(extents, ghosts, hasBC),
606  expr_.init(extents, ghosts, hasBC));
607  }
608 
609  private:
610  Test const test_;
611 
612  Expr const expr_;
613  }
614  #endif
615  /* ENABLE_THREADS */;
616  template<typename Test, typename Expr, typename T>
617  struct NeboSingleValueClause<SeqWalk, Test, Expr, T> {
618  public:
620  field_type;
621 
622  typename field_type::value_type typedef value_type;
623 
624  NeboSingleValueClause(Test const & test, Expr const & expr)
625  : test_(test), expr_(expr)
626  {}
627 
628  inline value_type eval(int const x, int const y, int const z) const {
629  return expr_.eval(x, y, z);
630  }
631 
632  inline bool check(int const x, int const y, int const z) const {
633  return test_.eval(x, y, z);
634  }
635 
636  private:
637  Test test_;
638 
639  Expr expr_;
640  };
641  #ifdef __CUDACC__
642  template<typename Test, typename Expr, typename T>
643  struct NeboSingleValueClause<GPUWalk, Test, Expr, T> {
644  public:
646  field_type;
647 
648  typename field_type::value_type typedef value_type;
649 
650  NeboSingleValueClause(Test const & test, Expr const & expr)
651  : test_(test), expr_(expr)
652  {}
653 
654  __device__ inline value_type eval(int const x,
655  int const y,
656  int const z) const {
657  return expr_.eval(x, y, z);
658  }
659 
660  __device__ inline bool check(int const x, int const y, int const z) const {
661  return test_.eval(x, y, z);
662  }
663 
664  private:
665  Test test_;
666 
667  Expr expr_;
668  }
669  #endif
670  /* __CUDACC__ */;
671 
672  template<typename CurrentMode,
673  typename ClauseType,
674  typename Otherwise,
675  typename T>
677  template<typename ClauseType, typename Otherwise, typename T>
678  struct NeboSingleValueCond<Initial, ClauseType, Otherwise, T> {
679  public:
681  field_type;
682 
683  NeboSingleValueCond<SeqWalk,
684  typename ClauseType::SeqWalkType,
685  typename Otherwise::SeqWalkType,
686  T> typedef SeqWalkType;
687 
688  #ifdef ENABLE_THREADS
689  NeboSingleValueCond<Resize,
690  typename ClauseType::ResizeType,
691  typename Otherwise::ResizeType,
692  T> typedef ResizeType;
693  #endif
694  /* ENABLE_THREADS */
695 
696  #ifdef __CUDACC__
697  NeboSingleValueCond<GPUWalk,
698  typename ClauseType::GPUWalkType,
699  typename Otherwise::GPUWalkType,
700  T> typedef GPUWalkType;
701  #endif
702  /* __CUDACC__ */
703 
704  NeboSingleValueCond(ClauseType const & c, Otherwise const & e)
705  : clause_(c), otherwise_(e)
706  {}
707 
708  inline GhostData ghosts_with_bc(void) const {
709  return GhostData(GHOST_MAX);
710  }
711 
712  inline GhostData ghosts_without_bc(void) const {
713  return GhostData(GHOST_MAX);
714  }
715 
716  inline bool has_extents(void) const { return false; }
717 
718  inline IntVec extents(void) const { return IntVec(0, 0, 0); }
719 
720  inline IntVec has_bc(void) const { return IntVec(0, 0, 0); }
721 
722  inline SeqWalkType init(IntVec const & extents,
723  GhostData const & ghosts,
724  IntVec const & hasBC) const {
725  return SeqWalkType(clause_.init(extents, ghosts, hasBC),
726  otherwise_.init(extents, ghosts, hasBC));
727  }
728 
729  #ifdef ENABLE_THREADS
730  inline ResizeType resize(void) const {
731  return ResizeType(clause_.resize(), otherwise_.resize());
732  }
733  #endif
734  /* ENABLE_THREADS */
735 
736  #ifdef __CUDACC__
737  inline bool cpu_ready(void) const {
738  return clause_.cpu_ready() && otherwise_.cpu_ready();
739  }
740 
741  inline bool gpu_ready(int const deviceIndex) const {
742  return clause_.gpu_ready(deviceIndex) && otherwise_.gpu_ready(deviceIndex);
743  }
744 
745  inline GPUWalkType gpu_init(IntVec const & extents,
746  GhostData const & ghosts,
747  IntVec const & hasBC,
748  int const deviceIndex,
749  cudaStream_t const & lhsStream) const {
750  return GPUWalkType(clause_.gpu_init(extents,
751  ghosts,
752  hasBC,
753  deviceIndex,
754  lhsStream),
755  otherwise_.gpu_init(extents,
756  ghosts,
757  hasBC,
758  deviceIndex,
759  lhsStream));
760  }
761 
762  inline void stream_wait_event(cudaEvent_t const & event) const {
763  clause_.stream_wait_event(event);
764 
765  otherwise_.stream_wait_event(event);
766  }
767 
768  #ifdef NEBO_GPU_TEST
769  inline void gpu_prep(int const deviceIndex) const {
770  clause_.gpu_prep(deviceIndex);
771 
772  otherwise_.gpu_prep(deviceIndex);
773  }
774  #endif
775  /* NEBO_GPU_TEST */
776  #endif
777  /* __CUDACC__ */
778 
779  template<typename FieldType>
780  struct Convert {
781  typename ClauseType::template Convert<FieldType> typedef
782  ConvertingClause;
783 
784  typename ConvertingClause::Result typedef ConvertedClause;
785 
786  typename Otherwise::template Convert<FieldType>::Result typedef
787  ConvertedClauses;
788 
790  typedef Result;
791 
792  static inline Result convert(ClauseType const & c,
793  Otherwise const & o) {
794  return Result(ConvertingClause::convert(c.test(), c.expr()),
795  o.template convert<FieldType>());
796  }
797  };
798 
799  template<typename FieldType>
800  inline typename Convert<FieldType>::Result convert(void) const {
801  return Convert<FieldType>::convert(clause(), otherwise());
802  }
803 
804  inline ClauseType const & clause(void) const { return clause_; }
805 
806  inline Otherwise const & otherwise(void) const { return otherwise_; }
807 
808  private:
809  ClauseType const clause_;
810 
811  Otherwise const otherwise_;
812  };
813  #ifdef ENABLE_THREADS
814  template<typename ClauseType, typename Otherwise, typename T>
815  struct NeboSingleValueCond<Resize, ClauseType, Otherwise, T> {
816  public:
818  field_type;
819 
820  NeboSingleValueCond<SeqWalk,
821  typename ClauseType::SeqWalkType,
822  typename Otherwise::SeqWalkType,
823  T> typedef SeqWalkType;
824 
825  NeboSingleValueCond(ClauseType const & clause,
826  Otherwise const & otherwise)
827  : clause_(clause), otherwise_(otherwise)
828  {}
829 
830  inline SeqWalkType init(IntVec const & extents,
831  GhostData const & ghosts,
832  IntVec const & hasBC) const {
833  return SeqWalkType(clause_.init(extents, ghosts, hasBC),
834  otherwise_.init(extents, ghosts, hasBC));
835  }
836 
837  private:
838  ClauseType const clause_;
839 
840  Otherwise const otherwise_;
841  }
842  #endif
843  /* ENABLE_THREADS */;
844  template<typename ClauseType, typename Otherwise, typename T>
845  struct NeboSingleValueCond<SeqWalk, ClauseType, Otherwise, T> {
846  public:
848  field_type;
849 
850  typename field_type::value_type typedef value_type;
851 
852  NeboSingleValueCond(ClauseType const & clause,
853  Otherwise const & otherwise)
854  : clause_(clause), otherwise_(otherwise)
855  {}
856 
857  inline value_type eval(int const x, int const y, int const z) const {
858  return (clause_.check(x, y, z) ? clause_.eval(x, y, z) : otherwise_.eval(x,
859  y,
860  z));
861  }
862 
863  private:
864  ClauseType clause_;
865 
866  Otherwise otherwise_;
867  };
868  #ifdef __CUDACC__
869  template<typename ClauseType, typename Otherwise, typename T>
870  struct NeboSingleValueCond<GPUWalk, ClauseType, Otherwise, T> {
871  public:
873  field_type;
874 
875  typename field_type::value_type typedef value_type;
876 
877  NeboSingleValueCond(ClauseType const & clause,
878  Otherwise const & otherwise)
879  : clause_(clause), otherwise_(otherwise)
880  {}
881 
882  __device__ inline value_type eval(int const x,
883  int const y,
884  int const z) const {
885  return (clause_.check(x, y, z) ? clause_.eval(x, y, z) :
886  otherwise_.eval(x, y, z));
887  }
888 
889  private:
890  ClauseType clause_;
891 
892  Otherwise otherwise_;
893  }
894  #endif
895  /* __CUDACC__ */;
896 
898  public:
899  NeboSimpleClause(bool const & b, double const & d)
900  : b_(b), d_(d)
901  {}
902 
903  inline bool check(void) const { return b_; }
904 
905  inline double eval(void) const { return d_; }
906 
907  template<typename FieldType>
908  struct FullConvert {
909  NeboScalar<Initial, bool> typedef Boolean;
910 
912 
914 
915  static inline result full_convert(bool const b,
916  typename FieldType::value_type
917  const d) {
918  return result(Boolean(b), Scalar(d));
919  }
920  };
921 
922  template<typename T>
923  struct SingleConvert {
924  NeboScalar<Initial, bool> typedef Boolean;
925 
926  NeboScalar<Initial, T> typedef Scalar;
927 
929 
930  static inline result single_convert(bool const b, T const d) {
931  return result(Boolean(b), Scalar(d));
932  }
933  };
934 
935  private:
936  bool const b_;
937 
938  double const d_;
939  };
940 
942  public:
943  NeboSimpleFinalClause(double const d)
944  : d_(d)
945  {}
946 
947  inline double eval(void) const { return d_; }
948 
949  private:
950  double const d_;
951  };
952 
953  template<typename Otherwise>
954  struct NeboSimpleCond {
955  public:
956  NeboSimpleCond(NeboSimpleClause const & c, Otherwise const & otherwise)
957  : c_(c), otherwise_(otherwise)
958  {}
959 
960  inline double eval(void) const {
961  return (c_.check() ? c_.eval() : otherwise_.eval());
962  }
963 
964  template<typename FieldType>
965  struct FullConvert {
966  NeboSimpleClause::template FullConvert<FieldType> typedef
967  ConvertingClause;
968 
969  typename ConvertingClause::result typedef ConvertedClause;
970 
971  typename Otherwise::template FullConvert<FieldType>::result typedef
972  ConvertedClauses;
973 
975  typedef result;
976 
977  static inline result full_convert(NeboSimpleClause const & c,
978  Otherwise const & o) {
979  return result(ConvertingClause::full_convert(c.check(), c.eval()),
980  o.template full_convert<FieldType>());
981  }
982  };
983 
984  template<typename FieldType>
985  inline typename FullConvert<FieldType>::result full_convert(void) const {
986  return FullConvert<FieldType>::full_convert(clause(), otherwise());
987  }
988 
989  template<typename T>
990  struct SingleConvert {
991  NeboSimpleClause::template SingleConvert<T> typedef
992  ConvertingClause;
993 
994  typename ConvertingClause::result typedef ConvertedClause;
995 
996  typename Otherwise::template SingleConvert<T>::result typedef
997  ConvertedClauses;
998 
1000  typedef result;
1001 
1002  static inline result single_convert(NeboSimpleClause const & c,
1003  Otherwise const & o) {
1004  return result(ConvertingClause::single_convert(c.check(), c.eval()),
1005  o.template single_convert<T>());
1006  }
1007  };
1008 
1009  template<typename T>
1010  inline typename SingleConvert<T>::result single_convert(void) const {
1011  return SingleConvert<T>::single_convert(clause(), otherwise());
1012  }
1013 
1014  inline NeboSimpleClause const & clause(void) const { return c_; }
1015 
1016  inline Otherwise const & otherwise(void) const { return otherwise_; }
1017 
1018  private:
1019  NeboSimpleClause const c_;
1020 
1021  Otherwise const otherwise_;
1022  };
1023 
1024  template<>
1026  public:
1027  NeboSimpleCond(NeboSimpleClause const & c, NeboNil const & nil)
1028  : c_(c)
1029  {}
1030 
1031  template<typename FieldType>
1032  struct FullConvert {
1033  NeboSimpleClause::template FullConvert<FieldType> typedef
1034  ConvertingClause;
1035 
1036  typename ConvertingClause::result typedef ConvertedClause;
1037 
1038  NeboNil typedef ConvertedClauses;
1039 
1041  typedef result;
1042 
1043  static inline result full_convert(NeboSimpleClause const & c) {
1044  return result(ConvertingClause::full_convert(c.check(), c.eval()),
1045  NeboNil());
1046  }
1047  };
1048 
1049  template<typename FieldType>
1050  inline typename FullConvert<FieldType>::result full_convert(void) const {
1051  return FullConvert<FieldType>::full_convert(clause());
1052  }
1053 
1054  template<typename T>
1055  struct SingleConvert {
1056  NeboSimpleClause::template SingleConvert<T> typedef
1057  ConvertingClause;
1058 
1059  typename ConvertingClause::result typedef ConvertedClause;
1060 
1061  NeboNil typedef ConvertedClauses;
1062 
1064  typedef result;
1065 
1066  static inline result single_convert(NeboSimpleClause const & c) {
1067  return result(ConvertingClause::single_convert(c.check(), c.eval()),
1068  NeboNil());
1069  }
1070  };
1071 
1072  template<typename T>
1073  inline typename SingleConvert<T>::result single_convert(void) const {
1074  return SingleConvert<T>::single_convert(clause());
1075  }
1076 
1077  inline NeboSimpleClause const & clause(void) const { return c_; }
1078 
1079  inline NeboNil otherwise(void) const { return NeboNil(); }
1080 
1081  private:
1082  NeboSimpleClause const c_;
1083  };
1084 
1085  template<typename Clauses>
1086  struct CondBuilder;
1087 
1088  template<typename ClauseType, typename Otherwise, typename FieldType>
1089  struct CondBuilder<NeboCond<Initial, ClauseType, Otherwise, FieldType> > {
1090  public:
1092 
1093  private:
1094  template<typename Remaining, typename PreceedingResult>
1095  struct ReverseClausesRecursive;
1096 
1097  template<typename PreceedingResult>
1098  struct ReverseClausesRecursive<NeboNil, PreceedingResult> {
1099  PreceedingResult typedef Result;
1100 
1101  static inline Result reverse(NeboNil const & nil,
1102  PreceedingResult const & r) {
1103  return r;
1104  }
1105  };
1106 
1107  template<typename Next, typename Following, typename PreceedingResult>
1108  struct ReverseClausesRecursive<NeboCond<Initial,
1109  Next,
1110  Following,
1111  FieldType>,
1112  PreceedingResult> {
1114 
1116  NewResult;
1117 
1118  ReverseClausesRecursive<Following, NewResult> typedef InternalCall;
1119 
1120  typename InternalCall::Result typedef Result;
1121 
1122  static inline Result reverse(Remaining const & l,
1123  PreceedingResult const & r) {
1124  return InternalCall::reverse(l.otherwise(),
1125  NewResult(l.clause(), r));
1126  }
1127  };
1128 
1129  Clauses const clauses_;
1130 
1131  public:
1133  & cs)
1134  : clauses_(cs)
1135  {}
1136 
1137  template<typename Final>
1138  struct ReverseClauses;
1139 
1140  template<typename Final>
1141  struct ReverseClauses {
1142  ReverseClausesRecursive<Clauses, Final> typedef InternalCall;
1143 
1144  typename InternalCall::Result typedef Result;
1145 
1146  static inline Result reverse(Clauses const & cs, Final const & f) {
1147  return InternalCall::reverse(cs, f);
1148  }
1149  };
1150 
1151  template<typename Final>
1152  inline typename ReverseClauses<Final>::Result reverse(Final const & f) {
1153  ReverseClauses<Final> typedef InternalCall;
1154 
1155  return InternalCall::reverse(clauses_, f);
1156  }
1157 
1158  /* full X final X double */
1159  inline NeboExpression<typename ReverseClauses<NeboScalar<Initial,
1160  typename
1161  FieldType::
1162  value_type> >::
1163  Result,
1164  FieldType> operator ()(double const d) {
1166 
1167  typename ReverseClauses<Scalar>::Result typedef ReversedClauses;
1168 
1169  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1170 
1171  return ReturnType(reverse(Scalar(d)));
1172  }
1173 
1174  /* full X final X single-field */
1175  inline NeboExpression<typename ReverseClauses<NeboConstSingleValueField<Initial,
1176  typename
1177  FieldType::
1178  value_type>
1179  >::Result,
1180  FieldType> operator ()(SpatialOps::SpatialField<SpatialOps::
1181  SingleValue,
1182  typename
1183  FieldType::
1184  value_type>
1185  const & f) {
1187  typedef Field;
1188 
1189  typename ReverseClauses<Field>::Result typedef ReversedClauses;
1190 
1191  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1192 
1193  return ReturnType(reverse(Field(f)));
1194  }
1195 
1196  /* full X final X single-expr */
1197  template<typename Expr>
1199  FieldType> operator ()(NeboSingleValueExpression<Expr,
1200  typename
1201  FieldType::
1202  value_type>
1203  const & e) {
1204  typename ReverseClauses<Expr>::Result typedef ReversedClauses;
1205 
1206  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1207 
1208  return ReturnType(reverse(e.expr()));
1209  }
1210 
1211  /* full X final X field */
1212  inline NeboExpression<typename ReverseClauses<NeboConstField<Initial,
1213  FieldType>
1214  >::Result,
1215  FieldType> operator ()(FieldType const & f) {
1216  NeboConstField<Initial, FieldType> typedef Field;
1217 
1218  typename ReverseClauses<Field>::Result typedef ReversedClauses;
1219 
1220  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1221 
1222  return ReturnType(reverse(Field(f)));
1223  }
1224 
1225  /* full X final X expr */
1226  template<typename Expr>
1228  FieldType> operator ()(NeboExpression<Expr,
1229  FieldType>
1230  const & e) {
1231  typename ReverseClauses<Expr>::Result typedef ReversedClauses;
1232 
1233  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1234 
1235  return ReturnType(reverse(e.expr()));
1236  }
1237 
1238  /* full X bool X double */
1239  inline CondBuilder<NeboCond<Initial,
1240  NeboClause<Initial,
1242  NeboScalar<Initial,
1243  typename FieldType::
1244  value_type>,
1245  FieldType>,
1246  Clauses,
1247  FieldType> > operator ()(bool const b,
1248  double const d) {
1249  NeboScalar<Initial, bool> typedef Boolean;
1250 
1252 
1254 
1256 
1257  CondBuilder<Cond> typedef ReturnType;
1258 
1259  return ReturnType(Cond(Clause(Boolean(b), Scalar(d)), clauses_));
1260  }
1261 
1262  /* full X bool X single-field */
1263  inline CondBuilder<NeboCond<Initial,
1264  NeboClause<Initial,
1265  NeboScalar<Initial, bool>,
1266  NeboConstSingleValueField<Initial,
1267  typename
1268  FieldType::
1269  value_type>,
1270  FieldType>,
1271  Clauses,
1272  FieldType> > operator ()(bool const b,
1273  SpatialOps::
1275  SingleValue,
1276  typename
1277  FieldType::
1278  value_type>
1279  const & f) {
1280  NeboScalar<Initial, bool> typedef Boolean;
1281 
1283  typedef Field;
1284 
1286 
1288 
1289  CondBuilder<Cond> typedef ReturnType;
1290 
1291  return ReturnType(Cond(Clause(Boolean(b), Field(f)), clauses_));
1292  }
1293 
1294  /* full X bool X single-expr */
1295  template<typename Expr>
1296  inline CondBuilder<NeboCond<Initial,
1297  NeboClause<Initial,
1298  NeboScalar<Initial, bool>,
1299  Expr,
1300  FieldType>,
1301  Clauses,
1302  FieldType> > operator ()(bool const b,
1304  typename
1305  FieldType::
1306  value_type>
1307  const & e) {
1308  NeboScalar<Initial, bool> typedef Boolean;
1309 
1311 
1313 
1314  CondBuilder<Cond> typedef ReturnType;
1315 
1316  return ReturnType(Cond(Clause(Boolean(b), e.expr()), clauses_));
1317  }
1318 
1319  /* full X bool X field */
1320  inline CondBuilder<NeboCond<Initial,
1321  NeboClause<Initial,
1322  NeboScalar<Initial, bool>,
1323  NeboConstField<Initial,
1324  FieldType>,
1325  FieldType>,
1326  Clauses,
1327  FieldType> > operator ()(bool const b,
1328  FieldType const &
1329  f) {
1330  NeboScalar<Initial, bool> typedef Boolean;
1331 
1332  NeboConstField<Initial, FieldType> typedef Field;
1333 
1335 
1337 
1338  CondBuilder<Cond> typedef ReturnType;
1339 
1340  return ReturnType(Cond(Clause(Boolean(b), Field(f)), clauses_));
1341  }
1342 
1343  /* full X bool X expr */
1344  template<typename Expr>
1345  inline CondBuilder<NeboCond<Initial,
1346  NeboClause<Initial,
1347  NeboScalar<Initial, bool>,
1348  Expr,
1349  FieldType>,
1350  Clauses,
1351  FieldType> > operator ()(bool const b,
1352  NeboExpression<Expr,
1353  FieldType>
1354  const & e) {
1355  NeboScalar<Initial, bool> typedef Boolean;
1356 
1358 
1360 
1361  CondBuilder<Cond> typedef ReturnType;
1362 
1363  return ReturnType(Cond(Clause(Boolean(b), e.expr()), clauses_));
1364  }
1365 
1366  /* full X single-expr X double */
1367  template<typename BoolExpr>
1368  inline CondBuilder<NeboCond<Initial,
1369  NeboClause<Initial,
1370  BoolExpr,
1371  NeboScalar<Initial,
1372  typename FieldType::
1373  value_type>,
1374  FieldType>,
1375  Clauses,
1376  FieldType> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
1377  typename
1378  FieldType::
1379  value_type>
1380  const & nb,
1381  double const d) {
1383 
1385 
1387 
1388  CondBuilder<Cond> typedef ReturnType;
1389 
1390  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)), clauses_));
1391  }
1392 
1393  /* full X single-expr X single-field */
1394  template<typename BoolExpr>
1395  inline CondBuilder<NeboCond<Initial,
1396  NeboClause<Initial,
1397  BoolExpr,
1398  NeboConstSingleValueField<Initial,
1399  typename
1400  FieldType::
1401  value_type>,
1402  FieldType>,
1403  Clauses,
1404  FieldType> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
1405  typename
1406  FieldType::
1407  value_type>
1408  const & nb,
1409  SpatialOps::
1411  SingleValue,
1412  typename
1413  FieldType::
1414  value_type>
1415  const & f) {
1417  typedef Field;
1418 
1420 
1422 
1423  CondBuilder<Cond> typedef ReturnType;
1424 
1425  return ReturnType(Cond(Clause(nb.expr(), Field(f)), clauses_));
1426  }
1427 
1428  /* full X single-expr X single-expr */
1429  template<typename BoolExpr, typename Expr>
1430  inline CondBuilder<NeboCond<Initial,
1431  NeboClause<Initial,
1432  BoolExpr,
1433  Expr,
1434  FieldType>,
1435  Clauses,
1436  FieldType> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
1437  typename
1438  FieldType::
1439  value_type>
1440  const & nb,
1442  typename
1443  FieldType::
1444  value_type>
1445  const & e) {
1447 
1449 
1450  CondBuilder<Cond> typedef ReturnType;
1451 
1452  return ReturnType(Cond(Clause(nb.expr(), e.expr()), clauses_));
1453  }
1454 
1455  /* full X single-expr X field */
1456  template<typename BoolExpr>
1457  inline CondBuilder<NeboCond<Initial,
1458  NeboClause<Initial,
1459  BoolExpr,
1460  NeboConstField<Initial,
1461  FieldType>,
1462  FieldType>,
1463  Clauses,
1464  FieldType> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
1465  typename
1466  FieldType::
1467  value_type>
1468  const & nb,
1469  FieldType const
1470  & f) {
1471  NeboConstField<Initial, FieldType> typedef Field;
1472 
1474 
1476 
1477  CondBuilder<Cond> typedef ReturnType;
1478 
1479  return ReturnType(Cond(Clause(nb.expr(), Field(f)), clauses_));
1480  }
1481 
1482  /* full X single-expr X expr */
1483  template<typename BoolExpr, typename Expr>
1484  inline CondBuilder<NeboCond<Initial,
1485  NeboClause<Initial,
1486  BoolExpr,
1487  Expr,
1488  FieldType>,
1489  Clauses,
1490  FieldType> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
1491  typename
1492  FieldType::
1493  value_type>
1494  const & nb,
1495  NeboExpression<Expr,
1496  FieldType>
1497  const & e) {
1499 
1501 
1502  CondBuilder<Cond> typedef ReturnType;
1503 
1504  return ReturnType(Cond(Clause(nb.expr(), e.expr()), clauses_));
1505  }
1506 
1507  /* full X expr X double */
1508  template<typename BoolExpr>
1509  inline CondBuilder<NeboCond<Initial,
1510  NeboClause<Initial,
1511  BoolExpr,
1512  NeboScalar<Initial,
1513  typename FieldType::
1514  value_type>,
1515  FieldType>,
1516  Clauses,
1517  FieldType> > operator ()(NeboBooleanExpression<BoolExpr,
1518  FieldType>
1519  const & nb,
1520  double const d) {
1522 
1524 
1526 
1527  CondBuilder<Cond> typedef ReturnType;
1528 
1529  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)), clauses_));
1530  }
1531 
1532  /* full X expr X single-field */
1533  template<typename BoolExpr>
1534  inline CondBuilder<NeboCond<Initial,
1535  NeboClause<Initial,
1536  BoolExpr,
1537  NeboConstSingleValueField<Initial,
1538  typename
1539  FieldType::
1540  value_type>,
1541  FieldType>,
1542  Clauses,
1543  FieldType> > operator ()(NeboBooleanExpression<BoolExpr,
1544  FieldType>
1545  const & nb,
1546  SpatialOps::
1548  SingleValue,
1549  typename
1550  FieldType::
1551  value_type>
1552  const & f) {
1554  typedef Field;
1555 
1557 
1559 
1560  CondBuilder<Cond> typedef ReturnType;
1561 
1562  return ReturnType(Cond(Clause(nb.expr(), Field(f)), clauses_));
1563  }
1564 
1565  /* full X expr X single-expr */
1566  template<typename BoolExpr, typename Expr>
1567  inline CondBuilder<NeboCond<Initial,
1568  NeboClause<Initial,
1569  BoolExpr,
1570  Expr,
1571  FieldType>,
1572  Clauses,
1573  FieldType> > operator ()(NeboBooleanExpression<BoolExpr,
1574  FieldType>
1575  const & nb,
1577  typename
1578  FieldType::
1579  value_type>
1580  const & e) {
1582 
1584 
1585  CondBuilder<Cond> typedef ReturnType;
1586 
1587  return ReturnType(Cond(Clause(nb.expr(), e.expr()), clauses_));
1588  }
1589 
1590  /* full X expr X field */
1591  template<typename BoolExpr>
1592  inline CondBuilder<NeboCond<Initial,
1593  NeboClause<Initial,
1594  BoolExpr,
1595  NeboConstField<Initial,
1596  FieldType>,
1597  FieldType>,
1598  Clauses,
1599  FieldType> > operator ()(NeboBooleanExpression<BoolExpr,
1600  FieldType>
1601  const & nb,
1602  FieldType const
1603  & f) {
1604  NeboConstField<Initial, FieldType> typedef Field;
1605 
1607 
1609 
1610  CondBuilder<Cond> typedef ReturnType;
1611 
1612  return ReturnType(Cond(Clause(nb.expr(), Field(f)), clauses_));
1613  }
1614 
1615  /* full X expr X expr */
1616  template<typename BoolExpr, typename Expr>
1617  inline CondBuilder<NeboCond<Initial,
1618  NeboClause<Initial,
1619  BoolExpr,
1620  Expr,
1621  FieldType>,
1622  Clauses,
1623  FieldType> > operator ()(NeboBooleanExpression<BoolExpr,
1624  FieldType>
1625  const & nb,
1626  NeboExpression<Expr,
1627  FieldType>
1628  const & e) {
1630 
1632 
1633  CondBuilder<Cond> typedef ReturnType;
1634 
1635  return ReturnType(Cond(Clause(nb.expr(), e.expr()), clauses_));
1636  }
1637 
1638  /* full X mask X double */
1639  inline CondBuilder<NeboCond<Initial,
1640  NeboClause<Initial,
1642  NeboScalar<Initial,
1643  typename FieldType::
1644  value_type>,
1645  FieldType>,
1646  Clauses,
1647  FieldType> > operator ()(SpatialMask<FieldType>
1648  const & mask,
1649  double const d) {
1650  NeboMask<Initial, FieldType> typedef Mask;
1651 
1653 
1655 
1657 
1658  CondBuilder<Cond> typedef ReturnType;
1659 
1660  return ReturnType(Cond(Clause(Mask(mask), Scalar(d)), clauses_));
1661  }
1662 
1663  /* full X mask X single-field */
1664  inline CondBuilder<NeboCond<Initial,
1665  NeboClause<Initial,
1666  NeboMask<Initial, FieldType>,
1667  NeboConstSingleValueField<Initial,
1668  typename
1669  FieldType::
1670  value_type>,
1671  FieldType>,
1672  Clauses,
1673  FieldType> > operator ()(SpatialMask<FieldType>
1674  const & mask,
1675  SpatialOps::
1677  SingleValue,
1678  typename
1679  FieldType::
1680  value_type>
1681  const & f) {
1682  NeboMask<Initial, FieldType> typedef Mask;
1683 
1685  typedef Field;
1686 
1688 
1690 
1691  CondBuilder<Cond> typedef ReturnType;
1692 
1693  return ReturnType(Cond(Clause(Mask(mask), Field(f)), clauses_));
1694  }
1695 
1696  /* full X mask X single-expr */
1697  template<typename Expr>
1698  inline CondBuilder<NeboCond<Initial,
1699  NeboClause<Initial,
1700  NeboMask<Initial, FieldType>,
1701  Expr,
1702  FieldType>,
1703  Clauses,
1704  FieldType> > operator ()(SpatialMask<FieldType>
1705  const & mask,
1707  typename
1708  FieldType::
1709  value_type>
1710  const & e) {
1711  NeboMask<Initial, FieldType> typedef Mask;
1712 
1714 
1716 
1717  CondBuilder<Cond> typedef ReturnType;
1718 
1719  return ReturnType(Cond(Clause(Mask(mask), e.expr()), clauses_));
1720  }
1721 
1722  /* full X mask X field */
1723  inline CondBuilder<NeboCond<Initial,
1724  NeboClause<Initial,
1725  NeboMask<Initial, FieldType>,
1726  NeboConstField<Initial,
1727  FieldType>,
1728  FieldType>,
1729  Clauses,
1730  FieldType> > operator ()(SpatialMask<FieldType>
1731  const & mask,
1732  FieldType const &
1733  f) {
1734  NeboMask<Initial, FieldType> typedef Mask;
1735 
1736  NeboConstField<Initial, FieldType> typedef Field;
1737 
1739 
1741 
1742  CondBuilder<Cond> typedef ReturnType;
1743 
1744  return ReturnType(Cond(Clause(Mask(mask), Field(f)), clauses_));
1745  }
1746 
1747  /* full X mask X expr */
1748  template<typename Expr>
1749  inline CondBuilder<NeboCond<Initial,
1750  NeboClause<Initial,
1751  NeboMask<Initial, FieldType>,
1752  Expr,
1753  FieldType>,
1754  Clauses,
1755  FieldType> > operator ()(SpatialMask<FieldType>
1756  const & mask,
1757  NeboExpression<Expr,
1758  FieldType>
1759  const & e) {
1760  NeboMask<Initial, FieldType> typedef Mask;
1761 
1763 
1765 
1766  CondBuilder<Cond> typedef ReturnType;
1767 
1768  return ReturnType(Cond(Clause(Mask(mask), e.expr()), clauses_));
1769  }
1770  };
1771 
1772  template<typename ClauseType, typename Otherwise, typename T>
1773  struct CondBuilder<NeboSingleValueCond<Initial, ClauseType, Otherwise, T>
1774  > {
1775  public:
1777  Clauses;
1778 
1779  private:
1780  template<typename Remaining, typename PreceedingResult>
1781  struct ReverseClausesRecursive;
1782 
1783  template<typename PreceedingResult>
1784  struct ReverseClausesRecursive<NeboNil, PreceedingResult> {
1785  PreceedingResult typedef Result;
1786 
1787  static inline Result reverse(NeboNil const & nil,
1788  PreceedingResult const & r) {
1789  return r;
1790  }
1791  };
1792 
1793  template<typename Next, typename Following, typename PreceedingResult>
1794  struct ReverseClausesRecursive<NeboSingleValueCond<Initial,
1795  Next,
1796  Following,
1797  T>,
1798  PreceedingResult> {
1800 
1802  NewResult;
1803 
1804  ReverseClausesRecursive<Following, NewResult> typedef InternalCall;
1805 
1806  typename InternalCall::Result typedef Result;
1807 
1808  static inline Result reverse(Remaining const & l,
1809  PreceedingResult const & r) {
1810  return InternalCall::reverse(l.otherwise(),
1811  NewResult(l.clause(), r));
1812  }
1813  };
1814 
1815  Clauses const clauses_;
1816 
1817  public:
1819  const & cs)
1820  : clauses_(cs)
1821  {}
1822 
1823  template<typename Final>
1824  struct ReverseClauses;
1825 
1826  template<typename Final>
1827  struct ReverseClauses {
1828  ReverseClausesRecursive<Clauses, Final> typedef InternalCall;
1829 
1830  typename InternalCall::Result typedef Result;
1831 
1832  static inline Result reverse(Clauses const & cs, Final const & f) {
1833  return InternalCall::reverse(cs, f);
1834  }
1835  };
1836 
1837  template<typename Final>
1838  inline typename ReverseClauses<Final>::Result reverse(Final const & f) {
1839  ReverseClauses<Final> typedef InternalCall;
1840 
1841  return InternalCall::reverse(clauses_, f);
1842  }
1843 
1844  /* single X final X double */
1845  inline NeboSingleValueExpression<typename ReverseClauses<NeboScalar<Initial,
1846  T>
1847  >::Result,
1848  T> operator ()(double const d) {
1849  NeboScalar<Initial, T> typedef Scalar;
1850 
1851  typename ReverseClauses<Scalar>::Result typedef ReversedClauses;
1852 
1854 
1855  return ReturnType(reverse(Scalar(d)));
1856  }
1857 
1858  /* single X final X single-field */
1859  inline NeboSingleValueExpression<typename ReverseClauses<NeboConstSingleValueField<Initial,
1860  T>
1861  >::Result,
1862  T> operator ()(SpatialOps::
1864  SingleValue,
1865  T> const
1866  & f) {
1868 
1869  typename ReverseClauses<Field>::Result typedef ReversedClauses;
1870 
1872 
1873  return ReturnType(reverse(Field(f)));
1874  }
1875 
1876  /* single X final X single-expr */
1877  template<typename Expr>
1879  Result,
1880  T> operator ()(NeboSingleValueExpression<Expr,
1881  T>
1882  const & e) {
1883  typename ReverseClauses<Expr>::Result typedef ReversedClauses;
1884 
1886 
1887  return ReturnType(reverse(e.expr()));
1888  }
1889 
1890  /* single X final X field */
1891  template<typename FieldType>
1892  inline NeboExpression<typename ReverseClauses<NeboConstField<Initial,
1893  typename
1894  NeboFieldCheck<typename
1895  FieldType::
1896  field_type,
1897  FieldType>::
1898  Result> >::
1899  Result,
1900  typename NeboFieldCheck<typename FieldType::
1901  field_type,
1902  FieldType>::Result>
1903  operator ()(FieldType const & f) {
1904  NeboConstField<Initial, FieldType> typedef Field;
1905 
1906  typename ReverseClauses<Field>::Result typedef ReversedClauses;
1907 
1908  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1909 
1910  return ReturnType(reverse(Field(f)));
1911  }
1912 
1913  /* single X final X expr */
1914  template<typename Expr, typename FieldType>
1916  typename NeboFieldCheck<typename FieldType::
1917  field_type,
1918  FieldType>::Result>
1919  operator ()(NeboExpression<Expr, FieldType> const & e) {
1920  typename ReverseClauses<Expr>::Result typedef ReversedClauses;
1921 
1922  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
1923 
1924  return ReturnType(reverse(e.expr()));
1925  }
1926 
1927  /* single X bool X double */
1928  inline CondBuilder<NeboSingleValueCond<Initial,
1929  NeboSingleValueClause<Initial,
1930  NeboScalar<Initial,
1931  bool>,
1932  NeboScalar<Initial,
1933  T>,
1934  T>,
1935  Clauses,
1936  T> > operator ()(bool const b,
1937  double const d) {
1938  NeboScalar<Initial, bool> typedef Boolean;
1939 
1940  NeboScalar<Initial, T> typedef Scalar;
1941 
1943 
1945 
1946  CondBuilder<Cond> typedef ReturnType;
1947 
1948  return ReturnType(Cond(Clause(Boolean(b), Scalar(d)), clauses_));
1949  }
1950 
1951  /* single X bool X single-field */
1952  inline CondBuilder<NeboSingleValueCond<Initial,
1953  NeboSingleValueClause<Initial,
1954  NeboScalar<Initial,
1955  bool>,
1956  NeboConstSingleValueField<Initial,
1957  T>,
1958  T>,
1959  Clauses,
1960  T> > operator ()(bool const b,
1961  SpatialOps::
1963  SingleValue,
1964  T>
1965  const & f) {
1966  NeboScalar<Initial, bool> typedef Boolean;
1967 
1969 
1971 
1973 
1974  CondBuilder<Cond> typedef ReturnType;
1975 
1976  return ReturnType(Cond(Clause(Boolean(b), Field(f)), clauses_));
1977  }
1978 
1979  /* single X bool X single-expr */
1980  template<typename Expr>
1981  inline CondBuilder<NeboSingleValueCond<Initial,
1982  NeboSingleValueClause<Initial,
1983  NeboScalar<Initial,
1984  bool>,
1985  Expr,
1986  T>,
1987  Clauses,
1988  T> > operator ()(bool const b,
1990  T>
1991  const & e) {
1992  NeboScalar<Initial, bool> typedef Boolean;
1993 
1995 
1997 
1998  CondBuilder<Cond> typedef ReturnType;
1999 
2000  return ReturnType(Cond(Clause(Boolean(b), e.expr()), clauses_));
2001  }
2002 
2003  /* single X bool X field */
2004  template<typename FieldType>
2005  inline CondBuilder<NeboCond<Initial,
2006  NeboClause<Initial,
2007  NeboScalar<Initial, bool>,
2008  NeboConstField<Initial,
2009  typename
2010  NeboFieldCheck<typename
2011  FieldType::
2012  field_type,
2013  FieldType>::
2014  Result>,
2015  typename NeboFieldCheck<typename
2016  FieldType::
2017  field_type,
2018  FieldType>::
2019  Result>,
2020  typename Clauses::template Convert<typename
2021  NeboFieldCheck<typename
2022  FieldType::
2023  field_type,
2024  FieldType>::
2025  Result>::
2026  Result,
2027  typename NeboFieldCheck<typename
2028  FieldType::
2029  field_type,
2030  FieldType>::
2031  Result> > operator ()(bool const b,
2032  FieldType const & f) {
2033  NeboScalar<Initial, bool> typedef Boolean;
2034 
2035  NeboConstField<Initial, FieldType> typedef Field;
2036 
2038 
2039  typename Clauses::template Convert<FieldType>::Result typedef
2040  ConvertedClauses;
2041 
2043  Cond;
2044 
2045  CondBuilder<Cond> typedef ReturnType;
2046 
2047  return ReturnType(Cond(Clause(Boolean(b), Field(f)),
2048  clauses_.template convert<FieldType>()));
2049  }
2050 
2051  /* single X bool X expr */
2052  template<typename Expr, typename FieldType>
2053  inline CondBuilder<NeboCond<Initial,
2054  NeboClause<Initial,
2055  NeboScalar<Initial, bool>,
2056  Expr,
2057  typename NeboFieldCheck<typename
2058  FieldType::
2059  field_type,
2060  FieldType>::
2061  Result>,
2062  typename Clauses::template Convert<typename
2063  NeboFieldCheck<typename
2064  FieldType::
2065  field_type,
2066  FieldType>::
2067  Result>::
2068  Result,
2069  typename NeboFieldCheck<typename
2070  FieldType::
2071  field_type,
2072  FieldType>::
2073  Result> > operator ()(bool const b,
2074  NeboExpression<Expr,
2075  FieldType>
2076  const & e) {
2077  NeboScalar<Initial, bool> typedef Boolean;
2078 
2080 
2081  typename Clauses::template Convert<FieldType>::Result typedef
2082  ConvertedClauses;
2083 
2085  Cond;
2086 
2087  CondBuilder<Cond> typedef ReturnType;
2088 
2089  return ReturnType(Cond(Clause(Boolean(b), e.expr()),
2090  clauses_.template convert<FieldType>()));
2091  }
2092 
2093  /* single X single-expr X double */
2094  template<typename BoolExpr>
2095  inline CondBuilder<NeboSingleValueCond<Initial,
2096  NeboSingleValueClause<Initial,
2097  BoolExpr,
2098  NeboScalar<Initial,
2099  T>,
2100  T>,
2101  Clauses,
2102  T> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
2103  T>
2104  const & nb,
2105  double const
2106  d) {
2107  NeboScalar<Initial, T> typedef Scalar;
2108 
2110 
2112 
2113  CondBuilder<Cond> typedef ReturnType;
2114 
2115  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)), clauses_));
2116  }
2117 
2118  /* single X single-expr X single-field */
2119  template<typename BoolExpr>
2120  inline CondBuilder<NeboSingleValueCond<Initial,
2121  NeboSingleValueClause<Initial,
2122  BoolExpr,
2123  NeboConstSingleValueField<Initial,
2124  T>,
2125  T>,
2126  Clauses,
2127  T> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
2128  T>
2129  const & nb,
2130  SpatialOps::
2132  SingleValue,
2133  T>
2134  const & f) {
2136 
2138 
2140 
2141  CondBuilder<Cond> typedef ReturnType;
2142 
2143  return ReturnType(Cond(Clause(nb.expr(), Field(f)), clauses_));
2144  }
2145 
2146  /* single X single-expr X single-expr */
2147  template<typename BoolExpr, typename Expr>
2148  inline CondBuilder<NeboSingleValueCond<Initial,
2149  NeboSingleValueClause<Initial,
2150  BoolExpr,
2151  Expr,
2152  T>,
2153  Clauses,
2154  T> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
2155  T>
2156  const & nb,
2158  T>
2159  const & e) {
2161 
2163 
2164  CondBuilder<Cond> typedef ReturnType;
2165 
2166  return ReturnType(Cond(Clause(nb.expr(), e.expr()), clauses_));
2167  }
2168 
2169  /* single X single-expr X field */
2170  template<typename BoolExpr, typename FieldType>
2171  inline CondBuilder<NeboCond<Initial,
2172  NeboClause<Initial,
2173  BoolExpr,
2174  NeboConstField<Initial,
2175  typename
2176  NeboFieldCheck<typename
2177  FieldType::
2178  field_type,
2179  FieldType>::
2180  Result>,
2181  typename NeboFieldCheck<typename
2182  FieldType::
2183  field_type,
2184  FieldType>::
2185  Result>,
2186  typename Clauses::template Convert<typename
2187  NeboFieldCheck<typename
2188  FieldType::
2189  field_type,
2190  FieldType>::
2191  Result>::
2192  Result,
2193  typename NeboFieldCheck<typename
2194  FieldType::
2195  field_type,
2196  FieldType>::
2197  Result> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
2198  typename
2199  FieldType::
2200  value_type>
2201  const & nb,
2202  FieldType const & f) {
2203  NeboConstField<Initial, FieldType> typedef Field;
2204 
2206 
2207  typename Clauses::template Convert<FieldType>::Result typedef
2208  ConvertedClauses;
2209 
2211  Cond;
2212 
2213  CondBuilder<Cond> typedef ReturnType;
2214 
2215  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
2216  clauses_.template convert<FieldType>()));
2217  }
2218 
2219  /* single X single-expr X expr */
2220  template<typename BoolExpr, typename Expr, typename FieldType>
2221  inline CondBuilder<NeboCond<Initial,
2222  NeboClause<Initial,
2223  BoolExpr,
2224  Expr,
2225  typename NeboFieldCheck<typename
2226  FieldType::
2227  field_type,
2228  FieldType>::
2229  Result>,
2230  typename Clauses::template Convert<typename
2231  NeboFieldCheck<typename
2232  FieldType::
2233  field_type,
2234  FieldType>::
2235  Result>::
2236  Result,
2237  typename NeboFieldCheck<typename
2238  FieldType::
2239  field_type,
2240  FieldType>::
2241  Result> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
2242  typename
2243  FieldType::
2244  value_type>
2245  const & nb,
2246  NeboExpression<Expr,
2247  FieldType>
2248  const & e) {
2250 
2251  typename Clauses::template Convert<FieldType>::Result typedef
2252  ConvertedClauses;
2253 
2255  Cond;
2256 
2257  CondBuilder<Cond> typedef ReturnType;
2258 
2259  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
2260  clauses_.template convert<FieldType>()));
2261  }
2262 
2263  /* single X expr X double */
2264  template<typename BoolExpr, typename FieldType>
2265  inline CondBuilder<NeboCond<Initial,
2266  NeboClause<Initial,
2267  BoolExpr,
2268  NeboScalar<Initial,
2269  typename
2270  NeboFieldCheck<typename
2271  FieldType::
2272  field_type,
2273  FieldType>::
2274  Result::value_type>,
2275  typename NeboFieldCheck<typename
2276  FieldType::
2277  field_type,
2278  FieldType>::
2279  Result>,
2280  typename Clauses::template Convert<typename
2281  NeboFieldCheck<typename
2282  FieldType::
2283  field_type,
2284  FieldType>::
2285  Result>::
2286  Result,
2287  typename NeboFieldCheck<typename
2288  FieldType::
2289  field_type,
2290  FieldType>::
2291  Result> > operator ()(NeboBooleanExpression<BoolExpr,
2292  FieldType>
2293  const & nb,
2294  double const d) {
2296 
2298 
2299  typename Clauses::template Convert<FieldType>::Result typedef
2300  ConvertedClauses;
2301 
2303  Cond;
2304 
2305  CondBuilder<Cond> typedef ReturnType;
2306 
2307  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)),
2308  clauses_.template convert<FieldType>()));
2309  }
2310 
2311  /* single X expr X single-field */
2312  template<typename BoolExpr, typename FieldType>
2313  inline CondBuilder<NeboCond<Initial,
2314  NeboClause<Initial,
2315  BoolExpr,
2316  NeboConstSingleValueField<Initial,
2317  typename
2318  NeboFieldCheck<typename
2319  FieldType::
2320  field_type,
2321  FieldType>::
2322  Result::
2323  value_type>,
2324  typename NeboFieldCheck<typename
2325  FieldType::
2326  field_type,
2327  FieldType>::
2328  Result>,
2329  typename Clauses::template Convert<typename
2330  NeboFieldCheck<typename
2331  FieldType::
2332  field_type,
2333  FieldType>::
2334  Result>::
2335  Result,
2336  typename NeboFieldCheck<typename
2337  FieldType::
2338  field_type,
2339  FieldType>::
2340  Result> > operator ()(NeboBooleanExpression<BoolExpr,
2341  FieldType>
2342  const & nb,
2343  SpatialOps::
2345  SingleValue,
2346  typename
2347  FieldType::
2348  value_type>
2349  const & f) {
2351  typedef Field;
2352 
2354 
2355  typename Clauses::template Convert<FieldType>::Result typedef
2356  ConvertedClauses;
2357 
2359  Cond;
2360 
2361  CondBuilder<Cond> typedef ReturnType;
2362 
2363  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
2364  clauses_.template convert<FieldType>()));
2365  }
2366 
2367  /* single X expr X single-expr */
2368  template<typename BoolExpr, typename Expr, typename FieldType>
2369  inline CondBuilder<NeboCond<Initial,
2370  NeboClause<Initial,
2371  BoolExpr,
2372  Expr,
2373  typename NeboFieldCheck<typename
2374  FieldType::
2375  field_type,
2376  FieldType>::
2377  Result>,
2378  typename Clauses::template Convert<typename
2379  NeboFieldCheck<typename
2380  FieldType::
2381  field_type,
2382  FieldType>::
2383  Result>::
2384  Result,
2385  typename NeboFieldCheck<typename
2386  FieldType::
2387  field_type,
2388  FieldType>::
2389  Result> > operator ()(NeboBooleanExpression<BoolExpr,
2390  FieldType>
2391  const & nb,
2393  typename
2394  FieldType::
2395  value_type>
2396  const & e) {
2398 
2399  typename Clauses::template Convert<FieldType>::Result typedef
2400  ConvertedClauses;
2401 
2403  Cond;
2404 
2405  CondBuilder<Cond> typedef ReturnType;
2406 
2407  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
2408  clauses_.template convert<FieldType>()));
2409  }
2410 
2411  /* single X expr X field */
2412  template<typename BoolExpr, typename FieldType>
2413  inline CondBuilder<NeboCond<Initial,
2414  NeboClause<Initial,
2415  BoolExpr,
2416  NeboConstField<Initial,
2417  typename
2418  NeboFieldCheck<typename
2419  FieldType::
2420  field_type,
2421  FieldType>::
2422  Result>,
2423  typename NeboFieldCheck<typename
2424  FieldType::
2425  field_type,
2426  FieldType>::
2427  Result>,
2428  typename Clauses::template Convert<typename
2429  NeboFieldCheck<typename
2430  FieldType::
2431  field_type,
2432  FieldType>::
2433  Result>::
2434  Result,
2435  typename NeboFieldCheck<typename
2436  FieldType::
2437  field_type,
2438  FieldType>::
2439  Result> > operator ()(NeboBooleanExpression<BoolExpr,
2440  FieldType>
2441  const & nb,
2442  FieldType const & f) {
2443  NeboConstField<Initial, FieldType> typedef Field;
2444 
2446 
2447  typename Clauses::template Convert<FieldType>::Result typedef
2448  ConvertedClauses;
2449 
2451  Cond;
2452 
2453  CondBuilder<Cond> typedef ReturnType;
2454 
2455  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
2456  clauses_.template convert<FieldType>()));
2457  }
2458 
2459  /* single X expr X expr */
2460  template<typename BoolExpr, typename Expr, typename FieldType>
2461  inline CondBuilder<NeboCond<Initial,
2462  NeboClause<Initial,
2463  BoolExpr,
2464  Expr,
2465  typename NeboFieldCheck<typename
2466  FieldType::
2467  field_type,
2468  FieldType>::
2469  Result>,
2470  typename Clauses::template Convert<typename
2471  NeboFieldCheck<typename
2472  FieldType::
2473  field_type,
2474  FieldType>::
2475  Result>::
2476  Result,
2477  typename NeboFieldCheck<typename
2478  FieldType::
2479  field_type,
2480  FieldType>::
2481  Result> > operator ()(NeboBooleanExpression<BoolExpr,
2482  FieldType>
2483  const & nb,
2484  NeboExpression<Expr,
2485  FieldType>
2486  const & e) {
2488 
2489  typename Clauses::template Convert<FieldType>::Result typedef
2490  ConvertedClauses;
2491 
2493  Cond;
2494 
2495  CondBuilder<Cond> typedef ReturnType;
2496 
2497  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
2498  clauses_.template convert<FieldType>()));
2499  }
2500 
2501  /* single X mask X double */
2502  template<typename FieldType>
2503  inline CondBuilder<NeboCond<Initial,
2504  NeboClause<Initial,
2505  NeboMask<Initial,
2506  typename
2507  NeboFieldCheck<typename
2508  FieldType::
2509  field_type,
2510  FieldType>::
2511  Result>,
2512  NeboScalar<Initial,
2513  typename
2514  NeboFieldCheck<typename
2515  FieldType::
2516  field_type,
2517  FieldType>::
2518  Result::value_type>,
2519  typename NeboFieldCheck<typename
2520  FieldType::
2521  field_type,
2522  FieldType>::
2523  Result>,
2524  typename Clauses::template Convert<typename
2525  NeboFieldCheck<typename
2526  FieldType::
2527  field_type,
2528  FieldType>::
2529  Result>::
2530  Result,
2531  typename NeboFieldCheck<typename
2532  FieldType::
2533  field_type,
2534  FieldType>::
2535  Result> > operator ()(SpatialMask<FieldType>
2536  const & mask,
2537  double const d) {
2538  NeboMask<Initial, FieldType> typedef Mask;
2539 
2541 
2543 
2544  typename Clauses::template Convert<FieldType>::Result typedef
2545  ConvertedClauses;
2546 
2548  Cond;
2549 
2550  CondBuilder<Cond> typedef ReturnType;
2551 
2552  return ReturnType(Cond(Clause(Mask(mask), Scalar(d)),
2553  clauses_.template convert<FieldType>()));
2554  }
2555 
2556  /* single X mask X single-field */
2557  template<typename FieldType>
2558  inline CondBuilder<NeboCond<Initial,
2559  NeboClause<Initial,
2560  NeboMask<Initial,
2561  typename
2562  NeboFieldCheck<typename
2563  FieldType::
2564  field_type,
2565  FieldType>::
2566  Result>,
2567  NeboConstSingleValueField<Initial,
2568  typename
2569  NeboFieldCheck<typename
2570  FieldType::
2571  field_type,
2572  FieldType>::
2573  Result::
2574  value_type>,
2575  typename NeboFieldCheck<typename
2576  FieldType::
2577  field_type,
2578  FieldType>::
2579  Result>,
2580  typename Clauses::template Convert<typename
2581  NeboFieldCheck<typename
2582  FieldType::
2583  field_type,
2584  FieldType>::
2585  Result>::
2586  Result,
2587  typename NeboFieldCheck<typename
2588  FieldType::
2589  field_type,
2590  FieldType>::
2591  Result> > operator ()(SpatialMask<FieldType>
2592  const & mask,
2593  SpatialOps::
2595  SingleValue,
2596  typename
2597  FieldType::
2598  value_type>
2599  const & f) {
2600  NeboMask<Initial, FieldType> typedef Mask;
2601 
2603  typedef Field;
2604 
2606 
2607  typename Clauses::template Convert<FieldType>::Result typedef
2608  ConvertedClauses;
2609 
2611  Cond;
2612 
2613  CondBuilder<Cond> typedef ReturnType;
2614 
2615  return ReturnType(Cond(Clause(Mask(mask), Field(f)),
2616  clauses_.template convert<FieldType>()));
2617  }
2618 
2619  /* single X mask X single-expr */
2620  template<typename Expr, typename FieldType>
2621  inline CondBuilder<NeboCond<Initial,
2622  NeboClause<Initial,
2623  NeboMask<Initial,
2624  typename
2625  NeboFieldCheck<typename
2626  FieldType::
2627  field_type,
2628  FieldType>::
2629  Result>,
2630  Expr,
2631  typename NeboFieldCheck<typename
2632  FieldType::
2633  field_type,
2634  FieldType>::
2635  Result>,
2636  typename Clauses::template Convert<typename
2637  NeboFieldCheck<typename
2638  FieldType::
2639  field_type,
2640  FieldType>::
2641  Result>::
2642  Result,
2643  typename NeboFieldCheck<typename
2644  FieldType::
2645  field_type,
2646  FieldType>::
2647  Result> > operator ()(SpatialMask<FieldType>
2648  const & mask,
2650  typename
2651  FieldType::
2652  value_type>
2653  const & e) {
2654  NeboMask<Initial, FieldType> typedef Mask;
2655 
2657 
2658  typename Clauses::template Convert<FieldType>::Result typedef
2659  ConvertedClauses;
2660 
2662  Cond;
2663 
2664  CondBuilder<Cond> typedef ReturnType;
2665 
2666  return ReturnType(Cond(Clause(Mask(mask), e.expr()),
2667  clauses_.template convert<FieldType>()));
2668  }
2669 
2670  /* single X mask X field */
2671  template<typename FieldType>
2672  inline CondBuilder<NeboCond<Initial,
2673  NeboClause<Initial,
2674  NeboMask<Initial,
2675  typename
2676  NeboFieldCheck<typename
2677  FieldType::
2678  field_type,
2679  FieldType>::
2680  Result>,
2681  NeboConstField<Initial,
2682  typename
2683  NeboFieldCheck<typename
2684  FieldType::
2685  field_type,
2686  FieldType>::
2687  Result>,
2688  typename NeboFieldCheck<typename
2689  FieldType::
2690  field_type,
2691  FieldType>::
2692  Result>,
2693  typename Clauses::template Convert<typename
2694  NeboFieldCheck<typename
2695  FieldType::
2696  field_type,
2697  FieldType>::
2698  Result>::
2699  Result,
2700  typename NeboFieldCheck<typename
2701  FieldType::
2702  field_type,
2703  FieldType>::
2704  Result> > operator ()(SpatialMask<FieldType>
2705  const & mask,
2706  FieldType const & f) {
2707  NeboMask<Initial, FieldType> typedef Mask;
2708 
2709  NeboConstField<Initial, FieldType> typedef Field;
2710 
2712 
2713  typename Clauses::template Convert<FieldType>::Result typedef
2714  ConvertedClauses;
2715 
2717  Cond;
2718 
2719  CondBuilder<Cond> typedef ReturnType;
2720 
2721  return ReturnType(Cond(Clause(Mask(mask), Field(f)),
2722  clauses_.template convert<FieldType>()));
2723  }
2724 
2725  /* single X mask X expr */
2726  template<typename Expr, typename FieldType>
2727  inline CondBuilder<NeboCond<Initial,
2728  NeboClause<Initial,
2729  NeboMask<Initial,
2730  typename
2731  NeboFieldCheck<typename
2732  FieldType::
2733  field_type,
2734  FieldType>::
2735  Result>,
2736  Expr,
2737  typename NeboFieldCheck<typename
2738  FieldType::
2739  field_type,
2740  FieldType>::
2741  Result>,
2742  typename Clauses::template Convert<typename
2743  NeboFieldCheck<typename
2744  FieldType::
2745  field_type,
2746  FieldType>::
2747  Result>::
2748  Result,
2749  typename NeboFieldCheck<typename
2750  FieldType::
2751  field_type,
2752  FieldType>::
2753  Result> > operator ()(SpatialMask<FieldType>
2754  const & mask,
2755  NeboExpression<Expr,
2756  FieldType>
2757  const & e) {
2758  NeboMask<Initial, FieldType> typedef Mask;
2759 
2761 
2762  typename Clauses::template Convert<FieldType>::Result typedef
2763  ConvertedClauses;
2764 
2766  Cond;
2767 
2768  CondBuilder<Cond> typedef ReturnType;
2769 
2770  return ReturnType(Cond(Clause(Mask(mask), e.expr()),
2771  clauses_.template convert<FieldType>()));
2772  }
2773  };
2774 
2775  template<typename Otherwise>
2776  struct CondBuilder<NeboSimpleCond<Otherwise> > {
2777  public:
2778  NeboSimpleCond<Otherwise> typedef Clauses;
2779 
2780  private:
2781  template<typename Remaining, typename PreceedingResult>
2782  struct ReverseClausesRecursive;
2783 
2784  template<typename PreceedingResult>
2785  struct ReverseClausesRecursive<NeboNil, PreceedingResult> {
2786  PreceedingResult typedef Result;
2787 
2788  static inline Result reverse(NeboNil const & nil,
2789  PreceedingResult const & r) {
2790  return r;
2791  }
2792  };
2793 
2794  template<typename Following, typename PreceedingResult>
2795  struct ReverseClausesRecursive<NeboSimpleCond<Following>,
2796  PreceedingResult> {
2797  NeboSimpleCond<Following> typedef Remaining;
2798 
2799  NeboSimpleCond<PreceedingResult> typedef NewResult;
2800 
2801  ReverseClausesRecursive<Following, NewResult> typedef InternalCall;
2802 
2803  typename InternalCall::Result typedef Result;
2804 
2805  static inline Result reverse(Remaining const & l,
2806  PreceedingResult const & r) {
2807  return InternalCall::reverse(l.otherwise(),
2808  NewResult(l.clause(), r));
2809  }
2810  };
2811 
2812  Clauses const clauses_;
2813 
2814  public:
2816  : clauses_(cs)
2817  {}
2818 
2819  template<typename Final>
2820  struct ReverseClauses;
2821 
2822  template<typename Final>
2823  struct ReverseClauses {
2824  ReverseClausesRecursive<Clauses, Final> typedef InternalCall;
2825 
2826  typename InternalCall::Result typedef Result;
2827 
2828  static inline Result reverse(Clauses const & cs, Final const & f) {
2829  return InternalCall::reverse(cs, f);
2830  }
2831  };
2832 
2833  template<typename Final>
2834  inline typename ReverseClauses<Final>::Result reverse(Final const & f) {
2835  ReverseClauses<Final> typedef InternalCall;
2836 
2837  return InternalCall::reverse(clauses_, f);
2838  }
2839 
2840  /* simple X final X double */
2841  inline double operator ()(double const d) {
2842  return reverse(NeboSimpleFinalClause(d)).eval();
2843  }
2844 
2845  /* simple X final X single-field */
2846  template<typename T>
2847  inline NeboSingleValueExpression<typename CondBuilder<typename
2848  Clauses::
2849  template
2850  SingleConvert<T>::
2851  result>::
2852  template ReverseClauses<NeboConstSingleValueField<Initial,
2853  T>
2854  >::Result,
2855  T> operator ()(SpatialOps::
2857  SingleValue,
2858  T> const
2859  & f) {
2861 
2862  typename Clauses::template SingleConvert<T>::result typedef
2863  ConvertedClauses;
2864 
2865  CondBuilder<ConvertedClauses> typedef NewBuilder;
2866 
2867  typename NewBuilder::template ReverseClauses<Field>::Result
2868  typedef ReversedClauses;
2869 
2871 
2872  return ReturnType(NewBuilder(clauses_.template single_convert<T>()).reverse(Field(f)));
2873  }
2874 
2875  /* simple X final X single-expr */
2876  template<typename Expr, typename T>
2877  inline NeboSingleValueExpression<typename CondBuilder<typename
2878  Clauses::
2879  template
2880  SingleConvert<T>::
2881  result>::
2882  template ReverseClauses<Expr>::
2883  Result,
2884  T> operator ()(NeboSingleValueExpression<Expr,
2885  T>
2886  const & e) {
2887  typename Clauses::template SingleConvert<T>::result typedef
2888  ConvertedClauses;
2889 
2890  CondBuilder<ConvertedClauses> typedef NewBuilder;
2891 
2892  typename NewBuilder::template ReverseClauses<Expr>::Result typedef
2893  ReversedClauses;
2894 
2896 
2897  return ReturnType(NewBuilder(clauses_.template single_convert<T>()).reverse(e.expr()));
2898  }
2899 
2900  /* simple X final X field */
2901  template<typename FieldType>
2902  inline NeboExpression<typename CondBuilder<typename Clauses::template
2903  FullConvert<typename
2904  NeboFieldCheck<typename
2905  FieldType::
2906  field_type,
2907  FieldType>::
2908  Result>::
2909  result>::template
2910  ReverseClauses<NeboConstField<Initial,
2911  typename
2912  NeboFieldCheck<typename
2913  FieldType::
2914  field_type,
2915  FieldType>::
2916  Result> >::Result,
2917  typename NeboFieldCheck<typename FieldType::
2918  field_type,
2919  FieldType>::Result>
2920  operator ()(FieldType const & f) {
2921  NeboConstField<Initial, FieldType> typedef Field;
2922 
2923  typename Clauses::template FullConvert<FieldType>::result typedef
2924  ConvertedClauses;
2925 
2926  CondBuilder<ConvertedClauses> typedef NewBuilder;
2927 
2928  typename NewBuilder::template ReverseClauses<Field>::Result
2929  typedef ReversedClauses;
2930 
2931  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
2932 
2933  return ReturnType(NewBuilder(clauses_.template full_convert<FieldType>()).reverse(Field(f)));
2934  }
2935 
2936  /* simple X final X expr */
2937  template<typename Expr, typename FieldType>
2938  inline NeboExpression<typename CondBuilder<typename Clauses::template
2939  FullConvert<typename
2940  NeboFieldCheck<typename
2941  FieldType::
2942  field_type,
2943  FieldType>::
2944  Result>::
2945  result>::template
2946  ReverseClauses<Expr>::Result,
2947  typename NeboFieldCheck<typename FieldType::
2948  field_type,
2949  FieldType>::Result>
2950  operator ()(NeboExpression<Expr, FieldType> const & e) {
2951  typename Clauses::template FullConvert<FieldType>::result typedef
2952  ConvertedClauses;
2953 
2954  CondBuilder<ConvertedClauses> typedef NewBuilder;
2955 
2956  typename NewBuilder::template ReverseClauses<Expr>::Result typedef
2957  ReversedClauses;
2958 
2959  NeboExpression<ReversedClauses, FieldType> typedef ReturnType;
2960 
2961  return ReturnType(NewBuilder(clauses_.template full_convert<FieldType>()).reverse(e.expr()));
2962  }
2963 
2964  /* simple X bool X double */
2965  inline CondBuilder<NeboSimpleCond<Clauses> > operator ()(bool const b,
2966  double const
2967  d) {
2968  NeboSimpleCond<Clauses> typedef Cond;
2969 
2970  CondBuilder<Cond> typedef ReturnType;
2971 
2972  return ReturnType(Cond(NeboSimpleClause(b, d), clauses_));
2973  }
2974 
2975  /* simple X bool X single-field */
2976  template<typename T>
2977  inline CondBuilder<NeboSingleValueCond<Initial,
2978  NeboSingleValueClause<Initial,
2979  NeboScalar<Initial,
2980  bool>,
2981  NeboConstSingleValueField<Initial,
2982  T>,
2983  T>,
2984  typename Clauses::template
2985  SingleConvert<T>::result,
2986  T> > operator ()(bool const b,
2987  SpatialOps::
2989  SingleValue,
2990  T>
2991  const & f) {
2992  NeboScalar<Initial, bool> typedef Boolean;
2993 
2995 
2997 
2998  typename Clauses::template SingleConvert<T>::result typedef
2999  ConvertedClauses;
3000 
3002  Cond;
3003 
3004  CondBuilder<Cond> typedef ReturnType;
3005 
3006  return ReturnType(Cond(Clause(Boolean(b), Field(f)),
3007  clauses_.template single_convert<T>()));
3008  }
3009 
3010  /* simple X bool X single-expr */
3011  template<typename Expr, typename T>
3012  inline CondBuilder<NeboSingleValueCond<Initial,
3013  NeboSingleValueClause<Initial,
3014  NeboScalar<Initial,
3015  bool>,
3016  Expr,
3017  T>,
3018  typename Clauses::template
3019  SingleConvert<T>::result,
3020  T> > operator ()(bool const b,
3022  T>
3023  const & e) {
3024  NeboScalar<Initial, bool> typedef Boolean;
3025 
3027 
3028  typename Clauses::template SingleConvert<T>::result typedef
3029  ConvertedClauses;
3030 
3032  Cond;
3033 
3034  CondBuilder<Cond> typedef ReturnType;
3035 
3036  return ReturnType(Cond(Clause(Boolean(b), e.expr()),
3037  clauses_.template single_convert<T>()));
3038  }
3039 
3040  /* simple X bool X field */
3041  template<typename FieldType>
3042  inline CondBuilder<NeboCond<Initial,
3043  NeboClause<Initial,
3044  NeboScalar<Initial, bool>,
3045  NeboConstField<Initial,
3046  typename
3047  NeboFieldCheck<typename
3048  FieldType::
3049  field_type,
3050  FieldType>::
3051  Result>,
3052  typename NeboFieldCheck<typename
3053  FieldType::
3054  field_type,
3055  FieldType>::
3056  Result>,
3057  typename Clauses::template FullConvert<typename
3058  NeboFieldCheck<typename
3059  FieldType::
3060  field_type,
3061  FieldType>::
3062  Result>::
3063  result,
3064  typename NeboFieldCheck<typename
3065  FieldType::
3066  field_type,
3067  FieldType>::
3068  Result> > operator ()(bool const b,
3069  FieldType const & f) {
3070  NeboScalar<Initial, bool> typedef Boolean;
3071 
3072  NeboConstField<Initial, FieldType> typedef Field;
3073 
3075 
3076  typename Clauses::template FullConvert<FieldType>::result typedef
3077  ConvertedClauses;
3078 
3080  Cond;
3081 
3082  CondBuilder<Cond> typedef ReturnType;
3083 
3084  return ReturnType(Cond(Clause(Boolean(b), Field(f)),
3085  clauses_.template full_convert<FieldType>()));
3086  }
3087 
3088  /* simple X bool X expr */
3089  template<typename Expr, typename FieldType>
3090  inline CondBuilder<NeboCond<Initial,
3091  NeboClause<Initial,
3092  NeboScalar<Initial, bool>,
3093  Expr,
3094  typename NeboFieldCheck<typename
3095  FieldType::
3096  field_type,
3097  FieldType>::
3098  Result>,
3099  typename Clauses::template FullConvert<typename
3100  NeboFieldCheck<typename
3101  FieldType::
3102  field_type,
3103  FieldType>::
3104  Result>::
3105  result,
3106  typename NeboFieldCheck<typename
3107  FieldType::
3108  field_type,
3109  FieldType>::
3110  Result> > operator ()(bool const b,
3111  NeboExpression<Expr,
3112  FieldType>
3113  const & e) {
3114  NeboScalar<Initial, bool> typedef Boolean;
3115 
3117 
3118  typename Clauses::template FullConvert<FieldType>::result typedef
3119  ConvertedClauses;
3120 
3122  Cond;
3123 
3124  CondBuilder<Cond> typedef ReturnType;
3125 
3126  return ReturnType(Cond(Clause(Boolean(b), e.expr()),
3127  clauses_.template full_convert<FieldType>()));
3128  }
3129 
3130  /* simple X single-expr X double */
3131  template<typename BoolExpr, typename T>
3132  inline CondBuilder<NeboSingleValueCond<Initial,
3133  NeboSingleValueClause<Initial,
3134  BoolExpr,
3135  NeboScalar<Initial,
3136  T>,
3137  T>,
3138  typename Clauses::template
3139  SingleConvert<T>::result,
3140  T> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
3141  T>
3142  const & nb,
3143  double const
3144  d) {
3145  NeboScalar<Initial, T> typedef Scalar;
3146 
3148 
3149  typename Clauses::template SingleConvert<T>::result typedef
3150  ConvertedClauses;
3151 
3153  Cond;
3154 
3155  CondBuilder<Cond> typedef ReturnType;
3156 
3157  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)),
3158  clauses_.template single_convert<T>()));
3159  }
3160 
3161  /* simple X single-expr X single-field */
3162  template<typename BoolExpr, typename T>
3163  inline CondBuilder<NeboSingleValueCond<Initial,
3164  NeboSingleValueClause<Initial,
3165  BoolExpr,
3166  NeboConstSingleValueField<Initial,
3167  T>,
3168  T>,
3169  typename Clauses::template
3170  SingleConvert<T>::result,
3171  T> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
3172  T>
3173  const & nb,
3174  SpatialOps::
3176  SingleValue,
3177  T>
3178  const & f) {
3180 
3182 
3183  typename Clauses::template SingleConvert<T>::result typedef
3184  ConvertedClauses;
3185 
3187  Cond;
3188 
3189  CondBuilder<Cond> typedef ReturnType;
3190 
3191  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
3192  clauses_.template single_convert<T>()));
3193  }
3194 
3195  /* simple X single-expr X single-expr */
3196  template<typename BoolExpr, typename Expr, typename T>
3197  inline CondBuilder<NeboSingleValueCond<Initial,
3198  NeboSingleValueClause<Initial,
3199  BoolExpr,
3200  Expr,
3201  T>,
3202  typename Clauses::template
3203  SingleConvert<T>::result,
3204  T> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
3205  T>
3206  const & nb,
3208  T>
3209  const & e) {
3211 
3212  typename Clauses::template SingleConvert<T>::result typedef
3213  ConvertedClauses;
3214 
3216  Cond;
3217 
3218  CondBuilder<Cond> typedef ReturnType;
3219 
3220  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
3221  clauses_.template single_convert<T>()));
3222  }
3223 
3224  /* simple X single-expr X field */
3225  template<typename BoolExpr, typename FieldType>
3226  inline CondBuilder<NeboCond<Initial,
3227  NeboClause<Initial,
3228  BoolExpr,
3229  NeboConstField<Initial,
3230  typename
3231  NeboFieldCheck<typename
3232  FieldType::
3233  field_type,
3234  FieldType>::
3235  Result>,
3236  typename NeboFieldCheck<typename
3237  FieldType::
3238  field_type,
3239  FieldType>::
3240  Result>,
3241  typename Clauses::template FullConvert<typename
3242  NeboFieldCheck<typename
3243  FieldType::
3244  field_type,
3245  FieldType>::
3246  Result>::
3247  result,
3248  typename NeboFieldCheck<typename
3249  FieldType::
3250  field_type,
3251  FieldType>::
3252  Result> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
3253  typename
3254  FieldType::
3255  value_type>
3256  const & nb,
3257  FieldType const & f) {
3258  NeboConstField<Initial, FieldType> typedef Field;
3259 
3261 
3262  typename Clauses::template FullConvert<FieldType>::result typedef
3263  ConvertedClauses;
3264 
3266  Cond;
3267 
3268  CondBuilder<Cond> typedef ReturnType;
3269 
3270  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
3271  clauses_.template full_convert<FieldType>()));
3272  }
3273 
3274  /* simple X single-expr X expr */
3275  template<typename BoolExpr, typename Expr, typename FieldType>
3276  inline CondBuilder<NeboCond<Initial,
3277  NeboClause<Initial,
3278  BoolExpr,
3279  Expr,
3280  typename NeboFieldCheck<typename
3281  FieldType::
3282  field_type,
3283  FieldType>::
3284  Result>,
3285  typename Clauses::template FullConvert<typename
3286  NeboFieldCheck<typename
3287  FieldType::
3288  field_type,
3289  FieldType>::
3290  Result>::
3291  result,
3292  typename NeboFieldCheck<typename
3293  FieldType::
3294  field_type,
3295  FieldType>::
3296  Result> > operator ()(NeboBooleanSingleValueExpression<BoolExpr,
3297  typename
3298  FieldType::
3299  value_type>
3300  const & nb,
3301  NeboExpression<Expr,
3302  FieldType>
3303  const & e) {
3305 
3306  typename Clauses::template FullConvert<FieldType>::result typedef
3307  ConvertedClauses;
3308 
3310  Cond;
3311 
3312  CondBuilder<Cond> typedef ReturnType;
3313 
3314  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
3315  clauses_.template full_convert<FieldType>()));
3316  }
3317 
3318  /* simple X expr X double */
3319  template<typename BoolExpr, typename FieldType>
3320  inline CondBuilder<NeboCond<Initial,
3321  NeboClause<Initial,
3322  BoolExpr,
3323  NeboScalar<Initial,
3324  typename
3325  NeboFieldCheck<typename
3326  FieldType::
3327  field_type,
3328  FieldType>::
3329  Result::value_type>,
3330  typename NeboFieldCheck<typename
3331  FieldType::
3332  field_type,
3333  FieldType>::
3334  Result>,
3335  typename Clauses::template FullConvert<typename
3336  NeboFieldCheck<typename
3337  FieldType::
3338  field_type,
3339  FieldType>::
3340  Result>::
3341  result,
3342  typename NeboFieldCheck<typename
3343  FieldType::
3344  field_type,
3345  FieldType>::
3346  Result> > operator ()(NeboBooleanExpression<BoolExpr,
3347  FieldType>
3348  const & nb,
3349  double const d) {
3351 
3353 
3354  typename Clauses::template FullConvert<FieldType>::result typedef
3355  ConvertedClauses;
3356 
3358  Cond;
3359 
3360  CondBuilder<Cond> typedef ReturnType;
3361 
3362  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)),
3363  clauses_.template full_convert<FieldType>()));
3364  }
3365 
3366  /* simple X expr X single-field */
3367  template<typename BoolExpr, typename FieldType>
3368  inline CondBuilder<NeboCond<Initial,
3369  NeboClause<Initial,
3370  BoolExpr,
3371  NeboConstSingleValueField<Initial,
3372  typename
3373  NeboFieldCheck<typename
3374  FieldType::
3375  field_type,
3376  FieldType>::
3377  Result::
3378  value_type>,
3379  typename NeboFieldCheck<typename
3380  FieldType::
3381  field_type,
3382  FieldType>::
3383  Result>,
3384  typename Clauses::template FullConvert<typename
3385  NeboFieldCheck<typename
3386  FieldType::
3387  field_type,
3388  FieldType>::
3389  Result>::
3390  result,
3391  typename NeboFieldCheck<typename
3392  FieldType::
3393  field_type,
3394  FieldType>::
3395  Result> > operator ()(NeboBooleanExpression<BoolExpr,
3396  FieldType>
3397  const & nb,
3398  SpatialOps::
3400  SingleValue,
3401  typename
3402  FieldType::
3403  value_type>
3404  const & f) {
3406  typedef Field;
3407 
3409 
3410  typename Clauses::template FullConvert<FieldType>::result typedef
3411  ConvertedClauses;
3412 
3414  Cond;
3415 
3416  CondBuilder<Cond> typedef ReturnType;
3417 
3418  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
3419  clauses_.template full_convert<FieldType>()));
3420  }
3421 
3422  /* simple X expr X single-expr */
3423  template<typename BoolExpr, typename Expr, typename FieldType>
3424  inline CondBuilder<NeboCond<Initial,
3425  NeboClause<Initial,
3426  BoolExpr,
3427  Expr,
3428  typename NeboFieldCheck<typename
3429  FieldType::
3430  field_type,
3431  FieldType>::
3432  Result>,
3433  typename Clauses::template FullConvert<typename
3434  NeboFieldCheck<typename
3435  FieldType::
3436  field_type,
3437  FieldType>::
3438  Result>::
3439  result,
3440  typename NeboFieldCheck<typename
3441  FieldType::
3442  field_type,
3443  FieldType>::
3444  Result> > operator ()(NeboBooleanExpression<BoolExpr,
3445  FieldType>
3446  const & nb,
3448  typename
3449  FieldType::
3450  value_type>
3451  const & e) {
3453 
3454  typename Clauses::template FullConvert<FieldType>::result typedef
3455  ConvertedClauses;
3456 
3458  Cond;
3459 
3460  CondBuilder<Cond> typedef ReturnType;
3461 
3462  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
3463  clauses_.template full_convert<FieldType>()));
3464  }
3465 
3466  /* simple X expr X field */
3467  template<typename BoolExpr, typename FieldType>
3468  inline CondBuilder<NeboCond<Initial,
3469  NeboClause<Initial,
3470  BoolExpr,
3471  NeboConstField<Initial,
3472  typename
3473  NeboFieldCheck<typename
3474  FieldType::
3475  field_type,
3476  FieldType>::
3477  Result>,
3478  typename NeboFieldCheck<typename
3479  FieldType::
3480  field_type,
3481  FieldType>::
3482  Result>,
3483  typename Clauses::template FullConvert<typename
3484  NeboFieldCheck<typename
3485  FieldType::
3486  field_type,
3487  FieldType>::
3488  Result>::
3489  result,
3490  typename NeboFieldCheck<typename
3491  FieldType::
3492  field_type,
3493  FieldType>::
3494  Result> > operator ()(NeboBooleanExpression<BoolExpr,
3495  FieldType>
3496  const & nb,
3497  FieldType const & f) {
3498  NeboConstField<Initial, FieldType> typedef Field;
3499 
3501 
3502  typename Clauses::template FullConvert<FieldType>::result typedef
3503  ConvertedClauses;
3504 
3506  Cond;
3507 
3508  CondBuilder<Cond> typedef ReturnType;
3509 
3510  return ReturnType(Cond(Clause(nb.expr(), Field(f)),
3511  clauses_.template full_convert<FieldType>()));
3512  }
3513 
3514  /* simple X expr X expr */
3515  template<typename BoolExpr, typename Expr, typename FieldType>
3516  inline CondBuilder<NeboCond<Initial,
3517  NeboClause<Initial,
3518  BoolExpr,
3519  Expr,
3520  typename NeboFieldCheck<typename
3521  FieldType::
3522  field_type,
3523  FieldType>::
3524  Result>,
3525  typename Clauses::template FullConvert<typename
3526  NeboFieldCheck<typename
3527  FieldType::
3528  field_type,
3529  FieldType>::
3530  Result>::
3531  result,
3532  typename NeboFieldCheck<typename
3533  FieldType::
3534  field_type,
3535  FieldType>::
3536  Result> > operator ()(NeboBooleanExpression<BoolExpr,
3537  FieldType>
3538  const & nb,
3539  NeboExpression<Expr,
3540  FieldType>
3541  const & e) {
3543 
3544  typename Clauses::template FullConvert<FieldType>::result typedef
3545  ConvertedClauses;
3546 
3548  Cond;
3549 
3550  CondBuilder<Cond> typedef ReturnType;
3551 
3552  return ReturnType(Cond(Clause(nb.expr(), e.expr()),
3553  clauses_.template full_convert<FieldType>()));
3554  }
3555 
3556  /* simple X mask X double */
3557  template<typename FieldType>
3558  inline CondBuilder<NeboCond<Initial,
3559  NeboClause<Initial,
3560  NeboMask<Initial,
3561  typename
3562  NeboFieldCheck<typename
3563  FieldType::
3564  field_type,
3565  FieldType>::
3566  Result>,
3567  NeboScalar<Initial,
3568  typename
3569  NeboFieldCheck<typename
3570  FieldType::
3571  field_type,
3572  FieldType>::
3573  Result::value_type>,
3574  typename NeboFieldCheck<typename
3575  FieldType::
3576  field_type,
3577  FieldType>::
3578  Result>,
3579  typename Clauses::template FullConvert<typename
3580  NeboFieldCheck<typename
3581  FieldType::
3582  field_type,
3583  FieldType>::
3584  Result>::
3585  result,
3586  typename NeboFieldCheck<typename
3587  FieldType::
3588  field_type,
3589  FieldType>::
3590  Result> > operator ()(SpatialMask<FieldType>
3591  const & mask,
3592  double const d) {
3593  NeboMask<Initial, FieldType> typedef Mask;
3594 
3596 
3598 
3599  typename Clauses::template FullConvert<FieldType>::result typedef
3600  ConvertedClauses;
3601 
3603  Cond;
3604 
3605  CondBuilder<Cond> typedef ReturnType;
3606 
3607  return ReturnType(Cond(Clause(Mask(mask), Scalar(d)),
3608  clauses_.template full_convert<FieldType>()));
3609  }
3610 
3611  /* simple X mask X single-field */
3612  template<typename FieldType>
3613  inline CondBuilder<NeboCond<Initial,
3614  NeboClause<Initial,
3615  NeboMask<Initial,
3616  typename
3617  NeboFieldCheck<typename
3618  FieldType::
3619  field_type,
3620  FieldType>::
3621  Result>,
3622  NeboConstSingleValueField<Initial,
3623  typename
3624  NeboFieldCheck<typename
3625  FieldType::
3626  field_type,
3627  FieldType>::
3628  Result::
3629  value_type>,
3630  typename NeboFieldCheck<typename
3631  FieldType::
3632  field_type,
3633  FieldType>::
3634  Result>,
3635  typename Clauses::template FullConvert<typename
3636  NeboFieldCheck<typename
3637  FieldType::
3638  field_type,
3639  FieldType>::
3640  Result>::
3641  result,
3642  typename NeboFieldCheck<typename
3643  FieldType::
3644  field_type,
3645  FieldType>::
3646  Result> > operator ()(SpatialMask<FieldType>
3647  const & mask,
3648  SpatialOps::
3650  SingleValue,
3651  typename
3652  FieldType::
3653  value_type>
3654  const & f) {
3655  NeboMask<Initial, FieldType> typedef Mask;
3656 
3658  typedef Field;
3659 
3661 
3662  typename Clauses::template FullConvert<FieldType>::result typedef
3663  ConvertedClauses;
3664 
3666  Cond;
3667 
3668  CondBuilder<Cond> typedef ReturnType;
3669 
3670  return ReturnType(Cond(Clause(Mask(mask), Field(f)),
3671  clauses_.template full_convert<FieldType>()));
3672  }
3673 
3674  /* simple X mask X single-expr */
3675  template<typename Expr, typename FieldType>
3676  inline CondBuilder<NeboCond<Initial,
3677  NeboClause<Initial,
3678  NeboMask<Initial,
3679  typename
3680  NeboFieldCheck<typename
3681  FieldType::
3682  field_type,
3683  FieldType>::
3684  Result>,
3685  Expr,
3686  typename NeboFieldCheck<typename
3687  FieldType::
3688  field_type,
3689  FieldType>::
3690  Result>,
3691  typename Clauses::template FullConvert<typename
3692  NeboFieldCheck<typename
3693  FieldType::
3694  field_type,
3695  FieldType>::
3696  Result>::
3697  result,
3698  typename NeboFieldCheck<typename
3699  FieldType::
3700  field_type,
3701  FieldType>::
3702  Result> > operator ()(SpatialMask<FieldType>
3703  const & mask,
3705  typename
3706  FieldType::
3707  value_type>
3708  const & e) {
3709  NeboMask<Initial, FieldType> typedef Mask;
3710 
3712 
3713  typename Clauses::template FullConvert<FieldType>::result typedef
3714  ConvertedClauses;
3715 
3717  Cond;
3718 
3719  CondBuilder<Cond> typedef ReturnType;
3720 
3721  return ReturnType(Cond(Clause(Mask(mask), e.expr()),
3722  clauses_.template full_convert<FieldType>()));
3723  }
3724 
3725  /* simple X mask X field */
3726  template<typename FieldType>
3727  inline CondBuilder<NeboCond<Initial,
3728  NeboClause<Initial,
3729  NeboMask<Initial,
3730  typename
3731  NeboFieldCheck<typename
3732  FieldType::
3733  field_type,
3734  FieldType>::
3735  Result>,
3736  NeboConstField<Initial,
3737  typename
3738  NeboFieldCheck<typename
3739  FieldType::
3740  field_type,
3741  FieldType>::
3742  Result>,
3743  typename NeboFieldCheck<typename
3744  FieldType::
3745  field_type,
3746  FieldType>::
3747  Result>,
3748  typename Clauses::template FullConvert<typename
3749  NeboFieldCheck<typename
3750  FieldType::
3751  field_type,
3752  FieldType>::
3753  Result>::
3754  result,
3755  typename NeboFieldCheck<typename
3756  FieldType::
3757  field_type,
3758  FieldType>::
3759  Result> > operator ()(SpatialMask<FieldType>
3760  const & mask,
3761  FieldType const & f) {
3762  NeboMask<Initial, FieldType> typedef Mask;
3763 
3764  NeboConstField<Initial, FieldType> typedef Field;
3765 
3767 
3768  typename Clauses::template FullConvert<FieldType>::result typedef
3769  ConvertedClauses;
3770 
3772  Cond;
3773 
3774  CondBuilder<Cond> typedef ReturnType;
3775 
3776  return ReturnType(Cond(Clause(Mask(mask), Field(f)),
3777  clauses_.template full_convert<FieldType>()));
3778  }
3779 
3780  /* simple X mask X expr */
3781  template<typename Expr, typename FieldType>
3782  inline CondBuilder<NeboCond<Initial,
3783  NeboClause<Initial,
3784  NeboMask<Initial,
3785  typename
3786  NeboFieldCheck<typename
3787  FieldType::
3788  field_type,
3789  FieldType>::
3790  Result>,
3791  Expr,
3792  typename NeboFieldCheck<typename
3793  FieldType::
3794  field_type,
3795  FieldType>::
3796  Result>,
3797  typename Clauses::template FullConvert<typename
3798  NeboFieldCheck<typename
3799  FieldType::
3800  field_type,
3801  FieldType>::
3802  Result>::
3803  result,
3804  typename NeboFieldCheck<typename
3805  FieldType::
3806  field_type,
3807  FieldType>::
3808  Result> > operator ()(SpatialMask<FieldType>
3809  const & mask,
3810  NeboExpression<Expr,
3811  FieldType>
3812  const & e) {
3813  NeboMask<Initial, FieldType> typedef Mask;
3814 
3816 
3817  typename Clauses::template FullConvert<FieldType>::result typedef
3818  ConvertedClauses;
3819 
3821  Cond;
3822 
3823  CondBuilder<Cond> typedef ReturnType;
3824 
3825  return ReturnType(Cond(Clause(Mask(mask), e.expr()),
3826  clauses_.template full_convert<FieldType>()));
3827  }
3828  };
3829 
3830  template<>
3831  struct CondBuilder<NeboNil> {
3832  public:
3833  CondBuilder() {}
3834  };
3835 
3836  /* none X final X double */
3837  inline double cond(double const d) { return d; };
3838 
3839  /* none X final X single-field */
3840  template<typename T>
3844 
3845  NeboSingleValueExpression<Field, T> typedef ReturnType;
3846 
3847  return ReturnType(Field(f));
3848  };
3849 
3850  /* none X final X single-expr */
3851  template<typename Expr, typename T>
3853  T>
3854  const & e) { return e; };
3855 
3856  /* none X final X field */
3857  template<typename FieldType>
3858  inline NeboExpression<NeboConstField<Initial,
3859  typename NeboFieldCheck<typename
3860  FieldType::
3861  field_type,
3862  FieldType>::
3863  Result>,
3864  typename NeboFieldCheck<typename FieldType::
3865  field_type,
3866  FieldType>::Result> cond(FieldType
3867  const
3868  &
3869  f) {
3870  NeboConstField<Initial, FieldType> typedef Field;
3871 
3872  NeboExpression<Field, FieldType> typedef ReturnType;
3873 
3874  return ReturnType(Field(f));
3875  };
3876 
3877  /* none X final X expr */
3878  template<typename Expr, typename FieldType>
3879  inline NeboExpression<Expr,
3880  typename NeboFieldCheck<typename FieldType::
3881  field_type,
3882  FieldType>::Result> cond(NeboExpression<Expr,
3883  FieldType>
3884  const
3885  &
3886  e) {
3887  return e;
3888  };
3889 
3890  /* none X bool X double */
3891  inline CondBuilder<NeboSimpleCond<NeboNil> > cond(bool const b,
3892  double const d) {
3893  NeboSimpleCond<NeboNil> typedef Cond;
3894 
3895  CondBuilder<Cond> typedef ReturnType;
3896 
3897  return ReturnType(Cond(NeboSimpleClause(b, d), NeboNil()));
3898  };
3899 
3900  /* none X bool X single-field */
3901  template<typename T>
3902  inline CondBuilder<NeboSingleValueCond<Initial,
3903  NeboSingleValueClause<Initial,
3904  NeboScalar<Initial,
3905  bool>,
3906  NeboConstSingleValueField<Initial,
3907  T>,
3908  T>,
3909  NeboNil,
3910  T> > cond(bool const b,
3912  SingleValue,
3913  T>
3914  const & f) {
3915  NeboScalar<Initial, bool> typedef Boolean;
3916 
3918 
3920 
3922 
3923  CondBuilder<Cond> typedef ReturnType;
3924 
3925  return ReturnType(Cond(Clause(Boolean(b), Field(f)), NeboNil()));
3926  };
3927 
3928  /* none X bool X single-expr */
3929  template<typename Expr, typename T>
3930  inline CondBuilder<NeboSingleValueCond<Initial,
3931  NeboSingleValueClause<Initial,
3932  NeboScalar<Initial,
3933  bool>,
3934  Expr,
3935  T>,
3936  NeboNil,
3937  T> > cond(bool const b,
3939  T>
3940  const & e) {
3941  NeboScalar<Initial, bool> typedef Boolean;
3942 
3944 
3946 
3947  CondBuilder<Cond> typedef ReturnType;
3948 
3949  return ReturnType(Cond(Clause(Boolean(b), e.expr()), NeboNil()));
3950  };
3951 
3952  /* none X bool X field */
3953  template<typename FieldType>
3954  inline CondBuilder<NeboCond<Initial,
3955  NeboClause<Initial,
3956  NeboScalar<Initial, bool>,
3957  NeboConstField<Initial,
3958  typename
3959  NeboFieldCheck<typename
3960  FieldType::
3961  field_type,
3962  FieldType>::
3963  Result>,
3964  typename NeboFieldCheck<typename
3965  FieldType::
3966  field_type,
3967  FieldType>::
3968  Result>,
3969  NeboNil,
3970  typename NeboFieldCheck<typename FieldType::
3971  field_type,
3972  FieldType>::Result> >
3973  cond(bool const b, FieldType const & f) {
3974  NeboScalar<Initial, bool> typedef Boolean;
3975 
3976  NeboConstField<Initial, FieldType> typedef Field;
3977 
3979 
3981 
3982  CondBuilder<Cond> typedef ReturnType;
3983 
3984  return ReturnType(Cond(Clause(Boolean(b), Field(f)), NeboNil()));
3985  };
3986 
3987  /* none X bool X expr */
3988  template<typename Expr, typename FieldType>
3989  inline CondBuilder<NeboCond<Initial,
3990  NeboClause<Initial,
3991  NeboScalar<Initial, bool>,
3992  Expr,
3993  typename NeboFieldCheck<typename
3994  FieldType::
3995  field_type,
3996  FieldType>::
3997  Result>,
3998  NeboNil,
3999  typename NeboFieldCheck<typename FieldType::
4000  field_type,
4001  FieldType>::Result> >
4002  cond(bool const b, NeboExpression<Expr, FieldType> const & e) {
4003  NeboScalar<Initial, bool> typedef Boolean;
4004 
4006 
4008 
4009  CondBuilder<Cond> typedef ReturnType;
4010 
4011  return ReturnType(Cond(Clause(Boolean(b), e.expr()), NeboNil()));
4012  };
4013 
4014  /* none X single-expr X double */
4015  template<typename BoolExpr, typename T>
4016  inline CondBuilder<NeboSingleValueCond<Initial,
4017  NeboSingleValueClause<Initial,
4018  BoolExpr,
4019  NeboScalar<Initial,
4020  T>,
4021  T>,
4022  NeboNil,
4023  T> > cond(NeboBooleanSingleValueExpression<BoolExpr,
4024  T>
4025  const & nb,
4026  double const d) {
4027  NeboScalar<Initial, T> typedef Scalar;
4028 
4030 
4032 
4033  CondBuilder<Cond> typedef ReturnType;
4034 
4035  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)), NeboNil()));
4036  };
4037 
4038  /* none X single-expr X single-field */
4039  template<typename BoolExpr, typename T>
4040  inline CondBuilder<NeboSingleValueCond<Initial,
4041  NeboSingleValueClause<Initial,
4042  BoolExpr,
4043  NeboConstSingleValueField<Initial,
4044  T>,
4045  T>,
4046  NeboNil,
4047  T> > cond(NeboBooleanSingleValueExpression<BoolExpr,
4048  T>
4049  const & nb,
4051  SingleValue,
4052  T>
4053  const & f) {
4055 
4057 
4059 
4060  CondBuilder<Cond> typedef ReturnType;
4061 
4062  return ReturnType(Cond(Clause(nb.expr(), Field(f)), NeboNil()));
4063  };
4064 
4065  /* none X single-expr X single-expr */
4066  template<typename BoolExpr, typename Expr, typename T>
4067  inline CondBuilder<NeboSingleValueCond<Initial,
4068  NeboSingleValueClause<Initial,
4069  BoolExpr,
4070  Expr,
4071  T>,
4072  NeboNil,
4073  T> > cond(NeboBooleanSingleValueExpression<BoolExpr,
4074  T>
4075  const & nb,
4077  T>
4078  const & e) {
4080 
4082 
4083  CondBuilder<Cond> typedef ReturnType;
4084 
4085  return ReturnType(Cond(Clause(nb.expr(), e.expr()), NeboNil()));
4086  };
4087 
4088  /* none X single-expr X field */
4089  template<typename BoolExpr, typename FieldType>
4090  inline CondBuilder<NeboCond<Initial,
4091  NeboClause<Initial,
4092  BoolExpr,
4093  NeboConstField<Initial,
4094  typename
4095  NeboFieldCheck<typename
4096  FieldType::
4097  field_type,
4098  FieldType>::
4099  Result>,
4100  typename NeboFieldCheck<typename
4101  FieldType::
4102  field_type,
4103  FieldType>::
4104  Result>,
4105  NeboNil,
4106  typename NeboFieldCheck<typename FieldType::
4107  field_type,
4108  FieldType>::Result> >
4109  cond(NeboBooleanSingleValueExpression<BoolExpr,
4110  typename FieldType::value_type>
4111  const & nb,
4112  FieldType const & f) {
4113  NeboConstField<Initial, FieldType> typedef Field;
4114 
4116 
4118 
4119  CondBuilder<Cond> typedef ReturnType;
4120 
4121  return ReturnType(Cond(Clause(nb.expr(), Field(f)), NeboNil()));
4122  };
4123 
4124  /* none X single-expr X expr */
4125  template<typename BoolExpr, typename Expr, typename FieldType>
4126  inline CondBuilder<NeboCond<Initial,
4127  NeboClause<Initial,
4128  BoolExpr,
4129  Expr,
4130  typename NeboFieldCheck<typename
4131  FieldType::
4132  field_type,
4133  FieldType>::
4134  Result>,
4135  NeboNil,
4136  typename NeboFieldCheck<typename FieldType::
4137  field_type,
4138  FieldType>::Result> >
4139  cond(NeboBooleanSingleValueExpression<BoolExpr,
4140  typename FieldType::value_type>
4141  const & nb,
4142  NeboExpression<Expr, FieldType> const & e) {
4144 
4146 
4147  CondBuilder<Cond> typedef ReturnType;
4148 
4149  return ReturnType(Cond(Clause(nb.expr(), e.expr()), NeboNil()));
4150  };
4151 
4152  /* none X expr X double */
4153  template<typename BoolExpr, typename FieldType>
4154  inline CondBuilder<NeboCond<Initial,
4155  NeboClause<Initial,
4156  BoolExpr,
4157  NeboScalar<Initial,
4158  typename NeboFieldCheck<typename
4159  FieldType::
4160  field_type,
4161  FieldType>::
4162  Result::value_type>,
4163  typename NeboFieldCheck<typename
4164  FieldType::
4165  field_type,
4166  FieldType>::
4167  Result>,
4168  NeboNil,
4169  typename NeboFieldCheck<typename FieldType::
4170  field_type,
4171  FieldType>::Result> >
4173  double const d) {
4175 
4177 
4179 
4180  CondBuilder<Cond> typedef ReturnType;
4181 
4182  return ReturnType(Cond(Clause(nb.expr(), Scalar(d)), NeboNil()));
4183  };
4184 
4185  /* none X expr X single-field */
4186  template<typename BoolExpr, typename FieldType>
4187  inline CondBuilder<NeboCond<Initial,
4188  NeboClause<Initial,
4189  BoolExpr,
4190  NeboConstSingleValueField<Initial,
4191  typename
4192  NeboFieldCheck<typename
4193  FieldType::
4194  field_type,
4195  FieldType>::
4196  Result::
4197  value_type>,
4198  typename NeboFieldCheck<typename
4199  FieldType::
4200  field_type,
4201  FieldType>::
4202  Result>,
4203  NeboNil,
4204  typename NeboFieldCheck<typename FieldType::
4205  field_type,
4206  FieldType>::Result> >
4209  typename FieldType::value_type> const & f) {
4211  typedef Field;
4212 
4214 
4216 
4217  CondBuilder<Cond> typedef ReturnType;
4218 
4219  return ReturnType(Cond(Clause(nb.expr(), Field(f)), NeboNil()));
4220  };
4221 
4222  /* none X expr X single-expr */
4223  template<typename BoolExpr, typename Expr, typename FieldType>
4224  inline CondBuilder<NeboCond<Initial,
4225  NeboClause<Initial,
4226  BoolExpr,
4227  Expr,
4228  typename NeboFieldCheck<typename
4229  FieldType::
4230  field_type,
4231  FieldType>::
4232  Result>,
4233  NeboNil,
4234  typename NeboFieldCheck<typename FieldType::
4235  field_type,
4236  FieldType>::Result> >
4239  const & e) {
4241 
4243 
4244  CondBuilder<Cond> typedef ReturnType;
4245 
4246  return ReturnType(Cond(Clause(nb.expr(), e.expr()), NeboNil()));
4247  };
4248 
4249  /* none X expr X field */
4250  template<typename BoolExpr, typename FieldType>
4251  inline CondBuilder<NeboCond<Initial,
4252  NeboClause<Initial,
4253  BoolExpr,
4254  NeboConstField<Initial,
4255  typename
4256  NeboFieldCheck<typename
4257  FieldType::
4258  field_type,
4259  FieldType>::
4260  Result>,
4261  typename NeboFieldCheck<typename
4262  FieldType::
4263  field_type,
4264  FieldType>::
4265  Result>,
4266  NeboNil,
4267  typename NeboFieldCheck<typename FieldType::
4268  field_type,
4269  FieldType>::Result> >
4271  FieldType const & f) {
4272  NeboConstField<Initial, FieldType> typedef Field;
4273 
4275 
4277 
4278  CondBuilder<Cond> typedef ReturnType;
4279 
4280  return ReturnType(Cond(Clause(nb.expr(), Field(f)), NeboNil()));
4281  };
4282 
4283  /* none X expr X expr */
4284  template<typename BoolExpr, typename Expr, typename FieldType>
4285  inline CondBuilder<NeboCond<Initial,
4286  NeboClause<Initial,
4287  BoolExpr,
4288  Expr,
4289  typename NeboFieldCheck<typename
4290  FieldType::
4291  field_type,
4292  FieldType>::
4293  Result>,
4294  NeboNil,
4295  typename NeboFieldCheck<typename FieldType::
4296  field_type,
4297  FieldType>::Result> >
4299  NeboExpression<Expr, FieldType> const & e) {
4301 
4303 
4304  CondBuilder<Cond> typedef ReturnType;
4305 
4306  return ReturnType(Cond(Clause(nb.expr(), e.expr()), NeboNil()));
4307  };
4308 
4309  /* none X mask X double */
4310  template<typename FieldType>
4311  inline CondBuilder<NeboCond<Initial,
4312  NeboClause<Initial,
4313  NeboMask<Initial,
4314  typename NeboFieldCheck<typename
4315  FieldType::
4316  field_type,
4317  FieldType>::
4318  Result>,
4319  NeboScalar<Initial,
4320  typename NeboFieldCheck<typename
4321  FieldType::
4322  field_type,
4323  FieldType>::
4324  Result::value_type>,
4325  typename NeboFieldCheck<typename
4326  FieldType::
4327  field_type,
4328  FieldType>::
4329  Result>,
4330  NeboNil,
4331  typename NeboFieldCheck<typename FieldType::
4332  field_type,
4333  FieldType>::Result> >
4334  cond(SpatialMask<FieldType> const & mask, double const d) {
4335  NeboMask<Initial, FieldType> typedef Mask;
4336 
4338 
4340 
4342 
4343  CondBuilder<Cond> typedef ReturnType;
4344 
4345  return ReturnType(Cond(Clause(Mask(mask), Scalar(d)), NeboNil()));
4346  };
4347 
4348  /* none X mask X single-field */
4349  template<typename FieldType>
4350  inline CondBuilder<NeboCond<Initial,
4351  NeboClause<Initial,
4352  NeboMask<Initial,
4353  typename NeboFieldCheck<typename
4354  FieldType::
4355  field_type,
4356  FieldType>::
4357  Result>,
4358  NeboConstSingleValueField<Initial,
4359  typename
4360  NeboFieldCheck<typename
4361  FieldType::
4362  field_type,
4363  FieldType>::
4364  Result::
4365  value_type>,
4366  typename NeboFieldCheck<typename
4367  FieldType::
4368  field_type,
4369  FieldType>::
4370  Result>,
4371  NeboNil,
4372  typename NeboFieldCheck<typename FieldType::
4373  field_type,
4374  FieldType>::Result> >
4375  cond(SpatialMask<FieldType> const & mask,
4377  typename FieldType::value_type> const & f) {
4378  NeboMask<Initial, FieldType> typedef Mask;
4379 
4381  typedef Field;
4382 
4384 
4386 
4387  CondBuilder<Cond> typedef ReturnType;
4388 
4389  return ReturnType(Cond(Clause(Mask(mask), Field(f)), NeboNil()));
4390  };
4391 
4392  /* none X mask X single-expr */
4393  template<typename Expr, typename FieldType>
4394  inline CondBuilder<NeboCond<Initial,
4395  NeboClause<Initial,
4396  NeboMask<Initial,
4397  typename NeboFieldCheck<typename
4398  FieldType::
4399  field_type,
4400  FieldType>::
4401  Result>,
4402  Expr,
4403  typename NeboFieldCheck<typename
4404  FieldType::
4405  field_type,
4406  FieldType>::
4407  Result>,
4408  NeboNil,
4409  typename NeboFieldCheck<typename FieldType::
4410  field_type,
4411  FieldType>::Result> >
4412  cond(SpatialMask<FieldType> const & mask,
4414  const & e) {
4415  NeboMask<Initial, FieldType> typedef Mask;
4416 
4418 
4420 
4421  CondBuilder<Cond> typedef ReturnType;
4422 
4423  return ReturnType(Cond(Clause(Mask(mask), e.expr()), NeboNil()));
4424  };
4425 
4426  /* none X mask X field */
4427  template<typename FieldType>
4428  inline CondBuilder<NeboCond<Initial,
4429  NeboClause<Initial,
4430  NeboMask<Initial,
4431  typename NeboFieldCheck<typename
4432  FieldType::
4433  field_type,
4434  FieldType>::
4435  Result>,
4436  NeboConstField<Initial,
4437  typename
4438  NeboFieldCheck<typename
4439  FieldType::
4440  field_type,
4441  FieldType>::
4442  Result>,
4443  typename NeboFieldCheck<typename
4444  FieldType::
4445  field_type,
4446  FieldType>::
4447  Result>,
4448  NeboNil,
4449  typename NeboFieldCheck<typename FieldType::
4450  field_type,
4451  FieldType>::Result> >
4452  cond(SpatialMask<FieldType> const & mask, FieldType const & f) {
4453  NeboMask<Initial, FieldType> typedef Mask;
4454 
4455  NeboConstField<Initial, FieldType> typedef Field;
4456 
4458 
4460 
4461  CondBuilder<Cond> typedef ReturnType;
4462 
4463  return ReturnType(Cond(Clause(Mask(mask), Field(f)), NeboNil()));
4464  };
4465 
4466  /* none X mask X expr */
4467  template<typename Expr, typename FieldType>
4468  inline CondBuilder<NeboCond<Initial,
4469  NeboClause<Initial,
4470  NeboMask<Initial,
4471  typename NeboFieldCheck<typename
4472  FieldType::
4473  field_type,
4474  FieldType>::
4475  Result>,
4476  Expr,
4477  typename NeboFieldCheck<typename
4478  FieldType::
4479  field_type,
4480  FieldType>::
4481  Result>,
4482  NeboNil,
4483  typename NeboFieldCheck<typename FieldType::
4484  field_type,
4485  FieldType>::Result> >
4486  cond(SpatialMask<FieldType> const & mask,
4487  NeboExpression<Expr, FieldType> const & e) {
4488  NeboMask<Initial, FieldType> typedef Mask;
4489 
4491 
4493 
4494  CondBuilder<Cond> typedef ReturnType;
4495 
4496  return ReturnType(Cond(Clause(Mask(mask), e.expr()), NeboNil()));
4497  };
4498 
4499  #define nebo_cond cond//;
4500  } /* SpatialOps */
4501 
4502 #endif
4503 /* NEBO_COND_H */
Type traits for a single value field.
Abstracts a mask.
Definition: SpatialMask.h:70
Holds information about the number of ghost cells on each side of the domain.
Definition: GhostData.h:54