Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tnnmg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
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
Patrick Jaap
dune-tnnmg
Commits
743c1abc
Commit
743c1abc
authored
8 years ago
by
oliver.sander_at_tu-dresden.de
Browse files
Options
Downloads
Patches
Plain Diff
Use the dune-solvers-style API to call the linear solver
parent
65aaecf2
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
dune/tnnmg/iterationsteps/tnnmgstep.hh
+26
-3
26 additions, 3 deletions
dune/tnnmg/iterationsteps/tnnmgstep.hh
with
26 additions
and
3 deletions
dune/tnnmg/iterationsteps/tnnmgstep.hh
+
26
−
3
View file @
743c1abc
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
"dune/solvers/iterationsteps/iterationstep.hh"
#include
"dune/solvers/iterationsteps/iterationstep.hh"
#include
"dune/solvers/iterationsteps/lineariterationstep.hh"
#include
"dune/solvers/iterationsteps/lineariterationstep.hh"
#include
<dune/solvers/solvers/iterativesolver.hh>
#ifndef USE_OLD_TNNMG
#ifndef USE_OLD_TNNMG
...
@@ -23,7 +24,6 @@ namespace TNNMG {
...
@@ -23,7 +24,6 @@ namespace TNNMG {
* \tparam BV Bit-vector type for marking ignored components
* \tparam BV Bit-vector type for marking ignored components
*/
*/
template
<
class
F
,
class
BV
,
class
Linearization
,
template
<
class
F
,
class
BV
,
class
Linearization
,
class
LinearSolver
,
class
DefectProjection
,
class
DefectProjection
,
class
LineSearchSolver
>
class
LineSearchSolver
>
class
TNNMGStep
:
class
TNNMGStep
:
...
@@ -36,6 +36,7 @@ public:
...
@@ -36,6 +36,7 @@ public:
using
Vector
=
typename
F
::
Vector
;
using
Vector
=
typename
F
::
Vector
;
using
BitVector
=
typename
Base
::
BitVector
;
using
BitVector
=
typename
Base
::
BitVector
;
using
Functional
=
F
;
using
Functional
=
F
;
using
LinearSolver
=
Solvers
::
IterativeSolver
<
typename
Linearization
::
ConstrainedVector
,
Solvers
::
DefaultBitVector_t
<
Vector
>
>
;
/** \brief Constructor
/** \brief Constructor
* \param linearSolver This is a callback used to solve the constrained linearized system
* \param linearSolver This is a callback used to solve the constrained linearized system
...
@@ -104,8 +105,30 @@ public:
...
@@ -104,8 +105,30 @@ public:
auto
emptyIgnore
=
ignore
;
auto
emptyIgnore
=
ignore
;
Solvers
::
resizeInitialize
(
emptyIgnore
,
constrainedCorrection_
,
false
);
Solvers
::
resizeInitialize
(
emptyIgnore
,
constrainedCorrection_
,
false
);
linearSolver_
->
step_
->
setIgnore
(
emptyIgnore
);
linearSolver_
->
step_
->
setProblem
(
A
,
constrainedCorrection_
,
r
);
// Hand the linear problem to the linear solver.
// Currently we only support IterativeSolvers. The IterationStep member
// needs to be a LinearIterationStep, so we can give it the matrix.
using
LinearIterationStepType
=
Solvers
::
LinearIterationStep
<
std
::
decay_t
<
decltype
(
A
)
>
,
typename
Linearization
::
ConstrainedVector
,
decltype
(
emptyIgnore
)
>
;
LinearIterationStepType
*
linearIterationStep
;
auto
iterativeSolver
=
std
::
dynamic_pointer_cast
<
Solvers
::
IterativeSolver
<
typename
Linearization
::
ConstrainedVector
>
>
(
linearSolver_
);
if
(
iterativeSolver
)
{
iterativeSolver
->
iterationStep_
->
setIgnore
(
emptyIgnore
);
linearIterationStep
=
dynamic_cast
<
LinearIterationStepType
*>
(
iterativeSolver
->
iterationStep_
);
}
else
DUNE_THROW
(
Exception
,
"Linear solver has to be an IterativeSolver!"
);
if
(
linearIterationStep
)
linearIterationStep
->
setProblem
(
A
,
constrainedCorrection_
,
r
);
else
DUNE_THROW
(
Exception
,
"Linear solver does not accept matrices!"
);
linearSolver_
->
preprocess
();
linearSolver_
->
preprocess
();
linearSolver_
->
solve
();
linearSolver_
->
solve
();
...
...
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