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 #include "NOX_TSF_StatusTestBuilder.H"
00034 #include "NOX_StatusTest_NormF.H"
00035 #include "NOX_StatusTest_NormUpdate.H"
00036 #include "NOX_StatusTest_SafeCombo.H"
00037 #include "NOX_StatusTest_MaxIters.H"
00038 #include "Teuchos_TestForException.hpp"
00039
00040 using namespace NOX;
00041 using namespace NOX::TSF;
00042 using namespace Teuchos;
00043
00044 RCP<StatusTest::Generic>
00045 StatusTestBuilder::makeStatusTest(const ParameterList& params)
00046 {
00047 TEST_FOR_EXCEPTION(!params.isSublist("Status Test"), runtime_error,
00048 "did not find Status Test sublist in " << params);
00049
00050 ParameterList testSublist = params.sublist("Status Test");
00051
00052 double fTol = 1.0e-15;
00053 double dxTol = 1.0e-15;
00054 int maxiters = 20;
00055 if (testSublist.isParameter("Tolerance"))
00056 {
00057 fTol = getParameter<double>(testSublist, "Tolerance");
00058 }
00059 if (testSublist.isParameter("Residual Tolerance"))
00060 {
00061 fTol = getParameter<double>(testSublist, "Residual Tolerance");
00062 }
00063 if (testSublist.isParameter("Step Tolerance"))
00064 {
00065 dxTol = getParameter<double>(testSublist, "Step Tolerance");
00066 }
00067 if (testSublist.isParameter("Max Iterations"))
00068 {
00069 maxiters = getParameter<int>(testSublist, "Max Iterations");
00070 }
00071
00072 RCP<StatusTest::Generic> A = rcp(new StatusTest::NormF(fTol));
00073 RCP<StatusTest::Generic> B = rcp(new StatusTest::MaxIters(maxiters));
00074 RCP<StatusTest::Generic> C = rcp(new StatusTest::NormUpdate(dxTol));
00075 RCP<StatusTest::Generic> AB
00076 = rcp(new StatusTest::SafeCombo(StatusTest::SafeCombo::OR, A, B));
00077 RCP<StatusTest::Generic> ABC
00078 = rcp(new StatusTest::SafeCombo(StatusTest::SafeCombo::OR, AB, C));
00079
00080 return ABC;
00081 }
00082
00083
00084