15 double Utils::chopVal_ = 1.0e-16;
19 if (std::fabs(x) < chopVal_)
return 0;
25 typedef std::string::size_type size_type;
26 const size_type len = str.length();
30 size_type first_non_white = 0;
33 isWhiteSpace(str[first_non_white]) && first_non_white < len ;
38 size_type last_non_white = 0;
40 last_non_white = len-1 ;
41 isWhiteSpace(str[last_non_white]) && (last_non_white != 0);
46 if( first_non_white > last_non_white )
47 return std::string(
"");
48 return str.substr(first_non_white,last_non_white-first_non_white+1);
54 std::snprintf(s,
sizeof(s),
"%d", x);
55 return std::string(s);
61 std::snprintf(s,
sizeof(s),
"%lld", x);
62 return std::string(s);
68 std::snprintf(s,
sizeof(s),
"%d", x);
69 return std::string(s);
75 std::snprintf(s,
sizeof(s),
"%g", x);
76 return std::string(s);
87 if( numProcs_in > 0 ) {
88 procRank = procRank_in;
89 numProcs = numProcs_in;
97 double tmp = numProcs;
98 for(
int i = 0; i < 10; ++i, tmp *= 0.1 ) {
105 std::ostringstream parallelExtension;
108 << std::right << std::setw(maxProcOrder)
112 << std::right << std::setw(maxProcOrder)
114 return parallelExtension.str();
static int getRank()
The rank of the calling process in MPI_COMM_WORLD.
static int getNProc()
The number of processes in MPI_COMM_WORLD.
static std::string toString(const double &x)
Write a double as a std::string.
static bool isWhiteSpace(const char c)
Determine if a char is whitespace or not.
static std::string trimWhiteSpace(const std::string &str)
Trim whitespace from beginning and end of std::string.
static double chop(const double &x)
Set a number to zero if it is less than getChopVal().
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
static std::string getParallelExtension(int procRank=-1, int numProcs=-1)
Get a parallel file name extention .
A utilities class for Teuchos.