QMCPACK
ParticleAttrib.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #ifndef OHMMS_PARTICLEATTRIB_PEPE_OPERATORS_H
16 #define OHMMS_PARTICLEATTRIB_PEPE_OPERATORS_H
17 ///////////////////////////////////////////////////////////////////////////////
18 //
19 // WARNING: THIS FILE WAS GENERATED AUTOMATICALLY!
20 // YOU SHOULD MODIFY THE INPUT FILES INSTEAD OF CHANGING THIS FILE DIRECTLY!
21 //
22 // THE FOLLOWING INPUT FILES WERE USED TO MAKE THIS FILE:
23 //
24 // MakeOperators
25 
26 // WHERE are these Files?
27 
28 // matrixOps.in
29 // MatrixDefs.in
30 //
31 ///////////////////////////////////////////////////////////////////////////////
32 
33 namespace qmcplusplus
34 {
35 template<class T1>
36 inline typename MakeReturn<UnaryNode<OpUnaryMinus, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>>::Expression_t
38 {
40  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
41 }
42 
43 template<class T1>
44 inline typename MakeReturn<UnaryNode<OpUnaryPlus, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>>::Expression_t
46 {
48  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
49 }
50 
51 template<class T1>
52 inline typename MakeReturn<UnaryNode<OpBitwiseNot, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>>::Expression_t
54 {
56  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
57 }
58 
59 template<class T1>
60 inline typename MakeReturn<UnaryNode<OpIdentity, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>>::Expression_t
62 {
64  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
65 }
66 
67 template<class T1, class T2>
68 inline typename MakeReturn<UnaryNode<OpCast<T1>, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
69  peteCast(const T1&, const ParticleAttrib<T2>& l)
70 {
71  using Tree_t = UnaryNode<OpCast<T1>, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>;
72  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T2>>::make(l)));
73 }
74 
75 template<class T1, class T2>
76 inline typename MakeReturn<BinaryNode<OpAdd,
77  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
78  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
80 {
82  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
83  Tree_t;
85  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
86 }
87 
88 template<class T1, class T2>
89 inline typename MakeReturn<BinaryNode<OpSubtract,
90  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
91  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
93 {
95  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
96  Tree_t;
98  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
99 }
100 
101 template<class T1, class T2>
102 inline typename MakeReturn<BinaryNode<OpMultiply,
103  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
104  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
106 {
108  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
109  Tree_t;
111  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
112 }
113 
114 template<class T1, class T2>
115 inline typename MakeReturn<BinaryNode<OpMod,
116  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
117  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
119 {
121  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
122  Tree_t;
124  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
125 }
126 
127 template<class T1, class T2>
128 inline typename MakeReturn<BinaryNode<OpBitwiseAnd,
129  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
130  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
132 {
134  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
135  Tree_t;
137  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
138 }
139 
140 template<class T1, class T2>
141 inline typename MakeReturn<BinaryNode<OpBitwiseOr,
142  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
143  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
145 {
147  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
148  Tree_t;
150  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
151 }
152 
153 template<class T1, class T2>
154 inline typename MakeReturn<BinaryNode<OpBitwiseXor,
155  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
156  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
158 {
160  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
161  Tree_t;
163  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
164 }
165 
166 template<class T1, class T2>
167 inline typename MakeReturn<
168  BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
169  Expression_t
171 {
173  typename CreateLeaf<Expression<T2>>::Leaf_t>
174  Tree_t;
176 }
177 
178 template<class T1, class T2>
179 inline typename MakeReturn<BinaryNode<OpSubtract,
180  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
181  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
183 {
185  typename CreateLeaf<Expression<T2>>::Leaf_t>
186  Tree_t;
188 }
189 
190 template<class T1, class T2>
191 inline typename MakeReturn<BinaryNode<OpMultiply,
192  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
193  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
195 {
197  typename CreateLeaf<Expression<T2>>::Leaf_t>
198  Tree_t;
200 }
201 
202 template<class T1, class T2>
203 inline typename MakeReturn<
204  BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
205  Expression_t
207 {
209  typename CreateLeaf<Expression<T2>>::Leaf_t>
210  Tree_t;
212 }
213 
214 template<class T1, class T2>
215 inline typename MakeReturn<BinaryNode<OpBitwiseAnd,
216  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
217  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
219 {
221  typename CreateLeaf<Expression<T2>>::Leaf_t>
222  Tree_t;
224 }
225 
226 template<class T1, class T2>
227 inline typename MakeReturn<BinaryNode<OpBitwiseOr,
228  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
229  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
231 {
233  typename CreateLeaf<Expression<T2>>::Leaf_t>
234  Tree_t;
236 }
237 
238 template<class T1, class T2>
239 inline typename MakeReturn<BinaryNode<OpBitwiseXor,
240  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
241  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
243 {
245  typename CreateLeaf<Expression<T2>>::Leaf_t>
246  Tree_t;
248 }
249 
250 template<class T1, class T2>
251 inline typename MakeReturn<
252  BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
253  Expression_t
255 {
257  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
258  Tree_t;
260 }
261 
262 template<class T1, class T2>
263 inline typename MakeReturn<BinaryNode<OpSubtract,
264  typename CreateLeaf<Expression<T1>>::Leaf_t,
265  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
267 {
269  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
270  Tree_t;
272 }
273 
274 template<class T1, class T2>
275 inline typename MakeReturn<BinaryNode<OpMultiply,
276  typename CreateLeaf<Expression<T1>>::Leaf_t,
277  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
279 {
281  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
282  Tree_t;
284 }
285 
286 template<class T1, class T2>
287 inline typename MakeReturn<
288  BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
289  Expression_t
291 {
293  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
294  Tree_t;
296 }
297 
298 template<class T1, class T2>
299 inline typename MakeReturn<BinaryNode<OpBitwiseAnd,
300  typename CreateLeaf<Expression<T1>>::Leaf_t,
301  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
303 {
305  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
306  Tree_t;
308 }
309 
310 template<class T1, class T2>
311 inline typename MakeReturn<BinaryNode<OpBitwiseOr,
312  typename CreateLeaf<Expression<T1>>::Leaf_t,
313  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
315 {
317  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
318  Tree_t;
320 }
321 
322 template<class T1, class T2>
323 inline typename MakeReturn<BinaryNode<OpBitwiseXor,
324  typename CreateLeaf<Expression<T1>>::Leaf_t,
325  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
327 {
329  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
330  Tree_t;
332 }
333 
334 template<class T1, class T2>
335 inline typename MakeReturn<
336  BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
337  operator+(const ParticleAttrib<T1>& l, const T2& r)
338 {
341 }
342 
343 template<class T1, class T2>
344 inline typename MakeReturn<
345  BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
346  Expression_t
347  operator-(const ParticleAttrib<T1>& l, const T2& r)
348 {
350  Tree_t;
352 }
353 
354 template<class T1, class T2>
355 inline typename MakeReturn<
356  BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
357  Expression_t
358  operator*(const ParticleAttrib<T1>& l, const T2& r)
359 {
361  Tree_t;
363 }
364 
365 template<class T1, class T2>
366 inline typename MakeReturn<
367  BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
368  operator%(const ParticleAttrib<T1>& l, const T2& r)
369 {
372 }
373 
374 template<class T1, class T2>
375 inline typename MakeReturn<
376  BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
377  Expression_t
378  operator&(const ParticleAttrib<T1>& l, const T2& r)
379 {
381  Tree_t;
383 }
384 
385 template<class T1, class T2>
386 inline typename MakeReturn<
387  BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
388  Expression_t
389  operator|(const ParticleAttrib<T1>& l, const T2& r)
390 {
392  Tree_t;
394 }
395 
396 template<class T1, class T2>
397 inline typename MakeReturn<
398  BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
399  Expression_t
400  operator^(const ParticleAttrib<T1>& l, const T2& r)
401 {
403  Tree_t;
405 }
406 
407 template<class T1, class T2>
408 inline typename MakeReturn<
409  BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
410  operator+(const T1& l, const ParticleAttrib<T2>& r)
411 {
414 }
415 
416 template<class T1, class T2>
417 inline typename MakeReturn<
418  BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
419  Expression_t
420  operator-(const T1& l, const ParticleAttrib<T2>& r)
421 {
423  Tree_t;
425 }
426 
427 template<class T1, class T2>
428 inline typename MakeReturn<
429  BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
430  Expression_t
431  operator*(const T1& l, const ParticleAttrib<T2>& r)
432 {
434  Tree_t;
436 }
437 
438 template<class T1, class T2>
439 inline typename MakeReturn<
440  BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::Expression_t
441  operator%(const T1& l, const ParticleAttrib<T2>& r)
442 {
445 }
446 
447 template<class T1, class T2>
448 inline typename MakeReturn<
449  BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
450  Expression_t
451  operator&(const T1& l, const ParticleAttrib<T2>& r)
452 {
454  Tree_t;
456 }
457 
458 template<class T1, class T2>
459 inline typename MakeReturn<
460  BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
461  Expression_t
462  operator|(const T1& l, const ParticleAttrib<T2>& r)
463 {
465  Tree_t;
467 }
468 
469 template<class T1, class T2>
470 inline typename MakeReturn<
471  BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>>::
472  Expression_t
473  operator^(const T1& l, const ParticleAttrib<T2>& r)
474 {
476  Tree_t;
478 }
479 #ifdef PETE_ALLOW_SCALAR_SHIFT
480 #endif // PETE_ALLOW_SCALAR_SHIFT
481 
482 template<class T1, class T2, class T3>
483 inline typename MakeReturn<TrinaryNode<FnWhere,
484  typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
485  typename CreateLeaf<T2>::Leaf_t,
486  typename CreateLeaf<T3>::Leaf_t>>::Expression_t
487  where(const ParticleAttrib<T1>& c, const T2& t, const T3& f)
488 {
490  typename CreateLeaf<T3>::Leaf_t>
491  Tree_t;
494 }
495 #ifndef PETE_EXPRESSION_OPERATORS
496 #define PETE_EXPRESSION_OPERATORS
497 
498 template<class T1>
499 inline typename MakeReturn<UnaryNode<OpUnaryMinus, typename CreateLeaf<Expression<T1>>::Leaf_t>>::Expression_t
500  operator-(const Expression<T1>& l)
501 {
502  using Tree_t = UnaryNode<OpUnaryMinus, typename CreateLeaf<Expression<T1>>::Leaf_t>;
503  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
504 }
505 
506 template<class T1>
507 inline typename MakeReturn<UnaryNode<OpUnaryPlus, typename CreateLeaf<Expression<T1>>::Leaf_t>>::Expression_t operator+(
508  const Expression<T1>& l)
509 {
510  using Tree_t = UnaryNode<OpUnaryPlus, typename CreateLeaf<Expression<T1>>::Leaf_t>;
511  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
512 }
513 
514 template<class T1>
515 inline typename MakeReturn<UnaryNode<OpBitwiseNot, typename CreateLeaf<Expression<T1>>::Leaf_t>>::Expression_t
516  operator~(const Expression<T1>& l)
517 {
518  using Tree_t = UnaryNode<OpBitwiseNot, typename CreateLeaf<Expression<T1>>::Leaf_t>;
519  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
520 }
521 
522 template<class T1>
523 inline typename MakeReturn<UnaryNode<OpIdentity, typename CreateLeaf<Expression<T1>>::Leaf_t>>::Expression_t
524  PETE_identity(const Expression<T1>& l)
525 {
526  using Tree_t = UnaryNode<OpIdentity, typename CreateLeaf<Expression<T1>>::Leaf_t>;
527  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
528 }
529 
530 template<class T1, class T2>
531 inline typename MakeReturn<UnaryNode<OpCast<T1>, typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t peteCast(
532  const T1&,
533  const Expression<T2>& l)
534 {
535  using Tree_t = UnaryNode<OpCast<T1>, typename CreateLeaf<Expression<T2>>::Leaf_t>;
536  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T2>>::make(l)));
537 }
538 
539 template<class T1, class T2>
540 inline typename MakeReturn<
541  BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
542  Expression_t
543  operator+(const Expression<T1>& l, const Expression<T2>& r)
544 {
545  typedef BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
546  Tree_t;
547  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
548 }
549 
550 template<class T1, class T2>
551 inline typename MakeReturn<
552  BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
553  Expression_t
554  operator-(const Expression<T1>& l, const Expression<T2>& r)
555 {
556  typedef BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t,
557  typename CreateLeaf<Expression<T2>>::Leaf_t>
558  Tree_t;
559  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
560 }
561 
562 template<class T1, class T2>
563 inline typename MakeReturn<
564  BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
565  Expression_t
566  operator*(const Expression<T1>& l, const Expression<T2>& r)
567 {
568  typedef BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t,
569  typename CreateLeaf<Expression<T2>>::Leaf_t>
570  Tree_t;
571  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
572 }
573 
574 template<class T1, class T2>
575 inline typename MakeReturn<
576  BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
577  Expression_t
578  operator%(const Expression<T1>& l, const Expression<T2>& r)
579 {
580  typedef BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
581  Tree_t;
582  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
583 }
584 
585 template<class T1, class T2>
586 inline typename MakeReturn<BinaryNode<OpBitwiseAnd,
587  typename CreateLeaf<Expression<T1>>::Leaf_t,
588  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
590 {
592  typename CreateLeaf<Expression<T2>>::Leaf_t>
593  Tree_t;
594  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
595 }
596 
597 template<class T1, class T2>
598 inline typename MakeReturn<
599  BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
600  Expression_t
601  operator|(const Expression<T1>& l, const Expression<T2>& r)
602 {
603  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t,
604  typename CreateLeaf<Expression<T2>>::Leaf_t>
605  Tree_t;
606  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
607 }
608 
609 template<class T1, class T2>
610 inline typename MakeReturn<BinaryNode<OpBitwiseXor,
611  typename CreateLeaf<Expression<T1>>::Leaf_t,
612  typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
613  operator^(const Expression<T1>& l, const Expression<T2>& r)
614 {
615  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t,
616  typename CreateLeaf<Expression<T2>>::Leaf_t>
617  Tree_t;
618  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
619 }
620 
621 template<class T1, class T2>
622 inline typename MakeReturn<
623  BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
624  operator+(const Expression<T1>& l, const T2& r)
625 {
626  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
627  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
628 }
629 
630 template<class T1, class T2>
631 inline typename MakeReturn<
632  BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
633  operator-(const Expression<T1>& l, const T2& r)
634 {
635  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
636  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
637 }
638 
639 template<class T1, class T2>
640 inline typename MakeReturn<
641  BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
642  operator*(const Expression<T1>& l, const T2& r)
643 {
644  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
645  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
646 }
647 
648 template<class T1, class T2>
649 inline typename MakeReturn<
650  BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
651  operator%(const Expression<T1>& l, const T2& r)
652 {
653  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
654  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
655 }
656 
657 template<class T1, class T2>
658 inline typename MakeReturn<
659  BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
660  Expression_t
661  operator&(const Expression<T1>& l, const T2& r)
662 {
665 }
666 
667 template<class T1, class T2>
668 inline typename MakeReturn<
669  BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::Expression_t
670  operator|(const Expression<T1>& l, const T2& r)
671 {
672  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
673  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
674 }
675 
676 template<class T1, class T2>
677 inline typename MakeReturn<
678  BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>>::
679  Expression_t
680  operator^(const Expression<T1>& l, const T2& r)
681 {
682  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
683  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
684 }
685 
686 template<class T1, class T2>
687 inline typename MakeReturn<
688  BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
689  operator+(const T1& l, const Expression<T2>& r)
690 {
691  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
692  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
693 }
694 
695 template<class T1, class T2>
696 inline typename MakeReturn<
697  BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
698  operator-(const T1& l, const Expression<T2>& r)
699 {
700  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
701  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
702 }
703 
704 template<class T1, class T2>
705 inline typename MakeReturn<
706  BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
707  operator*(const T1& l, const Expression<T2>& r)
708 {
709  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
710  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
711 }
712 
713 template<class T1, class T2>
714 inline typename MakeReturn<
715  BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
716  operator%(const T1& l, const Expression<T2>& r)
717 {
718  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
719  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
720 }
721 
722 template<class T1, class T2>
723 inline typename MakeReturn<
724  BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
725  Expression_t
726  operator&(const T1& l, const Expression<T2>& r)
727 {
730 }
731 
732 template<class T1, class T2>
733 inline typename MakeReturn<
734  BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::Expression_t
735  operator|(const T1& l, const Expression<T2>& r)
736 {
737  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
738  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
739 }
740 
741 template<class T1, class T2>
742 inline typename MakeReturn<
743  BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>>::
744  Expression_t
745  operator^(const T1& l, const Expression<T2>& r)
746 {
747  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
748  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
749 }
750 #ifdef PETE_ALLOW_SCALAR_SHIFT
751 #endif // PETE_ALLOW_SCALAR_SHIFT
752 
753 template<class T1, class T2, class T3>
754 inline typename MakeReturn<TrinaryNode<FnWhere,
755  typename CreateLeaf<Expression<T1>>::Leaf_t,
756  typename CreateLeaf<T2>::Leaf_t,
757  typename CreateLeaf<T3>::Leaf_t>>::Expression_t
758  where(const Expression<T1>& c, const T2& t, const T3& f)
759 {
760  typedef TrinaryNode<FnWhere, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t,
761  typename CreateLeaf<T3>::Leaf_t>
762  Tree_t;
764  Tree_t(CreateLeaf<Expression<T1>>::make(c), CreateLeaf<T2>::make(t), CreateLeaf<T3>::make(f)));
765 }
766 #endif // PETE_EXPRESSION_OPERATORS
767 
768 template<class T1, class RHS>
769 inline ParticleAttrib<T1>& assign(ParticleAttrib<T1>& lhs, const RHS& rhs)
770 {
771  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
773  return lhs;
774 }
775 
776 template<class T1, class RHS>
777 inline ParticleAttrib<T1>& operator+=(ParticleAttrib<T1>& lhs, const RHS& rhs)
778 {
779  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
781  return lhs;
782 }
783 
784 template<class T1, class RHS>
785 inline ParticleAttrib<T1>& operator-=(ParticleAttrib<T1>& lhs, const RHS& rhs)
786 {
787  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
789  return lhs;
790 }
791 
792 template<class T1, class RHS>
793 inline ParticleAttrib<T1>& operator*=(ParticleAttrib<T1>& lhs, const RHS& rhs)
794 {
795  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
797  return lhs;
798 }
799 
800 template<class T1, class RHS>
801 inline ParticleAttrib<T1>& operator%=(ParticleAttrib<T1>& lhs, const RHS& rhs)
802 {
803  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
805  return lhs;
806 }
807 
808 template<class T1, class RHS>
809 inline ParticleAttrib<T1>& operator|=(ParticleAttrib<T1>& lhs, const RHS& rhs)
810 {
811  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
813  return lhs;
814 }
815 
816 template<class T1, class RHS>
817 inline ParticleAttrib<T1>& operator&=(ParticleAttrib<T1>& lhs, const RHS& rhs)
818 {
819  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
821  return lhs;
822 }
823 
824 template<class T1, class RHS>
825 inline ParticleAttrib<T1>& operator^=(ParticleAttrib<T1>& lhs, const RHS& rhs)
826 {
827  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
829  return lhs;
830 }
831 
832 /////////////////////////////////////////////////////////////////////////////
833 // specialization of CreateLeaf for ParticleAttrib
834 /////////////////////////////////////////////////////////////////////////////
835 //-----------------------------------------------------------------------------
836 // We need to specialize CreateLeaf<T> for our class, so that operators
837 // know what to stick in the leaves of the expression tree.
838 //-----------------------------------------------------------------------------
839 template<class T>
841 {
843  inline static Leaf_t make(const ParticleAttrib<T>& a) { return Leaf_t(a); }
844 };
845 
846 //-----------------------------------------------------------------------------
847 // We need to write a functor that is capable of comparing the size of
848 // the vector with a stored value. Then, we supply LeafFunctor specializations
849 // for Scalar<T> and STL vector leaves.
850 //-----------------------------------------------------------------------------
852 {
853 public:
854  SizeLeafPA(int s) : size_m(s) {}
855  SizeLeafPA(const SizeLeafPA& model) : size_m(model.size_m) {}
856  bool operator()(int s) const { return size_m == s; }
857 
858 private:
859  int size_m;
860 };
861 
862 template<class T>
864 {
865  using Type_t = bool;
866  inline static bool apply(const Scalar<T>&, const SizeLeafPA&)
867  {
868  // Scalars always conform.
869  return true;
870  }
871 };
872 
873 template<class T>
875 {
876  using Type_t = bool;
877  inline static bool apply(const ParticleAttrib<T>& v, const SizeLeafPA& s) { return s(v.size()); }
878 };
879 
880 //-----------------------------------------------------------------------------
881 // EvalLeaf1 is used to evaluate expression with vectors.
882 // (It's already defined for Scalar values.)
883 //-----------------------------------------------------------------------------
884 
885 template<class T>
887 {
888  using Type_t = T;
889  inline static Type_t apply(const ParticleAttrib<T>& vec, const EvalLeaf1& f) { return vec[f.val1()]; }
890 };
891 
892 //////////////////////////////////////////////////////////////////////////////////
893 // LOOP is done by evaluate function
894 //////////////////////////////////////////////////////////////////////////////////
895 template<class T, class Op, class RHS>
896 inline void evaluate(ParticleAttrib<T>& lhs, const Op& op, const Expression<RHS>& rhs)
897 {
898  if (forEach(rhs, SizeLeafPA(lhs.size()), AndCombine()))
899  {
900  // We get here if the vectors on the RHS are the same size as those on
901  // the LHS.
902  for (int i = 0; i < lhs.size(); ++i)
903  {
904  // The actual assignment operation is performed here.
905  // PETE operator tags all define operator() to perform the operation.
906  // (In this case op performs an assignment.) forEach is used
907  // to compute the rhs value. EvalLeaf1 gets the
908  // values at each node using random access, and the tag
909  // OpCombine tells forEach to use the operator tags in the expression
910  // to combine values together.
911  op(lhs[i], forEach(rhs, EvalLeaf1(i), OpCombine()));
912  }
913  }
914  else
915  {
916  throw std::runtime_error("Error in evaluate: LHS and RHS don't conform in ParticleAttrib.");
917  }
918 }
919 
920 // I/O
921 template<class T>
922 std::ostream& operator<<(std::ostream& out, const ParticleAttrib<T>& rhs)
923 {
924  for (int i = 0; i < rhs.size(); i++)
925  out << rhs[i] << std::endl;
926  return out;
927 }
928 
929 } // namespace qmcplusplus
930 #endif // OHMMS_PARTICLEATTRIB_PEPE_OPERATORS_H
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator*(const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
Matrix< T1, C1 > & operator%=(Matrix< T1, C1 > &lhs, const RHS &rhs)
Matrix< T1, C1 > & operator|=(Matrix< T1, C1 > &lhs, const RHS &rhs)
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator%(const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Definition: Scalar.h:49
MakeReturn< UnaryNode< OpBitwiseNot, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t operator~(const Matrix< T1, C1 > &l)
ForEach< Expr, FTag, CTag >::Type_t forEach(const Expr &e, const FTag &f, const CTag &c)
Definition: ForEach.h:87
static bool apply(const Scalar< T > &, const SizeLeafPA &)
MakeReturn< UnaryNode< OpUnaryMinus, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t operator-(const Matrix< T1, C1 > &l)
Attaches a unit to a Vector for IO.
MakeReturn< TrinaryNode< FnWhere, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t, typename CreateLeaf< T3 >::Leaf_t > >::Expression_t where(const Matrix< T1, C1 > &c, const T2 &t, const T3 &f)
const AntiSymTensor< T, D > & operator+(const AntiSymTensor< T, D > &op)
Matrix< T1, C1 > & operator+=(Matrix< T1, C1 > &lhs, const RHS &rhs)
int val1() const
Definition: Functors.h:98
static Expression_t make(const T &a)
Definition: CreateLeaf.h:132
Matrix< T1, C1 > & operator &=(Matrix< T1, C1 > &lhs, const RHS &rhs)
static Leaf_t make(const T &a)
Definition: CreateLeaf.h:97
size_type size() const
return the current size
Definition: OhmmsVector.h:162
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator &(const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
Matrix< T1, C1 > & operator^=(Matrix< T1, C1 > &lhs, const RHS &rhs)
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator^(const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
MakeReturn< UnaryNode< OpCast< T1 >, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t peteCast(const T1 &, const Matrix< T2, C2 > &l)
bool operator()(int s) const
SizeLeafPA(const SizeLeafPA &model)
Matrix< T1, C1 > & operator*=(Matrix< T1, C1 > &lhs, const RHS &rhs)
static Leaf_t make(const ParticleAttrib< T > &a)
Matrix< T1, C1 > & operator-=(Matrix< T1, C1 > &lhs, const RHS &rhs)
static Type_t apply(const ParticleAttrib< T > &vec, const EvalLeaf1 &f)
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514
MakeReturn< UnaryNode< OpIdentity, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t PETE_identity(const Matrix< T1, C1 > &l)
static bool apply(const ParticleAttrib< T > &v, const SizeLeafPA &s)
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator|(const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)