morsecon.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 ///
00003 /// @file morsecon.h
00004 ///
00005 /// Connections between Morse sets.
00006 /// This file contains the definition of two auxiliary classes
00007 /// for recording connections between Morse sets in a Morse decomposition.
00008 ///
00009 /// @author Pawel Pilarczyk
00010 ///
00011 /////////////////////////////////////////////////////////////////////////////
00012 
00013 // Copyright (C) 1997-2008 by Pawel Pilarczyk.
00014 //
00015 // This file is part of my research software package.  This is free software;
00016 // you can redistribute it and/or modify it under the terms of the GNU
00017 // General Public License as published by the Free Software Foundation;
00018 // either version 2 of the License, or (at your option) any later version.
00019 //
00020 // This software is distributed in the hope that it will be useful,
00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 // GNU General Public License for more details.
00024 //
00025 // You should have received a copy of the GNU General Public License along
00026 // with this software; see the file "license.txt".  If not, write to the
00027 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00028 // MA 02111-1307, USA.
00029 
00030 // Started on February 11, 2008. Last revision: February 11, 2008.
00031 
00032 
00033 #ifndef _CMGRAPHS_MORSECON_H_
00034 #define _CMGRAPHS_MORSECON_H_
00035 
00036 
00037 // include selected header files from the CHomP library
00038 #include "chomp/system/config.h"
00039 #include "chomp/struct/multitab.h"
00040 
00041 // include local header files
00042 #include "config.h"
00043 #include "typedefs.h"
00044 #include "morsedec.h"
00045 
00046 
00047 // --------------------------------------------------
00048 // ---- Connection Recorders for inclusionGraph -----
00049 // --------------------------------------------------
00050 
00051 /// A simple class for storing connections in an array that uses
00052 /// the "multitable" class.
00053 class TConnTable
00054 {
00055 public:
00056         /// The constructor.
00057         TConnTable (int _n, chomp::homology::multitable
00058                 <chomp::homology::multitable<int> > &_connections,
00059                 chomp::homology::multitable<int> &_conncount,
00060                 const int *_numTranslate);
00061 
00062         /// Adds an element v at the connection from source to target.
00063         void operator () (int source, int target, int v);
00064 
00065 private:
00066         /// The number of vertices between the connections are recorded.
00067         int n;
00068 
00069         /// The tables of connectiong orbits; those for v -> w are stored
00070         /// at the index n * v + w.
00071         chomp::homology::multitable <chomp::homology::multitable<int> >
00072                 &connections;
00073 
00074         /// The numbers of elements in each connecting orbit.
00075         chomp::homology::multitable<int> &conncount;
00076 
00077         /// The translation table for vertex numbers in the connections.
00078         const int *numTranslate;
00079 
00080 }; /* class TConnTable */
00081 
00082 inline TConnTable::TConnTable (int _n,
00083         chomp::homology::multitable<chomp::homology::multitable<int> >
00084         &_connections, chomp::homology::multitable<int> &_conncount,
00085         const int *_numTranslate):
00086         n (_n), connections (_connections), conncount (_conncount),
00087         numTranslate (_numTranslate)
00088 {
00089         int maxcount = n * n;
00090         for (int i = 0; i < maxcount; ++ i)
00091                 conncount [i] = 0;
00092         return;
00093 } /* TConnTable::TConnTable */
00094 
00095 inline void TConnTable::operator () (int source, int target, int v)
00096 {
00097         int pos = n * source + target;
00098         connections [pos] [conncount [pos] ++] = numTranslate [v];
00099         return;
00100 } /* TConnTable::operator () */
00101 
00102 // --------------------------------------------------
00103 
00104 /// A simple class for storing connections in an array that uses
00105 /// the "multitable" class.
00106 class TConnMorse
00107 {
00108 public:
00109         /// The constructor.
00110         TConnMorse (theMorseDecompositionType &_morseDec,
00111                 const spcCubes &_X, const int *_numTranslate);
00112 
00113         /// Adds an element v at the connection from source to target.
00114         void operator () (int source, int target, int v);
00115 
00116 private:
00117         /// The Morse decomposition in which to record the connections.
00118         theMorseDecompositionType &morseDec;
00119 
00120         /// The set which contains cubes to add.
00121         const spcCubes &X;
00122 
00123         /// The translation table for vertex numbers in the connections.
00124         const int *numTranslate;
00125 
00126 }; /* class TConnMorse */
00127 
00128 inline TConnMorse::TConnMorse (theMorseDecompositionType &_morseDec,
00129         const spcCubes &_X, const int *_numTranslate):
00130         morseDec (_morseDec), X (_X), numTranslate (_numTranslate)
00131 {
00132         return;
00133 } /* TConnMorse::TConnMorse */
00134 
00135 inline void TConnMorse::operator () (int source, int target, int v)
00136 {
00137         morseDec. addconn (source, target, X [numTranslate [v]]);
00138         return;
00139 } /* TConnMorse::operator () */
00140 
00141 
00142 #endif // _CMGRAPHS_MORSECON_H_
00143 

Generated on Sun Mar 28 17:47:57 2010 for The Conley-Morse Graphs Software by  doxygen 1.5.3