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
01255a6c
Commit
01255a6c
authored
7 years ago
by
Jonathan Youett
Browse files
Options
Downloads
Patches
Plain Diff
Make baseSolver protected, store it as shared_ptr and add setter
parent
5025cb8e
No related branches found
No related tags found
1 merge request
!15
Reduce raw pointer
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/solvers/iterationsteps/multigridstep.cc
+6
-6
6 additions, 6 deletions
dune/solvers/iterationsteps/multigridstep.cc
dune/solvers/iterationsteps/multigridstep.hh
+9
-3
9 additions, 3 deletions
dune/solvers/iterationsteps/multigridstep.hh
with
15 additions
and
9 deletions
dune/solvers/iterationsteps/multigridstep.cc
+
6
−
6
View file @
01255a6c
...
@@ -141,14 +141,14 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
...
@@ -141,14 +141,14 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
if
(
basesolver_
)
if
(
basesolver_
)
{
{
// If the base solver can ignore dofs give it the ignoreNodes field
// If the base solver can ignore dofs give it the ignoreNodes field
if
(
dynamic_cast
<
CanIgnore
<
BitVectorType
>*>
(
this
->
basesolver_
))
if
(
dynamic_cast
<
CanIgnore
<
BitVectorType
>*>
(
this
->
basesolver_
.
get
()
))
dynamic_cast
<
CanIgnore
<
BitVectorType
>*>
(
this
->
basesolver_
)
->
ignoreNodes_
=
ignoreNodesHierarchy_
[
0
];
dynamic_cast
<
CanIgnore
<
BitVectorType
>*>
(
this
->
basesolver_
.
get
())
->
setIgnore
(
*
ignoreNodesHierarchy_
[
0
]
)
;
typedef
::
LoopSolver
<
VectorType
>
DuneSolversLoopSolver
;
typedef
::
LoopSolver
<
VectorType
>
DuneSolversLoopSolver
;
if
(
dynamic_cast
<
DuneSolversLoopSolver
*>
(
this
->
basesolver_
))
{
if
(
dynamic_cast
<
DuneSolversLoopSolver
*>
(
this
->
basesolver_
.
get
()
))
{
DuneSolversLoopSolver
*
loopBaseSolver
=
dynamic_cast
<
DuneSolversLoopSolver
*>
(
this
->
basesolver_
);
DuneSolversLoopSolver
*
loopBaseSolver
=
dynamic_cast
<
DuneSolversLoopSolver
*>
(
this
->
basesolver_
.
get
()
);
typedef
LinearIterationStep
<
MatrixType
,
VectorType
>
SmootherType
;
typedef
LinearIterationStep
<
MatrixType
,
VectorType
>
SmootherType
;
assert
(
dynamic_cast
<
SmootherType
*>
(
loopBaseSolver
->
iterationStep_
));
assert
(
dynamic_cast
<
SmootherType
*>
(
loopBaseSolver
->
iterationStep_
));
...
@@ -157,9 +157,9 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
...
@@ -157,9 +157,9 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
dynamic_cast
<
SmootherType
*>
(
loopBaseSolver
->
iterationStep_
)
->
ignoreNodes_
=
ignoreNodesHierarchy_
[
0
];
dynamic_cast
<
SmootherType
*>
(
loopBaseSolver
->
iterationStep_
)
->
ignoreNodes_
=
ignoreNodesHierarchy_
[
0
];
}
}
else
if
(
dynamic_cast
<
LinearSolver
<
MatrixType
,
VectorType
>*>
(
this
->
basesolver_
))
{
else
if
(
dynamic_cast
<
LinearSolver
<
MatrixType
,
VectorType
>*>
(
this
->
basesolver_
.
get
()
))
{
LinearSolver
<
MatrixType
,
VectorType
>*
linearBaseSolver
=
dynamic_cast
<
LinearSolver
<
MatrixType
,
VectorType
>*>
(
this
->
basesolver_
);
LinearSolver
<
MatrixType
,
VectorType
>*
linearBaseSolver
=
dynamic_cast
<
LinearSolver
<
MatrixType
,
VectorType
>*>
(
this
->
basesolver_
.
get
()
);
linearBaseSolver
->
setProblem
(
*
(
this
->
matrixHierarchy_
[
0
]),
*
this
->
xHierarchy_
[
0
],
this
->
rhsHierarchy_
[
0
]);
linearBaseSolver
->
setProblem
(
*
(
this
->
matrixHierarchy_
[
0
]),
*
this
->
xHierarchy_
[
0
],
this
->
rhsHierarchy_
[
0
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
dune/solvers/iterationsteps/multigridstep.hh
+
9
−
3
View file @
01255a6c
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include
<dune/solvers/transferoperators/multigridtransfer.hh>
#include
<dune/solvers/transferoperators/multigridtransfer.hh>
#include
<dune/solvers/solvers/iterativesolver.hh>
#include
<dune/solvers/solvers/iterativesolver.hh>
#include
<dune/solvers/common/wrapownshare.hh>
#include
"lineariterationstep.hh"
#include
"lineariterationstep.hh"
...
@@ -179,6 +180,13 @@ namespace Dune {
...
@@ -179,6 +180,13 @@ namespace Dune {
levelWiseSmoothers_
[
level
]
=
smoother
;
levelWiseSmoothers_
[
level
]
=
smoother
;
}
}
/** \brief Set base solver */
template
<
class
BaseSolver
>
void
setBaseSolver
(
BaseSolver
&&
baseSolver
)
{
basesolver_
=
wrap_own_share
<
Solver
>
(
std
::
forward
<
BaseSolver
>
(
baseSolver
));
}
protected
:
protected
:
/** \brief The presmoothers, one for each level */
/** \brief The presmoothers, one for each level */
std
::
vector
<
std
::
shared_ptr
<
LinearIterationStep
<
MatrixType
,
VectorType
>
>
>
presmoother_
;
std
::
vector
<
std
::
shared_ptr
<
LinearIterationStep
<
MatrixType
,
VectorType
>
>
>
presmoother_
;
...
@@ -186,11 +194,9 @@ namespace Dune {
...
@@ -186,11 +194,9 @@ namespace Dune {
/** \brief The postsmoothers, one for each level */
/** \brief The postsmoothers, one for each level */
std
::
vector
<
std
::
shared_ptr
<
LinearIterationStep
<
MatrixType
,
VectorType
>
>
>
postsmoother_
;
std
::
vector
<
std
::
shared_ptr
<
LinearIterationStep
<
MatrixType
,
VectorType
>
>
>
postsmoother_
;
public
:
/** \brief The base solver */
/** \brief The base solver */
Solver
*
basesolver_
;
std
::
shared_ptr
<
Solver
>
basesolver_
;
protected
:
//! Number of presmoothing steps
//! Number of presmoothing steps
int
nu1_
;
int
nu1_
;
...
...
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