Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
operator_solve
client_support
Thyra_LinearOpWithSolveHelpers.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_LINEAR_OP_WITH_SOLVE_FACTORY_SUBCLASS_HELPERS_HPP
11
#define THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_SUBCLASS_HELPERS_HPP
12
13
14
#include "Thyra_LinearOpWithSolveBase.hpp"
15
#include "Teuchos_toString.hpp"
16
17
18
namespace
Thyra {
19
20
28
template
<
class
Scalar>
29
void
assertSolveSupports
(
30
const
LinearOpWithSolveBase<Scalar>
&lows,
31
const
EOpTransp M_trans,
32
const
Ptr
<
const
SolveCriteria<Scalar>
> solveCriteria = Teuchos::null
33
);
34
42
template
<
class
Scalar>
43
void
assertSupportsSolveMeasureType(
44
const
LinearOpWithSolveBase<Scalar>
&lows,
45
const
EOpTransp M_trans,
46
const
SolveMeasureType
&solveMeasureType
47
);
48
// 2010/08/22: rabartl: ToDo: Deprecate this bug 4915 is finished!
49
50
}
// namespace Thyra
51
52
53
//
54
// Implementations
55
//
56
57
58
template
<
class
Scalar>
59
void
Thyra::assertSolveSupports
(
60
const
LinearOpWithSolveBase<Scalar>
&lows,
61
const
EOpTransp M_trans,
62
const
Ptr
<
const
SolveCriteria<Scalar>
> solveCriteria
63
)
64
{
65
using
Teuchos::toString
;
66
TEUCHOS_TEST_FOR_EXCEPTION
(
67
!lows.
solveSupports
(M_trans, solveCriteria),
68
std::logic_error,
69
"Error, the LinearOpWithSolve object \""
<< lows.
description
() <<
"\"\n"
70
"for M_trans = "
<<
toString
(M_trans) <<
" does not support the solve"
71
" criteria = "
72
<< ( nonnull(solveCriteria) ?
toString
(*solveCriteria) : std::string(
"null"
) )
73
<<
"!"
74
);
75
}
76
// 2010/08/22: rabartl: Bug 4915 ToDo: Move the above into the NIV function
77
// solve(...).
78
79
template
<
class
Scalar>
80
void
Thyra::assertSupportsSolveMeasureType(
81
const
LinearOpWithSolveBase<Scalar>
&lows,
82
const
EOpTransp M_trans,
83
const
SolveMeasureType
&solveMeasureType
84
)
85
{
86
TEUCHOS_TEST_FOR_EXCEPTION
(
87
!
solveSupportsSolveMeasureType
(lows,M_trans,solveMeasureType),
88
std::logic_error,
89
"Error, the LinearOpWithSolve object \""
<< lows.
description
() <<
"\"\n"
90
"for M_trans = "
<<
toString
(M_trans) <<
" does not support the solve"
91
" measure = "
92
<<
toString
(solveMeasureType.
numerator
)
93
<<
"/"
94
<<
toString
(solveMeasureType.
denominator
)
95
<<
"!"
96
);
97
}
98
99
#endif
// THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_SUBCLASS_HELPERS_HPP
Teuchos::Describable::description
virtual std::string description() const
Teuchos::Ptr
Thyra::LinearOpWithSolveBase
Base class for all linear operators that can support a high-level solve operation.
Definition
Thyra_LinearOpWithSolveBase_decl.hpp:279
Thyra::LinearOpWithSolveBase::assertSolveSupports
void assertSolveSupports(const LinearOpWithSolveBase< Scalar > &lows, const EOpTransp M_trans, const Ptr< const SolveCriteria< Scalar > > solveCriteria=Teuchos::null)
Assert that a LOWSB object supports a particular solve type.
Definition
Thyra_LinearOpWithSolveHelpers.hpp:59
Thyra::LinearOpWithSolveBase::solveSupportsSolveMeasureType
bool solveSupportsSolveMeasureType(const LinearOpWithSolveBase< Scalar > &A, const EOpTransp transp, const SolveMeasureType &solveMeasureType)
Call solveSupportsSolveMeasureType() as a non-member function.
Definition
Thyra_LinearOpWithSolveBase_decl.hpp:507
Thyra::LinearOpWithSolveBase::solveSupports
bool solveSupports(EOpTransp transp) const
Return if solve() supports the argument transp.
Definition
Thyra_LinearOpWithSolveBase_decl.hpp:350
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Thyra::toString
const char * toString(EOpTransp transp)
Return a string name for a EOpTransp value.
Definition
Thyra_OperatorVectorTypes.hpp:149
Teuchos::toString
std::string toString(const T &t)
Thyra::SolveCriteria
Simple struct that defines the requested solution criteria for a solve.
Definition
Thyra_SolveSupportTypes.hpp:280
Thyra::SolveMeasureType
Solve tolerance type.
Definition
Thyra_SolveSupportTypes.hpp:80
Thyra::SolveMeasureType::numerator
ESolveMeasureNormType numerator
Definition
Thyra_SolveSupportTypes.hpp:82
Thyra::SolveMeasureType::denominator
ESolveMeasureNormType denominator
Definition
Thyra_SolveSupportTypes.hpp:84
Generated by
1.17.0