00001
00002
00003
00004
00005
00006
00007
00008 #include "NOX_Playa_StatusTestBuilder.hpp"
00009 #include "NOX_StatusTest_NormF.H"
00010 #include "NOX_StatusTest_NormUpdate.H"
00011 #include "NOX_StatusTest_SafeCombo.hpp"
00012 #include "NOX_StatusTest_MaxIters.H"
00013 #include "Teuchos_Assert.hpp"
00014
00015 using namespace NOX;
00016 using namespace NOX::NOXPlaya;
00017 using namespace Teuchos;
00018
00019 RCP<StatusTest::Generic>
00020 StatusTestBuilder::makeStatusTest(const ParameterList& params)
00021 {
00022 TEUCHOS_TEST_FOR_EXCEPTION(!params.isSublist("Status Test"), runtime_error,
00023 "did not find Status Test sublist in " << params);
00024
00025 ParameterList testSublist = params.sublist("Status Test");
00026
00027 double fTol = 1.0e-15;
00028 double dxTol = 1.0e-15;
00029 int maxiters = 20;
00030 if (testSublist.isParameter("Tolerance"))
00031 {
00032 fTol = getParameter<double>(testSublist, "Tolerance");
00033 }
00034 if (testSublist.isParameter("Residual Tolerance"))
00035 {
00036 fTol = getParameter<double>(testSublist, "Residual Tolerance");
00037 }
00038 if (testSublist.isParameter("Step Tolerance"))
00039 {
00040 dxTol = getParameter<double>(testSublist, "Step Tolerance");
00041 }
00042 if (testSublist.isParameter("Max Iterations"))
00043 {
00044 maxiters = getParameter<int>(testSublist, "Max Iterations");
00045 }
00046
00047 RCP<StatusTest::Generic> A = rcp(new StatusTest::NormF(fTol));
00048 RCP<StatusTest::Generic> B = rcp(new StatusTest::MaxIters(maxiters));
00049 RCP<StatusTest::Generic> C = rcp(new StatusTest::NormUpdate(dxTol));
00050 RCP<StatusTest::Generic> AB
00051 = rcp(new StatusTest::SafeCombo(StatusTest::SafeCombo::OR, A, B));
00052 RCP<StatusTest::Generic> ABC
00053 = rcp(new StatusTest::SafeCombo(StatusTest::SafeCombo::OR, AB, C));
00054
00055 return ABC;
00056 }
00057
00058
00059