LifeV
MatrixElemental.cpp
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 Matrix for elementary assembly
30 
31  @contributor Matteo Astorino <matteo.astorino@epfl.ch>
32  @mantainer Matteo Astorino <matteo.astorino@epfl.ch>
33 
34  */
35 
36 #include <lifev/core/array/MatrixElemental.hpp>
37 
38 namespace LifeV
39 {
41 {
42 }
43 
44 MatrixElemental::MatrixElemental ( UInt nNode1, UInt nbr1, UInt nbc1 ) :
45  _mat ( nNode1* nbr1, nNode1* nbc1 )
46 {
47  //
48  _nBlockRow = nbr1;
49  _nBlockCol = nbc1;
50  //
51  _nRow.resize ( _nBlockRow );
52  _firstRow.resize ( _nBlockRow );
53  _nCol.resize ( _nBlockCol );
54  _firstCol.resize ( _nBlockCol );
55  //
56  UInt first = 0;
57  for ( UInt n = 0; n < nbr1; n++ )
58  {
59  _nRow[ n ] = nNode1;
60  _firstRow[ n ] = first;
61  first += nNode1;
62  }
63  //
64  first = 0;
65  for ( UInt n = 0; n < nbc1; n++ )
66  {
67  _nCol[ n ] = nNode1;
68  _firstCol[ n ] = first;
69  first += nNode1;
70  }
71 }
72 
74  UInt nNode2, UInt nbr2, UInt nbc2 ) :
76 {
77  //
78  _nBlockRow = nbr1 + nbr2;
79  _nBlockCol = nbc1 + nbc2;
80  //
81  _nRow.resize ( _nBlockRow );
82  _firstRow.resize ( _nBlockRow );
83  _nCol.resize ( _nBlockCol );
84  _firstCol.resize ( _nBlockCol );
85  //
86  UInt first = 0, n;
87  for ( n = 0; n < nbr1; n++ )
88  {
89  _nRow[ n ] = nNode1;
90  _firstRow[ n ] = first;
91  first += nNode1;
92  }
93  for ( n = nbr1; n < nbr1 + nbr2; n++ )
94  {
95  _nRow[ n ] = nNode2;
96  _firstRow[ n ] = first;
97  first += nNode2;
98  }
99  //
100  first = 0;
101  for ( n = 0; n < nbc1; n++ )
102  {
103  _nCol[ n ] = nNode1;
104  _firstCol[ n ] = first;
105  first += nNode1;
106  }
107  for ( n = nbc1; n < nbc1 + nbc2; n++ )
108  {
109  _nCol[ n ] = nNode2;
110  _firstCol[ n ] = first;
111  first += nNode2;
112  }
113 }
114 
115 
117  UInt nNode2, UInt nbr2, UInt nbc2,
118  UInt nNode3, UInt nbr3, UInt nbc3 ) :
119  _mat ( nNode1 * nbr1 + nNode2 * nbr2 + nNode3* nbr3,
120  nNode1 * nbc1 + nNode2 * nbc2 + nNode3* nbc3 )
121 {
122  //
123  _nBlockRow = nbr1 + nbr2 + nbr3;
124  _nBlockCol = nbc1 + nbc2 + nbc3;
125  //
126  _nRow.resize ( _nBlockRow );
127  _firstRow.resize ( _nBlockRow );
128  _nCol.resize ( _nBlockCol );
129  _firstCol.resize ( _nBlockCol );
130  //
131  UInt first = 0, n;
132  for ( n = 0; n < nbr1; n++ )
133  {
134  _nRow[ n ] = nNode1;
135  _firstRow[ n ] = first;
136  first += nNode1;
137  }
138  for ( n = nbr1; n < nbr1 + nbr2; n++ )
139  {
140  _nRow[ n ] = nNode2;
141  _firstRow[ n ] = first;
142  first += nNode2;
143  }
144  for ( n = nbr1 + nbr2; n < nbr1 + nbr2 + nbr3; n++ )
145  {
146  _nRow[ n ] = nNode3;
147  _firstRow[ n ] = first;
148  first += nNode3;
149  }
150  //
151  first = 0;
152  for ( n = 0; n < nbc1; n++ )
153  {
154  _nCol[ n ] = nNode1;
155  _firstCol[ n ] = first;
156  first += nNode1;
157  }
158  for ( n = nbc1; n < nbc1 + nbc2; n++ )
159  {
160  _nCol[ n ] = nNode2;
161  _firstCol[ n ] = first;
162  first += nNode2;
163  }
164  for ( n = nbc1 + nbc2; n < nbc1 + nbc2 + nbc3; n++ )
165  {
166  _nCol[ n ] = nNode3;
167  _firstCol[ n ] = first;
168  first += nNode3;
169  }
170 }
171 
172 void MatrixElemental::showMe ( std::ostream& c )
173 {
174  UInt i, j;
175  for ( i = 0; i < _nBlockRow; i++ )
176  {
177  for ( j = 0; j < _nBlockCol; j++ )
178  {
179  c << "Block (" << i << "," << j << "), ";
180  c << block ( i, j ) << std::endl;
181  }
182  }
183 }
184 }
MatrixElemental(UInt nNode1, UInt nbr1, UInt nbc1, UInt nNode2, UInt nbr2, UInt nbc2, UInt nNode3, UInt nbr3, UInt nbc3)
void updateInverseJacobian(const UInt &iQuadPt)
void showMe(std::ostream &c=std::cout)
MatrixElemental(UInt nNode1, UInt nbr1, UInt nbc1, UInt nNode2, UInt nbr2, UInt nbc2)
This is the constructor for the local matrix involving 2 finite elements.
MatrixElemental(UInt nNode1, UInt nbr1, UInt nbc1)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191