36 #ifndef _MATRIX_BLOCK_MONOLITHIC_EPETRA_VIEW_HPP_ 37 #define _MATRIX_BLOCK_MONOLITHIC_EPETRA_VIEW_HPP_ 39 #include <boost/shared_ptr.hpp> 43 #include <lifev/core/array/MatrixEpetra.hpp> 66 template<
typename DataType>
67 class MatrixBlockMonolithicEpetraView
78 typedef MatrixEpetra<DataType> matrix_Type;
87 MatrixBlockMonolithicEpetraView();
90 MatrixBlockMonolithicEpetraView (
const MatrixBlockMonolithicEpetraView<DataType>& mbv );
93 ~MatrixBlockMonolithicEpetraView();
101 void showMe (std::ostream& output = std::cout)
const;
107 void addToCoefficients (
UInt const numRows,
UInt const numColumns,
108 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
109 DataType*
const*
const localValues,
110 Int format = Epetra_FECrsMatrix::COLUMN_MAJOR )
const;
113 void sumIntoCoefficients (
UInt const numRows,
UInt const numColumns,
114 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
115 DataType*
const*
const localValues,
116 Int format = Epetra_FECrsMatrix::COLUMN_MAJOR )
const;
129 void setup (
const UInt& firstRow,
130 const UInt& firstColumn,
132 const UInt& numColumns,
154 return M_firstRowIndex;
160 return M_lastRowIndex;
166 return M_firstColumnIndex;
172 return M_lastColumnIndex;
176 matrix_Type* matrixPtr()
const 189 MatrixBlockMonolithicEpetraView<DataType> operator= (
const MatrixBlockMonolithicEpetraView& otherView);
200 matrix_Type* M_matrix;
207 template<
typename DataType>
208 MatrixBlockMonolithicEpetraView<DataType>::MatrixBlockMonolithicEpetraView() :
211 M_firstRowIndex ( 0 ),
212 M_lastRowIndex ( 0 ),
213 M_firstColumnIndex ( 0 ),
214 M_lastColumnIndex ( 0 ),
220 template<
typename DataType>
221 MatrixBlockMonolithicEpetraView<DataType>::MatrixBlockMonolithicEpetraView (
const MatrixBlockMonolithicEpetraView<DataType>& mbv ) :
222 M_numRows ( mbv.M_numRows ),
223 M_numColumns ( mbv.M_numColumns ),
224 M_firstRowIndex ( mbv.M_firstRowIndex ),
225 M_lastRowIndex ( mbv.M_lastRowIndex ),
226 M_firstColumnIndex ( mbv.M_firstColumnIndex ),
227 M_lastColumnIndex ( mbv.M_lastColumnIndex ),
228 M_matrix ( mbv.M_matrix )
233 template<
typename DataType>
234 MatrixBlockMonolithicEpetraView<DataType>::~MatrixBlockMonolithicEpetraView()
243 template<
typename DataType>
245 MatrixBlockMonolithicEpetraView<DataType>::showMe ( std::ostream& output )
const 247 output <<
"MatrixBlockMonolithicEpetraView informations:" << std::endl
248 <<
"Size = " << M_numRows <<
" x " << M_numColumns << std::endl
249 <<
"firstRow = " << M_firstRowIndex << std::endl
250 <<
"lastRow = " << M_lastRowIndex << std::endl
251 <<
"firstColumn = " << M_firstColumnIndex << std::endl
252 <<
"lastColumn = " << M_lastColumnIndex << std::endl;
256 template<
typename DataType>
258 MatrixBlockMonolithicEpetraView<DataType>::
261 return M_matrix->filled();
265 template<
typename DataType>
267 MatrixBlockMonolithicEpetraView<DataType>::
268 addToCoefficients (
UInt const numRows,
UInt const numColumns,
269 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
270 DataType*
const*
const localValues,
273 std::vector<Int> rowIndices (blockRowIndices);
274 std::vector<Int> columnIndices (blockColumnIndices);
276 for (
UInt i (0); i < numRows; ++i)
278 rowIndices[i] += M_firstRowIndex;
280 for (
UInt i (0); i < numColumns; ++i)
282 columnIndices[i] += M_firstColumnIndex;
285 M_matrix->addToCoefficients (numRows, numColumns,
286 rowIndices, columnIndices,
287 localValues, format);
291 template<
typename DataType>
293 MatrixBlockMonolithicEpetraView<DataType>::
294 sumIntoCoefficients (
UInt const numRows,
UInt const numColumns,
295 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
296 DataType*
const*
const localValues,
299 std::vector<Int> rowIndices (blockRowIndices);
300 std::vector<Int> columnIndices (blockColumnIndices);
302 for (
UInt i (0); i < numRows; ++i)
304 rowIndices[i] += M_firstRowIndex;
306 for (
UInt i (0); i < numColumns; ++i)
308 columnIndices[i] += M_firstColumnIndex;
311 M_matrix->sumIntoCoefficients (numRows, numColumns,
312 rowIndices, columnIndices,
313 localValues, format);
324 template<
typename DataType>
326 MatrixBlockMonolithicEpetraView<DataType>::setup (
const UInt& firstRow,
327 const UInt& firstColumn,
329 const UInt& numColumns,
333 M_numColumns = numColumns;
334 M_firstRowIndex = firstRow;
335 M_lastRowIndex = firstRow + numRows - 1;
336 M_firstColumnIndex = firstColumn;
337 M_lastColumnIndex = firstColumn + numColumns - 1;
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
uint32_type UInt
generic unsigned integer (used mainly for addressing)