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