51 if (std::fabs(x) <
chopVal_)
return 0;
57 typedef std::string::size_type size_type;
58 const size_type len = str.length();
62 size_type first_non_white = 0;
65 isWhiteSpace(str[first_non_white]) && first_non_white < len ;
70 size_type last_non_white = 0;
72 last_non_white = len-1 ;
73 isWhiteSpace(str[last_non_white]) && (last_non_white != 0);
78 if( first_non_white > last_non_white )
79 return std::string(
"");
80 return str.substr(first_non_white,last_non_white-first_non_white+1);
86 std::sprintf(s,
"%d", x);
87 return std::string(s);
93 std::sprintf(s,
"%lld", x);
94 return std::string(s);
100 std::sprintf(s,
"%d", x);
101 return std::string(s);
107 std::sprintf(s,
"%g", x);
108 return std::string(s);
119 if( numProcs_in > 0 ) {
120 procRank = procRank_in;
121 numProcs = numProcs_in;
128 int maxProcOrder = 1;
129 double tmp = numProcs;
130 for(
int i = 0; i < 10; ++i, tmp *= 0.1 ) {
137 std::ostringstream parallelExtension;
140 << std::right << std::setw(maxProcOrder)
144 << std::right << std::setw(maxProcOrder)
146 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.