Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include "NOX_Playa_StatusTestBuilder.hpp"
00051 #include "NOX_StatusTest_NormF.H"
00052 #include "NOX_StatusTest_NormUpdate.H"
00053 #include "NOX_StatusTest_SafeCombo.hpp"
00054 #include "NOX_StatusTest_MaxIters.H"
00055 #include "Teuchos_Assert.hpp"
00056
00057 using namespace NOX;
00058 using namespace NOX::NOXPlaya;
00059 using namespace Teuchos;
00060 using std::runtime_error;
00061
00062 RCP<StatusTest::Generic>
00063 StatusTestBuilder::makeStatusTest(const ParameterList& params)
00064 {
00065 TEUCHOS_TEST_FOR_EXCEPTION(!params.isSublist("Status Test"), runtime_error,
00066 "did not find Status Test sublist in " << params);
00067
00068 ParameterList testSublist = params.sublist("Status Test");
00069
00070 double fTol = 1.0e-15;
00071 double dxTol = 1.0e-15;
00072 int maxiters = 20;
00073 if (testSublist.isParameter("Tolerance"))
00074 {
00075 fTol = getParameter<double>(testSublist, "Tolerance");
00076 }
00077 if (testSublist.isParameter("Residual Tolerance"))
00078 {
00079 fTol = getParameter<double>(testSublist, "Residual Tolerance");
00080 }
00081 if (testSublist.isParameter("Step Tolerance"))
00082 {
00083 dxTol = getParameter<double>(testSublist, "Step Tolerance");
00084 }
00085 if (testSublist.isParameter("Max Iterations"))
00086 {
00087 maxiters = getParameter<int>(testSublist, "Max Iterations");
00088 }
00089
00090 RCP<StatusTest::Generic> A = rcp(new StatusTest::NormF(fTol));
00091 RCP<StatusTest::Generic> B = rcp(new StatusTest::MaxIters(maxiters));
00092 RCP<StatusTest::Generic> C = rcp(new StatusTest::NormUpdate(dxTol));
00093 RCP<StatusTest::Generic> AB
00094 = rcp(new StatusTest::SafeCombo(StatusTest::SafeCombo::OR, A, B));
00095 RCP<StatusTest::Generic> ABC
00096 = rcp(new StatusTest::SafeCombo(StatusTest::SafeCombo::OR, AB, C));
00097
00098 return ABC;
00099 }
00100
00101
00102