|
dune-fem 2.12-git
|
Loading...
Searching...
No Matches
spmatrix.hh
Go to the documentation of this file.
59 values_(0), columns_(0), rows_(0), dim_({{0,0}}), maxNzPerRow_(0), compressed_( false ), threading_( threading )
64 SparseRowMatrix(const size_type rows, const size_type cols, const size_type nz, const bool threading = true ) :
65 values_(0), columns_(0), rows_(0), dim_({{0,0}}), maxNzPerRow_(0), compressed_( false ), threading_( threading )
376 void forwardIterative(const DiagType& diagInv, const ArgDFType& b, const DestDFType& xold, DestDFType& xnew, const WType& w ) const
383 void backwardIterative(const DiagType& diagInv, const ArgDFType& b, const DestDFType& xold, DestDFType& xnew, const WType& w ) const
390 std::pair< size_type, size_type > sliceBeginEnd(const size_type thread, const size_type numThreads, std::true_type ) const
399 std::pair< size_type, size_type > sliceBeginEnd(const size_type thread, const size_type numThreads, std::false_type ) const
401 std::pair< size_type, size_type > beginEnd = sliceBeginEnd( thread, numThreads, std::true_type() );
406 void parallelIterative(const DiagType& diagInv, const ArgDFType& b, const DestDFType& xold, DestDFType& xnew,
418 doParallelIterative( diagInv.dofVector().find( slice.first ), // still O(1) operation just like for begin()
528 DUNE_THROW( InvalidStateException, "Could not store entry in sparse matrix - no space available" );
600 typedef NonBlockMapper< DomainBlockMapperType, DomainSpaceType::localBlockSize > DomainMapperType;
612 typedef Dune::FieldMatrix< field_type, rangeLocalBlockSize, domainLocalBlockSize > MatrixBlockType;
677 LocalMatrixType localMatrix( const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity ) const
712 for( unsigned int i=0, r = row * domainLocalBlockSize, c = col * domainLocalBlockSize; i<domainLocalBlockSize; ++i, ++r, ++c )
732 for( unsigned int i=0, r = row * domainLocalBlockSize, c = col * domainLocalBlockSize; i<domainLocalBlockSize; ++i, ++r, ++c )
748 void addLocalMatrix ( const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, const LocalMatrix &localMat )
750 auto functor = [ &localMat, this ] ( std::pair< int, int > local, const std::pair< size_type, size_type >& global )
759 void addScaledLocalMatrix ( const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, const LocalMatrix &localMat, const Scalar &s )
761 auto functor = [ &localMat, &s, this ] ( std::pair< int, int > local, const std::pair< size_type, size_type >& global )
770 void setLocalMatrix ( const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, const LocalMatrix &localMat )
772 auto functor = [ &localMat, this ] ( std::pair< int, int > local, const std::pair< size_type, size_type >& global )
781 void getLocalMatrix ( const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, LocalMatrix &localMat ) const
783 auto functor = [ &localMat, this ] ( std::pair< int, int > local, const std::pair< size_type, size_type >& global )
813 if( (domainSpace_.begin() != domainSpace_.end()) && (rangeSpace_.begin() != rangeSpace_.end()) )
818 std::cout << "Reserve Matrix with (" << rangeSpace_.size() << "," << domainSpace_.size()<< ")" << std::endl;
824 const auto nonZeros = std::max( static_cast<size_type>(stencil.maxNonZerosEstimate()*DomainSpaceType::localBlockSize),
827 matrix_.fillPattern( stencil, RangeSpaceType::localBlockSize, DomainSpaceType::localBlockSize );
904 typedef SparseRowMatrixObject< DomainSpaceType, RangeSpaceType, Matrix > SparseRowMatrixObjectType;
906 typedef typename SparseRowMatrixObjectType::template LocalMatrix< MatrixObject > LocalMatrixType;
Col col
Y & rhs()
iterator end()
std::ptrdiff_t index() const
#define DUNE_THROW(E,...)
const GlobalIndex & global() const
LocalIndex & local()
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
PairFunctor< Mapper, Entity, Functor > makePairFunctor(const Mapper &mapper, const Entity &entity, Functor functor)
Definition operator/matrix/functor.hh:65
A::size_type size_type
typename Imp::BlockTraits< T >::field_type field_type
Definition misc/functor.hh:31
Exception thrown when a code segment that is supposed to be only accessed in single thread mode is ac...
Definition mpimanager.hh:43
static int numThreads()
return number of current threads
Definition mpimanager.hh:442
Default implementation for local matrix classes.
Definition localmatrix.hh:287
BaseType::RangeEntityType RangeEntityType
Definition localmatrix.hh:301
BaseType::DomainEntityType DomainEntityType
Definition localmatrix.hh:300
Definition localmatrixwrapper.hh:48
const GlobalStencilType & globalStencil() const
Return the full stencil.
Definition stencil.hh:116
int maxNonZerosEstimate() const
Return an upper bound for the maximum number of non-zero entries in all rows.
Definition stencil.hh:123
a simple wrapper class for sparsity patterns provide as vector< set< size_t > >
Definition stencil.hh:234
Definition columnobject.hh:12
void print(std::ostream &s=std::cout, unsigned int offset=0) const
print matrix
Definition spmatrix.hh:283
size_type colIndex(size_type row, size_type col)
returns local col index for given global (row,col)
Definition spmatrix.hh:511
std::pair< const field_type, size_type > realValue(size_type index) const
Definition spmatrix.hh:277
void fillCSRStorage(std::vector< std::map< SizeT, NumericT > > &matrix) const
Definition spmatrix.hh:300
size_type endRow(const size_type row) const
Definition spmatrix.hh:362
SparseRowMatrix(const bool threading=true)
construct matrix of zero size
Definition spmatrix.hh:58
void clearRow(const size_type row)
set all entries in row to zero
Definition spmatrix.hh:227
void add(const size_type row, const size_type col, const field_type val)
add value to row,col entry
Definition spmatrix.hh:134
std::tuple< ValuesVector &, IndicesVector &, IndicesVector & > exportCRS()
Definition spmatrix.hh:367
void apply(const ArgDFType &f, DestDFType &ret) const
ret = A*f
Definition spmatrix.hh:148
size_type numNonZeros(size_type row) const
Definition spmatrix.hh:269
void reserve(const size_type rows, const size_type cols, const size_type nz)
reserve memory for given rows, columns and number of non zeros
Definition spmatrix.hh:71
void clear()
set all matrix entries to zero
Definition spmatrix.hh:220
SparseRowMatrix< field_type, size_type, ValuesVector, IndicesVector > ThisType
Definition spmatrix.hh:46
void forwardIterative(const DiagType &diagInv, const ArgDFType &b, const DestDFType &xold, DestDFType &xnew, const WType &w) const
Apply Jacobi/SOR method.
Definition spmatrix.hh:376
field_type get(const size_type row, const size_type col) const
return value of entry (row,col)
Definition spmatrix.hh:205
void doParallelIterative(DiagIt diag, ArgDFIt bit, const DestDFType &xold, DestDFIt xit, const WType &w, size_type row, const size_type end, std::integral_constant< bool, forward >) const
Apply Jacobi/SOR method.
Definition spmatrix.hh:450
void set(const size_type row, const size_type col, const field_type val)
set entry to value (also setting 0 will result in an entry)
Definition spmatrix.hh:121
size_type startRow(const size_type row) const
Definition spmatrix.hh:357
void resize(size_type rows, size_type cols, size_type nz)
resize matrix
Definition spmatrix.hh:492
size_type rows() const
return number of rows
Definition spmatrix.hh:109
size_type cols() const
return number of columns
Definition spmatrix.hh:115
std::pair< size_type, size_type > sliceBeginEnd(const size_type thread, const size_type numThreads, std::false_type) const
Definition spmatrix.hh:399
void scale(const size_type row, const size_type col, const field_type val)
scale all entries in row with a given value
Definition spmatrix.hh:241
SparseRowMatrix(const ThisType &)=delete
std::pair< size_type, size_type > sliceBeginEnd(const size_type thread, const size_type numThreads, std::true_type) const
Definition spmatrix.hh:390
void backwardIterative(const DiagType &diagInv, const ArgDFType &b, const DestDFType &xold, DestDFType &xnew, const WType &w) const
Apply Jacobi/SOR method.
Definition spmatrix.hh:383
SparseRowMatrix(const size_type rows, const size_type cols, const size_type nz, const bool threading=true)
Definition spmatrix.hh:64
void fillPattern(const Stencil &stencil, const size_type rowBlockSize, const size_type colBlockSize)
reserve memory for given rows, columns and number of non zeros
Definition spmatrix.hh:80
void parallelIterative(const DiagType &diagInv, const ArgDFType &b, const DestDFType &xold, DestDFType &xnew, const WType &w, std::integral_constant< bool, forward > direction) const
Definition spmatrix.hh:406
NonBlockMapper< DomainBlockMapperType, DomainSpaceType::localBlockSize > DomainMapperType
Definition spmatrix.hh:600
RangeSpaceType::EntityType RangeEntityType
Definition spmatrix.hh:595
const DomainSpaceType & domainSpace() const
get domain space (i.e. space that builds the rows)
Definition spmatrix.hh:637
const DomainSpaceType & domainSpace_
Definition spmatrix.hh:885
DomainMapperType domainMapper_
Definition spmatrix.hh:887
LocalMatrixType localMatrix() const
Definition spmatrix.hh:687
DomainSpaceType::EntityType DomainEntityType
Definition spmatrix.hh:594
RangeSpaceType::BlockMapperType RangeBlockMapperType
Definition spmatrix.hh:601
MatrixType::size_type size_type
Definition spmatrix.hh:604
LocalMatrixStackType localMatrixStack_
Definition spmatrix.hh:891
MatrixType & exportMatrix() const
get reference to storage object
Definition spmatrix.hh:659
ThisType LocalMatrixFactoryType
Definition spmatrix.hh:618
LocalMatrixWrapper< LocalMatrixStackType > LocalMatrixType
Definition spmatrix.hh:620
void addScaledLocalMatrix(const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, const LocalMatrix &localMat, const Scalar &s)
Definition spmatrix.hh:759
SparseRowMatrixObject< DomainSpaceType, RangeSpaceType, MatrixType > ThisType
Definition spmatrix.hh:607
void setBlock(const size_type row, const size_type col, const LocalBlock &block)
Definition spmatrix.hh:728
RangeSpaceType::EntityType RowEntityType
Definition spmatrix.hh:597
static const size_type rangeLocalBlockSize
Definition spmatrix.hh:610
void reserve(const std::vector< Set > &sparsityPattern)
Definition spmatrix.hh:801
LocalMatrix< ThisType > ObjectType
Definition spmatrix.hh:617
ColumnObject< ThisType > LocalColumnObjectType
Definition spmatrix.hh:621
void apply(const DomainFunction &arg, RangeFunction &dest) const
apply matrix to discrete function
Definition spmatrix.hh:835
Fem::ObjectStack< LocalMatrixFactoryType > LocalMatrixStackType
Definition spmatrix.hh:619
SparseRowMatrixObject(const DomainSpaceType &domainSpace, const RangeSpaceType &rangeSpace, const SolverParameter ¶m=SolverParameter())
construct matrix object
Definition spmatrix.hh:624
static const size_type domainLocalBlockSize
Definition spmatrix.hh:609
LocalColumnObjectType localColumn(const DomainEntityType &domainEntity) const
get local column
Definition spmatrix.hh:693
void extractDiagonal(DiscreteFunctionType &diag) const
Definition spmatrix.hh:846
void setLocalMatrix(const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, const LocalMatrix &localMat)
Definition spmatrix.hh:770
MatrixType::field_type field_type
Definition spmatrix.hh:605
LocalMatrixType localMatrix(const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity) const
Definition spmatrix.hh:677
MatrixType PreconditionMatrixType
Definition spmatrix.hh:615
DomainSpace DomainSpaceType
Definition spmatrix.hh:592
DomainSpaceType::BlockMapperType DomainBlockMapperType
Definition spmatrix.hh:599
DomainSpaceType::EntityType ColumnEntityType
Definition spmatrix.hh:596
ObjectType * newObject() const
interface method from LocalMatrixFactory
Definition spmatrix.hh:667
NonBlockMapper< RangeBlockMapperType, RangeSpaceType::localBlockSize > RangeMapperType
Definition spmatrix.hh:602
Dune::FieldMatrix< field_type, rangeLocalBlockSize, domainLocalBlockSize > MatrixBlockType
Definition spmatrix.hh:612
void reserve(const Stencil &stencil, bool verbose=false)
reserve memory
Definition spmatrix.hh:808
void addLocalMatrix(const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, const LocalMatrix &localMat)
Definition spmatrix.hh:748
void compress()
compress matrix to a real CRS format
Definition spmatrix.hh:798
void resort()
resort row numbering in matrix to have ascending numbering
Definition spmatrix.hh:877
void getLocalMatrix(const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity, LocalMatrix &localMat) const
Definition spmatrix.hh:781
void unitRow(const size_type row)
Definition spmatrix.hh:698
void addBlock(const size_type row, const size_type col, const LocalBlock &block)
Definition spmatrix.hh:708
RangeMapperType rangeMapper_
Definition spmatrix.hh:888
void setUnitRows(const Container &unitRows, const Container &auxRows)
Definition spmatrix.hh:859
const RangeSpaceType & rangeSpace_
Definition spmatrix.hh:886
const RangeSpaceType & rangeSpace() const
get range space (i.e. space that builds the columns)
Definition spmatrix.hh:643
MatrixType & matrix() const
get reference to storage object, for internal use
Definition spmatrix.hh:650
void finalizeAssembly() const
Definition spmatrix.hh:655
SparseRowMatrixObject< DomainSpaceType, RangeSpaceType, Matrix > SparseRowMatrixObjectType
Definition spmatrix.hh:904
RangeFieldType LittleBlockType
Definition spmatrix.hh:909
RangeSpaceType::RangeFieldType RangeFieldType
Definition spmatrix.hh:908
DomainSpace DomainSpaceType
Definition spmatrix.hh:901
RangeSpace RangeSpaceType
Definition spmatrix.hh:902
SparseRowMatrixObjectType::template LocalMatrix< MatrixObject > LocalMatrixType
Definition spmatrix.hh:906
SparseRowMatrixObjectType::RangeMapperType RangeMapperType
Definition spmatrix.hh:912
SparseRowMatrixObjectType::DomainMapperType DomainMapperType
Definition spmatrix.hh:911
MatrixType & matrix_
Definition spmatrix.hh:1079
LocalMatrix(const LocalMatrix &)=delete
void clearRow(size_type localRow)
set matrix row to zero
Definition spmatrix.hh:1025
const DomainMapperType & domainMapper_
Definition spmatrix.hh:1080
void add(size_type localRow, size_type localCol, DofType value)
add value to matrix entry
Definition spmatrix.hh:993
void init(const DomainEntityType &domainEntity, const RangeEntityType &rangeEntity)
Definition spmatrix.hh:968
MatrixObjectType::MatrixType MatrixType
type of matrix
Definition spmatrix.hh:935
void clearCol(size_type localCol)
set matrix column to zero
Definition spmatrix.hh:1032
void resort()
resort all global rows of matrix to have ascending numbering
Definition spmatrix.hh:1047
size_type columns() const
return number of columns
Definition spmatrix.hh:987
ColumnIndicesType columnIndices_
Definition spmatrix.hh:1083
size_type rows() const
return number of rows
Definition spmatrix.hh:981
RowIndicesType rowIndices_
Definition spmatrix.hh:1082
std::vector< typename DomainMapperType::SizeType > ColumnIndicesType
Definition spmatrix.hh:952
Traits::RangeFieldType RangeFieldType
type of entries of little blocks
Definition spmatrix.hh:938
DofType get(size_type localRow, size_type localCol) const
get matrix entry
Definition spmatrix.hh:1002
MatrixObject MatrixObjectType
type of matrix object
Definition spmatrix.hh:925
std::vector< typename RangeMapperType::SizeType > RowIndicesType
Definition spmatrix.hh:951
Traits::DomainMapperType DomainMapperType
type of nonblocked domain mapper
Definition spmatrix.hh:947
Traits::RangeMapperType RangeMapperType
type of nonblocked domain mapper
Definition spmatrix.hh:949
LocalMatrixTraits< MatrixObjectType > Traits
type of the traits
Definition spmatrix.hh:928
LocalMatrix(const MatrixObjectType &matrixObject, const DomainSpaceType &domainSpace, const RangeSpaceType &rangeSpace, const DomainMapperType &domainMapper, const RangeMapperType &rangeMapper)
constructor
Definition spmatrix.hh:955
const RangeMapperType & rangeMapper_
Definition spmatrix.hh:1081
void scale(const DofType &value)
scale local matrix with a certain value
Definition spmatrix.hh:1056
RangeFieldType DofType
type of the DoFs
Definition spmatrix.hh:941
void scale(size_type localRow, size_type localCol, DofType value)
scale matrix entry with value
Definition spmatrix.hh:1071
void clear()
clear all entries belonging to local matrix
Definition spmatrix.hh:1039
Traits::LittleBlockType LittleBlockType
type of little blocks
Definition spmatrix.hh:944
void set(size_type localRow, size_type localCol, DofType value)
set matrix entry to value
Definition spmatrix.hh:1010
void unitRow(size_type localRow)
set matrix row to zero except diagonla entry
Definition spmatrix.hh:1018
Definition solver/parameter.hh:25
T abort(T... args)
T endl(T... args)
T fill(T... args)
T forward(T... args)
T make_pair(T... args)
T max(T... args)
T tie(T... args)
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8