#include <NOX_StatusTest_Factory.H>
Public Member Functions | |
Factory () | |
Constructor. | |
virtual | ~Factory () |
Destructor. | |
Teuchos::RCP < NOX::StatusTest::Generic > | buildStatusTests (const std::string &file_name, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=0) const |
Returns a status test set from a parameter list xml file. | |
Teuchos::RCP < NOX::StatusTest::Generic > | buildStatusTests (Teuchos::ParameterList &p, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=0) const |
Returns a status test set from a parameter list. | |
Private Member Functions | |
Teuchos::RCP < NOX::StatusTest::Generic > | buildComboTest (Teuchos::ParameterList &p, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=0) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildNormFTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildNormUpdateTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildNormWRMSTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildMaxItersTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildFiniteValueTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildDivergenceTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildStagnationTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
Teuchos::RCP < NOX::StatusTest::Generic > | buildUserDefinedTest (Teuchos::ParameterList &p, const NOX::Utils &utils) const |
bool | checkAndTagTest (const Teuchos::ParameterList &p, const Teuchos::RCP< NOX::StatusTest::Generic > &test, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests) const |
Checks if a tag is present in the param list and adds the test to the tagged_test std::map if true. Returns true if a tag was present. | |
Related Functions | |
(Note that these are not member functions.) | |
Teuchos::RCP < NOX::StatusTest::Generic > | buildStatusTests (const std::string &file_name, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=0) |
Nonmember helper function for the NOX::StatusTest::Factory. | |
Teuchos::RCP < NOX::StatusTest::Generic > | buildStatusTests (Teuchos::ParameterList &p, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=0) |
Nonmember helper function for the NOX::StatusTest::Factory. |
This object takes either an xml file name or a Teuchos::ParameterList and generates an entire set (a tree) of status tests for use in a NOX::Solver derived object.
The tagged_tests field in the constructors allows users to store tests from the tree in a flat list in case they want to change the tolerance values during a run. The tagged_tests flag is optional.
Please use the related nonmember functions instead of calling the factory directly (See example below).
Valid parameters are as follows:
Additional parameters valid for a Combo test (NOX::StatusTest::Combo):
Additional parameters valid for a Norm F test (NOX::StatusTest::NormF):
Additional parameters valid for a Norm Update test (NOX::StatusTest::NormUpdate):
Additional parameters valid for a Norm WRMS test (NOX::StatusTest::NormWRMS):
Additional parameters valid for a Maximum Iterations test (NOX::StatusTest::MaxIters):
Additional parameters valid for a Finite Value test (NOX::StatusTest::FiniteValue):
Additional parameters valid for a Divergence test (NOX::StatusTest::Divergence):
Additional parameters valid for a Stagnation test (NOX::StatusTest::Stagnation):
Additional parameters valid for a "User Defined" test:
Example usage:
Teuchos::ParameterList stl; stl.set("Test Type", "Combo"); stl.set("Combo Type", "OR"); stl.set("Number of Tests", 5); Teuchos::ParameterList& conv = stl.sublist("Test 0"); Teuchos::ParameterList& fv = stl.sublist("Test 1"); Teuchos::ParameterList& divergence = stl.sublist("Test 2"); Teuchos::ParameterList& stagnation = stl.sublist("Test 3"); Teuchos::ParameterList& maxiters = stl.sublist("Test 4"); conv.set("Test Type", "Combo"); conv.set("Combo Type", "AND"); conv.set("Number of Tests", 4); Teuchos::ParameterList& normF = conv.sublist("Test 0"); Teuchos::ParameterList& normWRMS = conv.sublist("Test 1"); Teuchos::ParameterList& normUpdate = conv.sublist("Test 2"); Teuchos::ParameterList& userDefined = conv.sublist("Test 3"); normF.set("Test Type", "NormF"); normF.set("Tolerance", 1.0e-12); normF.set("Norm Type", "Two Norm"); normF.set("Scale Type", "Unscaled"); normWRMS.set("Test Type", "NormWRMS"); normWRMS.set("Absolute Tolerance", 1.0e-8); normWRMS.set("Relative Tolerance", 1.0e-5); normWRMS.set("Tolerance", 1.0); normWRMS.set("BDF Multiplier", 1.0); normWRMS.set("Alpha", 1.0); normWRMS.set("Beta", 0.5); normUpdate.set("Test Type", "NormUpdate"); normUpdate.set("Norm Type", "One Norm"); normUpdate.set("Scale Type", "Scaled"); userDefined.set("Test Type", "User Defined"); Teuchos::RCP<NOX::StatusTest::Generic> myTest = Teuchos::rcp(new MyTest(1.0e-3)); userDefined.set("User Status Test", myTest); fv.set("Test Type", "FiniteValue"); fv.set("Vector Type", "F Vector"); fv.set("Norm Type", "Two Norm"); divergence.set("Test Type", "Divergence"); divergence.set("Tolerance", 1.0e+20); divergence.set("Consecutive Iterations", 3); stagnation.set("Test Type", "Stagnation"); stagnation.set("Tolerance", 1.0); stagnation.set("Consecutive Iterations", 5); maxiters.set("Test Type", "MaxIters"); maxiters.set("Maximum Iterations", 20); Teuchos::RCP<NOX::StatusTest::Generic> status_tests = NOX::StatusTest::buildStatusTests(stl, utils);
Definition at line 250 of file NOX_StatusTest_Factory.H.
NOX::StatusTest::Factory::Factory | ( | ) |
NOX::StatusTest::Factory::~Factory | ( | ) | [virtual] |
Teuchos::RCP< NOX::StatusTest::Generic > NOX::StatusTest::Factory::buildStatusTests | ( | const std::string & | file_name, | |
const NOX::Utils & | utils, | |||
std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > * | tagged_tests = 0 | |||
) | const |
Returns a status test set from a parameter list xml file.
Definition at line 80 of file NOX_StatusTest_Factory.C.
Teuchos::RCP< NOX::StatusTest::Generic > NOX::StatusTest::Factory::buildStatusTests | ( | Teuchos::ParameterList & | p, | |
const NOX::Utils & | utils, | |||
std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > * | tagged_tests = 0 | |||
) | const |
Returns a status test set from a parameter list.
Definition at line 101 of file NOX_StatusTest_Factory.C.
References checkAndTagTest().
bool NOX::StatusTest::Factory::checkAndTagTest | ( | const Teuchos::ParameterList & | p, | |
const Teuchos::RCP< NOX::StatusTest::Generic > & | test, | |||
std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > * | tagged_tests | |||
) | const [private] |
Checks if a tag is present in the param list and adds the test to the tagged_test std::map if true. Returns true if a tag was present.
Definition at line 430 of file NOX_StatusTest_Factory.C.
Referenced by buildStatusTests().
Teuchos::RCP< NOX::StatusTest::Generic > buildStatusTests | ( | const std::string & | file_name, | |
const NOX::Utils & | utils, | |||
std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > * | tagged_tests = 0 | |||
) | [related] |
Nonmember helper function for the NOX::StatusTest::Factory.
Teuchos::RCP< NOX::StatusTest::Generic > buildStatusTests | ( | Teuchos::ParameterList & | p, | |
const NOX::Utils & | utils, | |||
std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > * | tagged_tests = 0 | |||
) | [related] |
Nonmember helper function for the NOX::StatusTest::Factory.