- Main Page
- Classes
- Files

- File List
- File Members

# contrib/sIPOPT/src/SensPCalculator.hpp

Go to the documentation of this file.

    00001 // Copyright 2009, 2011 Hans Pirnay
    00002 // All Rights Reserved.
    00003 // This code is published under the Eclipse Public License.
    00004 //
    00005 // Date   : 2009-05-06
    00006
    00007 #ifndef __ASPCALCULATOR_HPP__
    00008 #define __ASPCALCULATOR_HPP__
    00009
    00010 #include "IpAlgStrategy.hpp"
    00011 #include "SensSimpleBacksolver.hpp"
    00012 #include "SensSchurData.hpp"
    00013
    00014 namespace Ipopt
    00015 {
    00016
    00017   class PCalculator : public AlgorithmStrategyObject
    00018   {
    00029   public:
    00030
    00031     PCalculator(SmartPtr<SensBacksolver> backsolver,
    00032         SmartPtr<SchurData> A_data)
    00033       :
    00034       backsolver_(backsolver),
    00035       data_A_init(ConstPtr(A_data->MakeNewSchurDataCopy())),
    00036       data_A_(A_data)
    00037     {
    00038     }
    00039
    00040     virtual ~PCalculator()
    00041     {
    00042     }
    00043
    00045     virtual bool InitializeImpl(const OptionsList& options,
    00046                                 const std::string& prefix)
    00047     {
    00048       return true;
    00049     }
    00050
    00052     virtual bool ComputeP()=0;
    00053
    00055     virtual bool GetSchurMatrix(const SmartPtr<const SchurData>& B, SmartPtr<Matrix>& S) =0;
    00056
    00057     virtual void PrintImpl(const Journalist& jnlst,
    00058                EJournalLevel level,
    00059                EJournalCategory category,
    00060                const std::string& name,
    00061                Index indent,
    00062                const std::string& prefix) const =0;
    00063
    00064     void Print(const Journalist& jnlst,
    00065            EJournalLevel level,
    00066            EJournalCategory category,
    00067            const std::string& name,
    00068            Index indent=0,
    00069            const std::string& prefix="") const
    00070     {
    00071       if (jnlst.ProduceOutput(level, category)) {
    00072     PrintImpl(jnlst, level, category, name, indent, prefix);
    00073       }
    00074     }
    00075
    00076     void Print(SmartPtr<const Journalist> jnlst,
    00077            EJournalLevel level,
    00078            EJournalCategory category,
    00079            const std::string& name,
    00080            Index indent,
    00081            const std::string& prefix) const
    00082     {
    00083       if (IsValid(jnlst) && jnlst->ProduceOutput(level, category)) {
    00084     PrintImpl(*jnlst, level, category, name, indent, prefix);
    00085       }
    00086     }
    00087
    00091     SmartPtr<SensBacksolver> Solver() const
    00092     {
    00093       return backsolver_;
    00094     }
    00095
    00096     SmartPtr<const SchurData> data_A() const
    00097     {
    00098       return ConstPtr(data_A_);
    00099     }
    00100
    00101     SmartPtr<SchurData> data_A_nonconst() const
    00102     {
    00103       return data_A_;
    00104     }
    00105
    00106     void reset_data_A()
    00107     {
    00108       data_A_ = data_A_init->MakeNewSchurDataCopy();
    00109     }
    00110
    00111   private:
    00112
    00113     SmartPtr<SensBacksolver> backsolver_;
    00114
    00115     SmartPtr<const SchurData> data_A_init;
    00116     SmartPtr<SchurData> data_A_;
    00117
    00118
    00119   };
    00120
    00121
    00122 }
    00123
    00124 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines