MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_PreDropFunctionConstVal_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_PREDROPFUNCTIONCONSTVAL_DEF_HPP
11
#define MUELU_PREDROPFUNCTIONCONSTVAL_DEF_HPP
12
13
#include <Xpetra_CrsGraphFactory.hpp>
14
15
#include "
MueLu_PreDropFunctionConstVal_decl.hpp
"
16
#include "Teuchos_ScalarTraits.hpp"
17
18
namespace
MueLu
{
19
20
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
21
PreDropFunctionConstVal<Scalar, LocalOrdinal, GlobalOrdinal, Node>::PreDropFunctionConstVal
(
const
Scalar
threshold)
22
:
threshold_
(threshold) {}
23
24
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
25
bool
PreDropFunctionConstVal<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Drop
(
size_t
/* lrow */
,
GlobalOrdinal
grow,
size_t
k,
LocalOrdinal
/* lcid */
,
GlobalOrdinal
gcid,
const
Teuchos::ArrayView<const LocalOrdinal>&
/* indices */
,
const
Teuchos::ArrayView<const Scalar>& vals) {
26
if
(Teuchos::ScalarTraits<Scalar>::magnitude(vals[k]) > Teuchos::ScalarTraits<Scalar>::magnitude(
threshold_
) || grow == gcid) {
27
return
false
;
// keep values
28
}
29
return
true
;
// values too small -> drop them
30
}
31
32
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
33
Scalar
PreDropFunctionConstVal<Scalar, LocalOrdinal, GlobalOrdinal, Node>::GetThreshold
()
const
{
34
return
threshold_
;
35
}
36
37
template
<
class
Scalar,
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
38
std::string
PreDropFunctionConstVal<Scalar, LocalOrdinal, GlobalOrdinal, Node>::description
()
const
{
39
std::ostringstream out;
40
out <<
"PreDropFunctionConstVal: threshold = "
<<
threshold_
<< std::endl;
41
return
out.str();
42
}
43
44
/*template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
45
void PreDropFunctionConstVal<Scalar, LocalOrdinal, GlobalOrdinal, Node>::describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel) const {
46
MUELU_DESCRIBE;
47
if (verbLevel & Parameters0) {
48
out0 << "PreDropFunctionConstVal: threshold = " << threshold_ << std::endl;
49
}
50
}*/
51
52
}
// namespace MueLu
53
54
#define MUELU_PREDROPFUNCTIONCONSTVAL_SHORT
55
#endif
// MUELU_PREDROPFUNCTIONCONSTVAL_DEF_HPP
MueLu_PreDropFunctionConstVal_decl.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
MueLu::PreDropFunctionConstVal::threshold_
Scalar threshold_
Print the object with some verbosity level to an FancyOStream object.
Definition
MueLu_PreDropFunctionConstVal_decl.hpp:66
MueLu::PreDropFunctionConstVal::PreDropFunctionConstVal
PreDropFunctionConstVal(const Scalar threshold=0.0)
Constructor.
Definition
MueLu_PreDropFunctionConstVal_def.hpp:21
MueLu::PreDropFunctionConstVal::GetThreshold
Scalar GetThreshold() const
Return threshold value.
Definition
MueLu_PreDropFunctionConstVal_def.hpp:33
MueLu::PreDropFunctionConstVal::description
std::string description() const
Return a simple one-line description of this object.
Definition
MueLu_PreDropFunctionConstVal_def.hpp:38
MueLu::PreDropFunctionConstVal::Drop
bool Drop(size_t lrow, GlobalOrdinal grow, size_t k, LocalOrdinal lcid, GlobalOrdinal gcid, const Teuchos::ArrayView< const LocalOrdinal > &indices, const Teuchos::ArrayView< const Scalar > &vals)
Definition
MueLu_PreDropFunctionConstVal_def.hpp:25
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:42
src
Graph
MatrixTransformation
MueLu_PreDropFunctionConstVal_def.hpp
Generated by
1.17.0