G+Smo
24.08.0
Geometry + Simulation Modules
|
A sparse linear system indexed by sets of degrees of freedom.
Public Member Functions | |
matBlockView | blockView () |
returns a block view of the matrix, easy way to extract single blocks | |
matBlockView | blockView (size_t numRowBlocksNew, size_t numColBlocksNew, const gsVector< index_t > &rowBlocksNew, const gsVector< index_t > &colBlocksNew) |
returns a block view of the matrix, where you can choose which blocks (of gsSparseSystem) should be combined to one block More... | |
rhsBlockView | blockViewRhs (size_t numRowBlocksNew, const gsVector< index_t > &rowBlocksNew) |
returns a block view of the rhs, where you can choose which blocks (of gsSparseSystem) should be combined to one block More... | |
index_t | colBasis (const index_t c) const |
colBasis returns the index of the Basis used for column block c More... | |
const gsDofMapper & | colMapper (const index_t c) const |
colMapper returns the dofMapper for column block c More... | |
gsDofMapper & | colMapper (const index_t c) |
colMapper returns the dofMapper for column block c More... | |
index_t | cols () const |
the number of matrix columns | |
const DofMappers & | dofMappers () const |
returns all dof Mappers. More... | |
gsSparseSystem (gsDofMapper &mapper) | |
gsSparseSystem Constuctor for the sparse System only considering one block (scalar equation), described by the one DofMapper mapper. More... | |
gsSparseSystem (DofMappers &mappers, const gsVector< index_t > &dims) | |
gsSparseSystem Constructor of a sparse System specified by the number of unknows for each block, given by dims. It is assumed that the used Basis (m_bases in gsAssembler) has a one to one relation with the given mappers. E.g.: dims = {1,3,1,2}, then we consider a matrix with 1+3+1+2 = 7 x 7 blockstructure. Then a) mappers.size() == 7: In the first case, row and column mappers are identical, so there is no difference bettween column and row blocks. More... | |
gsSparseSystem (DofMappers &mappers, const index_t rows, const index_t cols) | |
gsSparseSystem Constructor for the sparse system, with given number of row and column blocks. It is assumed that the mappers have a one to one correspondence with the blocks, i.e. a) mappers.size() == rows + cols ==> the first row entries of mappers correspond to the row blocks and the last cols entries of mappers correspond to the column blocks Moreover, it is assumes that the basis for the solution space (column blocks) are indexed starting by 0. i.e. mappers[cols],...,mappers[rows+cols-1] correspond in a one to one relation to m_bases[0],...,m_bases[cols-1] in gsAssembler!!!! b) mappers.size() == rows == cols ==> row and column mappers are identical, and mappers[i] is the mapper for i-th column (and row) block c) mappers.size() == 1 ==> only one block More... | |
gsSparseSystem (DofMappers &mappers, const gsVector< index_t > &rowInd, const gsVector< index_t > &colInd, const gsVector< index_t > &colvar) | |
gsSparseSystem The constructor for the sparse system given the set of mappers, may be different for each column and row block, the assignment of mappers to row blocks and column block, and the relation which Multibases correspond to which unknown. This constructor allows for the most possible freedome to design your block system. More... | |
bool | initialized () const |
checks if the system was initialized | |
void | mapColIndices (const gsMatrix< index_t > &actives, const index_t patchIndex, gsMatrix< index_t > &result, const index_t c=0) const |
mapColIndices Maps a set of basis indices by the corresponding dofMapper. More... | |
void | mapRowIndices (const gsMatrix< index_t > &actives, const index_t patchIndex, gsMatrix< index_t > &result, const index_t r=0) const |
mapRowIndices Maps a set of basis indices by the corresponding dofMapper. More... | |
void | mapToGlobalColIndex (const index_t active, const index_t patchIndex, index_t &result, const index_t c=0) const |
mapToGlobalColIndex Maps a single basis index to the final position in the system, i.e. including the right shift due to the block structure More... | |
void | mapToGlobalRowIndex (const index_t active, const index_t patchIndex, index_t &result, const index_t r=0) const |
mapToGlobalRowIndex Maps a single basis index to the final position in the system, i.e. including the right shift due to the block structure More... | |
const gsSparseMatrix< T > & | matrix () const |
Access the system Matrix. | |
gsSparseMatrix< T > & | matrix () |
Access the system Matrix. | |
index_t | numColBlocks () const |
returns the number of column blocks | |
index_t | numColNz (const gsMultiBasis< T > &mb, const gsOptionList &opt) const |
Provides an estimation of the number of non-zero matrix entries per column. This value can be used for sparse matrix memory allocation. | |
index_t | numRowBlocks () const |
returns the number of row blocks | |
index_t | numUnknowns () const |
returns the number of unknowns | |
void | push (const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives, const gsMatrix< T > &eliminatedDofs, const size_t r=0, const size_t c=0) |
push pushes the local system matrix and rhs for an element to the global system, More... | |
void | push (const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives_i, const gsMatrix< index_t > &actives_j, const gsMatrix< T > &eliminatedDofs_j, const size_t r=0, const size_t c=0) |
push pushes the local system matrix and rhs for an element to the global system, More... | |
void | push (const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const std::vector< gsMatrix< index_t > > &actives_vec, const std::vector< gsMatrix< T > > &eliminatedDofs, const gsVector< index_t > &r_vec, const gsVector< index_t > &c_vec) |
pushToMatrix pushes one local matrix and rhs consisting of several blocks corresponding to blocks of the global system More... | |
void | push (const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const std::vector< gsMatrix< index_t > > &actives, const std::vector< gsMatrix< T > > &eliminatedDofs) |
push pushes one local system matrix and one local rhs for an element to the global system for several blocks More... | |
void | push (const std::vector< gsMatrix< T > > &, const std::vector< gsMatrix< T > > &, const std::vector< gsMatrix< index_t > > &, const std::vector< gsMatrix< T > > &, const gsVector< index_t > &, const gsVector< index_t > &) |
push pushes several local system matrices and local rhs for an element to the global system for several blocks More... | |
GISMO_DEPRECATED void | push (const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives, const size_t r=0, const size_t c=0) |
push pushes the local system matrix and rhs for an element to the global system, More... | |
void | pushAllFree (const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives, const size_t r=0, const size_t c=0) |
pushAllFree pushes the local system matrix and rhs for an element to the global system, More... | |
void | pushToMatrix (const gsMatrix< T > &localMat, const gsMatrix< index_t > &actives, const gsMatrix< T > &eliminatedDofs, const size_t r=0, const size_t c=0) |
pushToMatrix pushes the local matrix for an element to the global system, More... | |
void | pushToMatrix (const gsMatrix< T > &localMat, const gsMatrix< index_t > &actives_i, const gsMatrix< index_t > &actives_j, const gsMatrix< T > &eliminatedDofs_j, const size_t r=0, const size_t c=0) |
pushToMatrix pushes the local matrix for an element to the global system, More... | |
void | pushToMatrix (const gsMatrix< T > &localMat, const std::vector< gsMatrix< index_t > > &actives_vec, const std::vector< gsMatrix< T > > &eliminatedDofs, const gsVector< index_t > &r_vec, const gsVector< index_t > &c_vec) |
pushToMatrix pushes one local matrix consisting of several blocks corresponding to blocks of the global system More... | |
GISMO_DEPRECATED void | pushToMatrix (const gsMatrix< T > &localMat, const gsMatrix< index_t > &actives, const size_t r=0, const size_t c=0) |
pushToMatrix pushes the local matrix for an element to the global system, More... | |
GISMO_DEPRECATED void | pushToMatrix (const gsMatrix< T > &localMat, const gsMatrix< index_t > &actives_i, const gsMatrix< index_t > &actives_j, const size_t r=0, const size_t c=0) |
pushToMatrix pushes the local matrix for an element to the global system, More... | |
void | pushToMatrixAllFree (const gsMatrix< T > &localMat, const gsMatrix< index_t > &actives, const size_t r=0, const size_t c=0) |
pushToMatrixAllFree pushes the local matrix for an element to the global system, More... | |
void | pushToMatrixAllFree (const gsMatrix< T > &localMat, const gsMatrix< index_t > &actives_i, const gsMatrix< index_t > &actives_j, const size_t r=0, const size_t c=0) |
pushToMatrixAllFree pushes the local matrix for an element to the global system, More... | |
void | pushToRhs (const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives, const size_t r=0) |
pushToRhs pushes the local rhs for an element to the global system More... | |
void | pushToRhs (const gsMatrix< T > &localRhs, const std::vector< gsMatrix< index_t > > &actives_vec, const gsVector< index_t > &r_vec) |
pushToRhs pushes one local rhs consisting of several blocks corresponding to blocks of the global system More... | |
void | pushToRhsAllFree (const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives, const size_t r=0) |
pushToRhsAllFree pushes the local rhs for an element to the global system More... | |
void | reserve (const index_t nz, const index_t numRhs) |
reserve reserves the memory for the sparse matrix and the rhs. More... | |
void | reserve (const gsMultiBasis< T > &mb, const gsOptionList &opt, const index_t numRhs) |
Reserves the memory for the sparse matrix and the rhs, based on the polynomial degree of the first basis-piece in /em mb, as well as the input options bdA, bdB and bdO. More... | |
const gsMatrix< T > & | rhs () const |
Access the right hand side. | |
gsMatrix< T > & | rhs () |
Access the right hand side. | |
index_t | rhsCols () const |
the number of right-hand side vectors | |
index_t | rhsRows () const |
the rows of the right-hand side vector | |
const gsDofMapper & | rowMapper (const index_t r) const |
rowMapper returns the dofMapper for row block r More... | |
gsDofMapper & | rowMapper (const index_t r) |
rowMapper returns the dofMapper for row block r More... | |
index_t | rows () const |
the number of matrix rows | |
void | setZero () |
set everything to zero | |
void | swap (gsSparseSystem &other) |
swap swaps the content of the Sparse System with the other given one More... | |
bool | symmetry () const |
returns true if only half of the matrix is stored, due to its symmetry | |
index_t | unkSize (const index_t unk) const |
return the number of components for the given component | |
Protected Attributes | |
gsVector< index_t > | m_col |
map between column blocks and index of m_mappers i.e. col block j is described by m_mappers[m_col[j]]. | |
gsVector< index_t > | m_cstr |
strides for the column blocks (shifting of mapped indices). The mapper do not have this information anymore. | |
gsVector< index_t > | m_cvar |
map between column blocks and used multibasis (which unknown/component correlate to which multibasis), i.e. column block i uses multibasis m_cvar[i]. So this allows e.g. a single multibasis for several components. | |
DofMappers | m_mappers |
the mappers for the different blocks. The assignment of the mappers to the column (and row) blocks is done via the members m_row and m_col. This also allows for different mappers for columns and rows. There are no assumptions on the ordering of m_mappers. The relation of column mappers and the used multibasis is done via m_cvar. | |
gsSparseMatrix< T > | m_matrix |
the system matrix | |
gsMatrix< T > | m_rhs |
the right hand side of the system | |
gsVector< index_t > | m_row |
map between row blocks and index of m_mappers, i.e. row block i is described by m_mappers[m_row[i]]. | |
gsVector< index_t > | m_rstr |
strides for the row blocks (shifting of mapped indices). The mapper do not have this information anymore. | |
|
inline |
gsSparseSystem Constuctor for the sparse System only considering one block (scalar equation), described by the one DofMapper mapper.
[in] | mapper | the one DofMapper discribing the discretization. |
|
inline |
gsSparseSystem Constructor of a sparse System specified by the number of unknows for each block, given by dims. It is assumed that the used Basis (m_bases in gsAssembler) has a one to one relation with the given mappers. E.g.: dims = {1,3,1,2}, then we consider a matrix with 1+3+1+2 = 7 x 7 blockstructure. Then a) mappers.size() == 7: In the first case, row and column mappers are identical, so there is no difference bettween column and row blocks.
mappers | a vector of gsDofMapper with size == dims.sum() or 2*dims.sum() according to the definition above |
dims | Defines how many unknown are determined by a certain dofMapper. |
|
inline |
gsSparseSystem Constructor for the sparse system, with given number of row and column blocks. It is assumed that the mappers have a one to one correspondence with the blocks, i.e. a) mappers.size() == rows + cols ==> the first row entries of mappers correspond to the row blocks and the last cols entries of mappers correspond to the column blocks Moreover, it is assumes that the basis for the solution space (column blocks) are indexed starting by 0. i.e. mappers[cols],...,mappers[rows+cols-1] correspond in a one to one relation to m_bases[0],...,m_bases[cols-1] in gsAssembler!!!! b) mappers.size() == rows == cols ==> row and column mappers are identical, and mappers[i] is the mapper for i-th column (and row) block c) mappers.size() == 1 ==> only one block
mappers | the set of mappers, with restrictions above |
rows | the number of row blocks |
cols | the number of column blocks |
|
inline |
gsSparseSystem The constructor for the sparse system given the set of mappers, may be different for each column and row block, the assignment of mappers to row blocks and column block, and the relation which Multibases correspond to which unknown. This constructor allows for the most possible freedome to design your block system.
What is not possible here, cannot be done!
a fancy example: rowInd = {1,1,0,3}, colInd={0,2,2}, colvar={1,0,0}. this leads to a 4x3 block structure matrix
[in] | mappers | the set of mappers, need not be a one to one relation with the blocks. |
[in] | rowInd | assignment of row blocks to mappers, e.g. row block i uses mapper rowInd[i] of the set mappers. |
[in] | colInd | assignment of column blocks to mappers, e.g. column block j uses mapper colInd[j] of the set mappers. (need not be the same mappers as for the row blocks) |
[in] | colvar | assignment of unknowns to the used bases (i.e. column blocks to MultiBasis) |
|
inline |
returns a block view of the matrix, where you can choose which blocks (of gsSparseSystem) should be combined to one block
[in] | numRowBlocksNew | number of row blocks |
[in] | numColBlocksNew | number of column blocks |
[in] | rowBlocksNew | a vector defining the row blocks |
[in] | colBlocksNew | a vector defining the column blocks |
example: assume in gsSparseSystem we have 4 row blocks
rowBlocksNew = {0,1,1,2} yields a block system with only 3 row blocks, where the blocks 1 and 2 of gsSparseSystem are combined to one block
|
inline |
returns a block view of the rhs, where you can choose which blocks (of gsSparseSystem) should be combined to one block
[in] | numRowBlocksNew | number of row blocks |
[in] | rowBlocksNew | a vector defining the row blocks |
colBasis returns the index of the Basis used for column block c
[in] | c | the index of the column block |
|
inline |
colMapper returns the dofMapper for column block c
[in] | c | the index of the column block |
|
inline |
colMapper returns the dofMapper for column block c
[in] | c | the index of the column block |
|
inline |
returns all dof Mappers.
|
inline |
mapColIndices Maps a set of basis indices by the corresponding dofMapper.
[in] | actives | the set of basis indices |
[in] | patchIndex | the patch under consideration |
[out] | result | the mapped indices |
[in] | c | the considered column block |
|
inline |
mapRowIndices Maps a set of basis indices by the corresponding dofMapper.
[in] | actives | the set of basis indices |
[in] | patchIndex | the patch under consideration |
[out] | result | the mapped indices |
[in] | r | the considered row block |
|
inline |
mapToGlobalColIndex Maps a single basis index to the final position in the system, i.e. including the right shift due to the block structure
[in] | active | the basis index |
[in] | patchIndex | the patch index |
[out] | result | the mapped index |
[in] | c | the considered column block |
|
inline |
mapToGlobalRowIndex Maps a single basis index to the final position in the system, i.e. including the right shift due to the block structure
[in] | active | the basis index |
[in] | patchIndex | the patch index |
[out] | result | the mapped index |
[in] | r | the considered row block |
|
inline |
push pushes the local system matrix and rhs for an element to the global system,
[in] | localMat | the local system matrix |
[in] | localRhs | the local rhs matrix/vector |
[in] | actives | the mapped index of basis functions, without shifts! |
[in] | eliminatedDofs | the values for the dofs, which are removed from the system |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
push pushes the local system matrix and rhs for an element to the global system,
[in] | localMat | the local system matrix |
[in] | localRhs | the local rhs matrix/vector |
[in] | actives_i | the mapped index of row basis functions, without shifts! |
[in] | actives_j | the mapped index of column basis functions, without shifts! |
[in] | eliminatedDofs_j | the values for the dofs (corresponding to the columns), which are removed from the system |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrix pushes one local matrix and rhs consisting of several blocks corresponding to blocks of the global system
[in] | localMat | local system matrix |
[in] | localRhs | local rhs vector |
[in] | actives_vec | a vector of mapped index sets (for ALL blocks of the global system), accessed via actives_vec[r_vec(i)] |
[in] | eliminatedDofs | a vector of values for the dofs (corresponding to the columns) that are eliminated from the system (for ALL blocks of the global system), accessed via eliminatedDofs[r_vec(i)] |
[in] | r_vec | a vector of row block indices to which the local matrix is pushed |
[in] | c_vec | a vector of column block indices to which the local matrix is pushed |
|
inline |
push pushes one local system matrix and one local rhs for an element to the global system for several blocks
[in] | localMat | local system matrices |
[in] | localRhs | local rhs vector/matrices |
[in] | actives | a vector of index sets (one per block) |
[in] | eliminatedDofs | a vector of values for the dofs (corresponding to the columns), which are removed from the system, (one per block) |
|
inline |
push pushes several local system matrices and local rhs for an element to the global system for several blocks
Parameters
[in]localMat a vector local system matrices
[in]localRhs a vector local rhs vector/matrices
[in]actives a vector of index sets (one per block)
[in]fixedDofs
[in]r the row blocks where the matrices should be pushed
[in]c the colum blocks where the matrices shouldbe pushed
|
inline |
push pushes the local system matrix and rhs for an element to the global system,
[in] | localMat | the local system matrix |
[in] | localRhs | the local rhs matrix/vector |
[in] | actives | the mapped index of basis functions, without shifts! |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushAllFree pushes the local system matrix and rhs for an element to the global system,
Use this functions if you already know that your block has no eliminated dofs
[in] | localMat | the local system matrix |
[in] | localRhs | the local rhs matrix/vector |
[in] | actives | the mapped index of basis functions, without shifts! |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrix pushes the local matrix for an element to the global system,
[in] | localMat | the local matrix |
[in] | actives | the mapped index of basis functions, without shifts! |
[in] | eliminatedDofs | the values for the dofs, which are removed from the system |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrix pushes the local matrix for an element to the global system,
[in] | localMat | the local matrix |
[in] | actives_i | the mapped index of row - basis functions, without shifts! |
[in] | actives_j | the mapped index of column - basis functions, without shifts! |
[in] | eliminatedDofs_j | the values for the dofs (corresponding to the columns), which are removed from the system remark: if no column dofs are eliminated (only row dofs are eliminated), you can just give an empty matrix, because it will not be used |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrix pushes one local matrix consisting of several blocks corresponding to blocks of the global system
[in] | localMat | local system matrix |
[in] | actives_vec | a vector of mapped index sets (for ALL blocks of the global system), accessed via actives_vec[r_vec(i)] |
[in] | eliminatedDofs | a vector of values for the dofs (corresponding to the columns) that are eliminated from the system (for ALL blocks of the global system), accessed via eliminatedDofs[r_vec(i)] |
[in] | r_vec | a vector of row block indices to which the local matrix is pushed |
[in] | c_vec | a vector of column block indices to which the local matrix is pushed |
|
inline |
pushToMatrix pushes the local matrix for an element to the global system,
[in] | localMat | the local matrix |
[in] | actives | the mapped index of basis functions, without shifts! |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrix pushes the local matrix for an element to the global system,
[in] | localMat | the local matrix |
[in] | actives_i | the mapped index of row - basis functions, without shifts! |
[in] | actives_j | the mapped index of column - basis functions, without shifts! |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrixAllFree pushes the local matrix for an element to the global system,
[in] | localMat | the local matrix |
[in] | actives | the mapped index of basis functions, without shifts! |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToMatrixAllFree pushes the local matrix for an element to the global system,
[in] | localMat | the local matrix |
[in] | actives_i | the mapped index of row - basis functions, without shifts! |
[in] | actives_j | the mapped index of column - basis functions, without shifts! |
[in] | r | the row block |
[in] | c | the column block |
|
inline |
pushToRhs pushes the local rhs for an element to the global system
[in] | localRhs | the local right hand side matrix/vector |
[in] | actives | the corresponding mapped index of basis functions without shifts |
[in] | r | the row block associated to |
|
inline |
pushToRhs pushes one local rhs consisting of several blocks corresponding to blocks of the global system
[in] | localRhs | local system matrix |
[in] | actives_vec | a vector of mapped index sets (for ALL row blocks of the global system), accessed via actives_vec[r_vec(i)] |
[in] | r_vec | a vector of row block indices to which the local matrix is pushed |
|
inline |
pushToRhsAllFree pushes the local rhs for an element to the global system
[in] | localRhs | the local right hand side matrix/vector |
[in] | actives | the corresponding mapped index of basis functions without shifts |
[in] | r | the row block associated to |
reserve reserves the memory for the sparse matrix and the rhs.
[in] | nz | Non-zeros per column for the sparse matrix |
[in] | numRhs | number of columns |
|
inline |
Reserves the memory for the sparse matrix and the rhs, based on the polynomial degree of the first basis-piece in /em mb, as well as the input options bdA, bdB and bdO.
At each column approximately bdA * deg + dbB non-zero entries are expected. An extra amount of memory of bdO percent is allocated, in order to speedup the process.
mb | ||
opt | ||
[in] | numRhs | number of columns |
|
inline |
rowMapper returns the dofMapper for row block r
[in] | r | the index of the row block |
|
inline |
rowMapper returns the dofMapper for row block r
[in] | r | the index of the row block |
|
inline |
swap swaps the content of the Sparse System with the other given one
[in] | other | the other sparse system |