00001 ///////////////////////////////////////////////////////////////////////////// 00002 /// 00003 /// @file indpop2d.h 00004 /// 00005 /// Known Conley indices for a dynamical system. 00006 /// Alter this file every time a different system is considered. 00007 /// 00008 /// @author Pawel Pilarczyk 00009 /// 00010 ///////////////////////////////////////////////////////////////////////////// 00011 00012 // Copyright (C) 1997-2008 by Pawel Pilarczyk. 00013 // 00014 // This file is part of my research software package. This is free software; 00015 // you can redistribute it and/or modify it under the terms of the GNU 00016 // General Public License as published by the Free Software Foundation; 00017 // either version 2 of the License, or (at your option) any later version. 00018 // 00019 // This software is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License along 00025 // with this software; see the file "license.txt". If not, write to the 00026 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00027 // MA 02111-1307, USA. 00028 00029 // Started on April 5, 2008. Last revision: April 5, 2008. 00030 00031 00032 #ifndef _CMGRAPHS_INDPOP2D_H_ 00033 #define _CMGRAPHS_INDPOP2D_H_ 00034 00035 // include selected header files from the CHomP library 00036 #include "chomp/system/textfile.h" 00037 #include "chomp/homology/chains.h" 00038 #include "chomp/struct/integer.h" 00039 00040 // include local header files 00041 #include "config.h" 00042 #include "typedefs.h" 00043 #include "conindex.h" 00044 #include "morsedec.h" 00045 00046 00047 namespace custom { 00048 00049 /// Customized version of a function for the computation of Conley indices 00050 /// of Morse sets which fail the isolation condition. 00051 /// This version is valid for the 2-dimensional Leslie population model 00052 /// and returns the Conley index of the origin if the Morse set 00053 /// seems to be a small neighborhood of the origin. 00054 namespace popOriginInd2d { 00055 00056 00057 // -------------------------------------------------- 00058 // ---------------- set Conley index ---------------- 00059 // -------------------------------------------------- 00060 00061 /// Assigns a prescribed Conley index to the given Morse set 00062 /// whose index could not be computed because of the lack of isolation. 00063 /// This procedure assigns the known index of the origin 00064 /// for the Leslie population model which comes from the linearization, 00065 /// based on its eigenvalues computed by hand for the 2-dimensional model: 00066 /// lambda_1 = theta_1 and lambda_2 = -p theta_2 / theta_1. 00067 /// Returns "true" if the index was set, "false" otherwise. 00068 inline bool setConleyIndex (theMorseDecompositionType &morseDec, int n, 00069 int subdivDepth, const double *leftMapParam, 00070 const double *rightMapParam, int paramCount) 00071 { 00072 using chomp::homology::sbug; 00073 00074 // make sure that the dimension of the phase space is correct 00075 if (spaceDim != 2) 00076 return false; 00077 00078 // make sure that the ranges of parameters are good 00079 if (leftMapParam [0] <= 1.0) 00080 return false; 00081 bool repelling = false; 00082 double addError = 1.00000000000001; 00083 if (leftMapParam [2] * leftMapParam [1] / rightMapParam [0] / 00084 addError > 1) 00085 { 00086 repelling = true; 00087 } 00088 else if (rightMapParam [2] * rightMapParam [1] / leftMapParam [0] * 00089 addError < 1) 00090 { 00091 repelling = false; 00092 } 00093 else 00094 return false; 00095 00096 // if the set is quite large then skip it 00097 if (morseDec [n]. size () > 10) 00098 return false; 00099 00100 // determine a cube which covers the origin 00101 spcCoord origin [spaceDim]; 00102 for (int i = 0; i < spaceDim; ++ i) 00103 { 00104 origin [i] = static_cast<spcCoord> (-spaceOffset [i] * 00105 (1 << subdivDepth) / spaceWidth [i]); 00106 } 00107 00108 // if the set does not contain the origin then skip it 00109 if (!morseDec [n]. check (spcCube (origin, spaceDim))) 00110 return false; 00111 00112 // set the Conley index of the origin according to the parameters 00113 int betti [spaceDim + 1]; 00114 chomp::homology::mmatrix<chomp::homology::integer> 00115 matr [spaceDim + 1]; 00116 for (int i = 0; i <= spaceDim; ++ i) 00117 betti [i] = 0; 00118 chomp::homology::integer e; 00119 e = 1; 00120 if (!repelling) 00121 { 00122 betti [1] = 1; 00123 matr [1]. add (0, 0, e); 00124 } 00125 else 00126 { 00127 betti [2] = 1; 00128 matr [2]. add (0, 0, -e); 00129 } 00130 theConleyIndexType ind; 00131 ind. define (betti, matr, spaceDim); 00132 morseDec. setindex (n, ind); 00133 return true; 00134 } /* setConleyIndex */ 00135 00136 00137 } // namespace popOriginInd2d 00138 } // namespace custom 00139 00140 00141 #endif // _CMGRAPHS_INDPOP2D_H_ 00142
1.5.3