MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_TransPFactory_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_TRANSPFACTORY_DEF_HPP
11
#define MUELU_TRANSPFACTORY_DEF_HPP
12
13
#include <Teuchos_ParameterList.hpp>
14
#include <Teuchos_Time.hpp>
15
16
#include <Xpetra_Matrix.hpp>
17
18
#include "
MueLu_TransPFactory_decl.hpp
"
19
20
#include "
MueLu_Monitor.hpp
"
21
#include "MueLu_PerfUtils.hpp"
22
#include "MueLu_Utilities.hpp"
23
24
namespace
MueLu
{
25
26
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
27
RCP<const ParameterList>
TransPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::GetValidParameterList
()
const
{
28
RCP<ParameterList> validParamList = rcp(
new
ParameterList());
29
validParamList->set<RCP<const FactoryBase> >(
"P"
, Teuchos::null,
"Generating factory of the matrix P"
);
30
31
// Make sure we don't recursively validate options for the matrixmatrix kernels
32
ParameterList norecurse;
33
norecurse.disableRecursiveValidation();
34
validParamList->set<ParameterList>(
"matrixmatrix: kernel params"
, norecurse,
"MatrixMatrix kernel parameters"
);
35
36
return
validParamList;
37
}
38
39
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
40
void
TransPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::DeclareInput
(
Level
&
/* fineLevel */
,
Level
& coarseLevel)
const
{
41
Input
(coarseLevel,
"P"
);
42
}
43
44
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
45
void
TransPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Build
(
Level
&
/* fineLevel */
,
Level
& coarseLevel)
const
{
46
FactoryMonitor
m(*
this
,
"Transpose P"
, coarseLevel);
47
std::string label =
"MueLu::TransP-"
+ Teuchos::toString(coarseLevel.
GetLevelID
());
48
49
RCP<Matrix> P =
Get<RCP<Matrix>
>(coarseLevel,
"P"
);
50
// If we failed to create a valid P (e.g., # of global aggregates is zero), then we just bail here
51
// This level will ultimately be removed in MueLu_Hierarchy_defs.h via a resize()
52
if
(P == Teuchos::null)
return
;
53
54
const
Teuchos::ParameterList& pL =
GetParameterList
();
55
56
// Reuse pattern if available (multiple solve)
57
RCP<ParameterList> Tparams;
58
if
(pL.isSublist(
"matrixmatrix: kernel params"
))
59
Tparams = rcp(
new
ParameterList(pL.sublist(
"matrixmatrix: kernel params"
)));
60
else
61
Tparams = rcp(
new
ParameterList);
62
63
// By default, we don't need global constants for transpose
64
Tparams->set(
"compute global constants: temporaries"
, Tparams->get(
"compute global constants: temporaries"
,
false
));
65
Tparams->set(
"compute global constants"
, Tparams->get(
"compute global constants"
,
false
));
66
67
RCP<Matrix> R =
Utilities::Transpose
(*P,
true
, label, Tparams);
68
69
if
(
IsPrint
(
Statistics2
)) {
70
RCP<ParameterList> params = rcp(
new
ParameterList());
71
params->set(
"printLoadBalancingInfo"
,
true
);
72
params->set(
"printCommInfo"
,
true
);
73
GetOStream
(
Statistics2
) <<
PerfUtils::PrintMatrixInfo
(*R,
"R"
, params);
74
}
75
76
Set
(coarseLevel,
"R"
, R);
77
79
if
(P->IsView(
"stridedMaps"
))
80
R->CreateView(
"stridedMaps"
, P,
true
);
82
}
83
84
}
// namespace MueLu
85
86
#endif
// MUELU_TRANSPFACTORY_DEF_HPP
MueLu_Monitor.hpp
MueLu_TransPFactory_decl.hpp
MueLu::Factory::Input
void Input(Level &level, const std::string &varName) const
Definition
MueLu_Factory.cpp:72
MueLu::Factory::Get
T Get(Level &level, const std::string &varName) const
Definition
MueLu_Factory.hpp:69
MueLu::Factory::Set
void Set(Level &level, const std::string &varName, const T &data) const
Definition
MueLu_Factory.hpp:80
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::Level::GetLevelID
int GetLevelID() const
Return level number.
Definition
MueLu_Level.cpp:51
MueLu::ParameterListAcceptorImpl::GetParameterList
virtual const Teuchos::ParameterList & GetParameterList() const
Definition
MueLu_ParameterListAcceptor.cpp:50
MueLu::PerfUtils::PrintMatrixInfo
static std::string PrintMatrixInfo(const Matrix &A, const std::string &msgTag, RCP< const Teuchos::ParameterList > params=Teuchos::null)
Definition
MueLu_PerfUtils_def.hpp:92
MueLu::TransPFactory::DeclareInput
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
Definition
MueLu_TransPFactory_def.hpp:40
MueLu::TransPFactory::GetValidParameterList
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Definition
MueLu_TransPFactory_def.hpp:27
MueLu::TransPFactory::Build
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
Definition
MueLu_TransPFactory_def.hpp:45
MueLu::Utilities::Transpose
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Transpose(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, bool optimizeTranspose=false, const std::string &label=std::string(), const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Definition
MueLu_Utilities_def.hpp:50
MueLu::VerboseObject::GetOStream
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
Definition
MueLu_VerboseObject.cpp:72
MueLu::VerboseObject::IsPrint
bool IsPrint(MsgType type, int thisProcRankOnly=-1) const
Find out whether we need to print out information for a specific message type.
Definition
MueLu_VerboseObject.cpp:68
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
Generic
MueLu_TransPFactory_def.hpp
Generated by
1.17.0