LifeV
RNMOperatorConstant.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 Operator implementation of RNM.hpp
30 
31  @contributor Miguel Fernandez
32  Matteo Astorino <matteo.astorino@epfl.ch>
33  @mantainer Matteo Astorino <matteo.astorino@epfl.ch>
34 
35  */
36 // Modif Miguel 02/12/2002
37 // "operator=" was changed to "operator oper" when
38 // tab are consecutive in memory
39 namespace LifeV
40 {
41 template <class R>
42 const KN_<R>& KN_<R>::operator oper ( const_R a )
43 {
44  R* l ( v );
45  for ( int i = 0; i < n; i++, l += step )
46  {
47  * l oper a;
48  }
49  return *this;
50 }
51 
52 template <class R>
53 inline const KNM_<R>& KNM_<R>::operator oper ( const_R a )
54 {
55  if ( IsVector1() )
56  {
57  KN_<R>::operator oper ( a );
58  }
59  else
60  {
61  KN_<R> lj ( operator() ( '.', 0 ) ); // (.,.,O)
62  for ( int j = 0; j < M(); ++j, ++lj )
63  {
64  lj oper a;
65  }
66  }
67  return *this;
68 }
69 
70 template <class R>
71 inline const KNMK_<R>& KNMK_<R>::operator oper ( const_R a )
72 {
73  if ( IsVector1() )
74  {
75  KN_<R>::operator oper ( a );
76  }
77  else
78  {
79  KNM_<R> lj ( operator() ( '.', '.', 0 ) ); // (.,.,O)
80  int j = K();
81  while ( j-- )
82  {
83  lj oper a;
84  ++lj;
85  }
86  }
87  return *this;
88 }
89 
90 template <class R>
91 const KN_<R>& KN_<R>::operator oper ( const KN_<const_R>& u )
92 {
93  K_assert ( u.n == n );
94  R* l ( v );
95  const R* r ( u );
96  for ( int i = 0; i < n; i++, l += step, r += u.step )
97  {
98  * l oper* r;
99  }
100  return *this;
101 }
102 
103 template <class R>
104 inline const KNM_<R>& KNM_<R>::operator oper ( const KNM_<const_R>& u )
105 {
106  if ( IsVector1() && u.IsVector1() )
107  {
108  KN_<R>::operator oper ( u );
109  }
110  else
111  {
112  KN_<R> lj ( operator() ( '.', 0 ) ); // (.,O)
113  KN_<const_R> uj ( u ( '.', 0 ) );
114  int j = M();
115  while ( j-- )
116  {
117  lj oper uj;
118  ++lj;
119  ++uj;
120  }
121  }
122  return *this;
123 }
124 
125 
126 template <class R>
127 inline const KNMK_<R>& KNMK_<R>::operator oper ( const KNMK_<const_R>& u )
128 {
129  if ( IsVector1() && u.IsVector1() )
130  {
131  KN_<R>::operator oper ( u );
132  }
133  else
134  {
135  K_assert ( K() == u.K() );
136  KNM_<R> lj ( operator() ( '.', '.', 0 ) ); // (.,O)
137  KNM_<const_R> uj ( u ( '.', '.', 0 ) );
138  int j = K();
139  while ( j-- )
140  {
141  lj oper uj;
142  ++lj;
143  ++uj;
144  }
145  }
146  return *this;
147 }
148 
149 #undef oper
150 }
const KNM_ & operator=(const KNM_< R > &u)
int K() const
Definition: RNM.hpp:601
#define oper
void updateInverseJacobian(const UInt &iQuadPt)
R * v
Definition: RNM.hpp:275
const int n
Definition: RNM.hpp:180
int M() const
Definition: RNM.hpp:426
const int step
Definition: RNM.hpp:181
int IsVector1() const
Definition: RNM.hpp:418
const KNM_ & operator=(R a)
const KN_ & operator=(const KN_< R > &u)
const KNMK_ & operator=(const KNMK_< R > &u)
const KNMK_ & operator=(R a)
int IsVector1() const
Definition: RNM.hpp:589
const KN_ & operator=(R a)
#define K_assert(i)
Definition: RNM.hpp:59
#define const_R
Definition: RNM.hpp:48