Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
dumux-repositories
dumux
Commits
687cb503
Commit
687cb503
authored
1 year ago
by
IvBu
Committed by
Timo Koch
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[solvers] UMFPack backend accepts MultiType matrices from 2.10
parent
d2df9e82
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3641
[solvers] UMFPack backend accepts MultiType matrices from Dune 2.10
Pipeline
#35975
passed
1 year ago
Stage: check-status
Stage: trigger dumux pipelines
+3
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/linear/istlsolvers.hh
+21
-23
21 additions, 23 deletions
dumux/linear/istlsolvers.hh
with
21 additions
and
23 deletions
dumux/linear/istlsolvers.hh
+
21
−
23
View file @
687cb503
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include
<dumux/linear/solvercategory.hh>
#include
<dumux/linear/solvercategory.hh>
#include
<dumux/linear/solver.hh>
#include
<dumux/linear/solver.hh>
#include
<dune/istl/foreach.hh>
namespace
Dumux
::
Detail
::
IstlSolvers
{
namespace
Dumux
::
Detail
::
IstlSolvers
{
/*!
/*!
...
@@ -726,14 +728,14 @@ namespace Dumux::Detail {
...
@@ -726,14 +728,14 @@ namespace Dumux::Detail {
* \ingroup Linear
* \ingroup Linear
* \brief Direct dune-istl linear solvers
* \brief Direct dune-istl linear solvers
*/
*/
template
<
class
LSTraits
,
class
LATraits
,
template
<
class
M
>
class
Solver
>
template
<
class
LSTraits
,
class
LATraits
,
template
<
class
M
>
class
Solver
,
bool
convertMultiTypeVectorAndMatrix
=
isMultiTypeBlockVector
<
typename
LATraits
::
Vector
>
::
value
>
class
DirectIstlSolver
:
public
LinearSolver
class
DirectIstlSolver
:
public
LinearSolver
{
{
using
Matrix
=
typename
LATraits
::
Matrix
;
using
Matrix
=
typename
LATraits
::
Matrix
;
using
XVector
=
typename
LATraits
::
Vector
;
using
XVector
=
typename
LATraits
::
Vector
;
using
BVector
=
typename
LATraits
::
Vector
;
using
BVector
=
typename
LATraits
::
Vector
;
static
constexpr
bool
convertMultiTypeVectorAndMatrix
=
isMultiTypeBlockVector
<
XVector
>::
value
;
using
MatrixForSolver
=
typename
Detail
::
IstlSolvers
::
MatrixForSolver
<
Matrix
,
convertMultiTypeVectorAndMatrix
>::
type
;
using
MatrixForSolver
=
typename
Detail
::
IstlSolvers
::
MatrixForSolver
<
Matrix
,
convertMultiTypeVectorAndMatrix
>::
type
;
using
BVectorForSolver
=
typename
Detail
::
IstlSolvers
::
VectorForSolver
<
BVector
,
convertMultiTypeVectorAndMatrix
>::
type
;
using
BVectorForSolver
=
typename
Detail
::
IstlSolvers
::
VectorForSolver
<
BVector
,
convertMultiTypeVectorAndMatrix
>::
type
;
using
XVectorForSolver
=
typename
Detail
::
IstlSolvers
::
VectorForSolver
<
XVector
,
convertMultiTypeVectorAndMatrix
>::
type
;
using
XVectorForSolver
=
typename
Detail
::
IstlSolvers
::
VectorForSolver
<
XVector
,
convertMultiTypeVectorAndMatrix
>::
type
;
...
@@ -792,7 +794,7 @@ private:
...
@@ -792,7 +794,7 @@ private:
IstlSolverResult
solve_
(
const
Matrix
&
A
,
XVector
&
x
,
const
BVector
&
b
)
IstlSolverResult
solve_
(
const
Matrix
&
A
,
XVector
&
x
,
const
BVector
&
b
)
{
{
// support dune-istl multi-type block vector/matrix by copying
// support dune-istl multi-type block vector/matrix by copying
if
constexpr
(
is
MultiType
Block
Vector
<
BVector
>
()
)
if
constexpr
(
convert
MultiTypeVector
AndMatrix
)
{
{
const
auto
AA
=
MatrixConverter
<
Matrix
>::
multiTypeToBCRSMatrix
(
A
);
const
auto
AA
=
MatrixConverter
<
Matrix
>::
multiTypeToBCRSMatrix
(
A
);
Solver
<
MatrixForSolver
>
solver
(
AA
,
this
->
verbosity
()
>
0
);
Solver
<
MatrixForSolver
>
solver
(
AA
,
this
->
verbosity
()
>
0
);
...
@@ -807,11 +809,9 @@ private:
...
@@ -807,11 +809,9 @@ private:
IstlSolverResult
solve_
(
XVector
&
x
,
const
BVector
&
b
,
InverseOperator
&
solver
)
const
IstlSolverResult
solve_
(
XVector
&
x
,
const
BVector
&
b
,
InverseOperator
&
solver
)
const
{
{
static_assert
(
isBCRSMatrix
<
MatrixForSolver
>::
value
,
"Direct solver only works with BCRS matrices!"
);
static_assert
(
MatrixForSolver
::
block_type
::
rows
==
MatrixForSolver
::
block_type
::
cols
,
"Matrix block must be quadratic!"
);
Dune
::
InverseOperatorResult
result
;
Dune
::
InverseOperatorResult
result
;
if
constexpr
(
isMultiTypeBlockVector
<
BVector
>
())
if
constexpr
(
convertMultiTypeVectorAndMatrix
)
{
{
auto
bb
=
VectorConverter
<
BVector
>::
multiTypeToBlockVector
(
b
);
auto
bb
=
VectorConverter
<
BVector
>::
multiTypeToBlockVector
(
b
);
XVectorForSolver
xx
(
bb
.
size
());
XVectorForSolver
xx
(
bb
.
size
());
...
@@ -830,22 +830,14 @@ private:
...
@@ -830,22 +830,14 @@ private:
}
}
}
}
void
checkResult_
(
const
XVectorForSolver
&
x
,
Dune
::
InverseOperatorResult
&
result
)
const
void
checkResult_
(
XVectorForSolver
&
x
,
Dune
::
InverseOperatorResult
&
result
)
const
{
{
int
size
=
x
.
size
();
flatVectorForEach
(
x
,
[
&
](
auto
&&
entry
,
std
::
size_t
){
for
(
int
i
=
0
;
i
<
size
;
i
++
)
using
std
::
isnan
,
std
::
isinf
;
{
if
(
isnan
(
entry
)
||
isinf
(
entry
))
for
(
int
j
=
0
;
j
<
x
[
i
].
size
();
j
++
)
result
.
converged
=
false
;
{
});
using
std
::
isnan
;
using
std
::
isinf
;
if
(
isnan
(
x
[
i
][
j
])
||
isinf
(
x
[
i
][
j
]))
{
result
.
converged
=
false
;
break
;
}
}
}
}
}
//! matrix when using the setMatrix interface for matrix reuse
//! matrix when using the setMatrix interface for matrix reuse
...
@@ -878,6 +870,7 @@ using SuperLUIstlSolver = Detail::DirectIstlSolver<LSTraits, LATraits, Dune::Sup
...
@@ -878,6 +870,7 @@ using SuperLUIstlSolver = Detail::DirectIstlSolver<LSTraits, LATraits, Dune::Sup
#if HAVE_UMFPACK
#if HAVE_UMFPACK
#include
<dune/istl/umfpack.hh>
#include
<dune/istl/umfpack.hh>
#include
<dune/common/version.hh>
namespace
Dumux
{
namespace
Dumux
{
...
@@ -890,7 +883,12 @@ namespace Dumux {
...
@@ -890,7 +883,12 @@ namespace Dumux {
* http://faculty.cse.tamu.edu/davis/suitesparse.html
* http://faculty.cse.tamu.edu/davis/suitesparse.html
*/
*/
template
<
class
LSTraits
,
class
LATraits
>
template
<
class
LSTraits
,
class
LATraits
>
using
UMFPackIstlSolver
=
Detail
::
DirectIstlSolver
<
LSTraits
,
LATraits
,
Dune
::
UMFPack
>
;
using
UMFPackIstlSolver
=
Detail
::
DirectIstlSolver
<
LSTraits
,
LATraits
,
Dune
::
UMFPack
#if DUNE_VERSION_GTE(DUNE_ISTL,2,10)
,
false
// no need to convert multi-type matrix anymore
#endif
>
;
}
// end namespace Dumux
}
// end namespace Dumux
...
...
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