LifeV
RNMOperator.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV 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 License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Implementation of the operators defined in RNM.hpp
30 
31  @contributor Matteo Astorino <matteo.astorino@epfl.ch>
32  @mantainer Matteo Astorino <matteo.astorino@epfl.ch>
33 
34  */
35 
36 namespace LifeV
37 {
38 template <class R>
39 const KN_<R>& KN_<R>::operator oper ( const Mul_KNM_KN_<R>& u )
40 {
41  K_assert ( SameShape ( u.A.shapei ) && !constant() );
42  R* l ( v );
43  KN_<const_R> li ( u.A ( 0, '.' ) ); // first line
44  for ( int i = 0; i < n; i++, l += step, ++li )
45  {
46  * l oper ( li, u.b );
47  }
48  return *this;
49 }
50 
51 
52 template <class R>
53 const KN_<R>& KN_<R>::operator oper ( const Add_KN_<R>& u )
54 {
55  K_assert ( u.a.N() == N() );
56  int stepa ( u.a.step ), stepb ( u.b.step );
57  R* l ( v );
58  const_R* aa ( u.a ), *bb ( u.b );
59  for ( int i = 0; i < n; i++, l += step, aa += stepa, bb += stepb )
60  {
61  * l oper* aa + *bb;
62  }
63  return *this;
64 }
65 
66 template <class R>
67 const KN_<R>& KN_<R>::operator oper ( const Sub_KN_<R>& u )
68 {
69  K_assert ( u.a.N() == N() );
70  int stepa ( u.a.step ), stepb ( u.b.step );
71  R* l ( v );
72  const_R* aa ( u.a ), *bb ( u.b );
73  for ( int i = 0; i < n; i++, l += step, aa += stepa, bb += stepb )
74  {
75  * l oper* aa - *bb;
76  }
77  return *this;
78 }
79 
80 template <class R>
81 const KN_<R>& KN_<R>::operator oper ( const Mulc_KN_<R>& u )
82 {
83  K_assert ( u.a.N() == N() );
84  int stepa ( u.a.step );
85  R* l ( v );
86  const_R* aa ( u.a ), bb ( u.b ) ;
87  for ( int i = 0; i < n; i++, l += step, aa += stepa )
88  {
89  * l oper* aa* bb;
90  }
91  return *this;
92 }
93 
94 template <class R>
95 const KN_<R>& KN_<R>::operator oper ( const Add_Mulc_KN_<R>& u )
96 {
97  K_assert ( u.a.N() == N() );
98  const int stepa ( u.a.step ), stepb ( u.b.step );
99  const R ca ( u.ca ), cb ( u.cb );
100  R* l ( v );
101  const R* aa ( u.a ), *bb ( u.b );
102  for ( int i = 0; i < n; i++, l += step, aa += stepa, bb += stepb )
103  {
104  * l oper* aa* ca + *bb* cb;
105  }
106  return *this;
107 }
108 }
const KN_ & operator=(const Mul_KNM_KN_< R > &u)
#define oper
const KN_ & operator=(const Sub_KN_< R > &u)
const KN_ & operator=(const Add_KN_< R > &u)
void updateInverseJacobian(const UInt &iQuadPt)
R * v
Definition: RNM.hpp:275
const int n
Definition: RNM.hpp:180
const int step
Definition: RNM.hpp:181
const KN_ & operator=(const Mulc_KN_< R > &u)
#define K_assert(i)
Definition: RNM.hpp:59
#define const_R
Definition: RNM.hpp:48
const KN_ & operator=(const Add_Mulc_KN_< R > &u)