Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
agnumpde
dune-solvers
Commits
5e948d3c
Commit
5e948d3c
authored
9 years ago
by
Max Kahnt
Browse files
Options
Downloads
Patches
Plain Diff
Improve readability (use C++11).
parent
9938b2c6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/solvers/iterationsteps/blockgsstep.cc
+9
-12
9 additions, 12 deletions
dune/solvers/iterationsteps/blockgsstep.cc
dune/solvers/iterationsteps/blockgsstep.hh
+1
-1
1 addition, 1 deletion
dune/solvers/iterationsteps/blockgsstep.hh
with
10 additions
and
13 deletions
dune/solvers/iterationsteps/blockgsstep.cc
+
9
−
12
View file @
5e948d3c
...
@@ -16,19 +16,15 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::
...
@@ -16,19 +16,15 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::
residual
(
int
index
,
VectorBlock
&
r
)
const
residual
(
int
index
,
VectorBlock
&
r
)
const
{
{
const
MatrixType
&
mat
=
*
this
->
mat_
;
const
MatrixType
&
mat
=
*
this
->
mat_
;
const
auto
&
row
=
mat
[
index
];
typedef
typename
MatrixType
::
row_type
RowType
;
const
RowType
&
row
=
mat
[
index
];
typedef
typename
RowType
::
ConstIterator
ColumnIterator
;
r
=
(
*
this
->
rhs_
)[
index
];
r
=
(
*
this
->
rhs_
)[
index
];
/* The following loop subtracts
/* The following loop subtracts
* \f[ sum_i = \sum_j A_{ij}w_j \f]
* \f[ sum_i = \sum_j A_{ij}w_j \f]
*/
*/
ColumnIter
ato
r
cIt
=
row
.
begin
();
a
u
to
cIt
=
row
.
begin
();
ColumnIter
ato
r
cEndIt
=
row
.
end
();
a
u
to
cEndIt
=
row
.
end
();
for
(;
cIt
!=
cEndIt
;
++
cIt
)
{
for
(;
cIt
!=
cEndIt
;
++
cIt
)
{
// r_i -= A_ij x_j
// r_i -= A_ij x_j
...
@@ -64,14 +60,14 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i)
...
@@ -64,14 +60,14 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i)
VectorBlock
r
;
VectorBlock
r
;
residual
(
i
,
r
);
residual
(
i
,
r
);
const
auto
&
mat_ii
=
mat
[
i
][
i
];
// Compute
x_i +
= A_{i,i}^{-1} r[i]
// Compute
correction v
= A_{i,i}^{-1} r[i]
VectorBlock
v
;
VectorBlock
v
;
VectorBlock
&
x
=
(
*
this
->
x_
)[
i
];
if
(
count
==
0
)
{
if
(
count
==
0
)
{
// No degree of freedom shall be ignored --> solve linear problem
// No degree of freedom shall be ignored --> solve linear problem
mat
[
i
][
i
]
.
solve
(
v
,
r
);
mat
_ii
.
solve
(
v
,
r
);
}
else
{
}
else
{
// Copy the matrix and adjust rhs and matrix so that dofs given in ignoreNodes[i]
// Copy the matrix and adjust rhs and matrix so that dofs given in ignoreNodes[i]
// are not touched
// are not touched
...
@@ -83,11 +79,12 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i)
...
@@ -83,11 +79,12 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i)
for
(
int
k
=
0
;
k
<
BlockSize
;
++
k
)
for
(
int
k
=
0
;
k
<
BlockSize
;
++
k
)
matRes
[
j
][
k
]
=
(
k
==
j
);
matRes
[
j
][
k
]
=
(
k
==
j
);
}
else
}
else
matRes
[
j
]
=
mat
[
i
][
i
]
[
j
];
matRes
[
j
]
=
mat
_ii
[
j
];
}
}
matRes
.
solve
(
v
,
r
);
matRes
.
solve
(
v
,
r
);
}
}
// Add correction;
// Add correction
VectorBlock
&
x
=
(
*
this
->
x_
)[
i
];
x
+=
v
;
x
+=
v
;
}
}
This diff is collapsed.
Click to expand it.
dune/solvers/iterationsteps/blockgsstep.hh
+
1
−
1
View file @
5e948d3c
...
@@ -20,7 +20,7 @@ template<class MatrixType,
...
@@ -20,7 +20,7 @@ template<class MatrixType,
class
BlockGSStep
:
public
LinearIterationStep
<
MatrixType
,
DiscFuncType
,
BitVectorType
>
class
BlockGSStep
:
public
LinearIterationStep
<
MatrixType
,
DiscFuncType
,
BitVectorType
>
{
{
typedef
typename
DiscFuncType
::
block_type
VectorBlock
;
using
VectorBlock
=
typename
DiscFuncType
::
block_type
;
enum
{
BlockSize
=
VectorBlock
::
dimension
};
enum
{
BlockSize
=
VectorBlock
::
dimension
};
...
...
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