48 convertStatusTypeToRawString (
const StatusType status)
52 }
else if (status ==
Failed) {
57 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
58 "Belos::convertStatusTypeToRawString: Invalid StatusType enum value " 67 return convertStatusTypeToRawString (status);
73 if (status ==
"Passed") {
75 }
else if (status ==
"Failed") {
77 }
else if (status ==
"Undefined") {
80 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
81 "Belos::convertStringToStatusType: Invalid string \"" << status
89 if (scaleType ==
"Norm of Initial Residual") {
91 }
else if (scaleType ==
"Norm of Preconditioned Initial Residual") {
93 }
else if (scaleType ==
"Norm of RHS") {
95 }
else if (scaleType ==
"None") {
97 }
else if (scaleType ==
"User Provided") {
100 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
101 "Belos::convertStringToScaleType(): Invalid residual scaling type \"" 102 << scaleType <<
"\".");
110 return "Norm of Initial Residual";
112 return "Norm of Preconditioned Initial Residual";
114 return "Norm of RHS";
118 return "User Provided";
120 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
121 "Belos::convertScaleTypeToString(): Invalid residual scaling type " 122 "value " << scaleType <<
".");
129 typedef std::vector<int>::size_type size_type;
133 const size_type numValidTypes = 8;
134 const int validTypes[] = {
144 const char* typeNames[] = {
160 std::vector<size_type> theList;
161 for (size_type nameIndex = 0; nameIndex < numValidTypes; ++nameIndex) {
162 if (msgType & validTypes[nameIndex]) {
163 theList.push_back (nameIndex);
166 std::ostringstream os;
167 for (size_type k = 0; k < theList.size(); ++k) {
168 const size_type nameIndex = theList[k];
169 os << typeNames[nameIndex];
170 if (nameIndex < theList.size() - 1) {
183 return "Unconverged";
185 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
186 "Belos::convertReturnTypeToString: Invalid ReturnType enum value " ScaleType convertStringToScaleType(const std::string &scaleType)
Convert the given string to its ScaleType enum value.
Collection of types and exceptions used within the Belos solvers.
ScaleType
The type of scaling to use on the residual norm value.
MsgType
Available message types recognized by the linear solvers.
StatusType
Whether the StatusTest wants iteration to stop.
std::string convertStatusTypeToString(const StatusType status)
The string name corresponding to the given StatusType enum value.
std::string convertScaleTypeToString(const ScaleType scaleType)
Convert the given ScaleType enum value to its corresponding string.
std::string convertMsgTypeToString(const MsgType msgType)
Show MsgType as a comma-delimited list of names.
ReturnType
Whether the Belos solve converged for all linear systems.
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.