NOX_StatusTest_SafeCombo.hpp

00001 // $Id$ 
00002 // $Source$ 
00003 
00004 //@HEADER
00005 //   
00006 //@HEADER
00007 
00008 #ifndef NOX_STATUSTEST_SAFECOMBO_H
00009 #define NOX_STATUSTEST_SAFECOMBO_H
00010 
00011 #include "NOX_StatusTest_Generic.H" // base class
00012 #include "NOX_Common.H"   // class data element (vector)
00013 #include "Teuchos_RefCountPtr.hpp"
00014 
00015 namespace NOX {
00016 
00017   namespace StatusTest {
00018 
00046     class SafeCombo : public Generic {
00047 
00048     public:
00049 
00054       enum ComboType {
00056         AND, 
00058         OR
00059       };
00060 
00062       SafeCombo(ComboType t);
00063 
00065       SafeCombo(ComboType t, const Teuchos::RCP<Generic>& a);
00066 
00068       SafeCombo(ComboType t, const Teuchos::RCP<Generic>& a,
00069             const Teuchos::RCP<Generic>& b);
00070 
00072 
00075       virtual SafeCombo& addStatusTest(const Teuchos::RCP<Generic>& a);
00076 
00078       virtual ~SafeCombo();
00079 
00083       virtual StatusType checkStatus(const NOX::Solver::Generic& problem);
00084 
00090 #ifdef TRILINOS_6
00091       virtual StatusType checkStatusEfficiently(const NOX::Solver::Generic& problem, NOX::StatusTest::CheckType checkType);
00092 #else
00093       virtual StatusType checkStatus(const NOX::Solver::Generic& problem, NOX::StatusTest::CheckType checkType);
00094 #endif
00095 
00096       virtual StatusType getStatus() const;
00097 
00098       virtual ostream& print(std::ostream& stream, int indent = 0) const;
00099   
00100     protected:
00101 
00103 
00116       virtual void orOp(const Solver::Generic& problem, NOX::StatusTest::CheckType checkType);
00117 
00119 
00133       virtual void andOp(const Solver::Generic& problem, NOX::StatusTest::CheckType checkType);
00134 
00141       bool isSafe(const Teuchos::RCP<Generic>& a);
00142 
00143     private:
00144 
00146       const ComboType type;
00147 
00149       vector<Teuchos::RCP<Generic> > tests;
00150 
00152       StatusType status;
00153 
00154     }; // class Combo
00155 
00156   } // namespace Status
00157 } // namespace NOX
00158 
00159 #endif

doxygen