Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
0fb06009
Commit
0fb06009
authored
Jan 30, 2020
by
Kilian Weishaupt
Browse files
[parallelHelper] Clean-up internal structure
parent
633d308d
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
dumux/linear/amgbackend.hh
View file @
0fb06009
...
...
@@ -134,12 +134,18 @@ public:
template
<
class
Matrix
,
class
Vector
>
bool
solve
(
Matrix
&
A
,
Vector
&
x
,
Vector
&
b
)
{
int
rank
=
0
;
std
::
shared_ptr
<
Comm
>
comm
;
std
::
shared_ptr
<
LinearOperator
>
fop
;
std
::
shared_ptr
<
ScalarProduct
>
sp
;
static
const
bool
isParallel
=
AmgTraits
::
isParallel
;
prepareLinearAlgebra_
<
Matrix
,
Vector
,
isParallel
>
(
A
,
b
,
rank
,
comm
,
fop
,
sp
);
#if HAVE_MPI
if
constexpr
(
AmgTraits
::
isParallel
)
prepareLinearAlgebraParallel
<
AmgTraits
>
(
A
,
b
,
comm
,
fop
,
sp
,
*
phelper_
,
firstCall_
);
else
prepareLinearAlgebraSequential
<
AmgTraits
>
(
A
,
comm
,
fop
,
sp
);
#else
prepareLinearAlgebraSequential
<
AmgTraits
>
(
A
,
comm
,
fop
,
sp
);
#endif
using
SmootherArgs
=
typename
Dune
::
Amg
::
SmootherTraits
<
Smoother
>::
Arguments
;
using
Criterion
=
Dune
::
Amg
::
CoarsenCriterion
<
Dune
::
Amg
::
SymmetricCriterion
<
BCRSMat
,
Dune
::
Amg
::
FirstDiagonal
>>
;
...
...
@@ -156,7 +162,7 @@ public:
AMGType
amg
(
*
fop
,
criterion
,
smootherArgs
,
*
comm
);
Dune
::
BiCGSTABSolver
<
VType
>
solver
(
*
fop
,
*
sp
,
amg
,
this
->
residReduction
(),
this
->
maxIter
(),
rank
==
0
?
this
->
verbosity
()
:
0
);
comm
->
communicator
().
rank
()
==
0
?
this
->
verbosity
()
:
0
);
solver
.
apply
(
x
,
b
,
result_
);
firstCall_
=
false
;
...
...
@@ -181,34 +187,6 @@ public:
private:
/*!
* \brief Prepare the linear algebra member variables.
*
* At compile time, correct constructor calls have to be chosen,
* depending on whether the setting is parallel or sequential.
* Since several template parameters are present, this cannot be solved
* by a full function template specialization. Instead, class template
* specialization has to be used.
* This adapts example 4 from http://www.gotw.ca/publications/mill17.htm.
* The function is called from the solve function. The call is
* forwarded to the corresponding function of a class template.
*
* \tparam Matrix the matrix type
* \tparam Vector the vector type
* \tparam isParallel decides if the setting is parallel or sequential
*/
template
<
class
Matrix
,
class
Vector
,
bool
isParallel
>
void
prepareLinearAlgebra_
(
Matrix
&
A
,
Vector
&
b
,
int
&
rank
,
std
::
shared_ptr
<
Comm
>&
comm
,
std
::
shared_ptr
<
LinearOperator
>&
fop
,
std
::
shared_ptr
<
ScalarProduct
>&
sp
)
{
LinearAlgebraPreparator
<
GridView
,
AmgTraits
,
isParallel
>
::
prepareLinearAlgebra
(
A
,
b
,
rank
,
comm
,
fop
,
sp
,
*
phelper_
,
firstCall_
);
}
std
::
shared_ptr
<
ParallelISTLHelper
<
GridView
,
AmgTraits
>>
phelper_
;
Dune
::
InverseOperatorResult
result_
;
bool
firstCall_
;
...
...
dumux/linear/linearsolvertraits.hh
View file @
0fb06009
...
...
@@ -42,9 +42,7 @@
#include <dune/grid/uggrid.hh>
#endif // HAVE_UG
namespace
Dumux
{
namespace
Temp
{
namespace
Capabilities
{
namespace
Dumux
::
Temp
::
Capabilities
{
template
<
class
Grid
,
int
codim
>
struct
canCommunicate
...
...
@@ -60,9 +58,7 @@ struct canCommunicate<Dune::UGGrid<dim>, codim>
};
#endif // HAVE_UG
}
// namespace Capabilities
}
// namespace Temp
}
// namespace Dumux
}
// namespace Dumux::Temp::Capabilities
// end workaround
namespace
Dumux
{
...
...
dumux/linear/parallelhelpers.hh
View file @
0fb06009
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment