Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
interfaces
operator_vector
extended
Thyra_ScaledAdjointLinearOpBase_def.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
4
//
5
// Copyright 2004 NTESS and the Thyra contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef THYRA_SCALED_ADJOINT_LINEAR_OP_BASE_HPP
11
#define THYRA_SCALED_ADJOINT_LINEAR_OP_BASE_HPP
12
13
#include "Thyra_ScaledAdjointLinearOpBase_decl.hpp"
14
#include "Thyra_LinearOpBase.hpp"
15
16
17
template
<
class
Scalar>
18
void
Thyra::unwrap
(
19
const
LinearOpBase<Scalar>
&Op,
20
Scalar *scalar,
21
EOpTransp *transp,
22
const
LinearOpBase<Scalar>
* *origOp
23
)
24
{
25
#ifdef TEUCHOS_DEBUG
26
TEUCHOS_TEST_FOR_EXCEPT
( scalar==NULL );
27
TEUCHOS_TEST_FOR_EXCEPT
( transp==NULL );
28
TEUCHOS_TEST_FOR_EXCEPT
( origOp==NULL );
29
#endif
30
typedef
Teuchos::ScalarTraits<Scalar>
ST;
31
const
ScaledAdjointLinearOpBase<Scalar>
32
*saOp =
dynamic_cast<
const
ScaledAdjointLinearOpBase<Scalar>
*
>
(&Op);
33
if
(saOp) {
34
*scalar = saOp->
overallScalar
();
35
*transp = saOp->
overallTransp
();
36
*origOp = &*saOp->
getOrigOp
();
37
}
38
else
{
39
*scalar = ST::one();
40
*transp =
NOTRANS
;
41
*origOp = &Op;
42
}
43
}
44
45
46
template
<
class
Scalar>
47
void
Thyra::unwrap
(
48
const
RCP<
const
LinearOpBase<Scalar> > &Op,
49
Scalar *scalar,
50
EOpTransp *transp,
51
RCP<
const
LinearOpBase<Scalar> > *origOp
52
)
53
{
54
#ifdef TEUCHOS_DEBUG
55
TEUCHOS_TEST_FOR_EXCEPT
( scalar==NULL );
56
TEUCHOS_TEST_FOR_EXCEPT
( transp==NULL );
57
TEUCHOS_TEST_FOR_EXCEPT
( origOp==NULL );
58
#endif
59
typedef
Teuchos::ScalarTraits<Scalar>
ST;
60
RCP<const ScaledAdjointLinearOpBase<Scalar> >
61
saOp = Teuchos::rcp_dynamic_cast<const ScaledAdjointLinearOpBase<Scalar> >(Op);
62
if
(saOp.get()) {
63
*scalar = saOp->overallScalar();
64
*transp = saOp->overallTransp();
65
*origOp = saOp->getOrigOp();
66
}
67
else
{
68
*scalar = ST::one();
69
*transp =
NOTRANS
;
70
*origOp = Op;
71
}
72
}
73
74
75
//
76
// Explicit instant macro
77
//
78
79
#define THYRA_SCALED_ADJOINT_LINEAR_OP_BASE_INSTANT(SCALAR) \
80
\
81
template void unwrap( \
82
const LinearOpBase<SCALAR > &Op, \
83
SCALAR *scalar, \
84
EOpTransp *transp, \
85
const LinearOpBase<SCALAR >* *origOp \
86
); \
87
\
88
template void unwrap( \
89
const RCP<const LinearOpBase<SCALAR > > &Op, \
90
SCALAR *scalar, \
91
EOpTransp *transp, \
92
RCP<const LinearOpBase<SCALAR > > *origOp \
93
);
94
95
96
#endif
// THYRA_SCALED_ADJOINT_LINEAR_OP_BASE_HPP
Thyra::LinearOpBase
Base class for all linear operators.
Definition
Thyra_LinearOpBase_decl.hpp:159
Thyra::ScaledAdjointLinearOpBase
Base class for LinearOpBase decorator subclasses that wrap a LinearOpBase object and adds on an extra...
Definition
Thyra_ScaledAdjointLinearOpBase_decl.hpp:41
Thyra::ScaledAdjointLinearOpBase::overallScalar
virtual Scalar overallScalar() const =0
Return the overall scale factor.
Thyra::ScaledAdjointLinearOpBase::getOrigOp
virtual RCP< const LinearOpBase< Scalar > > getOrigOp() const =0
Return the const original linear operator origOp.
Thyra::ScaledAdjointLinearOpBase::overallTransp
virtual EOpTransp overallTransp() const =0
Return the overall transpose (adjoint) enum.
TEUCHOS_TEST_FOR_EXCEPT
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Thyra::unwrap
void unwrap(const LinearOpBase< Scalar > &Op, Scalar *scalar, EOpTransp *transp, const LinearOpBase< Scalar > **origOp)
Extract the overallScalar, overallTransp and const origOp from a const LinearOpBase object.
Definition
Thyra_ScaledAdjointLinearOpBase_def.hpp:18
Thyra::NOTRANS
NOTRANS
Type for the dimension of a vector space. `**/ typedef Teuchos::Ordinal Ordinal;.
Definition
Thyra_OperatorVectorTypes.hpp:130
Teuchos::ScalarTraits
Generated by
1.17.0