MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_BrickAggregationFactory_decl.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// MueLu: A package for multigrid based preconditioning
4
//
5
// Copyright 2012 NTESS and the MueLu contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef MUELU_BRICKAGGREGATIONFACTORY_DECL_HPP_
11
#define MUELU_BRICKAGGREGATIONFACTORY_DECL_HPP_
12
13
#include "
MueLu_ConfigDefs.hpp
"
14
15
#include <Xpetra_Import_fwd.hpp>
16
#include <Xpetra_ImportFactory_fwd.hpp>
17
#include <Xpetra_Map_fwd.hpp>
18
#include <Xpetra_MapFactory_fwd.hpp>
19
#include <Xpetra_Matrix_fwd.hpp>
20
#include <Xpetra_MultiVector_fwd.hpp>
21
#include <Xpetra_MultiVectorFactory_fwd.hpp>
22
23
#include "
MueLu_SingleLevelFactoryBase.hpp
"
24
#include "
MueLu_BrickAggregationFactory_fwd.hpp
"
25
26
#include "
MueLu_LWGraph_fwd.hpp
"
27
28
#include "
MueLu_LWGraph_fwd.hpp
"
29
#include "
MueLu_Level_fwd.hpp
"
30
#include "
MueLu_Aggregates_fwd.hpp
"
31
#include "
MueLu_Exceptions.hpp
"
32
#include "
MueLu_Utilities_fwd.hpp
"
33
41
42
namespace
MueLu
{
43
44
template
<
class
Scalar
=
DefaultScalar
,
45
class
LocalOrdinal
=
DefaultLocalOrdinal
,
46
class
GlobalOrdinal
=
DefaultGlobalOrdinal
,
47
class
Node
=
DefaultNode
>
48
class
BrickAggregationFactory
:
public
SingleLevelFactoryBase
{
49
#undef MUELU_BRICKAGGREGATIONFACTORY_SHORT
50
#include "
MueLu_UseShortNames.hpp
"
51
private
:
52
typedef
Teuchos::ScalarTraits<Scalar>
STS
;
53
54
// Comparator for doubles
55
// Generally, the coordinates for coarser levels would come out of averaging of fine level coordinates
56
// It is possible that the result of the averaging differs slightly between clusters, as we might have
57
// 3x2 and 2x2 cluster which would result in averaging 6 and 4 y-coordinates respectively, leading to
58
// slightly different results.
59
// Therefore, we hardcode a constant so that close points are considered the same.
60
class
compare
{
61
public
:
62
bool
operator()
(
const
Scalar
& x,
const
Scalar
& y)
const
{
63
if
(STS::magnitude(x - y) < 1e-14)
64
return
false
;
65
return
STS::real(x) < STS::real(y);
66
}
67
};
68
typedef
std::map<Scalar, GlobalOrdinal, compare>
container
;
69
70
public
:
72
73
75
BrickAggregationFactory
()
76
:
nDim_
(-1)
77
,
nx_
(-1)
78
,
ny_
(-1)
79
,
nz_
(-1)
80
,
bx_
(-1)
81
,
by_
(-1)
82
,
bz_
(-1){};
83
85
virtual
~BrickAggregationFactory
() {}
86
87
RCP<const ParameterList>
GetValidParameterList
()
const
;
88
90
91
// Options shared by all aggregation algorithms
92
94
95
96
void
DeclareInput
(
Level
& currentLevel)
const
;
97
99
101
102
104
void
Build
(
Level
& currentLevel)
const
;
105
107
108
private
:
109
void
Setup
(
const
RCP<
const
Teuchos::Comm<int>
>& comm,
const
RCP<Xpetra::MultiVector<
typename
Teuchos::ScalarTraits<Scalar>::magnitudeType, LO, GO, NO> >& coords,
const
RCP<const Map>& map)
const
;
110
RCP<container>
Construct1DMap
(
const
RCP<
const
Teuchos::Comm<int>
>& comm,
const
ArrayRCP<
const
typename
Teuchos::ScalarTraits<Scalar>::magnitudeType>& x)
const
;
111
112
void
BuildGraph
(
Level
& currentLevel,
const
RCP<Matrix>& A)
const
;
113
114
bool
isDirichlet
(
LocalOrdinal
LID)
const
;
115
bool
isRoot
(
LocalOrdinal
LID)
const
;
116
GlobalOrdinal
getRoot
(
LocalOrdinal
LID)
const
;
117
GlobalOrdinal
getAggGID
(
LocalOrdinal
LID)
const
;
118
119
void
getIJK
(
LocalOrdinal
LID,
int
& i,
int
& j,
int
& k)
const
;
120
void
getAggIJK
(
LocalOrdinal
LID,
int
& i,
int
& j,
int
& k)
const
;
121
122
mutable
int
nDim_
;
123
mutable
RCP<container>
xMap_
,
yMap_
,
zMap_
;
124
mutable
ArrayRCP<const typename Teuchos::ScalarTraits<Scalar>::magnitudeType>
x_
,
y_
,
z_
;
125
mutable
int
nx_
,
ny_
,
nz_
;
126
mutable
int
bx_
,
by_
,
bz_
;
127
mutable
bool
dirichletX_
,
dirichletY_
,
dirichletZ_
;
128
mutable
int
naggx_
,
naggy_
,
naggz_
;
129
130
mutable
std::map<GlobalOrdinal, GlobalOrdinal>
revMap_
;
131
};
// class BrickAggregationFactory
132
133
}
// namespace MueLu
134
135
#define MUELU_BRICKAGGREGATIONFACTORY_SHORT
136
#endif
/* MUELU_BRICKAGGREGATIONFACTORY_DECL_HPP_ */
MueLu_Aggregates_fwd.hpp
MueLu_BrickAggregationFactory_fwd.hpp
MueLu_ConfigDefs.hpp
MueLu_Exceptions.hpp
MueLu_LWGraph_fwd.hpp
MueLu_Level_fwd.hpp
MueLu_SingleLevelFactoryBase.hpp
LocalOrdinal
MueLu::DefaultLocalOrdinal LocalOrdinal
Definition
MueLu_UseDefaultTypes.hpp:13
Scalar
MueLu::DefaultScalar Scalar
Definition
MueLu_UseDefaultTypes.hpp:12
GlobalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Definition
MueLu_UseDefaultTypes.hpp:14
Node
MueLu::DefaultNode Node
Definition
MueLu_UseDefaultTypes.hpp:15
MueLu_UseShortNames.hpp
MueLu_Utilities_fwd.hpp
MueLu::BrickAggregationFactory::compare
Definition
MueLu_BrickAggregationFactory_decl.hpp:60
MueLu::BrickAggregationFactory::compare::operator()
bool operator()(const Scalar &x, const Scalar &y) const
Definition
MueLu_BrickAggregationFactory_decl.hpp:62
MueLu::BrickAggregationFactory::Setup
void Setup(const RCP< const Teuchos::Comm< int > > &comm, const RCP< Xpetra::MultiVector< typename Teuchos::ScalarTraits< Scalar >::magnitudeType, LO, GO, NO > > &coords, const RCP< const Map > &map) const
Definition
MueLu_BrickAggregationFactory_def.hpp:252
MueLu::BrickAggregationFactory::by_
int by_
Definition
MueLu_BrickAggregationFactory_decl.hpp:126
MueLu::BrickAggregationFactory::x_
ArrayRCP< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > x_
Definition
MueLu_BrickAggregationFactory_decl.hpp:124
MueLu::BrickAggregationFactory::bz_
int bz_
Definition
MueLu_BrickAggregationFactory_decl.hpp:126
MueLu::BrickAggregationFactory::container
std::map< Scalar, GlobalOrdinal, compare > container
Definition
MueLu_BrickAggregationFactory_decl.hpp:68
MueLu::BrickAggregationFactory::getRoot
GlobalOrdinal getRoot(LocalOrdinal LID) const
Definition
MueLu_BrickAggregationFactory_def.hpp:374
MueLu::BrickAggregationFactory::naggx_
int naggx_
Definition
MueLu_BrickAggregationFactory_decl.hpp:128
MueLu::BrickAggregationFactory::isDirichlet
bool isDirichlet(LocalOrdinal LID) const
Definition
MueLu_BrickAggregationFactory_def.hpp:359
MueLu::BrickAggregationFactory::yMap_
RCP< container > yMap_
Definition
MueLu_BrickAggregationFactory_decl.hpp:123
MueLu::BrickAggregationFactory::dirichletY_
bool dirichletY_
Definition
MueLu_BrickAggregationFactory_decl.hpp:127
MueLu::BrickAggregationFactory::GetValidParameterList
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Definition
MueLu_BrickAggregationFactory_def.hpp:40
MueLu::BrickAggregationFactory::~BrickAggregationFactory
virtual ~BrickAggregationFactory()
Destructor.
Definition
MueLu_BrickAggregationFactory_decl.hpp:85
MueLu::BrickAggregationFactory::ny_
int ny_
Definition
MueLu_BrickAggregationFactory_decl.hpp:125
MueLu::BrickAggregationFactory::dirichletZ_
bool dirichletZ_
Definition
MueLu_BrickAggregationFactory_decl.hpp:127
MueLu::BrickAggregationFactory::y_
ArrayRCP< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > y_
Definition
MueLu_BrickAggregationFactory_decl.hpp:124
MueLu::BrickAggregationFactory::z_
ArrayRCP< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > z_
Definition
MueLu_BrickAggregationFactory_decl.hpp:124
MueLu::BrickAggregationFactory::getAggGID
GlobalOrdinal getAggGID(LocalOrdinal LID) const
Definition
MueLu_BrickAggregationFactory_def.hpp:419
MueLu::BrickAggregationFactory::DeclareInput
void DeclareInput(Level ¤tLevel) const
Input.
Definition
MueLu_BrickAggregationFactory_def.hpp:58
MueLu::BrickAggregationFactory::Build
void Build(Level ¤tLevel) const
Build aggregates.
Definition
MueLu_BrickAggregationFactory_def.hpp:108
MueLu::BrickAggregationFactory::BuildGraph
void BuildGraph(Level ¤tLevel, const RCP< Matrix > &A) const
Definition
MueLu_BrickAggregationFactory_def.hpp:445
MueLu::BrickAggregationFactory::revMap_
std::map< GlobalOrdinal, GlobalOrdinal > revMap_
Definition
MueLu_BrickAggregationFactory_decl.hpp:130
MueLu::BrickAggregationFactory::bx_
int bx_
Definition
MueLu_BrickAggregationFactory_decl.hpp:126
MueLu::BrickAggregationFactory::nx_
int nx_
Definition
MueLu_BrickAggregationFactory_decl.hpp:125
MueLu::BrickAggregationFactory::Level
MueLu::Level Level
MueLu::BrickAggregationFactory::STS
Teuchos::ScalarTraits< Scalar > STS
Definition
MueLu_BrickAggregationFactory_decl.hpp:52
MueLu::BrickAggregationFactory::getAggIJK
void getAggIJK(LocalOrdinal LID, int &i, int &j, int &k) const
Definition
MueLu_BrickAggregationFactory_def.hpp:399
MueLu::BrickAggregationFactory::nz_
int nz_
Definition
MueLu_BrickAggregationFactory_decl.hpp:125
MueLu::BrickAggregationFactory::zMap_
RCP< container > zMap_
Definition
MueLu_BrickAggregationFactory_decl.hpp:123
MueLu::BrickAggregationFactory::xMap_
RCP< container > xMap_
Definition
MueLu_BrickAggregationFactory_decl.hpp:123
MueLu::BrickAggregationFactory::naggz_
int naggz_
Definition
MueLu_BrickAggregationFactory_decl.hpp:128
MueLu::BrickAggregationFactory::BrickAggregationFactory
BrickAggregationFactory()
Constructor.
Definition
MueLu_BrickAggregationFactory_decl.hpp:75
MueLu::BrickAggregationFactory::Construct1DMap
RCP< container > Construct1DMap(const RCP< const Teuchos::Comm< int > > &comm, const ArrayRCP< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &x) const
Definition
MueLu_BrickAggregationFactory_def.hpp:303
MueLu::BrickAggregationFactory::dirichletX_
bool dirichletX_
Definition
MueLu_BrickAggregationFactory_decl.hpp:127
MueLu::BrickAggregationFactory::isRoot
bool isRoot(LocalOrdinal LID) const
Definition
MueLu_BrickAggregationFactory_def.hpp:351
MueLu::BrickAggregationFactory::getIJK
void getIJK(LocalOrdinal LID, int &i, int &j, int &k) const
Definition
MueLu_BrickAggregationFactory_def.hpp:392
MueLu::BrickAggregationFactory::naggy_
int naggy_
Definition
MueLu_BrickAggregationFactory_decl.hpp:128
MueLu::BrickAggregationFactory::nDim_
int nDim_
Definition
MueLu_BrickAggregationFactory_decl.hpp:122
MueLu::Level
Class that holds all level-specific information.
Definition
MueLu_Level.hpp:63
MueLu::SingleLevelFactoryBase::SingleLevelFactoryBase
SingleLevelFactoryBase()
Constructor.
Teuchos::Comm
Definition
MueLu_Memory.hpp:22
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:42
MueLu::DefaultNode
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Definition
MueLu_Details_DefaultTypes.hpp:32
MueLu::DefaultGlobalOrdinal
int DefaultGlobalOrdinal
Definition
MueLu_Details_DefaultTypes.hpp:29
MueLu::DefaultLocalOrdinal
int DefaultLocalOrdinal
Definition
MueLu_Details_DefaultTypes.hpp:22
MueLu::DefaultScalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
Definition
MueLu_Details_DefaultTypes.hpp:20
src
Graph
BrickAggregation
MueLu_BrickAggregationFactory_decl.hpp
Generated by
1.17.0