Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-istl
Commits
0b06cd77
Commit
0b06cd77
authored
17 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
more documentation on random mode
[[Imported from SVN: r765]]
parent
d0468951
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
istl/bcrsmatrix.hh
+84
-25
84 additions, 25 deletions
istl/bcrsmatrix.hh
with
84 additions
and
25 deletions
istl/bcrsmatrix.hh
+
84
−
25
View file @
0b06cd77
...
...
@@ -26,42 +26,92 @@
namespace
Dune
{
/**
*
@defgroup ISTL_SPMV Sparse Matrix and Vector classes
*
@ingroup ISTL
@defgroup ISTL_SPMV Sparse Matrix and Vector classes
@ingroup ISTL
*/
/**
@addtogroup ISTL_SPMV
@{
@addtogroup ISTL_SPMV
@{
*/
/** \brief A sparse block matrix with compressed row storage
/**
\brief A sparse block matrix with compressed row storage
Implements a block compressed row storage scheme. The block
type B can be any type implementing the matrix interface.
type B can be any type implementing the matrix interface.
Different ways to build up a compressed row
storage matrix are supported:
Different ways to build up a compressed row
storage matrix are supported:
1. Row-wise scheme
1. Row-wise scheme
2. Random scheme
Rows are built up in sequential order. Size of the row and
the column indices are defined. A row can be used as soon as it
is initialized. With respect to memory there are two variants of
this scheme: (a) number of non-zeroes known in advance (application
finite difference schemes), (b) number of non-zeroes not known
in advance (application: Sparse LU, ILU(n)).
Error checking: no error checking is provided normally.
Setting the compile time switch DUNE_ISTL_WITH_CHECKING
enables error checking.
2. Random scheme
Details:
For general finite element implementations the number of rows n
is known, the number of non-zeroes might also be known (e.g.
\#edges + \#nodes for P1) but the size of a row and the indices of a row
can not be defined in sequential order.
1. Row-wise scheme
Rows are built up in sequential order. Size of the row and
the column indices are defined. A row can be used as soon as it
is initialized. With respect to memory there are two variants of
this scheme: (a) number of non-zeroes known in advance (application
finite difference schemes), (b) number of non-zeroes not known
in advance (application: Sparse LU, ILU(n)).
Error checking: no error checking is provided normally.
Setting the compile time switch DUNE_ISTL_WITH_CHECKING
enables error checking.
2. Random scheme
For general finite element implementations the number of rows n
is known, the number of non-zeroes might also be known (e.g.
\#edges + \#nodes for P1) but the size of a row and the indices of a row
can not be defined in sequential order.
\code
#include<dune/common/fmatrix.hh>
#include<dune/istl/bcrsmatrix.hh>
...
typedef FieldMatrix<double,2,2> M;
BCRSMatrix<M> B(4,4,BCRSMatrix<M>::random);
// initially set row size for each row
B.setrowsize(0,1);
B.setrowsize(3,4);
B.setrowsize(2,1);
B.setrowsize(1,1);
// increase row size for row 2
B.incrementrowsize(2)
// finalize row setup phase
B.endrowsizes();
// add column entries to rows
B.addindex(0,0);
B.addindex(3,1);
B.addindex(2,2);
B.addindex(1,1);
B.addindex(2,0);
B.addindex(3,2);
B.addindex(3,0);
B.addindex(3,3);
// finalize column setup phase
B.endindices();
// set entries using the random access operator
B[0][0] = 1;
B[1][1] = 2;
B[2][0] = 3;
B[2][2] = 4;
B[3][1] = 5;
B[3][2] = 6;
B[3][0] = 7;
B[3][3] = 8;
\endcode
*/
#ifdef DUNE_EXPRESSIONTEMPLATES
template
<
class
B
,
class
A
>
...
...
@@ -348,7 +398,6 @@ namespace Dune {
BCRSMatrix
(
size_type
_n
,
size_type
_m
,
BuildMode
bm
)
:
build_mode
(
bm
),
ready
(
notbuilt
)
{
allocate
(
_n
,
_m
);
}
...
...
@@ -650,7 +699,17 @@ namespace Dune {
ready
=
rowSizesBuilt
;
}
//! add index (row,col) to the matrix
//! \brief add index (row,col) to the matrix
/*!
This method can only be used when building the BCRSMatrix
in random mode.
addindex adds a new column entry to the row. If this column
entry already exists, nothing is done.
Don't call addindex after the setup phase is finished
(after endindices is called).
*/
void
addindex
(
size_type
row
,
size_type
col
)
{
if
(
build_mode
!=
random
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment