MoReFEM
|
Class which encapsulates both the Petsc matrix and the numbering subsets used to described its rows and columns. More...
#include <GlobalMatrix.hpp>
Public Types | |
using | unique_ptr = std::unique_ptr<GlobalMatrix> |
Alias to unique pointer. | |
using | vector_unique_ptr = std::vector<unique_ptr> |
Alias to vector of unique pointers. | |
template<std::size_t I> | |
using | array_unique_ptr = std::array<unique_ptr, I> |
Alias to an array of unique pointers. | |
using | petsc_parent = Wrappers::Petsc::Matrix |
Alias to parent. | |
using | numbering_subset_parent = Crtp::NumberingSubsetForMatrix<GlobalMatrix> |
Alias to other parent. | |
using | self = Matrix |
Alias to self. | |
using | parent = Advanced::Wrappers::Petsc::AbstractMatrix |
Alias to parent. | |
using | call_petsc_destroy = Advanced::Wrappers::Petsc::call_petsc_destroy |
Convenient alias. | |
Public Member Functions | |
void | InitMinimalCase (const Mpi &mpi, MatType petsc_matrix_type, const std::source_location location=std::source_location::current()) |
A method which provides a very bare initialization: only the type of the matrix is set. | |
void | InitSequentialMatrix (std::size_t Nrow, std::size_t Ncolumn, const MatrixPattern &matrix_pattern, const Mpi &mpi, const std::source_location location=std::source_location::current()) |
Create a sequential sparse matrix. | |
void | InitParallelMatrix (std::size_t Nlocal_row, std::size_t Nlocal_column, std::size_t Nglobal_row, std::size_t Nglobal_column, const MatrixPattern &matrix_pattern, const Mpi &mpi, const std::source_location location=std::source_location::current()) |
Create a parallel sparse matrix. | |
void | InitSequentialDenseMatrix (std::size_t Nrow, std::size_t Ncolumn, const Mpi &mpi, const std::source_location location=std::source_location::current()) |
Create a sequential dense matrix. | |
void | InitParallelDenseMatrix (std::size_t Nlocal_row, std::size_t Nlocal_column, std::size_t Nglobal_row, std::size_t Nglobal_column, const Mpi &mpi, const std::source_location location=std::source_location::current()) |
Create a parallel dense matrix. | |
void | DuplicateLayout (const Matrix &original, MatDuplicateOption option, const std::source_location location=std::source_location::current()) |
Duplicate the layout of the matrix. | |
void | Copy (const Matrix &source, const MatStructure &structure=SAME_NONZERO_PATTERN, const std::source_location location=std::source_location::current()) |
A wrapper over MatCopy, which assumed target already gets the right layout. | |
void | CompleteCopy (const Matrix &source, const std::source_location location=std::source_location::current()) |
A complete copy: layout is copied first and then the values. | |
void | Assembly (const std::source_location location=std::source_location::current()) |
Petsc Assembling of the matrix. | |
bool | IsAssembled (const std::source_location location=std::source_location::current()) const |
Indicates if a matrix has been assembled and is ready for use; for example, in matrix-vector product. | |
void | SetValues (const std::vector< PetscInt > &row_indexing, const std::vector< PetscInt > &column_indexing, const PetscScalar *values, InsertMode insertOrAppend, const std::source_location location=std::source_location::current(), ignore_zero_entries do_ignore_zero_entries=ignore_zero_entries::no) |
Add or modify values inside a Petsc matrix. | |
void | SetValuesRow (PetscInt row_index, const PetscScalar *values, const std::source_location location=std::source_location::current()) |
Set the values of a row. | |
void | SetValue (PetscInt row_index, PetscInt column_index, PetscScalar value, InsertMode insertOrAppend, const std::source_location location=std::source_location::current()) |
Set a single entry into a Petsc matrix. | |
void | LoadBinary (const Mpi &mpi, const FilesystemNS::File &input_file, const std::source_location location=std::source_location::current()) |
Wrapper over MatLoad in the case the viewer is a file. | |
void | SetFromPetscMat (Mat petsc_matrix, const std::source_location location=std::source_location::current()) |
Init a Matrix from a Petsc Mat object. | |
const std::string & | GetName () const noexcept |
Get the name given to the vector at construction. | |
Mat | Internal (std::source_location location) |
Handle over the internal Mat object. | |
Mat | InternalForReadOnly (std::source_location location) const |
Handle over the internal Mat object - when you can guarantee the call is only to read the value, not act upon it. | |
std::pair< PetscInt, PetscInt > | GetProcessorWiseSize (const std::source_location location=std::source_location::current()) const |
Get the number of elements in the local matrix. | |
std::pair< PetscInt, PetscInt > | GetProgramWiseSize (const std::source_location location=std::source_location::current()) const |
Get the number of elements in the global matrix (first is number of rows, second number of columns). | |
void | ZeroEntries (const std::source_location location=std::source_location::current()) |
Set all the entries to zero. | |
void | ZeroRows (const std::vector< PetscInt > &row_indexes, PetscScalar diagonal_value, const std::source_location location=std::source_location::current()) |
Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix. | |
void | ZeroRowsColumns (const std::vector< PetscInt > &row_indexes, PetscScalar diagonal_value, const std::source_location location=std::source_location::current()) |
Zeros all entries (except possibly the main diagonal) of a set of rows and columns of a matrix. | |
void | Scale (PetscScalar a, const std::source_location location=std::source_location::current()) |
Wrapper over MatScale, that performs Y = a * Y. | |
double | Norm (NormType type, const std::source_location location=std::source_location::current()) const |
Wrapper over MatNorm. | |
void | GetInfo (MatInfo *infos, const std::source_location location=std::source_location::current()) |
Wrapper over MatGetInfo() | |
void | GetOption (MatOption op, PetscBool *flg, const std::source_location location=std::source_location::current()) |
Wrapper over MatGetOption() | |
void | SetOption (MatOption op, PetscBool flg, const std::source_location location=std::source_location::current()) |
Wrapper over MatSetOption() | |
MatType | GetType (const std::source_location location=std::source_location::current()) const |
Return the type of the matrix. | |
PetscScalar | GetValue (PetscInt row_index, PetscInt column_index, const std::source_location location=std::source_location::current()) const |
Get the value of an element of the matrix. | |
void | GetRow (PetscInt row_index, std::vector< PetscInt > &row_content_position_list, std::vector< PetscScalar > &row_content_value_list, const std::source_location location=std::source_location::current()) const |
Get a row for the matrix. | |
void | GetRow (PetscInt row_index, std::vector< std::pair< PetscInt, PetscScalar > > &row_content, const std::source_location location=std::source_location::current()) const |
Get a row for the matrix. | |
void | GetColumnVector (PetscInt column_index, ::MoReFEM::Wrappers::Petsc::Vector &column, const std::source_location location=std::source_location::current()) const |
Get the column of the matrix. | |
void | View (const ::MoReFEM::Wrappers::Mpi &mpi, const std::source_location location=std::source_location::current()) const |
Wrapper over MatView. | |
void | View (const ::MoReFEM::Wrappers::Mpi &mpi, const FilesystemNS::File &output_file, const std::source_location location=std::source_location::current(), PetscViewerFormat format=PETSC_VIEWER_DEFAULT, PetscFileMode file_mode=FILE_MODE_WRITE) const |
Wrapper over MatView in the case the viewer is a file. | |
void | ViewBinary (const ::MoReFEM::Wrappers::Mpi &mpi, const FilesystemNS::File &output_file, const std::source_location location=std::source_location::current()) const |
Wrapper over MatView in the case the viewer is a binary file. | |
const NumberingSubset & | GetRowNumberingSubset () const |
Numbering subset used to describe rows. | |
const NumberingSubset & | GetColNumberingSubset () const |
Numbering subset used to describe columns. | |
Special members. | |
GlobalMatrix (const NumberingSubset &row_numbering_subset, const NumberingSubset &col_numbering_subset, std::optional< std::string > name=std::nullopt) | |
Constructor. | |
~GlobalMatrix () override | |
Destructor. | |
GlobalMatrix (const GlobalMatrix &rhs, std::optional< std::string > name=std::nullopt) | |
The copy constructor. | |
GlobalMatrix (GlobalMatrix &&rhs)=delete | |
The move constructor. | |
GlobalMatrix & | operator= (const GlobalMatrix &rhs)=delete |
The (copy) operator=. | |
GlobalMatrix & | operator= (GlobalMatrix &&rhs)=delete |
The (move) operator=. | |
Static Public Attributes | |
static constexpr bool | ConceptIsGlobalLinearAlgebra = true |
Keyword to indicate that this class qualify for the Concept::GlobalLinearAlgebra. | |
static constexpr bool | ConceptIsPetscMatrix = true |
Keyword to indicate that this class qualify for the Concept::PetscStrictlyMatrix. | |
Protected Member Functions | |
Mat & | InternalNoCheck () |
Handle over the internal Mat object, with no check whether it is initialized or not. | |
const Mat & | InternalNoCheckForReadOnly () const |
Same as InternalNoCheck with const qualifier. | |
void | ChangeInternal (const ::MoReFEM::Wrappers::Mpi &mpi, Mat new_petsc_matrix) |
Change the underlying Mat object pointed by the class. | |
void | SetDoNotDestroyPetscMatrix () |
Tells the class not to destroy the underlying vector through a call to MatDestroy(). | |
call_petsc_destroy | DoCallPetscDestroy () const noexcept |
Get the value of do_call_petsc_destroy_. | |
void | SetDoCallPetscDestroy (call_petsc_destroy value) |
Set the value of do_call_petsc_destroy_. | |
Special members. | |
virtual void | Unused () const |
Private Member Functions | |
GlobalMatrix (const Wrappers::Mpi &mpi, const NumberingSubset &row_numbering_subset, const NumberingSubset &col_numbering_subset, Internal::WrapPetscMat wrap_petsc_matrix) | |
Constructor to provide a thin-wrapper over a Mat object. | |
void | InitMatrixHelper (const Mpi &mpi, MatType petsc_matrix_type, std::size_t Nlocal_row, std::size_t Nlocal_column, std::size_t Nglobal_row, std::size_t Nglobal_column, const std::source_location location=std::source_location::current()) |
Helper to init a matrix. | |
Private Attributes | |
Mat | petsc_matrix_ |
Underlying Petsc matrix. | |
call_petsc_destroy | do_call_petsc_destroy_ { call_petsc_destroy::yes } |
Whether the underlying Petsc matrix will be destroyed upon destruction of the object. | |
std::string | name_ |
Advanced::Wrappers::Petsc::print_linalg_destruction | do_print_linalg_destruction_ |
Whether there is a print on standard output to inform of the deletion of the Matrix. | |
const NumberingSubset & | row_numbering_subset_ |
Numbering subset used to describe rows. | |
const NumberingSubset & | col_numbering_subset_ |
Numbering subset used to describe columns. | |
Friends | |
template<class VariationalFormulationT > | |
struct | Internal::SolverNS::SnesInterface |
Friendship (to enable ChangeInternal usage). | |
Class which encapsulates both the Petsc matrix and the numbering subsets used to described its rows and columns.
|
explicit |
Constructor.
[in] | row_numbering_subset | NumberingSubset to use to define the numbering of rows. |
[in] | col_numbering_subset | NumberingSubset to use to define the numbering of columns. |
[in] | name | A name that may optionally be given to the matrix. |
This name may be used to provide hints in error messages - especially when the error occurs in PetscFinalize() call where all the information we get is given by PETSc error message and is frankly not that useful: knowing a MatDestroy() call fails doesn't tell for which matrix it happens. If name is not provided, a default name featuring the numbering subset number is used.
MoReFEM::GlobalMatrix::GlobalMatrix | ( | const GlobalMatrix & | rhs, |
std::optional< std::string > | name = std::nullopt ) |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
[in] | name | A name that may optionally be given to the matrix. |
This name may be used to provide hints in error messages - especially when the error occurs in PetscFinalize() call where all the information we get is given by PETSc error message and is frankly not that useful: knowing a MatDestroy() call fails doesn't tell for which matrix it happens. If name is not provided, a default name featuring the numbering subset numbers is used.
|
delete |
The move constructor.
[in] | rhs | The object from which the construction occurs. |
|
explicitprivate |
Constructor to provide a thin-wrapper over a Mat object.
This constructor is not meant to be used widely - hence its private status - : it is used only when defining a Snes interface for a non-linear solver in PETSc. In this case, PETSc provides a Mat object to compute quantities such as residual or evaluation_state; we want to be able to manipulate them with high-level PETSc wrapper defined in MoReFEM. PETSc owns these linear algebra quantities, so we do not call MatDestroy at destruction.
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | row_numbering_subset | NumberingSubset to use to define the numbering of rows. |
[in] | col_numbering_subset | NumberingSubset to use to define the numbering of columns. |
[in] | wrap_petsc_matrix | A very thin wrapper object over a Mat . The sole purpose of the class used here is to make apparent at call site that it is really a very special constructor that is used. |
|
delete |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
delete |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
inherited |
A method which provides a very bare initialization: only the type of the matrix is set.
Most of the time, you should use another method such as InitSequentialMatrix() or InitParallelDenseMatrix(); however when you just want to load a matrix from a file you may not know the informations related to sizes. In this case, this method will provide the minimum set up required to properly init your matrix. Beware though: if you're reloading a matrix in parallel (typically with petsc_matrix_type = MATMPIAIJ) you get no guarantee whatsoever of the repartition that will be done among the ranks. To control this, you should use instead another of the InitXXX() methods for which you are able to set the dimensions yourself (you may have a look at TestPetscMatrixIO where both versions are checked).
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | petsc_matrix_type | The PETSc identifier for the requested matrix (see https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatType.html#MatType) |
|
inherited |
Create a sequential sparse matrix.
[in] | Nrow | Number of rows. |
[in] | Ncolumn | Number of columns. |
[in] | matrix_pattern | Pattern of the matrix (number of elements expected on each row_). |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
The matrix hence created will keep the non-zero structure: even if a value becomes 0 it will go on being held as a non-zero emplacement.
|
inherited |
Create a parallel sparse matrix.
[in] | Nlocal_row | Number of rows on the local processor. |
[in] | Nlocal_column | Number of columns on the local processor. |
[in] | Nglobal_row | Number of rows on the global processor. |
[in] | Nglobal_column | Number of columns on the global processor. |
[in] | matrix_pattern | Pattern of the matrix (number of elements expected on each row_). |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Create a sequential dense matrix.
[in] | Nrow | Number of rows. |
[in] | Ncolumn | Number of columns. |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Create a parallel dense matrix.
[in] | Nlocal_row | Number of rows on the local processor. |
[in] | Nlocal_column | Number of columns on the local processor. |
[in] | Nglobal_row | Number of rows on the global processor. |
[in] | Nglobal_column | Number of columns on the global processor. |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Duplicate the layout of the matrix.
[in] | original | Original matrix, which layout is to be duplicated. |
[in] | option | Fine tune the behaviour of the duplication. Three values are possible:
|
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
To make the third option work, the original matrix must have been assembled (i.e. where are the non-zero values must already be determined accurately, not just how many of them there are on each line - which is the information we get when a matrix is created). So technically it means you can't just duplicate the layout of a matrix you've just initialized but in which you haven't put any value yet.
|
inherited |
A wrapper over MatCopy, which assumed target already gets the right layout.
[in] | source | Original matrix which content is copied. It is assumed the object that called the method already gets the same layout as source. |
[in] | structure | SAME_NONZERO_PATTERN or DIFFERENT_NONZERO_PATTERN. SAME_NONZERO_PATTERN should apply for almost all cases in MoReFEM; however if you're using raw Petsc library you'll see there are more prerequisite to this choice (the pattern must be fully built). Within the frame of this wrapper there shouldn't be any problem provided one of the InitXXX() method has been called. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
A complete copy: layout is copied first and then the values.
[in] | source | Original matrix which layout AND content is copied. Beware: this method requires that source has already been deeply initialized (SetValues() and Assembly() should already have been called). See DuplicateLayout() for a lenghtier explanation. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Petsc Assembling of the matrix.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Indicates if a matrix has been assembled and is ready for use; for example, in matrix-vector product.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Add or modify values inside a Petsc matrix.
[in] | row_indexing | Program-wise index of the rows which values will be set. |
[in] | column_indexing | Program-wise index of the columns which values will be set. |
[in] | values | Values to put in the matrix. This array should be the same size as row_indexing x column_indexing: it is a block of values that is actually introduced! |
[in] | insertOrAppend | Petsc ADD_VALUES or INSERT_VALUES (see Petsc documentation). |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | do_ignore_zero_entries | If yes, you might specify a block which encompass locations that are not within the pattern. For instance in our case above, you may specify row_indexing = { 1, 2 } and col_indexing = { 3, 5 } even if pattern says there are no value at (1, 5). In this case, the associated value in values MUST be 0.; any other value will rightfully trigger a Petsc error. |
|
inherited |
Set the values of a row.
[in] | row_index | Program-wise index of the row which values will be set. |
[in] | values | Non-zero values to report in the matrix. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Set a single entry into a Petsc matrix.
As noted in Petsc manual pages, if several values the SetValues() method should be preferred; however see SetValues() documentation that specify the cases in which it can be applied.
[in] | row_index | Program-wise index of the row which value will be set. |
[in] | column_index | Program-wise index of the column which value will be set. |
[in] | value | Value to put in the matrix. |
[in] | insertOrAppend | Petsc ADD_VALUES or INSERT_VALUES (see Petsc documentation). |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Wrapper over MatLoad in the case the viewer is a file.
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | input_file | File from which matrix is to be loaded ON THE ROOT PROCESSOR. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
privateinherited |
Helper to init a matrix.
[in] | Nlocal_row | Number of rows on the local processor. |
[in] | Nlocal_column | Number of columns on the local processor. |
[in] | Nglobal_row | Number of rows on the global processor. |
[in] | Nglobal_column | Number of columns on the global processor. |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | petsc_matrix_type | The PETSc identifier for the requested matrix (see https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatType.html#MatType) |
|
protectedvirtualinherited |
Unused method that should never been called to satisfy the condition of at least one out of line virtual method definition.
|
inherited |
Init a Matrix from a Petsc Mat object.
Ideally it shouldn't be used at all except in the implementation of few of the associated function such as MatMatMult.
[in] | petsc_matrix | Native Petsc matrix which should be put inside current object. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
noexceptinherited |
Get the name given to the vector at construction.
This is intended as a developer tool for debug, especially when something goes awry with PetscFinalize().
It should be noticed that inherited class GlobalVector may provide a default name if none was given; no default name however is foreseen in current base class.
|
inherited |
Handle over the internal Mat object.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
Ideally it shouldn't be used at all except in the implementation of the Petsc Wrapper: a wrapper method should be implemented over the function that might need access to the Mat internal object.
|
inherited |
Handle over the internal Mat object - when you can guarantee the call is only to read the value, not act upon it.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
Ideally it shouldn't be used at all except in the implementation of the Petsc Wrapper: a wrapper method should be implemented over the function that might need access to the Mat internal object.
|
protectedinherited |
Handle over the internal Mat object, with no check whether it is initialized or not.
|
protectedinherited |
Same as InternalNoCheck
with const
qualifier.
|
inherited |
Get the number of elements in the local matrix.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Get the number of elements in the global matrix (first is number of rows, second number of columns).
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Set all the entries to zero.
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix.
[in] | row_indexes | Indexes of the row considered (C - numbering). |
[in] | diagonal_value | Value for the diagonal term. Put 0. if you want it zeroed too. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Zeros all entries (except possibly the main diagonal) of a set of rows and columns of a matrix.
[in] | row_indexes | Indexes of the row considered (C - numbering). All values on this row (except the diagonal value) AND all values on the columns will be zeroed. |
[in] | diagonal_value | Value for the diagonal term. Put 0. if you want it zeroed too. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Wrapper over MatScale, that performs Y = a * Y.
[in] | a | Factor by which the vector is scaled. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Wrapper over MatNorm.
[in] | type | Type of norm. Available norms are NORM_1, NORM_FROBENIUS and NORM_INFINITY. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Wrapper over MatGetInfo()
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | infos | Matrix information context (see Petsc documentation for more details). |
|
inherited |
Wrapper over MatGetOption()
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | op | The Petsc MatOption which status is sought. |
[out] | flg | True if the option is set, false otherwise. |
|
inherited |
Wrapper over MatSetOption()
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | op | The Petsc MatOption which status is to be modified. |
[in] | flg | Whether the option is activated or not. |
|
inherited |
Return the type of the matrix.
Thin wrapper over https://petsc.org/release/docs/manualpages/Mat/MatGetType
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Get the value of an element of the matrix.
The underlying Petsc function requires that the row belong to the current processor; however for the column it is much more liberal: if there is an attempt to get a value that doesn't belong to the CSR pattern, the function simply returns 0.
[in] | row_index | Program-wise index of the row. The row MUST be one of the row handled by the current processor. |
[in] | column_index | Program-wise index of the column. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Get a row for the matrix.
This is a wrapper over MatGetRow; it should be noticed that Petsc people hope this function is actually not used...
[in] | row_index | Program-wise index of the row. The row MUST be one of the row handled by the current processor. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[out] | row_content_position_list | Position of the non-zero values in the row. |
[out] | row_content_value_list | Values of non-zero values in the row. This container is the same size as row_content_position |
|
inherited |
Get a row for the matrix.
This is a wrapper over MatGetRow; it should be noticed that Petsc people hope this function is actually not used...
[in] | row_index | Program-wise index of the row. The row MUST be one of the row handled by the current processor. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[out] | row_content | Key is position of the non-zero values, value the actual value. |
|
inherited |
Get the column of the matrix.
This is a wrapper over MatGetColumnVector; it should be noticed that Petsc people hope this function is actually not used...
[in] | column_index | Program-wise index of the column. |
[out] | column | Vector containing the column. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Wrapper over MatView.
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
|
inherited |
Wrapper over MatView in the case the viewer is a file.
MatView write the content of the matrix only on the root processor; if you need it on several you need to copy the file afterwards (for instance in the case of prepartitioned data).
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
[in] | format | Format in which the matrix is written. See Petsc manual pages to get all the formats available; relevant ones so far are PETSC_VIEWER_DEFAULT and PETSC_VIEWER_ASCII_MATLAB. |
[in] | output_file | File into which the vector content will be written. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | file_mode | Same modes as in Petsc documentation , i.e.:
|
|
inherited |
Wrapper over MatView in the case the viewer is a binary file.
[in] | output_file | File into which the vector content will be written. This file will be written only on the root processor; for other ranks nothing is written at all. |
[in] | location | STL object with relevant information about the calling site (usually to help when an exception is thrown. |
[in] | mpi | Mpi object which knows the rank of the processor, the total number of processors, etc... |
|
protectedinherited |
Change the underlying Mat object pointed by the class.
[in] | mpi | Mpi object. It is provided so that Barrier() may be called: we do not want the ranks oto be inconsistent... |
[in] | new_petsc_matrix | The Mat object that should now be used internally (for thecurrent mpi rank). |
|
protectedinherited |
Tells the class not to destroy the underlying vector through a call to MatDestroy().
|
protectedinherited |
Set the value of do_call_petsc_destroy_.
You should rather use SetDoNotDestroyPetscMatrix(); this one is just helpful to define recopy in derived classes.
[in] | value | The value to set. |
|
inlinestaticconstexpr |
Keyword to indicate that this class qualify for the Concept::GlobalLinearAlgebra.
|
inlinestaticconstexprinherited |
Keyword to indicate that this class qualify for the Concept::PetscStrictlyMatrix.
|
privateinherited |
Whether the underlying Petsc matrix will be destroyed upon destruction of the object.
Default behaviour is to do so, but in some cases it is wiser not to.
|
privateinherited |
This name may be used to provide hints in error messages - especially when the error occurs in PetscFinalize() call where all the information we get is given by PETSc error message and is frankly not that useful: knowing a MatDestroy() call fails doesn't tell for which matrix it happens.
|
privateinherited |
Whether there is a print on standard output to inform of the deletion of the Matrix.