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
4d91b51f
Commit
4d91b51f
authored
Jan 29, 2020
by
Kilian Weishaupt
Browse files
[linear] Rename amgtraits to linearsolvertraits and deprecate
parent
47163f51
Changes
3
Hide whitespace changes
Inline
Side-by-side
dumux/linear/CMakeLists.txt
View file @
4d91b51f
...
...
@@ -2,6 +2,7 @@ install(FILES
amgbackend.hh
amgparallelhelpers.hh
amgtraits.hh
linearsolvertraits.hh
linearsolveracceptsmultitypematrix.hh
matrixconverter.hh
pdesolver.hh
...
...
dumux/linear/amgtraits.hh
View file @
4d91b51f
...
...
@@ -24,151 +24,16 @@
#ifndef DUMUX_AMG_TRAITS_HH
#define DUMUX_AMG_TRAITS_HH
#include <dune/istl/schwarz.hh>
#include <dune/istl/novlpschwarz.hh>
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/istl/paamg/pinfo.hh>
#include <dune/istl/preconditioners.hh>
#include <dune/grid/common/capabilities.hh>
#warning "This header is deprecated and will be removed after release 3.2. Use linearsolver/linearsolvertraits.hh"
#include
<dumux/discretization/method
.hh
>
#include
"linearsolvertraits
.hh
"
// TODO: The following is a temporary solution to make the parallel AMG work
// for UGGrid. Once it is resolved upstream
// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
// it should be guarded by a DUNE_VERSION macro and removed later.
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif // HAVE_UG
namespace
Dumux
{
namespace
Temp
{
namespace
Capabilities
{
template
<
class
Grid
,
int
codim
>
struct
canCommunicate
{
static
const
bool
v
=
false
;
};
#if HAVE_UG
template
<
int
dim
,
int
codim
>
struct
canCommunicate
<
Dune
::
UGGrid
<
dim
>
,
codim
>
{
static
const
bool
v
=
true
;
};
#endif // HAVE_UG
}
// namespace Capabilities
}
// namespace Temp
}
// namespace Dumux
// end workaround
namespace
Dumux
{
//! The implementation is specialized for the different discretizations
template
<
class
MType
,
class
VType
,
class
GridGeometry
,
DiscretizationMethod
discMethod
>
struct
AmgTraitsImpl
;
//! The type traits required for using the AMG backend
template
<
class
MType
,
class
VType
,
class
GridGeometry
>
using
AmgTraits
=
AmgTraitsImpl
<
MType
,
VType
,
GridGeometry
,
GridGeometry
::
discMethod
>
;
//! NonoverlappingSolverTraits used by discretization with non-overlapping parallel model
template
<
class
MType
,
class
VType
,
bool
isParallel
>
class
NonoverlappingSolverTraits
{
public:
using
Comm
=
Dune
::
Amg
::
SequentialInformation
;
using
LinearOperator
=
Dune
::
MatrixAdapter
<
MType
,
VType
,
VType
>
;
using
ScalarProduct
=
Dune
::
SeqScalarProduct
<
VType
>
;
using
Smoother
=
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
;
};
#if HAVE_MPI
template
<
class
MType
,
class
VType
>
class
NonoverlappingSolverTraits
<
MType
,
VType
,
true
>
{
public:
using
Comm
=
Dune
::
OwnerOverlapCopyCommunication
<
Dune
::
bigunsignedint
<
96
>
,
int
>
;
using
LinearOperator
=
Dune
::
NonoverlappingSchwarzOperator
<
MType
,
VType
,
VType
,
Comm
>
;
using
ScalarProduct
=
Dune
::
NonoverlappingSchwarzScalarProduct
<
VType
,
Comm
>
;
using
Smoother
=
Dune
::
NonoverlappingBlockPreconditioner
<
Comm
,
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
>
;
};
#endif
//! Box: use the non-overlapping AMG
template
<
class
Matrix
,
class
Vector
,
class
GridGeometry
>
struct
AmgTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
box
>
{
using
Grid
=
typename
GridGeometry
::
GridView
::
Traits
::
Grid
;
enum
{
dofCodim
=
Grid
::
dimension
,
isNonOverlapping
=
true
,
// TODO: see above for description of this workaround, remove second line if fixed upstream
isParallel
=
Dune
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
||
Dumux
::
Temp
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
};
using
MType
=
Matrix
;
using
VType
=
Dune
::
BlockVector
<
Dune
::
FieldVector
<
typename
Vector
::
block_type
::
value_type
,
Vector
::
block_type
::
dimension
>>
;
using
SolverTraits
=
NonoverlappingSolverTraits
<
MType
,
VType
,
isParallel
>
;
using
Comm
=
typename
SolverTraits
::
Comm
;
using
LinearOperator
=
typename
SolverTraits
::
LinearOperator
;
using
ScalarProduct
=
typename
SolverTraits
::
ScalarProduct
;
using
Smoother
=
typename
SolverTraits
::
Smoother
;
using
DofMapper
=
typename
GridGeometry
::
VertexMapper
;
};
//! OverlappingSolverTraits used by discretization with overlapping parallel model
template
<
class
MType
,
class
VType
,
bool
isParallel
>
class
OverlappingSolverTraits
{
public:
using
Comm
=
Dune
::
Amg
::
SequentialInformation
;
using
LinearOperator
=
Dune
::
MatrixAdapter
<
MType
,
VType
,
VType
>
;
using
ScalarProduct
=
Dune
::
SeqScalarProduct
<
VType
>
;
using
Smoother
=
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
;
};
#if HAVE_MPI
template
<
class
MType
,
class
VType
>
class
OverlappingSolverTraits
<
MType
,
VType
,
true
>
{
public:
using
Comm
=
Dune
::
OwnerOverlapCopyCommunication
<
Dune
::
bigunsignedint
<
96
>
,
int
>
;
using
LinearOperator
=
Dune
::
OverlappingSchwarzOperator
<
MType
,
VType
,
VType
,
Comm
>
;
using
ScalarProduct
=
Dune
::
OverlappingSchwarzScalarProduct
<
VType
,
Comm
>
;
using
Smoother
=
Dune
::
BlockPreconditioner
<
VType
,
VType
,
Comm
,
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
>
;
};
#endif
//! Cell-centered tpfa: use the overlapping AMG
template
<
class
Matrix
,
class
Vector
,
class
GridGeometry
>
struct
AmgTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
cctpfa
>
{
using
Grid
=
typename
GridGeometry
::
GridView
::
Traits
::
Grid
;
enum
{
dofCodim
=
0
,
isNonOverlapping
=
false
,
// TODO: see above for description of this workaround, remove second line if fixed upstream
isParallel
=
Dune
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
||
Dumux
::
Temp
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
};
using
MType
=
Matrix
;
using
VType
=
Dune
::
BlockVector
<
Dune
::
FieldVector
<
typename
Vector
::
block_type
::
value_type
,
Vector
::
block_type
::
dimension
>>
;
using
SolverTraits
=
OverlappingSolverTraits
<
MType
,
VType
,
isParallel
>
;
using
Comm
=
typename
SolverTraits
::
Comm
;
using
LinearOperator
=
typename
SolverTraits
::
LinearOperator
;
using
ScalarProduct
=
typename
SolverTraits
::
ScalarProduct
;
using
Smoother
=
typename
SolverTraits
::
Smoother
;
using
DofMapper
=
typename
GridGeometry
::
ElementMapper
;
};
template
<
class
Matrix
,
class
Vector
,
class
GridGeometry
>
struct
AmgTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
ccmpfa
>
:
public
AmgTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
cctpfa
>
{};
using
AmgTraits
[[
deprecated
(
"Use LinearSolverTraits<MType, VType, GridGeometry> instead. AmgTraits will be removed after 3.2!"
)]]
=
LinearSolverTraits
<
MType
,
VType
,
GridGeometry
>
;
}
// end namespace Dumux
...
...
dumux/linear/linearsolvertraits.hh
0 → 100644
View file @
4d91b51f
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup Linear
* \brief Define traits for linear solvers.
*/
#ifndef DUMUX_LINEAR_SOLVER_TRAITS_HH
#define DUMUX_LINEAR_SOLVER_TRAITS_HH
#include <dune/istl/schwarz.hh>
#include <dune/istl/novlpschwarz.hh>
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/istl/paamg/pinfo.hh>
#include <dune/istl/preconditioners.hh>
#include <dune/grid/common/capabilities.hh>
#include <dumux/discretization/method.hh>
// TODO: The following is a temporary solution to make the parallel AMG work
// for UGGrid. Once it is resolved upstream
// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
// it should be guarded by a DUNE_VERSION macro and removed later.
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif // HAVE_UG
namespace
Dumux
{
namespace
Temp
{
namespace
Capabilities
{
template
<
class
Grid
,
int
codim
>
struct
canCommunicate
{
static
const
bool
v
=
false
;
};
#if HAVE_UG
template
<
int
dim
,
int
codim
>
struct
canCommunicate
<
Dune
::
UGGrid
<
dim
>
,
codim
>
{
static
const
bool
v
=
true
;
};
#endif // HAVE_UG
}
// namespace Capabilities
}
// namespace Temp
}
// namespace Dumux
// end workaround
namespace
Dumux
{
//! The implementation is specialized for the different discretizations
template
<
class
MType
,
class
VType
,
class
GridGeometry
,
DiscretizationMethod
discMethod
>
struct
LinearSolverTraitsImpl
;
//! The type traits required for using the IstlFactoryBackend
template
<
class
MType
,
class
VType
,
class
GridGeometry
>
using
LinearSolverTraits
=
LinearSolverTraitsImpl
<
MType
,
VType
,
GridGeometry
,
GridGeometry
::
discMethod
>
;
//! NonoverlappingSolverTraits used by discretization with non-overlapping parallel model
template
<
class
MType
,
class
VType
,
bool
isParallel
>
class
NonoverlappingSolverTraits
{
public:
using
Comm
=
Dune
::
Amg
::
SequentialInformation
;
using
LinearOperator
=
Dune
::
MatrixAdapter
<
MType
,
VType
,
VType
>
;
using
ScalarProduct
=
Dune
::
SeqScalarProduct
<
VType
>
;
using
Smoother
=
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
;
};
#if HAVE_MPI
template
<
class
MType
,
class
VType
>
class
NonoverlappingSolverTraits
<
MType
,
VType
,
true
>
{
public:
using
Comm
=
Dune
::
OwnerOverlapCopyCommunication
<
Dune
::
bigunsignedint
<
96
>
,
int
>
;
using
LinearOperator
=
Dune
::
NonoverlappingSchwarzOperator
<
MType
,
VType
,
VType
,
Comm
>
;
using
ScalarProduct
=
Dune
::
NonoverlappingSchwarzScalarProduct
<
VType
,
Comm
>
;
using
Smoother
=
Dune
::
NonoverlappingBlockPreconditioner
<
Comm
,
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
>
;
};
#endif
//! Box: use non-overlapping model
template
<
class
Matrix
,
class
Vector
,
class
GridGeometry
>
struct
LinearSolverTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
box
>
{
using
Grid
=
typename
GridGeometry
::
GridView
::
Traits
::
Grid
;
enum
{
dofCodim
=
Grid
::
dimension
,
isNonOverlapping
=
true
,
// TODO: see above for description of this workaround, remove second line if fixed upstream
isParallel
=
Dune
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
||
Dumux
::
Temp
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
};
using
MType
=
Matrix
;
using
VType
=
Dune
::
BlockVector
<
Dune
::
FieldVector
<
typename
Vector
::
block_type
::
value_type
,
Vector
::
block_type
::
dimension
>>
;
using
SolverTraits
=
NonoverlappingSolverTraits
<
MType
,
VType
,
isParallel
>
;
using
Comm
=
typename
SolverTraits
::
Comm
;
using
LinearOperator
=
typename
SolverTraits
::
LinearOperator
;
using
ScalarProduct
=
typename
SolverTraits
::
ScalarProduct
;
using
Smoother
=
typename
SolverTraits
::
Smoother
;
using
DofMapper
=
typename
GridGeometry
::
VertexMapper
;
};
//! OverlappingSolverTraits used by discretization with overlapping parallel model
template
<
class
MType
,
class
VType
,
bool
isParallel
>
class
OverlappingSolverTraits
{
public:
using
Comm
=
Dune
::
Amg
::
SequentialInformation
;
using
LinearOperator
=
Dune
::
MatrixAdapter
<
MType
,
VType
,
VType
>
;
using
ScalarProduct
=
Dune
::
SeqScalarProduct
<
VType
>
;
using
Smoother
=
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
;
};
#if HAVE_MPI
template
<
class
MType
,
class
VType
>
class
OverlappingSolverTraits
<
MType
,
VType
,
true
>
{
public:
using
Comm
=
Dune
::
OwnerOverlapCopyCommunication
<
Dune
::
bigunsignedint
<
96
>
,
int
>
;
using
LinearOperator
=
Dune
::
OverlappingSchwarzOperator
<
MType
,
VType
,
VType
,
Comm
>
;
using
ScalarProduct
=
Dune
::
OverlappingSchwarzScalarProduct
<
VType
,
Comm
>
;
using
Smoother
=
Dune
::
BlockPreconditioner
<
VType
,
VType
,
Comm
,
Dune
::
SeqSSOR
<
MType
,
VType
,
VType
>
>
;
};
#endif
//! Cell-centered tpfa: use overlapping model
template
<
class
Matrix
,
class
Vector
,
class
GridGeometry
>
struct
LinearSolverTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
cctpfa
>
{
using
Grid
=
typename
GridGeometry
::
GridView
::
Traits
::
Grid
;
enum
{
dofCodim
=
0
,
isNonOverlapping
=
false
,
// TODO: see above for description of this workaround, remove second line if fixed upstream
isParallel
=
Dune
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
||
Dumux
::
Temp
::
Capabilities
::
canCommunicate
<
Grid
,
dofCodim
>::
v
};
using
MType
=
Matrix
;
using
VType
=
Dune
::
BlockVector
<
Dune
::
FieldVector
<
typename
Vector
::
block_type
::
value_type
,
Vector
::
block_type
::
dimension
>>
;
using
SolverTraits
=
OverlappingSolverTraits
<
MType
,
VType
,
isParallel
>
;
using
Comm
=
typename
SolverTraits
::
Comm
;
using
LinearOperator
=
typename
SolverTraits
::
LinearOperator
;
using
ScalarProduct
=
typename
SolverTraits
::
ScalarProduct
;
using
Smoother
=
typename
SolverTraits
::
Smoother
;
using
DofMapper
=
typename
GridGeometry
::
ElementMapper
;
};
template
<
class
Matrix
,
class
Vector
,
class
GridGeometry
>
struct
LinearSolverTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
ccmpfa
>
:
public
LinearSolverTraitsImpl
<
Matrix
,
Vector
,
GridGeometry
,
DiscretizationMethod
::
cctpfa
>
{};
}
// end namespace Dumux
#endif // DUMUX_LINEAR_SOLVER_TRAITS_HH
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