Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
adbinaryoperators.tmpl.hpp
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2008-02-14
7 
8  Copyright (C) 2008 Université Joseph Fourier (Grenoble I)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 3.0 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 // -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
30 
31 
32 //------------------------------- AD operators ------------------------------------------
33 
34 template<class E1, class E2>
35 inline
36 ADExpr< @STYPE@< ADExpr<E1>, ADExpr<E2> > >
37 @OP@ ( const ADExpr<E1> &v, const ADExpr<E2> &w )
38 {
39  typedef @STYPE@<ADExpr<E1>, ADExpr<E2> > expr_t;
40  return ADExpr<expr_t> ( expr_t ( v , w ) );
41 }
42 template<class E, int Nvar, int order, int Var>
43 inline
44 ADExpr<@STYPE@<ADExpr<E>,ADType<typename E::value_type, Nvar, order, Var> > >
45 @OP@ ( const ADExpr<E> &e,const ADType<typename E::value_type, Nvar, order, Var>& v )
46 {
47  typedef typename E::value_type A;
48  typedef @STYPE@<ADExpr<E>,ADType<typename E::value_type, Nvar, order, Var> > expr_t;
49  return ADExpr<expr_t>( expr_t ( e, v ) );
50 }
51 
52 template<typename A, int Nvar, int order, int Var1, int Var2>
53 inline
54 ADExpr<@STYPE@<ADType<A, Nvar, order, Var1>,ADType<A, Nvar, order, Var2> > >
55 @OP@ ( const ADType<A, Nvar, order, Var1> &e1,const ADType<A, Nvar, order, Var2>& e2 )
56 {
57  typedef @STYPE@<ADType<A, Nvar, order, Var1>,ADType<A, Nvar, order, Var2> > expr_t;
58  return ADExpr<expr_t>( expr_t ( e1 , e2 ) );
59 }
60 
61 template<class E, int Nvar, int order, int Var>
62 inline
63 ADExpr<@STYPE@<ADType<typename E::value_type, Nvar, order, Var>,ADExpr<E> > >
64 @OP@ ( const ADType<typename E::value_type, Nvar, order, Var> &v, const ADExpr<E> &e )
65 {
66  typedef typename E::value_type A;
67  typedef @STYPE@<ADType<typename E::value_type, Nvar, order, Var>,ADExpr<E> > expr_t;
68  return ADExpr<expr_t> ( expr_t ( v , e ) );
69 }
70 
71 template<typename A, typename C, int Nvar, int order, int Var>
72 inline
73 ADExpr<@STYPE@<ADCst<C>,ADType<A, Nvar, order, Var> > >
74 @OP@ ( C a, const ADType<A, Nvar, order, Var> &e )
75 {
76  typedef @STYPE@<ADCst<C>,ADType<A, Nvar, order, Var> > expr_t;
77  return ADExpr<expr_t> ( expr_t ( ADCst<C>( a ), e ) );
78 }
79 
80 template<typename A, typename C, int Nvar, int order, int Var>
81 inline
82 ADExpr<@STYPE@<ADType<A, Nvar, order, Var>,ADCst<C> > >
83 @OP@ ( const ADType<A, Nvar, order, Var> &e, C a )
84 {
85  typedef @STYPE@<ADType<A, Nvar, order, Var>,ADCst<C> > expr_t;
86  return ADExpr<expr_t>( expr_t ( e ,ADCst<C>( a ) ) );
87 }
88 
89 template<class E, class C>
90 inline
91 ADExpr<@STYPE@<ADCst<C>,ADExpr<E> > >
92 @OP@ ( C t, const ADExpr<E> &e )
93 {
94  typedef @STYPE@<ADCst<C>,ADExpr<E> > expr_t;
95  return ADExpr<expr_t> ( expr_t ( ADCst<C> ( t ),e ) );
96 }
97 
98 template<class E, class C>
99 inline
100 ADExpr<@STYPE@<ADExpr<E>,ADCst<C> > >
101 @OP@ ( const ADExpr<E> &e, C t )
102 {
103  typedef @STYPE@<ADExpr<E>,ADCst<C> > expr_t;
104  return ADExpr<expr_t>( expr_t ( e, ADCst<C> ( t ) ) );
105 }
106 

Generated on Sun Dec 22 2013 13:10:54 for Feel++ by doxygen 1.8.5