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
6eb61e07
There was a problem fetching the pipeline summary.
Commit
6eb61e07
authored
7 years ago
by
Max Kahnt
Browse files
Options
Downloads
Patches
Plain Diff
Allow custom ignore type in cgstep.
parent
9184389a
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/solvers/iterationsteps/cgstep.cc
+7
-7
7 additions, 7 deletions
dune/solvers/iterationsteps/cgstep.cc
dune/solvers/iterationsteps/cgstep.hh
+7
-5
7 additions, 5 deletions
dune/solvers/iterationsteps/cgstep.hh
with
14 additions
and
12 deletions
dune/solvers/iterationsteps/cgstep.cc
+
7
−
7
View file @
6eb61e07
...
...
@@ -3,13 +3,13 @@
#include
<dune/solvers/common/canignore.hh>
template
<
class
MatrixType
,
class
VectorType
>
void
CGStep
<
MatrixType
,
VectorType
>::
check
()
const
template
<
class
MatrixType
,
class
VectorType
,
class
Ignore
>
void
CGStep
<
MatrixType
,
VectorType
,
Ignore
>::
check
()
const
{
}
template
<
class
MatrixType
,
class
VectorType
>
void
CGStep
<
MatrixType
,
VectorType
>::
preprocess
()
template
<
class
MatrixType
,
class
VectorType
,
class
Ignore
>
void
CGStep
<
MatrixType
,
VectorType
,
Ignore
>::
preprocess
()
{
// Compute the residual (r starts out as the rhs)
this
->
mat_
->
mmv
(
*
x_
,
r_
);
...
...
@@ -19,7 +19,7 @@ void CGStep<MatrixType, VectorType>::preprocess()
r_
[
i
]
=
0
;
if
(
preconditioner_
)
{
using
CanIgnore_t
=
CanIgnore
<
DefaultBitVector_t
<
VectorType
>
>
;
using
CanIgnore_t
=
CanIgnore
<
Ignore
>
;
CanIgnore_t
*
asCanIgnore
=
dynamic_cast
<
CanIgnore_t
*>
(
preconditioner_
);
if
(
asCanIgnore
!=
nullptr
and
this
->
hasIgnore
())
asCanIgnore
->
setIgnore
(
this
->
ignore
());
...
...
@@ -32,8 +32,8 @@ void CGStep<MatrixType, VectorType>::preprocess()
r_squared_old_
=
p_
*
r_
;
}
template
<
class
MatrixType
,
class
VectorType
>
void
CGStep
<
MatrixType
,
VectorType
>::
iterate
()
template
<
class
MatrixType
,
class
VectorType
,
class
Ignore
>
void
CGStep
<
MatrixType
,
VectorType
,
Ignore
>::
iterate
()
{
// Avoid divide-by-zero. If r_squared was zero, we're done anyway.
if
(
r_squared_old_
<=
0
)
...
...
This diff is collapsed.
Click to expand it.
dune/solvers/iterationsteps/cgstep.hh
+
7
−
5
View file @
6eb61e07
...
...
@@ -4,16 +4,18 @@
#define DUNE_SOLVERS_ITERATIONSTEPS_CGSTEP_HH
#include
<dune/solvers/common/preconditioner.hh>
#include
<dune/solvers/common/defaultbitvector.hh>
#include
<dune/solvers/iterationsteps/lineariterationstep.hh>
namespace
Dune
{
namespace
Solvers
{
//! A conjugate gradient solver
template
<
class
MatrixType
,
class
VectorType
>
class
CGStep
:
public
LinearIterationStep
<
MatrixType
,
VectorType
>
template
<
class
MatrixType
,
class
VectorType
,
class
Ignore
=
DefaultBitVector_t
<
VectorType
>
>
class
CGStep
:
public
LinearIterationStep
<
MatrixType
,
VectorType
,
Ignore
>
{
using
Base
=
LinearIterationStep
<
MatrixType
,
VectorType
>
;
using
Base
=
LinearIterationStep
<
MatrixType
,
VectorType
,
Ignore
>
;
using
Preconditioner
=
Dune
::
Solvers
::
Preconditioner
<
MatrixType
,
VectorType
,
Ignore
>
;
public:
CGStep
()
...
...
@@ -30,7 +32,7 @@ namespace Dune {
CGStep
(
const
MatrixType
&
matrix
,
VectorType
&
x
,
const
VectorType
&
rhs
,
Preconditioner
<
MatrixType
,
VectorType
>
&
preconditioner
)
Preconditioner
&
preconditioner
)
:
Base
(
matrix
,
x
),
p_
(
rhs
.
size
()),
r_
(
rhs
),
preconditioner_
(
&
preconditioner
)
{}
...
...
@@ -54,7 +56,7 @@ namespace Dune {
VectorType
r_
;
// residual
using
Base
::
x_
;
double
r_squared_old_
;
Preconditioner
<
MatrixType
,
VectorType
>
*
preconditioner_
;
Preconditioner
*
preconditioner_
;
};
...
...
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