Belos Version of the Day
Loading...
Searching...
No Matches
BelosTypes.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Belos: Block Linear Solvers Package
4//
5// Copyright 2004-2016 NTESS and the Belos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef BELOS_TYPES_HPP
11#define BELOS_TYPES_HPP
12
18#include "BelosConfigDefs.hpp"
19#include "Teuchos_Assert.hpp"
20#ifdef HAVE_BELOS_DENSEMATRIXKOKKOSDEFAULT
21#include "Kokkos_DualView.hpp"
22#include "KokkosKernels_ArithTraits.hpp"
23#else
24#include "Teuchos_SerialDenseMatrix.hpp"
25#endif
26
27#ifdef HAVE_BELOS_TPETRA
28#include "Tpetra_MultiVector.hpp"
29#endif
30
31namespace Belos {
32
34
35
38 class BelosError : public std::logic_error {
39 public:
40 BelosError (const std::string& what_arg) : std::logic_error(what_arg) {}
41 };
42
44
45
59 enum ETrans { NOTRANS = 0,
60 TRANS = 1,
61 CONJTRANS = 2
62 };
63
80
107 };
108
121 User
122 };
123
146
147 inline constexpr bool compare(int lhs_int, int rhs_int) {
148 if (lhs_int == 1) {
149 return (rhs_int >= 1);
150 }
151 else if (rhs_int == 1) {
152 return (lhs_int >= 1);
153 }
154 else {
155 return (lhs_int == rhs_int);
156 }
157 }
158
160 int lhs_int = static_cast<int>(lhs);
161 int rhs_int = static_cast<int>(rhs);
162 return compare(lhs_int, rhs_int);
163 }
164
165 constexpr bool operator==(ReturnType lhs, int rhs_int) {
166 int lhs_int = static_cast<int>(lhs);
167 return compare(lhs_int, rhs_int);
168 }
169
170 constexpr bool operator==(int lhs_int, ReturnType rhs) {
171 int rhs_int = static_cast<int>(rhs);
172 return compare(lhs_int, rhs_int);
173 }
174
176 int lhs_int = static_cast<int>(lhs);
177 int rhs_int = static_cast<int>(rhs);
178 return !compare(lhs_int, rhs_int);
179 }
180
181 constexpr bool operator!=(ReturnType lhs, int rhs_int) {
182 int lhs_int = static_cast<int>(lhs);
183 return !compare(lhs_int, rhs_int);
184 }
185
186 constexpr bool operator!=(int lhs_int, ReturnType rhs) {
187 int rhs_int = static_cast<int>(rhs);
188 return !compare(lhs_int, rhs_int);
189 }
190
192 std::string
194
220 enum StatusType { Passed = 0x1,
221 Failed = 0x2,
222 Undefined = 0x4
223 };
224
237 enum ResetType { Problem = 0x1,
238 RecycleSubspace = 0x2
239 };
240
242 std::string
244
247 convertStringToStatusType (const std::string& status);
248
251 convertStringToNormType (const std::string& normType);
252
255 convertStringToScaleType (const std::string& scaleType);
256
258 std::string
259 convertScaleTypeToString (const ScaleType scaleType);
260
273
295
306 std::string
307 convertMsgTypeToString (const MsgType msgType);
308
324 static const double convTol;
325
327 static const double polyTol;
328
330 static const double orthoKappa;
331
333 static const double resScaleFactor;
334
336 static const double impTolScale;
337 };
338
343
344#ifdef HAVE_BELOS_DENSEMATRIXKOKKOSDEFAULT
345
346#ifdef HAVE_BELOS_TPETRA
347
348 template <class Ordinal, class Scalar>
349 using DefaultDenseMatrix = typename ::Tpetra::MultiVector<Scalar>::wrapped_dual_view_type::DVT;
350
351#else
352
353 template <class Ordinal, class Scalar>
354 using DefaultDenseMatrix = Kokkos::DualView<typename KokkosKernels::ArithTraits<Scalar>::val_type **, Kokkos::LayoutLeft>;
355
356#endif
357
359
360#else
361
362 template <class Ordinal, class Scalar>
363 using DefaultDenseMatrix = Teuchos::SerialDenseMatrix<Ordinal, Scalar>;
364
366
367#endif
368
369} // end Belos namespace
370
371#endif /* BELOS_TYPES_HPP */
Belos header file which uses auto-configuration information to include necessary C++ headers.
Parent class to all Belos exceptions.
BelosError(const std::string &what_arg)
Alternative run-time polymorphic interface for operators.
std::string convertMsgTypeToString(const MsgType msgType)
Show MsgType as a comma-delimited list of names.
ScaleType convertStringToScaleType(const std::string &scaleType)
Convert the given string to its ScaleType enum value.
NormType
The type of vector norm to compute.
@ PreconditionerNorm
MsgType
Available message types recognized by the linear solvers.
@ OrthoDetails
@ StatusTestDetails
@ FinalSummary
@ TimingDetails
@ IterationDetails
ReturnType
Whether the Belos solve converged for all linear systems.
@ NaNDetected
@ Unconverged
@ MaxItersReached
@ NonspecificException
@ MaxRestartsReached
@ LossOfAccuracyDetected
@ InconsistentState
@ BreakdownDetected
@ OrthonormFailure
@ Undetermined
StatusType
Whether the StatusTest wants iteration to stop.
constexpr bool operator==(ReturnType lhs, ReturnType rhs)
NormType convertStringToNormType(const std::string &normType)
Convert the given string to its NormType enum value.
std::string convertScaleTypeToString(const ScaleType scaleType)
Convert the given ScaleType enum value to its corresponding string.
@ KokkosDualView
@ TeuchosSerialDenseMatrix
constexpr bool compare(int lhs_int, int rhs_int)
constexpr const DenseMatrixType defaultDenseMatrixType
Teuchos::SerialDenseMatrix< Ordinal, Scalar > DefaultDenseMatrix
OutputType
Style of output used to display status test information.
ConjType
Whether or not to conjugate the transpose for block inner products.
std::string convertStatusTypeToString(const StatusType status)
The string name corresponding to the given StatusType enum value.
ScaleType
The type of scaling to use on the residual norm value.
@ UserProvided
@ NormOfFullInitRes
@ NormOfFullPrecInitRes
@ NormOfFullScaledPrecInitRes
@ NormOfFullScaledInitRes
@ NormOfPrecInitRes
@ NormOfInitRes
@ NormOfRHS
ETrans
Whether to apply the (conjugate) transpose of an operator.
@ CONJTRANS
ResetType
How to reset the solver.
@ RecycleSubspace
std::string convertReturnTypeToString(const ReturnType result)
Convert the given ReturnType enum value to its corresponding string.
StatusType convertStringToStatusType(const std::string &status)
The StatusType enum value corresponding to the given string name.
constexpr bool operator!=(ReturnType lhs, ReturnType rhs)
Default parameters common to most Belos solvers.
static const double resScaleFactor
User-defined residual scaling factor.
static const double impTolScale
"Implicit Tolerance Scale Factor"
static const double convTol
Default convergence tolerance.
static const double orthoKappa
DGKS orthogonalization constant.
static const double polyTol
Relative residual tolerance for matrix polynomial construction.

Generated for Belos by doxygen 1.9.8