Diana  0.8.3
IDianaSolver.hpp
00001 /* -----------------------------------------------------------------------------
00002  *  Diana process modelling, simulation and analysis software
00003  *  Copyright (c) 2005, Michael Krasnyk
00004  *  All rights reserved.
00005  *
00006  *  This file is a part of Diana process modelling, simulation and analysis software
00007  *
00008  *  Diana is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published
00010  *  by the Free Software Foundation (see accompanying file LICENSE)
00011  * -----------------------------------------------------------------------------
00012  *  $Id: IDianaSolver.hpp 8160 2009-03-16 18:36:30Z miha $
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 #ifndef IDIANA_SOLVER_H
00018 #define IDIANA_SOLVER_H
00019 
00020 #include <CapeOpen.hpp>
00021 #include <Diana/IDianaReporting.hpp>
00022 #include <Diana/IDianaNLPParalleling.hpp>
00023 
00024 namespace Diana {
00025 
00026   // Foward declaration of interfaces
00027   class IDianaNumericSolver;
00028   class IDianaNumericNLPSolver;
00029 
00030   // Interface sequence
00031   typedef std::vector<IDianaNumericSolver*> DianaArrayNumericSolver;         
00032   typedef std::vector<IDianaNumericNLPSolver*> DianaArrayNumericNLPSolver;         
00033 
00034 
00037   class IDianaNumericSolver : virtual public Numeric::Solvers::Solver::ICapeNumericSolver {
00038   public:
00051     virtual void SetReportingInterface(Diana::IDianaReporting* _pReportingInterface)
00052       throw (Common::Error::ECapeUnknown) = 0;
00053 
00054     virtual void RemoveReportingInterface(Diana::IDianaReporting* _pReportingInterface)
00055       throw (Common::Error::ECapeUnknown) = 0;
00056   };
00057 
00060   class IDianaNumericDAESolver : virtual public Numeric::Solvers::Solver::ICapeNumericDAESolver,
00061                                  virtual public IDianaNumericSolver {
00062 
00063 // #ifndef SWIG
00064 //     /** ostream output operator for the IDianaNumericDAESolver class.*/
00065 //     friend std::ostream& operator<<(std::ostream& out_file, const IDianaNumericDAESolver& solver);
00066 // #endif
00067 //     public:
00068 //     /** This method should reinitialize solver with the values currently contained in ESO, including independent
00069 //      *  variable. It takes part in reversing model to previous step. Needed by discrete part.*/
00070 // #ifndef SWIG
00071 //     virtual void StepBack() = 0;
00072 //     /** This method should advance solver exactly to the given time. Needed by discrete part.*/
00073 //     virtual void MakeStep(Common::Types::CapeDouble tend, Common::Types::CapeBoolean fireEvents = false) = 0;
00074 // #endif    
00075 //     /** This method should recalculate initial conditions. It's called when Petri net switches and 
00076 //      * the model (parameter values, equations) changed.*/
00077 //     virtual void RecalculateIC() = 0;
00078   };
00079 
00082   class IDianaNumericNLPSolver : virtual public Numeric::Solvers::Solver::ICapeNumericNLPSolver,
00083                                  virtual public IDianaNumericSolver {
00084   public:
00085     
00086     /* Sets class that provides parallel optimization task solving*/
00087     virtual void SetParallelInterface(Diana::IDianaNLPSolverParallelInterface *_pi) = 0;
00088 
00089     /* Gets optimization solution as parameters set */
00090     virtual Numeric::Solvers::NLPTasks::Parameters::ICapeOptimizationPoint *GetNLPSolution() 
00091       throw(Common::Error::ECapeUnknown, Common::Error::ECapeFailedInitialisation) = 0;
00092     
00093   };
00094 
00096   class IDianaHybridSolver {
00097 
00098   public:
00099 
00100     /* Adds reference to external solver that will be used in hybrid */
00101     virtual void SetSolver(Diana::IDianaNumericSolver *_solver)
00102       throw (Common::Error::ECapeUnknown) = 0;
00103     /* Remove solver from the list of added solvers */
00104     virtual void RemoveSolver(Diana::IDianaNumericSolver *_solver)
00105       throw (Common::Error::ECapeUnknown) = 0;
00106   };
00107 
00109   class IDianaNLPHybridSolver : virtual public IDianaHybridSolver, virtual public IDianaNumericNLPSolver {
00110   public:
00111     /* Sets class that provides parallel optimization task solving*/
00112     //    virtual void SetParallelInterface(Diana::IDianaNLPSolverParallelInterface *_pi) = 0;
00113   };
00114 
00115 };
00116 
00117 #endif // IDIANA_SOLVER_H