36 #ifndef _MATRIXEPETRASTRUCTUREDVIEW_HPP_ 37 #define _MATRIXEPETRASTRUCTUREDVIEW_HPP_ 40 #include <lifev/core/LifeV.hpp> 42 #include <lifev/core/array/MatrixEpetra.hpp> 65 template<
typename DataType>
66 class MatrixEpetraStructuredView
77 typedef MatrixEpetra<DataType> matrix_Type;
86 MatrixEpetraStructuredView();
89 MatrixEpetraStructuredView (
const MatrixEpetraStructuredView<DataType>& matrixEpetraStructured );
92 ~MatrixEpetraStructuredView();
100 void showMe (std::ostream& output = std::cout)
const;
103 void addToCoefficients (
UInt const numRows,
UInt const numColumns,
104 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
105 DataType*
const*
const localValues,
106 Int format = Epetra_FECrsMatrix::COLUMN_MAJOR )
const;
108 void sumIntoCoefficients (
UInt const numRows,
UInt const numColumns,
109 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
110 DataType*
const*
const localValues,
111 Int format = Epetra_FECrsMatrix::COLUMN_MAJOR )
const;
123 void setup (
const UInt& firstRow,
124 const UInt& firstColumn,
126 const UInt& numColumns,
148 return M_firstRowIndex;
154 return M_lastRowIndex;
160 return M_firstColumnIndex;
166 return M_lastColumnIndex;
172 return M_matrix->matrixPtr()->Filled();
176 matrix_Type* matrixPtr()
const 189 MatrixEpetraStructuredView<DataType> operator= (
const MatrixEpetraStructuredView& otherView);
200 matrix_Type* M_matrix;
207 template<
typename DataType>
208 MatrixEpetraStructuredView<DataType>::MatrixEpetraStructuredView() :
211 M_firstRowIndex ( 0 ),
212 M_lastRowIndex ( 0 ),
213 M_firstColumnIndex ( 0 ),
214 M_lastColumnIndex ( 0 ),
220 template<
typename DataType>
221 MatrixEpetraStructuredView<DataType>::MatrixEpetraStructuredView (
const MatrixEpetraStructuredView<DataType>& matrixEpetraStructured ) :
222 M_numRows ( matrixEpetraStructured.M_numRows ),
223 M_numColumns ( matrixEpetraStructured.M_numColumns ),
224 M_firstRowIndex ( matrixEpetraStructured.M_firstRowIndex ),
225 M_lastRowIndex ( matrixEpetraStructured.M_lastRowIndex ),
226 M_firstColumnIndex ( matrixEpetraStructured.M_firstColumnIndex ),
227 M_lastColumnIndex ( matrixEpetraStructured.M_lastColumnIndex ),
228 M_matrix ( matrixEpetraStructured.M_matrix )
233 template<
typename DataType>
234 MatrixEpetraStructuredView<DataType>::~MatrixEpetraStructuredView()
243 template<
typename DataType>
245 MatrixEpetraStructuredView<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;
255 template<
typename DataType>
257 MatrixEpetraStructuredView<DataType>::
258 addToCoefficients (
UInt const numRows,
UInt const numColumns,
259 std::vector<Int>
const& blockRowIndices, std::vector<Int>
const& blockColumnIndices,
260 DataType*
const*
const localValues,
263 std::vector<Int> rowIndices (blockRowIndices);
264 std::vector<Int> columnIndices (blockColumnIndices);
266 for (
UInt i (0); i < numRows; ++i)
268 rowIndices[i] += M_firstRowIndex;
270 for (
UInt i (0); i < numColumns; ++i)
272 columnIndices[i] += M_firstColumnIndex;
275 M_matrix->addToCoefficients (numRows, numColumns,
276 rowIndices, columnIndices,
277 localValues, format);
280 template<
typename DataType>
282 MatrixEpetraStructuredView<DataType>::
283 sumIntoCoefficients (
UInt const numRows,
UInt const numColumns,
284 std::vector<Int>
const& blockRowIndices,
285 std::vector<Int>
const& blockColumnIndices,
286 DataType*
const*
const localValues,
289 std::vector<Int> rowIndices (blockRowIndices);
290 std::vector<Int> columnIndices (blockColumnIndices);
292 for (
UInt i (0); i < numRows; ++i)
294 rowIndices[i] += M_firstRowIndex;
296 for (
UInt i (0); i < numColumns; ++i)
298 columnIndices[i] += M_firstColumnIndex;
301 M_matrix->sumIntoCoefficients (numRows, numColumns,
302 rowIndices, columnIndices,
303 localValues, format);
310 template<
typename DataType>
312 MatrixEpetraStructuredView<DataType>::setup (
const UInt& firstRow,
313 const UInt& firstColumn,
315 const UInt& numColumns,
319 M_numColumns = numColumns;
320 M_firstRowIndex = firstRow;
321 M_lastRowIndex = firstRow + numRows - 1;
322 M_firstColumnIndex = firstColumn;
323 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)