LifeV
MatrixElemental.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 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 #ifndef _ELEMMAT_H_INCLUDED
37 #define _ELEMMAT_H_INCLUDED
38 
39 #include <lifev/core/LifeV.hpp>
40 #include <lifev/core/array/RNM.hpp>
41 
42 namespace LifeV
43 {
45 {
46 
47 public:
48  typedef KNM<Real> matrix_type;
49  typedef KNM_<Real> matrix_view;
50  //typedef Tab2d matrix_type;
51 
52  ~MatrixElemental();
53  MatrixElemental ( UInt nNode1, UInt nbr1, UInt nbc1 ); // constructor for 1 finite element
54 
55  //! This is the constructor for the local matrix involving 2 finite elements
56  /*!
57  There are 6 arguments for this constructor. The arguements nbNode1 and nbNode2
58  are simply the number of basis function for each finite element.
59 
60  The 4 others are used to describe the number of blocks on want in the matrix.
61 
62  Warning: all the blocks do not have the same size!
63 
64  Indeed, nbr1 describes the number of blocks that have a "height" of nbNode1,
65  nbr2 the number of blocks that have a "height" of nbNode2, and the same with
66  the columns for nbc1 and nbc2 (Think about it as a "local Stokes matrix": nbr1
67  and nbc1 are 3 (components for the velocity), nbr2 and nbc2 are 1 (pressure
68  is scalar)).
69  */
70  MatrixElemental ( UInt nNode1, UInt nbr1, UInt nbc1,
71  UInt nNode2, UInt nbr2, UInt nbc2 );
72  MatrixElemental ( UInt nNode1, UInt nbr1, UInt nbc1,
73  UInt nNode2, UInt nbr2, UInt nbc2,
74  UInt nNode3, UInt nbr3, UInt nbc3 ); // constructor for 3 finite elements
76  {
77  return _mat;
78  }
79  UInt nBlockRow() const
80  {
81  return _nBlockRow;
82  }
83  UInt nBlockCol() const
84  {
85  return _nBlockCol;
86  }
87 
88  //Tab2dView block( UInt i, UInt j )
90  {
91  return _mat ( SubArray ( _nRow[ i ], _firstRow[ i ] ),
92  SubArray ( _nCol[ j ], _firstCol[ j ] ) );
93  //Tab2dView __mr (_mat, TabRange(_firstRow[i], _nRow[i]), TabRange(_firstCol[j], _nCol[j]));
94  //return __mr;
95  }
96  void zero()
97  {
98  //_mat = ZeroMatrix( _mat.size1(), _mat.size2() );
99  _mat = 0.0;
100  };
101  void showMe ( std::ostream& c = std::cout );
102 
103  void operator *= (Real coef)
104  {
105  this->_mat *= coef;
106  }
107 private:
108 
110 
111  UInt _nBlockRow; // number of block rows
112  UInt _nBlockCol; // number of block columns
113  std::vector<UInt> _nRow; // _nRow[i]=nb of rows in the i-th block row
114  std::vector<UInt> _firstRow; //_firstRow[i]=index of first row of i-th block row
115  std::vector<UInt> _nCol; // _nCol[i]=nb of col in the i-th block col
116  std::vector<UInt> _firstCol; //_firstCol[i]=index of first col of i-th block col
117 };
118 }
119 #endif
MatrixElemental(UInt nNode1, UInt nbr1, UInt nbc1, UInt nNode2, UInt nbr2, UInt nbc2, UInt nNode3, UInt nbr3, UInt nbc3)
std::vector< UInt > _firstCol
std::vector< UInt > _nRow
void operator*=(Real coef)
std::vector< UInt > _firstRow
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.
matrix_view block(UInt i, UInt j)
double Real
Generic real data.
Definition: LifeV.hpp:175
MatrixElemental(UInt nNode1, UInt nbr1, UInt nbc1)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
std::vector< UInt > _nCol