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
b8be25b5
Commit
b8be25b5
authored
19 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
a block-diagonal matrix -- not fully complete yet
[[Imported from SVN: r285]]
parent
f1de0f23
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
istl/bdmatrix.hh
+86
-0
86 additions, 0 deletions
istl/bdmatrix.hh
with
86 additions
and
0 deletions
istl/bdmatrix.hh
0 → 100644
+
86
−
0
View file @
b8be25b5
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_BLOCK_DIAGONAL_MATRIX_HH
#define DUNE_BLOCK_DIAGONAL_MATRIX_HH
#include
<dune/istl/bvector.hh>
/** \file
\brief Implementation of the BDMatrix class
*/
namespace
Dune
{
/** \brief A block-diagonal matrix */
template
<
class
B
,
class
A
=
ISTLAllocator
>
class
BDMatrix
{
public:
//===== type definitions and constants
//! export the type representing the field
typedef
typename
B
::
field_type
field_type
;
//! export the type representing the components
typedef
B
block_type
;
//! export the allocator type
typedef
A
allocator_type
;
//! implement row_type with compressed vector
//typedef CompressedBlockVectorWindow<B,A> row_type;
//! increment block level counter
enum
{
blocklevel
=
B
::
blocklevel
+
1
};
/** \brief Change the size of the matrix */
void
resize
(
int
n
)
{
data_
.
resize
(
n
);}
/** \brief Number of rows of the matrix */
int
N
()
const
{
return
data_
.
size
();}
/** \brief Number of columns of the matrix */
int
M
()
const
{
return
data_
.
size
();}
/** \brief Get the i-th diagonal element */
B
&
operator
[](
int
i
)
{
return
data_
[
i
];}
/** \brief y -= Ax */
template
<
class
X
,
class
Y
>
void
umv
(
const
X
&
x
,
Y
&
y
)
const
{
#ifdef DUNE_ISTL_WITH_CHECKING
if
(
x
.
N
()
!=
M
())
DUNE_THROW
(
ISTLError
,
"index out of range"
);
if
(
y
.
N
()
!=
N
())
DUNE_THROW
(
ISTLError
,
"index out of range"
);
#endif
for
(
int
i
=
0
;
i
<
data_
.
size
();
i
++
)
data_
[
i
].
umv
(
x
[
i
],
y
[
i
]);
}
/** \brief y -= Ax */
template
<
class
X
,
class
Y
>
void
mmv
(
const
X
&
x
,
Y
&
y
)
const
{
#ifdef DUNE_ISTL_WITH_CHECKING
if
(
x
.
N
()
!=
M
())
DUNE_THROW
(
ISTLError
,
"index out of range"
);
if
(
y
.
N
()
!=
N
())
DUNE_THROW
(
ISTLError
,
"index out of range"
);
#endif
for
(
int
i
=
0
;
i
<
data_
.
size
();
i
++
)
data_
[
i
].
mmv
(
x
[
i
],
y
[
i
]);
}
/** \brief Inverts the matrix */
void
invert
()
{
for
(
int
i
=
0
;
i
<
data_
.
size
();
i
++
)
data_
[
i
].
invert
();
}
private
:
BlockVector
<
B
>
data_
;
};
}
// end namespace Dune
#endif
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