Teko
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Teko_ReorderedLinearOp.cpp
1
// @HEADER
2
// *****************************************************************************
3
// Teko: A package for block and physics based preconditioning
4
//
5
// Copyright 2010 NTESS and the Teko contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#include "Teko_ReorderedLinearOp.hpp"
11
12
namespace
Teko {
13
14
ReorderedLinearOp::ReorderedLinearOp(
const
Teuchos::RCP<const BlockReorderManager>& mgr,
15
const
Teuchos::RCP<Thyra::LinearOpBase<double> >& blockedOp)
16
: mgr_(mgr), blockedOp_(blockedOp) {
17
range_ = buildFlatVectorSpace(*mgr_, blockedOp_->range());
18
domain_ = buildFlatVectorSpace(*mgr_, blockedOp_->domain());
19
}
20
21
VectorSpace
ReorderedLinearOp::range
()
const
{
return
range_; }
22
23
VectorSpace
ReorderedLinearOp::domain
()
const
{
return
domain_; }
24
25
void
ReorderedLinearOp::implicitApply
(
const
MultiVector& x, MultiVector& y,
const
double
alpha,
26
const
double
beta)
const
{
27
using
Teuchos::rcp_dynamic_cast;
28
29
Teuchos::RCP<const Thyra::MultiVectorBase<double> > reorderX = Teko::buildReorderedMultiVector(
30
*mgr_, rcp_dynamic_cast<
const
Thyra::ProductMultiVectorBase<double> >(x));
31
MultiVector reorderY = Teko::buildReorderedMultiVector(
32
*mgr_, rcp_dynamic_cast<Thyra::ProductMultiVectorBase<double> >(y));
33
34
// this will automatically fill the right data
35
Thyra::apply(*blockedOp_, Thyra::NOTRANS, *reorderX, reorderY.ptr(), alpha, beta);
36
}
37
38
void
ReorderedLinearOp::describe(Teuchos::FancyOStream& out_arg,
39
const
Teuchos::EVerbosityLevel verbLevel)
const
{
40
using
Teuchos::OSTab;
41
using
Teuchos::RCP;
42
43
RCP<Teuchos::FancyOStream> out = rcp(&out_arg,
false
);
44
OSTab tab(out);
45
switch
(verbLevel) {
46
case
Teuchos::VERB_DEFAULT:
47
case
Teuchos::VERB_LOW: *out << this->description() << std::endl;
break
;
48
case
Teuchos::VERB_MEDIUM:
49
case
Teuchos::VERB_HIGH:
50
case
Teuchos::VERB_EXTREME: {
51
*out << Teuchos::Describable::description() <<
"{"
52
<<
"rangeDim="
<< this->range()->dim() <<
",domainDim="
<< this->domain()->dim()
53
<<
"}\n"
;
54
{
55
OSTab tab2(out);
56
*out <<
"[Blocked Op] = "
;
57
*out << Teuchos::describe(*blockedOp_, verbLevel);
58
}
59
{
60
OSTab tab2(out);
61
*out <<
"[Blocked Manager] = "
;
62
*out << mgr_->toString() << std::endl;
63
}
64
break
;
65
}
66
default
: TEUCHOS_TEST_FOR_EXCEPT(
true
);
// Should never get here!
67
}
68
}
69
70
}
// end namespace Teko
Teko::ReorderedLinearOp::domain
virtual VectorSpace domain() const
Domain space of this operator.
Definition
Teko_ReorderedLinearOp.cpp:23
Teko::ReorderedLinearOp::implicitApply
virtual void implicitApply(const MultiVector &x, MultiVector &y, const double alpha=1.0, const double beta=0.0) const
Perform a matrix vector multiply with this implicitly defined blocked operator.
Definition
Teko_ReorderedLinearOp.cpp:25
Teko::ReorderedLinearOp::range
virtual VectorSpace range() const
Range space of this operator.
Definition
Teko_ReorderedLinearOp.cpp:21
Generated by
1.17.0