Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
expression.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_EXPRESSION_H
2#define _RHEOLEF_EXPRESSION_H
3//
4// This file is part of Rheolef.
5//
6// Copyright (C) 2000-2009 Pierre Saramito
7//
8// Rheolef is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 2 of the License, or
11// (at your option) any later version.
12//
13// Rheolef is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with Rheolef; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// ==========================================================================
23// author: Pierre.Saramito@imag.fr
24// date: 25 march 2013
25
26
27namespace rheolef {
129} // namespace rheolef
130
131/*
132This file "expression.h" focuses on operators between fields
133since the field return value (scalar,vector,tensor) is not known
134at compile time, operators try to infer it when the return type
135or a second argument is known at compile time
136
137optherwise, the return value is undeterminated_basic<T> that
138will be solved at run time from the field::valued_tag() method.
139
140OVERVIEW:
141 0. error utilities
142 1. unary operations
143 1.1. unary function helper
144 1.2. unary operators: +x -x
145 1.3. unary standard maths: sin(x), cos(x), ...
146 1.4. unary extensions: tr(x), trans(x), norm(x) norm2(x)
147 2. binary operations
148 2.1. binary function helper
149 2.2. binary operators: x+y, x-y, x*y, x/y
150 2.3. binary standard maths: pow(x,y), atan2(x,y),...
151 2.4. binary extensions: dot(x,y), ddot(x,y), dddot(x,y)
152 3. binders
153 3.1. binder_first
154 3.2. binder_second
155 3.3. swapper
156*/
157#include "rheolef/promote.h"
158#include "rheolef/undeterminated.h"
159#include "rheolef/space_constant.h"
160
161namespace rheolef { namespace details {
162
163// ===========================================================================
164// part 0. error utilities
165// ===========================================================================
166template<class Op, class T1, class T2, class R>
167struct binop_error {};
168
169template <class T> struct is_error: std::false_type {};
170
171template<class Op, class T1, class T2, class R>
172struct is_error<binop_error<Op,T1,T2,R> >: std::true_type {};
173
174} // namespace details
175
176template<class Op, class T1, class T2, class R>
177struct float_traits<details::binop_error<Op,T1,T2,R> > { typedef typename float_traits<R>::type type; };
178
179// ===========================================================================
180// part 1. unary operations
181// ===========================================================================
182namespace details {
183// ---------------------------------------------------------------------------
184// chap 1.1. unary function helper
185// ---------------------------------------------------------------------------
186// defualt is STL class-functions
187template<class Function>
189 template <class Arg>
193 template <class Arg, class Result>
194 struct hint {
196 typedef typename std::decay<typename function_traits<Function>::template arg<0>::type>::type
198 };
203};
204// ----------------------------------------------------------------------------
205// chap 1.2. unary operators: +x -x
206// ----------------------------------------------------------------------------
207// +x
208// ------
210 template <class T> T operator() (const T& a) const { return +a; }
211};
212template<>
214 template <class Arg>
215 struct result_hint {
216 typedef Arg type;
217 };
218 template <class Arg, class Result>
219 struct hint {
222 };
225 return tag;
226 }
227};
228// ------
229// -x
230// ------
231struct negate {
232 template <class T> T operator() (const T& a) const { return -a; }
233};
234template<>
236 template <class Arg>
237 struct result_hint {
238 typedef Arg type;
239 };
240 template <class Arg, class Result>
241 struct hint {
244 };
247 return tag;
248 }
249};
250// ----------------------------------------------------------------------------
251// chap 1.3. unary standard maths: sin(x), cos(x), ...
252// ----------------------------------------------------------------------------
253// specialization for is scalar generic functions, as details::sin_, details::cos_, etc
254#define _RHEOLEF_generic_unary_scalar(F) \
255struct F##_ { \
256 template<class T> \
257 T operator() (const T& x) const { return F(x); } \
258}; \
259template<> \
260struct generic_unary_traits<F##_> { \
261 template <class Arg> \
262 struct result_hint { \
263 typedef typename scalar_traits<Arg>::type type; \
264 }; \
265 template <class Arg, class Result> \
266 struct hint { \
267 typedef typename promote< \
268 typename scalar_traits<Arg>::type \
269 ,typename scalar_traits<Result>::type>::type S; \
270 typedef S result_type; \
271 typedef S argument_type; \
272 }; \
273 static space_constant::valued_type \
274 valued_tag (space_constant::valued_type) { \
275 return space_constant::scalar; \
276 } \
277};
278// std::cmath
296// rheolef extension:
298#undef _RHEOLEF_generic_unary_scalar
299// ----------------------------------------------------------------------------
300// chap 1.4. unary extensions: tr(x), norm(x) norm2(x)
301// ----------------------------------------------------------------------------
302// tr(tau)
303// ----------
304struct tr_ {
305 template <class T> T operator() (const tensor_basic<T>& a) const { return tr(a); }
306};
307template<>
309 template <class A1>
310 struct result_hint {
312 };
313 template <class A1, class R>
322};
323// ----------
324// trans(tau)
325// ----------
326struct trans_ {
327 template <class T> tensor_basic<T> operator() (const tensor_basic<T>& a) const { return trans(a); }
328};
329template<>
331 template <class A1>
332 struct result_hint {
334 };
335 template <class A1, class R>
345};
346// ----------
347// norm(x)
348// ----------
349struct norm_ {
350 template<class T>
351 typename float_traits<T>::type operator() (const T& x) const { return fabs(x); }
352 template<class T>
353 typename float_traits<T>::type operator() (const point_basic<T>& x) const { return norm(x); }
354 template<class T>
355 typename float_traits<T>::type operator() (const tensor_basic<T>& x) const { return norm(x); }
356};
357template<>
359 template <class Arg>
360 struct result_hint {
362 };
363 template <class A1, class R>
364 struct hint {
366 typedef A1 argument_type;
367 };
372};
373// ----------
374// norm2(x)
375// ----------
376struct norm2_ {
377 template<class T>
378 typename float_traits<T>::type operator() (const T& x) const { return sqr(x); }
379 template<class T>
380 typename float_traits<T>::type operator() (const point_basic<T>& x) const { return norm2(x); }
381 template<class T>
382 typename float_traits<T>::type operator() (const tensor_basic<T>& x) const { return norm2(x); }
383};
384template<>
386 template <class Arg>
387 struct result_hint {
389 };
390 template <class A1, class R>
391 struct hint {
393 typedef A1 argument_type;
394 };
399};
400// ===========================================================================
401// part 2. binary operations
402// ===========================================================================
403// ---------------------------------------------------------------------------
404// chap 2.1. binary function helper
405// ---------------------------------------------------------------------------
406template<class Function>
408 template <class Arg1, class Arg2>
412 template <class Arg1, class Arg2, class Result>
413 struct hint {
414 typedef typename std::decay<typename function_traits<Function>::template arg<0>::type>::type
416 typedef typename std::decay<typename function_traits<Function>::template arg<1>::type>::type
418 typedef typename std::decay<typename function_traits<Function>::result_type>::type
420 };
425};
426// ----------------------------------------------------------------------------
427// chap 2.2. binary operators: x+y, x-y, x*y, x/y
428// ----------------------------------------------------------------------------
429// x+y
430// --------
431struct plus; // foward declaration
432
433// result type
434// -----------
435template <class A1, class A2, class Sfinae = void>
439// s+s -> s
440template <class A1, class A2>
441struct plus_result<A1,A2,
442 typename std::enable_if<
443 is_rheolef_arithmetic<A1>::value &&
444 is_rheolef_arithmetic<A2>::value
445 >::type>
446{
447 typedef typename promote<A1,A2>::type type;
448};
449// v+v -> v, t+t -> t
450template <class A>
451struct plus_result<A,A,
452 typename std::enable_if<
453 ! is_rheolef_arithmetic<A>::value>::type>
454{
455 typedef A type;
456};
457struct plus {
458 template <class T1, class T2>
459 typename plus_result<T1,T2>::type operator() (const T1& a, const T2& b) const { return a+b; }
460};
461template<>
463 // --------------------------
464 // hint interface
465 // --------------------------
466 template <class A1, class A2, class R>
467 struct hint {
470 typedef R result_type;
471 };
472 // two types are known
473 // --------------------------
474 // a1+a2 -> ? : deduce r
475 template <class A1, class A2, class R>
476 struct hint<A1,A2,undeterminated_basic<R> > {
480 };
481 // ?+a2 -> r : deduce a1
482 template <class A1, class A2, class R>
483 struct hint<undeterminated_basic<A1>,A2,R> {
484 typedef typename std::conditional<
486 R,
490 typedef R result_type;
491 };
492 // a1+? -> r : deduce a2
493 template <class A1, class A2, class R>
494 struct hint<A1,undeterminated_basic<A2>,R> {
496 typedef typename std::conditional<
498 R,
501 typedef R result_type;
502 };
503 // ?+? -> r : deduce a1,a2
504 template <class A1, class A2, class R>
508 typedef R result_type;
509 };
510 // a1+? -> ? : deduce a2,r
511 template <class A1, class A2, class R>
515 typedef A1 result_type;
516 };
517 // ?+a2 -> ? : deduce a2,r
518 template <class A1, class A2, class R>
522 typedef A2 result_type;
523 };
524 // ?+? -> ? : deduce a1, a2,r
525 template <class A1, class A2, class R>
535 typedef std::true_type is_symmetric;
536 template <class Arg1, class Arg2>
537 struct result_hint {
538 typedef typename hint<Arg1,Arg2,undeterminated_basic<Float> >::result_type type;
539 };
540};
541// --------
542// x-y
543// --------
544struct minus {
545 template <class T1, class T2>
546 typename plus_result<T1,T2>::type operator() (const T1& a, const T2& b) const { return a-b; }
547};
548template<>
550 template <class A1, class A2, class R>
551 struct hint : generic_binary_traits<plus>::template hint<A1,A2,R> {};
552
553 template <class A1, class A2>
554 struct result_hint {
555 typedef typename hint<A1,A2,undeterminated_basic<Float> >::result_type type;
556 };
561 typedef std::false_type is_symmetric;
562};
563// --------
564// x*y
565// --------
566/*
567 result: when arg1 & arg2 are given
568 1\2 s v t t3 t4
569 s s v t t3 t4
570 v v E E E E
571 t t v t E E
572 t3 t3 t t3 E E
573 t4 t4 E E E E
574
575 arg1: deduced when arg2 & result are known
576 2\r s v t t3 t4
577 s s v t t3 t4
578 v E (st)t3 E E
579 t E E (st)t3 E st: indetermine'
580 t3 E E E s E
581 t4 E E E E s
582
583 arg2: deduced when arg1 & result are known
584 1\r s v t t3 t4
585 s s v t t3 t4
586 v E s E E E
587 t E v (st)E E st: indetermine'
588 t3 E E v (st) E
589 t4 E E E E E
590
591 il n'y a que deux cas ou l'arg1 est indetermine' :
592 quand arg2=v et res_t=v alors arg1=s ou t
593 quand arg2=t et res_t=t alors arg1=s ou t
594 dans tous les autres cas, on deduit l'arg1
595
596 il n'y a qu'un cas ou l'arg2 est indetermine' :
597 quand arg1=t et res_t=t alors arg2=s ou t
598 dans tous les autres cas, on deduit l'arg2
599*/
600struct multiplies; // foward declaration
601
602// result type
603// -----------
604// s*s -> s
605template <class A1, class A2>
607 typedef typename promote<A1,A2>::type type;
608};
609// s*v -> v
610template <class S>
613};
614// s*t -> t
615template <class S>
619// v*s -> v
620template <class S>
624// v*v -> err
625template <class S1, class S2>
630// v*t -> err
631template <class S1, class S2>
636// t*s -> t
637template <class S>
641// t*v -> v
642template <class S1, class S2>
647// t*t -> t
648template <class S1, class S2>
653// s*t3 -> t3
654template <class S>
658// t*s -> t
659template <class S>
663// t3*v -> t
664template <class S1, class S2>
669// t3*t -> t3
670template <class S1, class S2>
675// v*t3 -> err
676template <class S1, class S2>
681// t*t3 -> err
682template <class S1, class S2>
687// t3*t3 -> err
688template <class S1, class S2>
693// s*t4 -> t4
694template <class S>
698// t4*s -> t4
699template <class S>
703// v*t4 -> err
704template <class S1, class S2>
709// t*t4 -> err
710template <class S1, class S2>
715// t3*t4 -> err
716template <class S1, class S2>
721// t4*v -> err
722template <class S1, class S2>
727// t4*t -> err
728template <class S1, class S2>
733// t4*t3 -> err
734template <class S1, class S2>
739// t4*t4 -> err
740template <class S1, class S2>
745
747 template <class T1, class T2>
749 operator() (const T1& a, const T2& b) const { return a*b; }
750};
751template<>
757 // --------------------------
758 // hint arg1 type
759 // --------------------------
760 // ?*s=s => a1=s
761 template <class A2, class R, class Sfinae = void>
762 struct first_argument_hint {
763 typedef typename promote<A2,R>::type type;
764 };
765 // ?*s=v => a1=v
766 template <class A2, class R>
767 struct first_argument_hint<A2,point_basic<R> > {
769 };
770 // ?*s=t => a1=t
771 template <class A2, class R>
772 struct first_argument_hint<A2,tensor_basic<R> > {
774 };
775 // ?*s=t3 => a1=t3
776 template <class A2, class R>
777 struct first_argument_hint<A2,tensor3_basic<R> > {
779 };
780 // ?*s=t4 => a1=t4
781 template <class A2, class R>
782 struct first_argument_hint<A2,tensor4_basic<R>,
783 typename std::enable_if<is_rheolef_arithmetic<A2>::value>::type> {
785 };
786 // ?*v=s => a1=err
787 template <class A2, class R>
791 // ?*v=v => a1={s,t}=undeterminated
792 template <class A2, class R>
793 struct first_argument_hint<point_basic<A2>,point_basic<R> > {
795 };
796 // ?*v=t => a1=t3
797 template <class A2, class R>
798 struct first_argument_hint<point_basic<A2>,tensor_basic<R> > {
800 };
801 // ?*v=t3 => a1=err
802 template <class A2, class R>
806 // ?*v=t4 => a1=err
807 template <class A2, class R>
811 // ?*t=s => a1=err
812 template <class A2, class R>
816 // ?*t=v => a1=err
817 template <class A2, class R>
821 // ?*t=t => a1={s,t}=undeterminated
822 template <class A2, class R>
823 struct first_argument_hint<tensor_basic<A2>,tensor_basic<R> > {
825 };
826 // ?*t=t3 => a1=t3
827 template <class A2, class R>
828 struct first_argument_hint<tensor_basic<A2>,tensor3_basic<R> > {
830 };
831 // ?*t3=s => a1=err
832 template <class A2, class R>
836 // ?*t3=v => a1=err
837 template <class A2, class R>
841 // ?*t3=t => a1=err
842 template <class A2, class R>
846 // ?*t3=t3 => a1=s
847 template <class A2, class R>
848 struct first_argument_hint<tensor3_basic<A2>,tensor3_basic<R> > {
849 typedef typename promote<A2,R>::type type;
850 };
851 // ?*t4=s => a1=E
852 template <class A2, class R>
853 struct first_argument_hint<tensor4_basic<A2>,R,
854 typename std::enable_if<is_rheolef_arithmetic<R>::value>::type> {
855 typedef typename promote<A2,R>::type S;
857 };
858 // ?*t4=v => a1=E
859 template <class A2, class R>
864 // ?*t4=t => a1=E
865 template <class A2, class R>
870 // ?*t4=t3 => a1=E
871 template <class A2, class R>
876 // ?*t4=t4 => a1=s
877 template <class A2, class R>
878 struct first_argument_hint<tensor4_basic<A2>,tensor4_basic<R> > {
879 typedef typename promote<A2,R>::type type;
880 };
881 // --------------------------
882 // hint arg2 type
883 // --------------------------
884 // s*?=s => a2=s
885 template <class A1, class R, class Sfinae = void>
886 struct second_argument_hint {
887 typedef typename promote<A1,R>::type type;
888 };
889 // s*?=v => a2=v
890 template <class A1, class R>
891 struct second_argument_hint<A1,point_basic<R> > {
893 };
894 // s*?=t => a2=t
895 template <class A1, class R>
896 struct second_argument_hint<A1,tensor_basic<R> > {
898 };
899 // s*?=t3 => a2=t3
900 template <class A1, class R>
901 struct second_argument_hint<A1,tensor3_basic<R> > {
903 };
904 // s*?=t4 => a2=t4
905 template <class A1, class R>
906 struct second_argument_hint<A1,tensor4_basic<R>,
907 typename std::enable_if<is_rheolef_arithmetic<A1>::value>::type> {
909 };
910 // v*?=s => a2=err
911 template <class A1, class R>
915 // v*?=v => a2=s
916 template <class A1, class R>
917 struct second_argument_hint<point_basic<A1>,point_basic<R> > {
918 typedef typename promote<A1,R>::type type;
919 };
920 // v*?=t => a2=err
921 template <class A1, class R>
925 // t*?=s => a2=err
926 template <class A1, class R>
930 // t*?=v => a2=v
931 template <class A1, class R>
932 struct second_argument_hint<tensor_basic<A1>,point_basic<R> > {
934 };
935 // t*?=t => a2={s,t}=undeterminated
936 template <class A1, class R>
937 struct second_argument_hint<tensor_basic<A1>,tensor_basic<R> > {
939 };
940 // v*?=t3 => a2=err
941 template <class A1, class R>
945 // t*?=t3 => a2=err
946 template <class A1, class R>
950 // t3*?=s => a2=err
951 template <class A1, class R>
955 // t3*?=v => a2=err
956 template <class A1, class R>
960 // t3*?=t => a2=v
961 template <class A1, class R>
962 struct second_argument_hint<tensor3_basic<A1>,tensor_basic<R> > {
964 };
965 // t3*?=t3 => a2={st}
966 template <class A1, class R>
967 struct second_argument_hint<tensor3_basic<A1>,tensor3_basic<R> > {
969 };
970 // t4*?=s => a2=err
971 template <class A1, class R>
972 struct second_argument_hint<tensor4_basic<A1>,R,
973 typename std::enable_if<is_rheolef_arithmetic<R>::value>::type> {
975 };
976 // t4*?=v => a2=err
977 template <class A1, class R>
981 // t4*?=t => a2=err
982 template <class A1, class R>
986 // t4*?=t3 => a2=err
987 template <class A1, class R>
991 // t4*?=t4 => a2=err
992 template <class A1, class R>
993 struct second_argument_hint<tensor4_basic<A1>,tensor4_basic<R> > {
994 typedef typename promote<A1,R>::type S;
995 typedef S type;
996 };
997 // --------------------------
998 // hint interface
999 // --------------------------
1000 template <class A1, class A2, class R>
1001 struct hint {
1004 typedef R result_type;
1005 };
1006 // two types are known
1007 // --------------------------
1008 // a1*a2 -> ? : deduce r
1009 template <class A1, class A2, class R>
1010 struct hint<A1,A2,undeterminated_basic<R> > {
1014 };
1015 // ?*a2 -> r : deduce a1
1016 template <class A1, class A2, class R>
1017 struct hint<undeterminated_basic<A1>,A2,R> {
1018 // TODO: promote scalar_type of first arg: tensor<Float>*point<complex> -> point<complex>
1019 // promote_valued<Arg,Scalar>::type
1020 // e.g. promote_valued<point_basic<Float>,complex<Float> >::type -> point_basic<cmplex<Float>>
1023 typedef R result_type;
1024 };
1025 // a1*? -> r : deduce a2
1026 template <class A1, class A2, class R>
1032 // only one type is known
1033 // -----------------------
1034 // ?*? -> s : deduce a1=a2=s
1035 template <class A1, class A2, class R>
1039 typedef R result_type;
1040 };
1041 // ?*? -> v : deduce (a1,a2)={(s,v),(v,s),(t,v)}=?
1042 template <class A1, class A2, class R>
1048 // ?*? -> t : deduce (a1,a2)={(s,t),(t,s),(t,t)}=?
1049 template <class A1, class A2, class R>
1055 // ?*? -> t3 : deduce (a1,a2)={(s,t3),(t3,s),(t3,t)}=?
1056 template <class A1, class A2, class R>
1062 // ?*? -> t4 : deduce (a1,a2)={(s,t4),(t4,s)}=?
1063 template <class A1, class A2, class R>
1069 // s*? -> ? : deduce (a2,r)={(s,s),(v,v),(t,t)}=?
1070 template <class A1, class A2, class R>
1076 // v*? -> ? : deduce (a2,r)=(s,v)
1077 template <class A1, class A2, class R>
1083 // t*? -> ? : deduce (a2,r)={(v,v),(t,t),(s,t)}=?
1084 template <class A1, class A2, class R>
1090 // t3*? -> ? : deduce (a2,r)={(s,t3),(v,t),(t3,t3)}=?
1091 template <class A1, class A2, class R>
1097 // ?*s -> ? : deduce (a1,r)={(s,s),(v,v),(t,t)}=?
1098 template <class A1, class A2, class R>
1104 // ?*v -> ? : deduce (a1,r)={(s,v),(t,v)}=?
1105 template <class A1, class A2, class R>
1111 // ?*t -> ? : deduce (a1,r)={(s,t),(t,t)}=?
1112 template <class A1, class A2, class R>
1118 // ?*t3 -> ? : deduce (a1,r)=(s,t3)
1119 template <class A1, class A2, class R>
1125 // ?*t4 -> ? : deduce (a1,r)=(s,t4)
1126 template <class A1, class A2, class R>
1132 // t4*? -> ? : deduce (a2,r)=(s,t4)
1133 template <class A1, class A2, class R>
1139 // none types are known
1140 // -----------------------
1141 // ?*? -> ? : deduce (a1,a2,r)=?
1142 template <class A1, class A2, class R>
1148 // short interface
1149 template <class Arg1, class Arg2>
1150 struct result_hint {
1151 typedef typename hint<Arg1,Arg2,undeterminated_basic<Float> >::result_type type;
1152 };
1153 typedef std::false_type is_symmetric; // tensor*vector do not commute
1154}; // generic_binary_traits<multiplies>
1155// --------
1156// x/y
1157// --------
1158struct divides; // foward declaration
1159
1160template <class T1, class T2, class Sfinae = void>
1164// s/s -> s
1165template <class T1, class T2>
1166struct divides_result<T1,T2,
1167 typename std::enable_if<
1168 is_rheolef_arithmetic<T1>::value &&
1169 is_rheolef_arithmetic<T2>::value
1170 >::type>
1171{
1172 typedef typename promote<T1,T2>::type type;
1173};
1174// undef/undef -> undef
1175template <class T1, class T2>
1176struct divides_result<T1,T2,
1177 typename std::enable_if<
1178 is_undeterminated<T1>::value &&
1179 is_undeterminated<T2>::value
1180 >::type>
1181{
1182 typedef undeterminated_basic <typename promote<T1,T2>::type> type;
1183};
1184// v/v -> err ; t/t -> err
1185template <class T>
1187 typename std::enable_if<
1188 ! is_rheolef_arithmetic<T>::value
1189 && ! is_undeterminated<T>::value
1190>::type>
1191{
1192 typedef typename scalar_traits<T>::type S;
1194};
1195template <class T>
1199template <class T>
1203template <class T>
1207template <class T>
1211template <class T1, class T2>
1216template <class T1, class T2>
1221template <class T>
1225template <class T>
1229template <class T>
1233template <class T1, class T2>
1238template <class T1, class T2>
1243template <class T1, class T2>
1248template <class T1, class T2>
1253template <class T>
1257template <class T1, class T2>
1262template <class T1, class T2>
1267template <class T1, class T2>
1272struct divides {
1273 template <class T1, class T2>
1275 operator() (const T1& a, const T2& b) const { return a/b; }
1276};
1277template<>
1279 template <class Arg1, class Arg2>
1280 struct result_hint {
1282 };
1283 template <class Arg1, class Arg2, class Result>
1284 struct hint {
1287 typedef Result result_type;
1288 };
1289 // two types are known
1290 // --------------------------
1291 // a1/a2 -> ? : deduce r=a1 when a2=s (error otherwise)
1292 template <class A1, class A2, class R>
1293 struct hint<A1,A2,undeterminated_basic<R> > {
1297 };
1298 // ?/a2 -> r : deduce a1=r when a2=s (error otherwise)
1299 template <class A1, class A2, class R>
1300 struct hint<undeterminated_basic<A1>,A2,R> {
1301 typedef typename scalar_traits<A2>::type S2;
1302 typedef typename std::conditional<
1304 R,
1307 typedef R result_type;
1308 };
1309 // a1/? -> r : deduce a2=s when a1=r (error otherwise)
1310 template <class A1, class A2, class R>
1311 struct hint<A1,undeterminated_basic<A2>,R> {
1312 typedef typename promote<
1313 typename scalar_traits<A1>::type,
1314 typename scalar_traits<R>::type>::type S;
1316 typedef typename std::conditional<
1318 S,
1320 typedef R result_type;
1321 };
1322 // two types are unknown
1323 // --------------------------
1324 // ?/? -> r : deduce a1=r and a2=s
1325 template <class A1, class A2, class R>
1331 // a1/? -> ? : deduce r=a1 and a2=s
1332 template <class A1, class A2, class R>
1338 // ?/a2 -> ? : deduce r=a1=? and a2=s
1339 template <class A1, class A2, class R>
1349 // three types are unknown
1350 // -----------------------
1351 // ?/? -> ? : deduce a1=r=? and a2=s
1352 template <class A1, class A2, class R>
1362 typedef std::false_type is_symmetric;
1363};
1364// ----------------------------------------------------------------------------
1365// chap 2.3. binary standard maths: pow(x,y), atan2(x,y),...
1366// ----------------------------------------------------------------------------
1367// specialization for scalar generic functions, as details::pow_, details::atan2_, etc
1368//ICI
1369template<class F>
1375 template <class Arg1, class Arg2>
1379 template <class A1, class A2, class R>
1380 struct hint {
1381 typedef typename scalar_traits<A1>::type S1;
1382 typedef typename scalar_traits<A2>::type S2;
1383 typedef typename scalar_traits<R>::type S;
1384 typedef typename details::and_type<
1388 >
1392 >
1396 >
1397 >::type is_good;
1398 typedef typename std::conditional<
1400 ,typename std::conditional<
1401 is_good::value
1402 ,S1
1404 >::type
1405 ,A1
1407 typedef typename std::conditional<
1409 ,typename std::conditional<
1410 is_good::value
1411 ,S2
1413 >::type
1414 ,A2
1416 typedef typename std::conditional<
1418 ,typename std::conditional<
1419 is_good::value
1420 ,S
1422 >::type
1423 ,R
1425 };
1426 typedef std::false_type is_symmetric;
1427};
1428#define _RHEOLEF_generic_binary_scalar(F) \
1429struct F##_ { \
1430 template<class A1, class A2> \
1431 typename promote<A1,A2>::type \
1432 operator() (const A1& x, const A2& y) const { \
1433 typedef typename promote<A1,A2>::type R; \
1434 return F(R(x),R(y)); } \
1435}; \
1436template<> \
1437struct generic_binary_traits<F##_> : scalar_binary_traits<F##_> {}; \
1438
1444#undef _RHEOLEF_generic_binary_scalar
1445// ----------------------------------------------------------------------------
1446// chap 2.4. binary extensions: dot(x,y), ddot(x,y), dddot(x,y)
1447// ----------------------------------------------------------------------------
1448// dot(x,y)
1449// ------------
1450struct dot_ {
1451 template<class T>
1452 T operator() (const point_basic<T>& x, const point_basic<T>& y) const { return dot(x,y); }
1453};
1454template<>
1460 template <class Arg1, class Arg2>
1461 struct result_hint {
1463 };
1464 template <class A1, class A2, class R>
1465 struct hint {
1466 typedef typename scalar_traits<A1>::type S1;
1467 typedef typename scalar_traits<A2>::type S2;
1468 typedef typename scalar_traits<R>::type S;
1469 typedef typename details::and_type<
1473 >
1477 >
1481 >
1482 >::type is_good;
1483 typedef typename std::conditional<
1485 ,typename std::conditional<
1486 is_good::value
1489 >::type
1490 ,A1
1492 typedef typename std::conditional<
1494 ,typename std::conditional<
1495 is_good::value
1498 >::type
1499 ,A2
1501 typedef typename std::conditional<
1503 ,typename std::conditional<
1504 is_good::value
1505 ,S
1507 >::type
1508 ,R
1510 };
1511 typedef std::true_type is_symmetric;
1512};
1513// ------------
1514// ddot(x,y)
1515// ------------
1516/*
1517 result: when arg1 & arg2 are given
1518 1\2 t t4
1519 t s t
1520 t4 t E
1521*/
1522struct ddot_;
1523template <class A1, class A2>
1528template <class A1, class A2>
1533template <class A1, class A2>
1538template <class A1, class A2>
1543struct ddot_ {
1544 template<class A1, class A2>
1546 operator() (const A1& x, const A2& y) const { return ddot(x,y); }
1547};
1548template<>
1554 template <class A1, class A2, class R>
1555 struct hint {
1557 typedef typename std::conditional<is_undeterminated<A1>::value,T,A1>::type first_argument_type;
1558 typedef typename std::conditional<is_undeterminated<A2>::value,T,A2>::type second_argument_type;
1559 typedef typename std::conditional<is_undeterminated<R>::value, T,R> ::type result_type;
1560 };
1561 // a:b -> ?
1562 template <class A1, class A2, class R>
1563 struct hint<A1,A2,undeterminated_basic<R> > {
1565 typedef typename std::conditional<
1570 typedef typename std::conditional<
1575 };
1576 // ====================
1577 // A1 xor A2 is unknown
1578 // ====================
1579 // ?:t -> s => a=t
1580 template <class A1, class A2, class R>
1581 struct hint<undeterminated_basic<A1>,tensor_basic<A2>,R> {
1583 typedef typename std::conditional<is_scalar<R>::value,tensor_basic<A1>,E>::type
1586 typedef R result_type;
1587 };
1588 // t:? -> s => b=t
1589 template <class A1, class A2, class R>
1590 struct hint<tensor_basic<A1>,undeterminated_basic<A2>,R> {
1593 typedef typename std::conditional<is_scalar<R>::value,tensor_basic<A2>,E>::type
1595 typedef R result_type;
1596 };
1597 // ?:t4 -> t => a=t
1598 template <class A1, class A2, class R>
1604 // t4:? -> t => b=t
1605 template <class A1, class A2, class R>
1611 // =====================
1612 // A1 and A2 are unknown
1613 // =====================
1614 // ?:? -> s => a=b=t
1615 template <class A1, class A2, class R>
1618 typedef typename std::conditional<is_scalar<R>::value,tensor_basic<A1>,E>::type
1620 typedef typename std::conditional<is_scalar<R>::value,tensor_basic<A2>,E>::type
1622 typedef R result_type;
1623 };
1624 // ?:? -> t => (a,b)={(t,t4),(t4,t)}
1625 // =====================
1626 // A1 and R are unknown
1627 // =====================
1628 // ?:t -> ? => (a,r)={(t,s),(t4,t)}
1629 template <class A1, class A2, class R>
1635 // ?:t4 -> ? => (a,r)=(t,t)
1636 template <class A1, class A2, class R>
1642 // =====================
1643 // A2 and R are unknown
1644 // =====================
1645 // t:? -> ? => (b,r)={(t,s),(t4,t)}
1646 template <class A1, class A2, class R>
1652 // t4:? -> ? => (b,r)=(t,t)
1653 template <class A1, class A2, class R>
1659 // ========================
1660 // A1, A2 and R are unknown
1661 // ========================
1662 // ?:? -> ? => a,b,r=?
1663 template <class A1, class A2, class R>
1669 // short interface
1670 template <class Arg1, class Arg2>
1671 struct result_hint {
1672 typedef typename hint<Arg1,Arg2,undeterminated_basic<Float> >::result_type type;
1673 };
1674 typedef std::true_type is_symmetric;
1675};
1676// ------------
1677// dddot(x,y)
1678// ------------
1679/*
1680 result: when arg1 & arg2 are given
1681 1\2 t3
1682 t3 s
1683*/
1684struct dddot_;
1685template <class A1, class A2>
1690template <class A1, class A2>
1695struct dddot_ {
1696 template<class A1, class A2>
1698 operator() (const A1& x, const A2& y) const { return dddot(x,y); }
1699};
1700template<>
1706 template <class A1, class A2, class R>
1707 struct hint {
1709 typedef typename std::conditional<is_undeterminated<A1>::value,T,A1>::type first_argument_type;
1710 typedef typename std::conditional<is_undeterminated<A2>::value,T,A2>::type second_argument_type;
1711 typedef typename std::conditional<is_undeterminated<R>::value, T,R> ::type result_type;
1712 };
1713 // a:.b -> ?
1714 template <class A1, class A2, class R>
1715 struct hint<A1,A2,undeterminated_basic<R> > {
1717 typedef typename std::conditional<
1722 typedef typename std::conditional<
1727 };
1728 // ====================
1729 // A1 xor A2 is unknown
1730 // ====================
1731 // ?:.t3 -> s => a=t3
1732 template <class A1, class A2, class R>
1733 struct hint<undeterminated_basic<A1>,tensor3_basic<A2>,R> {
1735 typedef typename std::conditional<is_scalar<R>::value,tensor3_basic<A1>,E>::type
1738 typedef R result_type;
1739 };
1740 // t3:.? -> s => b=t3
1741 template <class A1, class A2, class R>
1742 struct hint<tensor3_basic<A1>,undeterminated_basic<A2>,R> {
1745 typedef typename std::conditional<is_scalar<R>::value,tensor3_basic<A2>,E>::type
1747 typedef R result_type;
1748 };
1749 // =====================
1750 // A1 and A2 are unknown
1751 // =====================
1752 // ?:.? -> s => a=b=t3
1753 template <class A1, class A2, class R>
1756 typedef typename std::conditional<is_scalar<R>::value,tensor3_basic<A1>,E>::type
1758 typedef typename std::conditional<is_scalar<R>::value,tensor3_basic<A2>,E>::type
1760 typedef R result_type;
1761 };
1762 // =====================
1763 // A2 and R are unknown
1764 // =====================
1765 // t3:.? -> ? => (b,r)={(t3,s)}
1766 template <class A1, class A2, class R>
1772 // ========================
1773 // A1, A2 and R are unknown
1774 // ========================
1775 // ?:.? -> ? => a,b,r=?
1776 template <class A1, class A2, class R>
1782 // short interface
1783 template <class Arg1, class Arg2>
1784 struct result_hint {
1785 typedef typename hint<Arg1,Arg2,undeterminated_basic<Float> >::result_type type;
1786 };
1787 typedef std::true_type is_symmetric;
1788};
1789// ===========================================================================
1790// part 3. binders
1791// ===========================================================================
1792// similar to std::binder1st, std::binder2nd, but for generic operators
1793
1794// ----------------------------------------------------------------------------
1795// chap 3.1. binder_first
1796// ----------------------------------------------------------------------------
1797template<class BinaryFunction, class A1>
1799 binder_first (const BinaryFunction& f, const A1& x1) : _f(f), _x1(x1) {}
1800 template<class A2>
1801 typename generic_binary_traits<BinaryFunction>::template result_hint<A1,A2>::type
1802 operator() (const A2& x2) const { return _f(_x1,x2); }
1803protected:
1804 BinaryFunction _f;
1806};
1807template<class BinaryFunction, class A1>
1808struct generic_unary_traits<binder_first<BinaryFunction,A1> > {
1809 template <class A2>
1813 template <class A2, class Result>
1814 struct hint {
1815 typedef Result result_type;
1816 typedef A2 argument_type;
1817 };
1818 // result unknown:
1819 template <class A2, class T>
1820 struct hint<A2,undeterminated_basic<T> > {
1822 typedef A1 argument_type;
1823 };
1824 // A2 unknown:
1825 template <class R, class T>
1826 struct hint<undeterminated_basic<T>,R> {
1827 typedef R result_type;
1828 typedef typename generic_binary_traits<BinaryFunction>::template hint<A1,undeterminated_basic<T>,R>::second_argument_type
1830 };
1831 // A2 & R unknown:
1832 template <class T1, class T>
1834 typedef typename generic_binary_traits<BinaryFunction>::template hint<A1,undeterminated_basic<T1>,undeterminated_basic<T> >::second_argument_type
1836 typedef typename generic_binary_traits<BinaryFunction>::template hint<A1,undeterminated_basic<T>,undeterminated_basic<T> >::result_type
1838 };
1844};
1845// ----------------------------------------------------------------------------
1846// chap 3.2. binder_second
1847// ----------------------------------------------------------------------------
1848template<class BinaryFunction, class A2>
1850 binder_second (const BinaryFunction& f, const A2& x2) : _f(f), _x2(x2) {}
1851 template<class A1>
1852 typename generic_binary_traits<BinaryFunction>::template result_hint<A1,A2>::type
1853 operator() (const A1& x1) const { return _f(x1,_x2); }
1854protected:
1855 BinaryFunction _f;
1857};
1858template<class BinaryFunction, class A2>
1859struct generic_unary_traits<binder_second<BinaryFunction,A2> > {
1860 template <class A1>
1864 template <class A1, class Result>
1865 struct hint {
1866 typedef Result result_type;
1867 typedef A1 argument_type;
1868 };
1869 // result unknown:
1870 template <class A1, class T>
1871 struct hint<A1,undeterminated_basic<T> > {
1873 typedef A1 argument_type;
1874 };
1875 // A1 unknown:
1876 template <class R, class T>
1877 struct hint<undeterminated_basic<T>,R> {
1878 typedef R result_type;
1879 typedef typename generic_binary_traits<BinaryFunction>::template hint<undeterminated_basic<T>,A2,R>::first_argument_type
1881 };
1882 // A1 & R unknown:
1883 template <class T1, class T>
1885 typedef typename generic_binary_traits<BinaryFunction>::template hint<undeterminated_basic<T1>,A2,undeterminated_basic<T> >::first_argument_type
1887 typedef typename generic_binary_traits<BinaryFunction>::template hint<undeterminated_basic<T>,A2,undeterminated_basic<T> >::result_type
1889 };
1895};
1896// ---------------------------------------------------------------------------
1897// chap 3.3. binary swapper
1898// ---------------------------------------------------------------------------
1899// as details::mutiplies, for field_vf_bind_bf
1900// swap is equivalet to binder_second, but with a field instead of a constant
1901template<class BinaryFunction>
1902struct swapper {
1903 swapper (const BinaryFunction& f) : _f(f) {}
1904 template<class A1, class A2>
1905 typename generic_binary_traits<BinaryFunction>::template result_hint<A2,A1>::type
1906 operator() (const A1& x1, const A2& x2) const { return _f(x2,x1); }
1907protected:
1908 BinaryFunction _f;
1909};
1910template<class BinaryFunction>
1911struct generic_binary_traits<swapper<BinaryFunction> > {
1912 template <class A1, class A2>
1913 struct result_hint : generic_binary_traits<BinaryFunction>::template result_hint<A2,A1> {};
1914
1915 template <class A1, class A2, class Result>
1916 struct hint {
1917 typedef typename generic_binary_traits<BinaryFunction>::template hint<A2,A1,Result> base;
1918 typedef typename base::second_argument_type first_argument_type;
1919 typedef typename base::first_argument_type second_argument_type;
1920 typedef typename base::result_type result_type;
1921 };
1926};
1927// ---------------------------------------------------------------------------
1928// chap 3.4. unary & binary function wrapper, for compose
1929// ---------------------------------------------------------------------------
1930// TODO: use std::function<F> ?
1931template<class Function>
1933 typedef Function type;
1934};
1935template<class Result, class Arg>
1936struct function_wrapper<Result(Arg)> {
1937 typedef std::function<Result(Arg)> type;
1938};
1939template<class Result, class Arg1, class Arg2>
1940struct function_wrapper<Result(Arg1,Arg2)> {
1941 typedef std::function<Result(Arg1,Arg2)> type;
1942};
1943
1944template<class Function>
1945inline
1946Function
1948{
1949 return f;
1950}
1951template<class Result, class Arg>
1952inline
1953std::pointer_to_unary_function<Arg,Result>
1954function_wrap (Result(*f)(Arg))
1955{
1956 return std::ptr_fun(f);
1957}
1958template<class Result, class Arg1, class Arg2>
1959inline
1960std::pointer_to_binary_function<Arg1,Arg2,Result>
1961function_wrap (Result(*f)(Arg1,Arg2))
1962{
1963 return std::ptr_fun(f);
1964}
1965
1966}} // namespace rheolef::details
1967#endif // _RHEOLEF_EXPRESSION_H
#define _RHEOLEF_generic_unary_scalar(F)
Definition expression.h:254
#define _RHEOLEF_generic_binary_scalar(F)
Expr1::float_type T
Definition field_expr.h:230
rheolef::details::is_vec dot
Function function_wrap(Function f)
valued_type multiplies_result_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
valued_type divides_result_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
This file is part of Rheolef.
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
Definition tensor.cc:278
U tr(const tensor_basic< U > &a, size_t d=3)
T norm2(const vec< T, M > &x)
norm2(x): see the expression page for the full documentation
Definition vec.h:379
T dddot(const tensor3_basic< T > &a, const tensor3_basic< T > &b)
Definition tensor3.cc:94
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition csr.h:455
T norm(const vec< T, M > &x)
norm(x): see the expression page for the full documentation
Definition vec.h:387
STL namespace.
Definition cavity_dg.h:29
generic_binary_traits< BinaryFunction >::template result_hint< A1, A2 >::type operator()(const A2 &x2) const
binder_first(const BinaryFunction &f, const A1 &x1)
generic_binary_traits< BinaryFunction >::template result_hint< A1, A2 >::type operator()(const A1 &x1) const
binder_second(const BinaryFunction &f, const A2 &x2)
dddot_result< A1, A2 >::type operator()(const A1 &x, const A2 &y) const
promote< typenamefloat_traits< A1 >::type, typenamefloat_traits< A2 >::type >::type S
promote< typenamefloat_traits< A1 >::type, typenamefloat_traits< A2 >::type >::type S
binop_error< dddot_, A1, A2, undeterminated_basic< S > > type
ddot_result< A1, A2 >::type operator()(const A1 &x, const A2 &y) const
promote< typenamefloat_traits< A1 >::type, typenamefloat_traits< A2 >::type >::type S
promote< typenamefloat_traits< A1 >::type, typenamefloat_traits< A2 >::type >::type S
promote< typenamefloat_traits< A1 >::type, typenamefloat_traits< A2 >::type >::type S
promote< typenamefloat_traits< A1 >::type, typenamefloat_traits< A2 >::type >::type S
binop_error< ddot_, A1, A2, undeterminated_basic< S > > type
binop_error< details::divides, T, point_basic< T >, undeterminated_basic< T > > type
binop_error< details::divides, T, tensor3_basic< T >, undeterminated_basic< T > > type
binop_error< details::divides, T, tensor4_basic< T >, undeterminated_basic< T > > type
binop_error< details::divides, T, tensor_basic< T >, undeterminated_basic< T > > type
binop_error< details::divides, point_basic< T1 >, tensor3_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, point_basic< T1 >, tensor4_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, point_basic< T1 >, tensor_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, tensor3_basic< T1 >, point_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, tensor3_basic< T1 >, tensor4_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, tensor3_basic< T1 >, tensor_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, tensor_basic< T1 >, point_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, tensor_basic< T1 >, tensor3_basic< T2 >, undeterminated_basic< S > > type
binop_error< details::divides, tensor_basic< T1 >, tensor4_basic< T2 >, undeterminated_basic< S > > type
undeterminated_basic< typename promote< typename scalar_traits< T1 >::type, typename scalar_traits< T2 >::type >::type > type
divides_result< T1, T2 >::type operator()(const T1 &a, const T2 &b) const
std::decay< typenamefunction_traits< Function >::result_type >::type result_type
Definition expression.h:419
std::decay< typenamefunction_traits< Function >::templatearg< 0 >::type >::type first_argument_type
Definition expression.h:415
std::decay< typenamefunction_traits< Function >::templatearg< 1 >::type >::type second_argument_type
Definition expression.h:417
function_traits< Function >::result_type type
Definition expression.h:410
std::conditional< is_undeterminated< A1 >::value &&is_error< result_type >::value, result_type, A1 >::type first_argument_type
std::conditional< is_undeterminated< A2 >::value &&is_error< result_type >::value, result_type, A2 >::type second_argument_type
std::conditional< is_scalar< R >::value, tensor3_basic< A2 >, E >::type second_argument_type
std::conditional< is_scalar< R >::value, tensor3_basic< A1 >, E >::type first_argument_type
std::conditional< is_undeterminated< A1 >::value, T, A1 >::type first_argument_type
std::conditional< is_undeterminated< R >::value, T, R >::type result_type
std::conditional< is_undeterminated< A2 >::value, T, A2 >::type second_argument_type
hint< Arg1, Arg2, undeterminated_basic< Float > >::result_type type
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
std::conditional< is_undeterminated< A1 >::value &&is_error< result_type >::value, result_type, A1 >::type first_argument_type
std::conditional< is_undeterminated< A2 >::value &&is_error< result_type >::value, result_type, A2 >::type second_argument_type
std::conditional< is_scalar< R >::value, tensor_basic< A2 >, E >::type second_argument_type
std::conditional< is_scalar< R >::value, tensor_basic< A1 >, E >::type first_argument_type
std::conditional< is_undeterminated< A1 >::value, T, A1 >::type first_argument_type
std::conditional< is_undeterminated< R >::value, T, R >::type result_type
std::conditional< is_undeterminated< A2 >::value, T, A2 >::type second_argument_type
hint< Arg1, Arg2, undeterminated_basic< Float > >::result_type type
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
promote< typenamescalar_traits< A1 >::type, typenamescalar_traits< R >::type >::type S
std::conditional< details::is_equal< A1, R >::value, S, binop_error< details::divides, A1, A2, R > >::type second_argument_type
std::conditional< details::is_scalar< A2 >::value, undeterminated_basic< A1 >, binop_error< details::divides, A1, A2, R > >::type first_argument_type
std::conditional< details::is_scalar< A2 >::value, R, binop_error< details::divides, A1, A2, R > >::type first_argument_type
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
std::conditional< is_undeterminated< A2 >::value, typenamestd::conditional< is_good::value, point_basic< S2 >, binop_error< details::dot_, A1, A2, R > >::type, A2 >::type second_argument_type
details::and_type< details::or_type< details::is_point< A1 >, is_undeterminated< A1 > >, details::or_type< details::is_point< A2 >, is_undeterminated< A2 > >, details::or_type< details::is_scalar< R >, is_undeterminated< R > > >::type is_good
std::conditional< is_undeterminated< R >::value, typenamestd::conditional< is_good::value, S, binop_error< details::dot_, A1, A2, R > >::type, R >::type result_type
std::conditional< is_undeterminated< A1 >::value, typenamestd::conditional< is_good::value, point_basic< S1 >, binop_error< details::dot_, A1, A2, R > >::type, A1 >::type first_argument_type
promote< typenamefloat_traits< Arg1 >::type, typenamefloat_traits< Arg2 >::type >::type type
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
hint< A1, A2, undeterminated_basic< Float > >::result_type type
Definition expression.h:555
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
Definition expression.h:558
binop_error< details::multiplies, undeterminated_basic< A2 >, tensor3_basic< A2 >, R > type
Definition expression.h:834
binop_error< details::multiplies, undeterminated_basic< A2 >, tensor3_basic< A2 >, point_basic< R > > type
Definition expression.h:839
binop_error< details::multiplies, undeterminated_basic< A2 >, point_basic< A2 >, tensor3_basic< R > > type
Definition expression.h:804
binop_error< details::multiplies, undeterminated_basic< A2 >, tensor_basic< A2 >, R > type
Definition expression.h:814
binop_error< details::multiplies, undeterminated_basic< A2 >, tensor_basic< A2 >, point_basic< R > > type
Definition expression.h:819
binop_error< details::multiplies, undeterminated_basic< S >, tensor4_basic< A2 >, tensor3_basic< R > > type
Definition expression.h:874
binop_error< details::multiplies, undeterminated_basic< S >, tensor4_basic< A2 >, point_basic< R > > type
Definition expression.h:862
binop_error< details::multiplies, undeterminated_basic< A2 >, tensor3_basic< A2 >, tensor_basic< R > > type
Definition expression.h:844
binop_error< details::multiplies, undeterminated_basic< S >, tensor4_basic< A2 >, tensor_basic< R > > type
Definition expression.h:868
binop_error< details::multiplies, undeterminated_basic< A2 >, point_basic< A2 >, R > type
Definition expression.h:789
binop_error< details::multiplies, undeterminated_basic< A2 >, point_basic< A2 >, tensor4_basic< R > > type
Definition expression.h:809
hint< Arg1, Arg2, undeterminated_basic< Float > >::result_type type
binop_error< details::multiplies, tensor_basic< A1 >, undeterminated_basic< A1 >, tensor3_basic< R > > type
Definition expression.h:948
binop_error< details::multiplies, tensor4_basic< A1 >, undeterminated_basic< A1 >, point_basic< R > > type
Definition expression.h:979
binop_error< details::multiplies, tensor3_basic< A1 >, undeterminated_basic< A1 >, R > type
Definition expression.h:953
binop_error< details::multiplies, tensor4_basic< A1 >, undeterminated_basic< A1 >, tensor_basic< R > > type
Definition expression.h:984
binop_error< details::multiplies, tensor3_basic< A1 >, undeterminated_basic< A1 >, point_basic< R > > type
Definition expression.h:958
binop_error< details::multiplies, tensor4_basic< A1 >, undeterminated_basic< A1 >, tensor3_basic< R > > type
Definition expression.h:989
binop_error< details::multiplies, point_basic< A1 >, undeterminated_basic< A1 >, tensor3_basic< R > > type
Definition expression.h:943
binop_error< details::multiplies, point_basic< A1 >, undeterminated_basic< A1 >, R > type
Definition expression.h:913
binop_error< details::multiplies, tensor_basic< A1 >, undeterminated_basic< A1 >, R > type
Definition expression.h:928
binop_error< details::multiplies, tensor_basic< A1 >, undeterminated_basic< A1 >, tensor_basic< R > > type
Definition expression.h:923
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
Definition expression.h:754
std::conditional< details::is_equal< A1, R >::value, R, binop_error< details::plus, A1, A2, R > >::type second_argument_type
Definition expression.h:500
std::conditional< details::is_equal< A2, R >::value, R, binop_error< details::plus, A1, A2, R > >::type first_argument_type
Definition expression.h:488
hint< Arg1, Arg2, undeterminated_basic< Float > >::result_type type
Definition expression.h:538
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
Definition expression.h:532
generic_binary_traits< BinaryFunction >::template hint< A2, A1, Result > base
static space_constant::valued_type valued_tag(space_constant::valued_type arg1_tag, space_constant::valued_type arg2_tag)
static space_constant::valued_type valued_tag(space_constant::valued_type, space_constant::valued_type)
Definition expression.h:422
std::decay< typenamefunction_traits< Function >::templatearg< 0 >::type >::type argument_type
Definition expression.h:197
function_traits< Function >::result_type result_type
Definition expression.h:195
function_traits< Function >::result_type type
Definition expression.h:191
generic_binary_traits< BinaryFunction >::template result_hint< A1, A2 >::type type
static space_constant::valued_type valued_tag(space_constant::valued_type arg_tag)
generic_binary_traits< BinaryFunction >::template hint< A1, undeterminated_basic< T >, R >::second_argument_type argument_type
generic_binary_traits< BinaryFunction >::template hint< A1, undeterminated_basic< T >, undeterminated_basic< T > >::result_type result_type
generic_binary_traits< BinaryFunction >::template hint< A1, undeterminated_basic< T1 >, undeterminated_basic< T > >::second_argument_type argument_type
generic_binary_traits< BinaryFunction >::template hint< undeterminated_basic< T >, A2, R >::first_argument_type argument_type
generic_binary_traits< BinaryFunction >::template hint< undeterminated_basic< T1 >, A2, undeterminated_basic< T > >::first_argument_type argument_type
generic_binary_traits< BinaryFunction >::template hint< undeterminated_basic< T >, A2, undeterminated_basic< T > >::result_type result_type
generic_binary_traits< BinaryFunction >::template result_hint< A1, A2 >::type type
static space_constant::valued_type valued_tag(space_constant::valued_type arg_tag)
static space_constant::valued_type valued_tag(space_constant::valued_type tag)
Definition expression.h:246
static space_constant::valued_type valued_tag(space_constant::valued_type tag)
Definition expression.h:396
static space_constant::valued_type valued_tag(space_constant::valued_type tag)
Definition expression.h:369
static space_constant::valued_type valued_tag(space_constant::valued_type tag)
Definition expression.h:319
promote< typenamescalar_traits< A1 >::type, typenamescalar_traits< R >::type >::type S
Definition expression.h:337
tensor_basic< typename scalar_traits< A1 >::type > type
Definition expression.h:333
static space_constant::valued_type valued_tag(space_constant::valued_type tag)
Definition expression.h:342
static space_constant::valued_type valued_tag(space_constant::valued_type tag)
Definition expression.h:224
static space_constant::valued_type valued_tag(space_constant::valued_type)
Definition expression.h:200
plus_result< T1, T2 >::type operator()(const T1 &a, const T2 &b) const
Definition expression.h:546
binop_error< details::multiplies, point_basic< S1 >, point_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:628
binop_error< details::multiplies, point_basic< S1 >, tensor3_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:679
binop_error< details::multiplies, point_basic< S1 >, tensor4_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:707
binop_error< details::multiplies, point_basic< S1 >, tensor_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:634
binop_error< details::multiplies, tensor3_basic< S1 >, tensor3_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:691
binop_error< details::multiplies, tensor3_basic< S1 >, tensor4_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:719
binop_error< details::multiplies, tensor4_basic< S1 >, point_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:725
binop_error< details::multiplies, tensor4_basic< S1 >, tensor3_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:737
binop_error< details::multiplies, tensor4_basic< S1 >, tensor4_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:743
binop_error< details::multiplies, tensor4_basic< S1 >, tensor_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:731
binop_error< details::multiplies, tensor_basic< S1 >, tensor3_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:685
binop_error< details::multiplies, tensor_basic< S1 >, tensor4_basic< S2 >, undeterminated_basic< S > > type
Definition expression.h:713
promote< A1, A2 >::type type
Definition expression.h:607
multiplies_result< T1, T2 >::type operator()(const T1 &a, const T2 &b) const
Definition expression.h:749
T operator()(const T &a) const
Definition expression.h:232
float_traits< T >::type operator()(const T &x) const
Definition expression.h:378
float_traits< T >::type operator()(const T &x) const
Definition expression.h:351
binop_error< details::plus, A1, A2, undeterminated_basic< Float > > type
Definition expression.h:437
plus_result< T1, T2 >::type operator()(const T1 &a, const T2 &b) const
Definition expression.h:459
std::conditional< is_undeterminated< A1 >::value, typenamestd::conditional< is_good::value, S1, binop_error< F, A1, A2, R > >::type, A1 >::type first_argument_type
details::and_type< details::or_type< details::is_scalar< A1 >, is_undeterminated< A1 > >, details::or_type< details::is_scalar< A2 >, is_undeterminated< A2 > >, details::or_type< details::is_scalar< R >, is_undeterminated< R > > >::type is_good
std::conditional< is_undeterminated< A2 >::value, typenamestd::conditional< is_good::value, S2, binop_error< F, A1, A2, R > >::type, A2 >::type second_argument_type
std::conditional< is_undeterminated< R >::value, typenamestd::conditional< is_good::value, S, binop_error< F, A1, A2, R > >::type, R >::type result_type
promote< typenamescalar_traits< Arg1 >::type, typenamescalar_traits< Arg2 >::type >::type type
static space_constant::valued_type valued_tag(space_constant::valued_type tag1, space_constant::valued_type tag2)
swapper(const BinaryFunction &f)
generic_binary_traits< BinaryFunction >::template result_hint< A2, A1 >::type operator()(const A1 &x1, const A2 &x2) const
tensor_basic< T > operator()(const tensor_basic< T > &a) const
Definition expression.h:327
T operator()(const T &a) const
Definition expression.h:210
helper for std::complex<T>: get basic T type
Definition Float.h:93
promote_not_specialized_for_this_case< T1, T2 > type
Definition promote.h:30
helper for generic field value_type: T, point_basic<T> or tensor_basic<T>