00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef EPETRAEXT_BLOCKCRSMATRIX_H
00032 #define EPETRAEXT_BLOCKCRSMATRIX_H
00033
00034 #include <vector>
00035
00036 #include "Epetra_CrsMatrix.h"
00037
00039
00046 namespace EpetraExt {
00047
00048 class BlockCrsMatrix: public Epetra_CrsMatrix {
00049 public:
00050
00052
00053
00062 BlockCrsMatrix( const Epetra_CrsGraph & BaseGraph, const std::vector<int> & RowStencil, int RowIndex, const Epetra_Comm & GlobalComm );
00063
00065
00074 BlockCrsMatrix( const Epetra_CrsGraph & BaseGraph, const std::vector< std::vector<int> > & RowStencil, const std::vector<int> & RowIndices, const Epetra_Comm & GlobalComm );
00075
00076 BlockCrsMatrix( const Epetra_RowMatrix & BaseMatrix, const std::vector< std::vector<int> > & RowStencil, const std::vector<int> & RowIndices, const Epetra_Comm & GlobalComm );
00077
00079 BlockCrsMatrix( const BlockCrsMatrix & Matrix );
00080
00082 virtual ~BlockCrsMatrix();
00084
00086 const std::vector<int> & Stencil( int i = 0 ) { return RowStencil_[i]; }
00087
00089 int RowIndex( int i = 0 ) { return RowIndices_[i]; }
00090
00093 void LoadBlock(const Epetra_RowMatrix & BaseMatrix, const int Row, const int Col);
00094
00097 void BlockSumIntoGlobalValues(const int BaseRow, int NumIndices,
00098 double* Values, const int* Indices, const int Row, const int Col);
00099 void BlockReplaceGlobalValues(const int BaseRow, int NumIndices,
00100 double* Values, const int* Indices, const int Row, const int Col);
00101 void BlockExtractGlobalRowView(const int BaseRow, int& NumEntries,
00102 double*& Values, const int Row, const int Col);
00103
00104 void ExtractBlock(Epetra_CrsMatrix & BaseMatrix, const int Row, const int Col);
00105
00106 protected:
00107
00108 Epetra_CrsGraph BaseGraph_;
00109
00110 std::vector< std::vector<int> > RowStencil_;
00111
00112 std::vector<int> RowIndices_;
00113
00114 int Offset_;
00115
00116 };
00117
00118 }
00119
00120 #endif