Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
17 #include "Teuchos_toString.hpp"
18 
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 
static bool isWhiteSpace(const char c)
Determine if a char is whitespace or not.
static void setChopVal(double chopVal)
Set the chopping value, below which numbers are considered to be zero.
static double getChopVal()
Get the chopping value, below which numbers are considered to be zero.
This class provides some basic std::string and floating-point utilities for Teuchos.
static double pi()
pi.