Diana  0.8.3
HopfPointContinuation.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: HopfPointContinuation.hpp 8160 2009-03-16 18:36:30Z miha $
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 #ifndef HOPF_POINT_CONTINUATION__HPP
00018 #define HOPF_POINT_CONTINUATION__HPP
00019 
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024 
00025 #include <Diana.hpp>
00026 #include <Fortran.hpp>
00027 #include <DianaContinuation.hpp>
00028 #include <vector>
00029 
00030 namespace Diana {
00031 
00036   class HopfPointContinuation : public DianaContinuation {
00037   public:
00044     HopfPointContinuation(Numeric::Solvers::Model::ICapeNumericModel* _pModel);
00045     virtual ~HopfPointContinuation();
00046 
00047     Numeric::Solvers::Solver::SolveReturn Solve()
00048       throw (Common::Error::ECapeUnknown, Common::Error::ECapeBadInvOrder,
00049              Common::Error::ECapeSolvingError, Common::Error::ECapeOutOfResources);
00050 
00051     ContiReturn Continuate()
00052       throw (Common::Error::ECapeUnknown, Common::Error::ECapeSolvingError);
00053   
00054     Common::Types::CapeString GetVariableName(Common::Types::CapeLong index)
00055       throw (Common::Error::ECapeUnknown);
00056 
00057   protected:
00059     int getModelEquations();
00060 
00062     int getModelVariables();
00063 
00066     void packModelBoundaries(Common::Types::CapeArrayDouble& arrMinY,
00067                              Common::Types::CapeArrayDouble& arrMaxY);
00068 
00070     void packModelVector(Common::Types::CapeArrayDouble& modelVector);
00071 
00073     void unpackModelVector(const Common::Types::CapeArrayDouble& modelVector);
00074 
00076     void packModelResidual(Common::Types::CapeArrayDouble& modelResidual);
00077 
00079     void packModelJacobian(Diana::DianaSparseArray& Jaco);
00080 
00081     CapeBoolean calcInitialEigenvector();
00082     CapeBoolean calcEigenvalues();
00083     CapeBoolean calcEigenvaluesLapack();
00084     CapeBoolean calcEigenvaluesArpack();
00085 
00086   private:
00087     Common::Types::CapeLong               nESOSize;
00088     Common::Types::CapeArrayDouble        arrReEigenVector;
00089     Common::Types::CapeArrayDouble        arrImEigenVector;
00090     Common::Types::CapeDouble             dblOmega;
00091 
00092     const Common::Types::CapeLong   nEigMonitorMax;
00093     Common::Types::CapeLong         nEigMonitor;
00094     Common::Types::CapeLong         nEigConverged;
00095     Common::Types::CapeArrayDouble  arrReEigenValues;
00096     Common::Types::CapeArrayDouble  arrImEigenValues;
00097 
00098   private:
00099     std::vector<fortrand>           lapA;
00100     std::vector<fortrand>           lapB;
00101     std::vector<fortrand>           lapAlphaR;
00102     std::vector<fortrand>           lapAlphaI;
00103     std::vector<fortrand>           lapBeta;
00104     std::vector<fortrand>           lapVl;
00105     std::vector<fortrand>           lapVr;
00106     std::vector<fortrand>           lapWork;
00107 
00108   private:
00109     std::vector<fortrand>           arpResid;
00110     std::vector<fortrand>           arpV;
00111     std::vector<fortrand>           arpWorkd;
00112     std::vector<fortrand>           arpWorkl;
00113     std::vector<fortrand>           arpTmpX;
00114     std::vector<fortranl>           arpSelect;
00115     std::vector<fortrand>           arpWorkev;
00116 
00117     Diana::DianaSparseArray         dsaArpAsM;
00118     Diana::DianaSparseSolver        dssArpM;
00119     Diana::DianaSparseSolver        dssArpAsM;
00120   };
00121 
00122 };
00123 
00124 #endif // HOPF_POINT_CONTINUATION__HPP
00125