Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Teuchos_Utils.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_UTILS_H
11
#define TEUCHOS_UTILS_H
12
16
17
#include "Teuchos_toString.hpp"
18
22
23
namespace
Teuchos
24
{
25
using
std::string;
26
27
class
TEUCHOSCORE_LIB_DLL_EXPORT
Utils
28
{
29
public
:
30
33
static
double
chop
(
const
double
& x);
34
37
static
double
getChopVal
() {
return
chopVal_;}
38
41
static
void
setChopVal
(
double
chopVal) {chopVal_ = chopVal;}
42
44
static
bool
isWhiteSpace
(
const
char
c )
45
{
return
( c==
' '
|| c ==
'\t'
|| c==
'\n'
); }
46
48
static
std::string trimWhiteSpace(
const
std::string& str );
49
51
static
std::string toString(
const
double
& x);
52
54
static
std::string toString(
const
int
& x);
55
57
static
std::string toString(
const
long
long
& x);
58
60
static
std::string toString(
const
unsigned
int
& x);
61
63
#ifdef M_PI
64
static
double
pi() {
return
M_PI;}
65
#else
66
static
double
pi
() {
return
3.14159265358979323846;}
67
#endif
68
70
static
std::string getParallelExtension(
71
int
procRank = -1
72
,
int
numProcs = -1
73
);
74
75
private
:
76
static
double
chopVal_;
77
};
78
79
80
}
// end namespace Teuchos
81
82
#endif
83
84
Teuchos::Utils
This class provides some basic std::string and floating-point utilities for Teuchos.
Definition
Teuchos_Utils.hpp:28
Teuchos::Utils::setChopVal
static void setChopVal(double chopVal)
Set the chopping value, below which numbers are considered to be zero.
Definition
Teuchos_Utils.hpp:41
Teuchos::Utils::getChopVal
static double getChopVal()
Get the chopping value, below which numbers are considered to be zero.
Definition
Teuchos_Utils.hpp:37
Teuchos::Utils::chop
static double chop(const double &x)
Set a number to zero if it is less than getChopVal().
Definition
Teuchos_Utils.cpp:17
Teuchos::Utils::pi
static double pi()
pi.
Definition
Teuchos_Utils.hpp:66
Teuchos::Utils::isWhiteSpace
static bool isWhiteSpace(const char c)
Determine if a char is whitespace or not.
Definition
Teuchos_Utils.hpp:44
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0