00001 ///////////////////////////////////////////////////////////////////////////// 00002 /// 00003 /// @file mapgraph.h 00004 /// 00005 /// Computation of the graph representation of a combinatorial map. 00006 /// This file contains the definition of a function for the computation 00007 /// of a directed graph which represents a combinatorial map 00008 /// restricted to a given set of cubes. 00009 /// 00010 /// @author Pawel Pilarczyk 00011 /// 00012 ///////////////////////////////////////////////////////////////////////////// 00013 00014 // Copyright (C) 1997-2008 by Pawel Pilarczyk. 00015 // 00016 // This file is part of my research software package. This is free software; 00017 // you can redistribute it and/or modify it under the terms of the GNU 00018 // General Public License as published by the Free Software Foundation; 00019 // either version 2 of the License, or (at your option) any later version. 00020 // 00021 // This software is distributed in the hope that it will be useful, 00022 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 // GNU General Public License for more details. 00025 // 00026 // You should have received a copy of the GNU General Public License along 00027 // with this software; see the file "license.txt". If not, write to the 00028 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00029 // MA 02111-1307, USA. 00030 00031 // Started on February 12, 2007. Last revision: February 29, 2008. 00032 00033 00034 #ifndef _CMGRAPHS_MAPGRAPH_H_ 00035 #define _CMGRAPHS_MAPGRAPH_H_ 00036 00037 00038 // include selected header files from the CHomP library 00039 #include "chomp/system/textfile.h" 00040 #include "chomp/cubes/pointset.h" 00041 #include "chomp/cubes/cube.h" 00042 #include "chomp/struct/digraph.h" 00043 00044 // include local header files 00045 #include "config.h" 00046 #include "typedefs.h" 00047 00048 00049 // -------------------------------------------------- 00050 // -------------- compute cubical map --------------- 00051 // -------------------------------------------------- 00052 00053 // Computes the cubical map on 'X' and fills out the graph 'g'. 00054 template <class typeCubes, class typeCubMap> 00055 void computeMapGraph (const typeCubes &X, chomp::homology::diGraph<> &g, 00056 const typeCubMap &theCubMap) 00057 { 00058 // remember the dimension of the phase space boxes 00059 int dim = X. size () ? X [0]. dim () : -1; 00060 00061 // compute the images of all the cubes 00062 int nX = X. size (); 00063 for (int cur = 0; cur < nX; ++ cur) 00064 { 00065 // create the empty image 00066 g. addVertex (); 00067 00068 // compute the image of the cube 00069 typeCubes img; 00070 theCubMap (X [cur], img); 00071 00072 // add the corresponding edges to the graph 00073 int nImg = img. size (); 00074 for (int i = 0; i < nImg; ++ i) 00075 { 00076 int number = X. getnumber (img [i]); 00077 if (number < 0) 00078 continue; 00079 g. addEdge (number); 00080 } 00081 00082 if ((dim > 3) && !(cur % 1000)) 00083 chomp::homology::scon << std::setw (8) << 00084 (cur / 1000) << "k\b\b\b\b\b\b\b\b\b"; 00085 } 00086 00087 return; 00088 } /* computeMapGraph */ 00089 00090 00091 #endif // _CMGRAPHS_MAPGRAPH_H_ 00092 00093
1.5.3