MueLu
Version of the Day
Loading...
Searching...
No Matches
MueLu_PatternFactory_def.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_PATTERNFACTORY_DEF_HPP
11
#define MUELU_PATTERNFACTORY_DEF_HPP
12
13
#include <Xpetra_Matrix.hpp>
14
#include <Xpetra_MatrixMatrix.hpp>
15
16
#include "
MueLu_PatternFactory_decl.hpp
"
17
18
#include "
MueLu_MasterList.hpp
"
19
#include "
MueLu_Monitor.hpp
"
20
//#include "MueLu_Utilities.hpp"
21
22
namespace
MueLu
{
23
24
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
25
RCP<const ParameterList>
PatternFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::GetValidParameterList
()
const
{
26
RCP<ParameterList> validParamList = rcp(
new
ParameterList());
27
28
#define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
29
SET_VALID_ENTRY
(
"emin: pattern order"
);
30
#undef SET_VALID_ENTRY
31
32
validParamList->set<RCP<const FactoryBase> >(
"A"
, Teuchos::null,
"Generating factory for the matrix"
);
33
validParamList->set<RCP<const FactoryBase> >(
"P"
, Teuchos::null,
"Generating factory for the matrix providing nonzero graph"
);
34
35
return
validParamList;
36
}
37
38
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
39
void
PatternFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput
(
Level
& fineLevel,
Level
& coarseLevel)
const
{
40
Input(coarseLevel,
"P"
);
41
42
const
ParameterList& pL = GetParameterList();
43
if
(pL.get<
int
>(
"emin: pattern order"
) > 0)
44
Input(fineLevel,
"A"
);
45
}
46
47
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
48
void
PatternFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Build
(
Level
& fineLevel,
Level
& coarseLevel)
const
{
49
FactoryMonitor
m(*
this
,
"Ppattern"
, coarseLevel);
50
51
RCP<Matrix> P = Get<RCP<Matrix> >(coarseLevel,
"P"
);
52
53
const
ParameterList& pL = GetParameterList();
54
int
k = pL.get<
int
>(
"emin: pattern order"
);
55
56
if
(k > 0) {
57
RCP<Matrix> A = Get<RCP<Matrix> >(fineLevel,
"A"
);
58
RCP<Matrix> AP;
59
60
bool
doFillComplete =
true
;
61
bool
optimizeStorage =
true
;
62
63
for
(
int
i = 0; i < k; i++) {
64
AP = Xpetra::MatrixMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Multiply(*A,
false
, *P,
false
, GetOStream(
Statistics2
), doFillComplete, optimizeStorage);
65
P.swap(AP);
66
}
67
}
68
69
Set(coarseLevel,
"Ppattern"
, P->getCrsGraph());
70
}
71
72
}
// namespace MueLu
73
74
#endif
// MUELU_PATTERNFACTORY_DEF_HPP
SET_VALID_ENTRY
#define SET_VALID_ENTRY(name)
MueLu_MasterList.hpp
MueLu_Monitor.hpp
MueLu_PatternFactory_decl.hpp
MueLu::FactoryMonitor
Timer to be used in factories. Similar to Monitor but with additional timers.
Definition
MueLu_Monitor.hpp:165
MueLu::Level
Class that holds all level-specific information.
Definition
MueLu_Level.hpp:63
MueLu::PatternFactory::GetValidParameterList
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Definition
MueLu_PatternFactory_def.hpp:25
MueLu::PatternFactory::DeclareInput
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
Definition
MueLu_PatternFactory_def.hpp:39
MueLu::PatternFactory::Build
void Build(Level &fineLevel, Level &coarseLevel) const
Build method.
Definition
MueLu_PatternFactory_def.hpp:48
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:42
MueLu::Statistics2
@ Statistics2
Print even more statistics.
Definition
MueLu_VerbosityLevel.hpp:35
src
Transfers
Energy-Minimization
MueLu_PatternFactory_def.hpp
Generated by
1.9.8