LifeV
|
MatrixBlockMonolithicEpetra - class of block matrix. More...
#include <MatrixBlockMonolithicEpetra.hpp>
Public Types | |
typedef MatrixBlockMonolithicEpetraView< DataType > | block_type |
typedef std::shared_ptr< block_type > | block_ptrType |
Public Types inherited from MatrixEpetra< DataType > | |
typedef Epetra_FECrsMatrix | matrix_type |
typedef std::shared_ptr< matrix_type > | matrix_ptrtype |
typedef VectorEpetra | vector_type |
typedef std::shared_ptr< vector_type > | vectorPtr_Type |
Private Attributes | |
std::vector< UInt > | M_blockNumRows |
std::vector< UInt > | M_blockNumColumns |
std::vector< UInt > | M_blockFirstRows |
std::vector< UInt > | M_blockFirstColumns |
Constructors, destructor | |
MatrixBlockMonolithicEpetra (const MapEpetra &map, int numEntries=50) | |
default constructor. More... | |
MatrixBlockMonolithicEpetra (const MapVector< MapEpetra > &vector, int numEntries=50) | |
Block constructor. More... | |
MatrixBlockMonolithicEpetra (const MatrixEpetra< DataType > &matrix) | |
Casting constructor. More... | |
MatrixBlockMonolithicEpetra (const MatrixBlockMonolithicEpetra &matrix) | |
Copy constructor. More... | |
~MatrixBlockMonolithicEpetra () | |
Destructor. More... | |
Set Methods | |
void | setBlockStructure (const std::vector< UInt > &blockNumRows, const std::vector< UInt > &blockNumColumns) |
void | setBlockStructure (const MapVector< MapEpetra > &mapVector) |
Get Methods | |
UInt | blockNumRows (const UInt &rowIndex) const |
Returns the number of rows of the block. More... | |
UInt | blockNumColumns (const UInt &columnIndex) const |
Returns the number of columns of the block. More... | |
void | blockView (const UInt &rowIndex, const UInt &columnIndex, block_type &mbv) |
Returns the MatrixBlockMonolithicEpetraView at the (rowIndex,colIndex) location. More... | |
block_ptrType | block (const UInt &rowIndex, const UInt &columnIndex) |
Returns the block (rowIndex,columnIndex) of the matrix. More... | |
Additional Inherited Members | |
Public Member Functions inherited from MatrixEpetra< DataType > | |
MatrixEpetra (const MapEpetra &map, const Epetra_CrsGraph &graph, bool ignoreNonLocalValues=false) | |
Constructor from a graph. More... | |
MatrixEpetra (const MapEpetra &map, const Epetra_FECrsGraph &graph, bool ignoreNonLocalValues=false) | |
Constructor from a FE graph. More... | |
MatrixEpetra (const MapEpetra &map, Int numEntries=50, bool ignoreNonLocalValues=false) | |
Constructor for square and rectangular matrices. More... | |
MatrixEpetra (const MapEpetra &map, Int *numEntriesPerRow, bool ignoreNonLocalValues=false) | |
Constructor for square and rectangular matrices, knowing the number of entries per row. More... | |
MatrixEpetra (const MatrixEpetra &matrix) | |
Copy Constructor. More... | |
MatrixEpetra (const MatrixEpetra &matrix, const UInt reduceToProc) | |
Copies the matrix to a matrix which resides only on the processor. More... | |
LIFEV_DEPRECATED (MatrixEpetra(matrix_ptrtype crsMatrixPtr)) | |
Constructs an MatrixEpetra view of an Epetra_FECrsMatrix. More... | |
MatrixEpetra (const MapEpetra &map, matrix_ptrtype crsMatrixPtr) | |
Constructs an MatrixEpetra view of an Epetra_FECrsMatrix. More... | |
virtual | ~MatrixEpetra () |
Destructor. More... | |
MatrixEpetra & | operator+= (const MatrixEpetra &matrix) |
Addition operator. More... | |
MatrixEpetra & | operator-= (const MatrixEpetra &matrix) |
Subtraction operator. More... | |
MatrixEpetra & | operator= (const MatrixEpetra &matrix) |
Assignment operator. More... | |
vector_type | operator* (const vector_type &vector) const |
Matrix-Vector multiplication. More... | |
MatrixEpetra & | operator*= (const DataType scalar) |
Multiplication operator. More... | |
MatrixEpetra | operator* (const DataType scalar) const |
Multiplication operator. More... | |
void | openCrsMatrix () |
If the matrix has been filled, this function will reopen the Matrix. More... | |
void | removeZeros () |
This function removes all the zeros in the matrix and add zero on the diagonal. More... | |
void | swapCrsMatrix (matrix_ptrtype &matrixPtr) |
Swap the given shared pointer with the one of the matrix. More... | |
void | swapCrsMatrix (MatrixEpetra< DataType > &matrix) |
Swap the matrix with the one given as argument. More... | |
Int | multiply (bool transposeCurrent, const MatrixEpetra< DataType > &matrix, bool transposeMatrix, MatrixEpetra< DataType > &result, bool callFillCompleteOnResult=true) const |
Multiply the MatrixEpetra by the first given matrix and put the result in the second given matrix. More... | |
Int | multiply (bool transposeCurrent, const vector_type &vector1, vector_type &vector2) const |
Multiply the first VectorEpetra given as a parameter by the MatrixEpetra and put the result into the second given VectorEpetra. More... | |
void | addDyadicProduct (const vector_type &uniqueVector1, const vector_type &uniqueVector2) |
Add to the matrix a dyadic product:
, where
is the matrix. More... | |
void | add (const DataType scalar, const MatrixEpetra &matrix) |
Add a multiple of a given matrix: *this += scalar*matrix. More... | |
std::shared_ptr< MatrixEpetra< DataType > > | transpose () |
Returns a pointer to a new matrix which contains the transpose of the current matrix. More... | |
void | diagonalize (std::vector< UInt > rVec, DataType const coefficient, UInt offset=0) |
Set entries (rVec(i),rVec(i)) to coefficient and the rest of the row entries to zero. More... | |
void | diagonalize (UInt const entryIndex, DataType const coefficient, UInt offset=0) |
Set entry (entryIndex,entryIndex) to coefficient and the rest of the row to zero. More... | |
void | diagonalize (std::vector< UInt > rVec, DataType const coefficient, vector_type &rhs, std::vector< DataType > datumVector, UInt offset=0) |
apply constraint on all rows rVec More... | |
void | diagonalize (UInt const row, DataType const coefficient, vector_type &rhs, DataType datum, UInt offset=0) |
apply constraint on row "row" More... | |
void | matrixMarket (std::string const &fileName, const bool headers=true) |
Save the matrix into a MatrixMarket (.mtx) file. More... | |
void | spy (std::string const &fileName) |
Save the matrix into a Matlab (.m) file. More... | |
void | exportToHDF5 (std::string const &fileName, std::string const &matrixName="matrix", bool const &truncate=true) |
Save the matrix into a HDF5 (.h5) file. More... | |
void | importFromHDF5 (std::string const &fileName, std::string const &matrixName="matrix") |
Read a matrix from a HDF5 (.h5) file. More... | |
void | showMe (std::ostream &output=std::cout) const |
Print the contents of the matrix. More... | |
Int | globalAssemble () |
Global assemble of a square matrix with default domain and range map. More... | |
Int | globalAssemble (const std::shared_ptr< const MapEpetra > &domainMap, const std::shared_ptr< const MapEpetra > &rangeMap) |
Global assemble for rectangular matrices. More... | |
Int | fillComplete () |
Fill complete of a square matrix with default domain and range map. More... | |
void | insertValueDiagonal (const DataType entry, const MapEpetra &Map, const UInt offset=0) |
insert the given value into the diagonal More... | |
void | insertValueDiagonal (const DataType &value, Int from=-1, Int to=-2) |
insert the given value into the diagonal More... | |
void | insertOneDiagonal (Int from=-1, Int to=-2) |
insert ones into the diagonal to ensure the matrix' graph has a entry there More... | |
void | insertZeroDiagonal (Int from=-1, Int to=-2) |
insert zeros into the diagonal to ensure the matrix' graph has a entry there More... | |
Real | norm1 () const |
Compute the norm 1 of the global matrix. More... | |
Real | normInf () const |
Compute the norm inf of the global matrix. More... | |
Real | normFrobenius () const |
Compute the frobenius norm of the global matrix. More... | |
void | zero () |
set zero in all the matrix entries More... | |
void | setCoefficients (Int const numRows, Int const numColumns, std::vector< Int > const &rowIndices, std::vector< Int > const &columnIndices, DataType *const *const localValues, Int format=Epetra_FECrsMatrix::COLUMN_MAJOR) |
Set a set of values to the corresponding set of coefficient in the matrix. More... | |
void | setCoefficient (UInt row, UInt column, DataType localValue) |
Set a coefficient of the matrix. More... | |
void | addToCoefficients (Int const numRows, Int const numColumns, std::vector< Int > const &rowIndices, std::vector< Int > const &columnIndices, DataType *const *const localValues, Int format=Epetra_FECrsMatrix::COLUMN_MAJOR) |
Add a set of values to the corresponding set of coefficient in the matrix. More... | |
void | sumIntoCoefficients (Int const numRows, Int const numColumns, std::vector< Int > const &rowIndices, std::vector< Int > const &columnIndices, DataType *const *const localValues, Int format=Epetra_FECrsMatrix::COLUMN_MAJOR) |
Add a set of values to the corresponding set of coefficient in the closed matrix. More... | |
void | addToCoefficient (UInt const row, UInt const column, DataType const localValue) |
Add a value at a coefficient of the matrix. More... | |
void | setUseTranspose (const bool &transpose=false) |
If set true, transpose of this operator will be applied. More... | |
bool | filled () const |
Return the fill-complete status of the Epetra_FECrsMatrix. More... | |
matrix_ptrtype & | matrixPtr () |
Return the shared_pointer of the Epetra_FECrsMatrix. More... | |
std::shared_ptr< MapEpetra > | mapPtr () |
Return the shared_pointer of the Epetra_Map. More... | |
const matrix_ptrtype & | matrixPtr () const |
Return the const shared_pointer of the Epetra_FECrsMatrix. More... | |
Int | meanNumEntries () const |
Return the mean number of entries in the matrix rows. More... | |
Int | processorId () |
Return the Id of the processor. More... | |
const MapEpetra & | map () const |
Return the row MapEpetra of the MatrixEpetra used in the assembling. More... | |
const MapEpetra & | domainMap () const |
Return the domain MapEpetra of the MatrixEpetra. More... | |
const boost::shared_ptr< const MapEpetra > & | domainMapPtr () const |
const MapEpetra & | rangeMap () const |
Return the range MapEpetra of the MatrixEpetra. More... | |
const boost::shared_ptr< const MapEpetra > & | rangeMapPtr () const |
void | restrict (const std::shared_ptr< MapEpetra > &map, const std::shared_ptr< VectorEpetra > &numeration, const UInt &offset, std::shared_ptr< MatrixEpetra< DataType > > &matrix_out) |
Restrict the matrix to the dofs contained in the input map. More... | |
MatrixBlockMonolithicEpetra - class of block matrix.
The MatrixBlockMonolithicEpetra class contains data related to block matrix. It is an extension to MatrixEpetra where data about blocks have been set. For an introduction to the block structures in LifeV, see this page.
There are mainly two ways to define a MatrixBlockMonolithicEpetra:
Both ways are equivalent.
To access the blocks, one uses then the blockView or block methods.
Definition at line 70 of file MatrixBlockMonolithicEpetra.hpp.
typedef MatrixBlockMonolithicEpetraView<DataType> block_type |
Definition at line 74 of file MatrixBlockMonolithicEpetra.hpp.
typedef std::shared_ptr<block_type> block_ptrType |
Definition at line 75 of file MatrixBlockMonolithicEpetra.hpp.
MatrixBlockMonolithicEpetra | ( | const MapEpetra & | map, |
int | numEntries = 50 |
||
) |
default constructor.
Definition at line 178 of file MatrixBlockMonolithicEpetra.hpp.
MatrixBlockMonolithicEpetra | ( | const MapVector< MapEpetra > & | vector, |
int | numEntries = 50 |
||
) |
Block constructor.
This is the most complete constructor, as it builds the whole block structure of the matrix, using the maps stored in the vector.
Definition at line 190 of file MatrixBlockMonolithicEpetra.hpp.
MatrixBlockMonolithicEpetra | ( | const MatrixEpetra< DataType > & | matrix | ) |
Casting constructor.
Definition at line 224 of file MatrixBlockMonolithicEpetra.hpp.
MatrixBlockMonolithicEpetra | ( | const MatrixBlockMonolithicEpetra< DataType > & | matrix | ) |
Copy constructor.
Definition at line 233 of file MatrixBlockMonolithicEpetra.hpp.
Destructor.
Definition at line 242 of file MatrixBlockMonolithicEpetra.hpp.
void setBlockStructure | ( | const std::vector< UInt > & | blockNumRows, |
const std::vector< UInt > & | blockNumColumns | ||
) |
Set the size of the blocks of the matrix
blockNumRows | Number of rows in the blocks |
blockNumColumns | Number of columns in the blocks |
Definition at line 250 of file MatrixBlockMonolithicEpetra.hpp.
Set the size of the blocks of the matrix using the maps stored in the vector of map. The resulting block structure in symmetric (same blocks in the rows and in the columns).
This method does not involve large computations. The global size and the map of the matrix cannot be changed with this method (and the block structure has to be compatible with the global size).
Definition at line 280 of file MatrixBlockMonolithicEpetra.hpp.
Returns the number of rows of the block.
rowIndex | Row index of the block |
Definition at line 312 of file MatrixBlockMonolithicEpetra.hpp.
Returns the number of columns of the block.
columnIndex | Column index of the block |
Definition at line 321 of file MatrixBlockMonolithicEpetra.hpp.
void blockView | ( | const UInt & | rowIndex, |
const UInt & | columnIndex, | ||
block_type & | mbv | ||
) |
Returns the MatrixBlockMonolithicEpetraView at the (rowIndex,colIndex) location.
rowIndex | Row position of the block in the matrix |
columnIndex | Column position of the block in the matrix |
mbv | MatrixBlockMonolithicEpetraView to be filled |
Definition at line 330 of file MatrixBlockMonolithicEpetra.hpp.
MatrixBlockMonolithicEpetra< DataType >::block_ptrType block | ( | const UInt & | rowIndex, |
const UInt & | columnIndex | ||
) |
Returns the block (rowIndex,columnIndex) of the matrix.
Remark that the returned block is a shared pointer. This is a limitation due to the non-copiability of the blocks.
rowIndex | The index of the block w.r. to the block structure |
columnIndex | The index of the block w.r. to the block structure |
Definition at line 346 of file MatrixBlockMonolithicEpetra.hpp.
|
private |
Definition at line 164 of file MatrixBlockMonolithicEpetra.hpp.
|
private |
Definition at line 165 of file MatrixBlockMonolithicEpetra.hpp.
|
private |
Definition at line 166 of file MatrixBlockMonolithicEpetra.hpp.
|
private |
Definition at line 167 of file MatrixBlockMonolithicEpetra.hpp.