The Conley-Morse Graphs Software
procsave.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2///
3/// @file procsave.h
4///
5/// A plug-in for post-processing of Morse decompositions
6/// which saves the Morse decomposition and the combinatorial map.
7/// This is a replacement for "procmdec.h".
8///
9/// @author Pawel Pilarczyk
10///
11/////////////////////////////////////////////////////////////////////////////
12
13// Copyright (C) 1997-2014 by Pawel Pilarczyk.
14//
15// This file is part of my research software package. This is free software:
16// you can redistribute it and/or modify it under the terms of the GNU
17// General Public License as published by the Free Software Foundation,
18// either version 3 of the License, or (at your option) any later version.
19//
20// This software is distributed in the hope that it will be useful,
21// but WITHOUT ANY WARRANTY; without even the implied warranty of
22// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23// GNU General Public License for more details.
24//
25// You should have received a copy of the GNU General Public License
26// along with this software; see the file "license.txt". If not,
27// please, see <https://www.gnu.org/licenses/>.
28
29// Started on August 7, 2010. Last revision: July 7, 2011.
30
31
32#ifndef _CMGRAPHS_PROCSAVE_H_
33#define _CMGRAPHS_PROCSAVE_H_
34
35// include some system header files
36#include <string>
37#include <sstream>
38#include <fstream>
39
40// include selected header files from the CHomP library
41#include "chomp/system/textfile.h"
42#include "chomp/struct/digraph.h"
43
44// include local header files
45#include "config.h"
46#include "typedefs.h"
47#include "conindex.h"
48#include "morsedec.h"
49#include "typedyns.h"
50
51
52namespace custom {
53
54/// Dummy version of a function for the post-processing
55/// of Morse decompositions.
56namespace saveMorseDec {
57
58
59// --------------------------------------------------
60// ------- post-process a Morse decomposition -------
61// --------------------------------------------------
62
63/// Dummy function for post-processing Morse decompositions.
64template <class CubSetType, class MorseDecType, class GraphType,
65 class CubMapType>
66inline void processMorseDec (const MorseDecType &morseDec,
67 const CubSetType &X, const GraphType &g,
68 const CubMapType &theCubMap, const CubMapType &,
69 const std::string &cubesFilePrefix,
70 const std::string &procFilePrefix)
71{
72 using chomp::homology::sout;
73
74 // don't save anything if the file name is not given
75 if (cubesFilePrefix. empty ())
76 return;
77
78 // save the entire space to a file
79 if (true)
80 {
81 sout << "Saving the phase space...\n";
82 std::ostringstream filename;
83 filename << cubesFilePrefix << ".cub";
84 std::ofstream f (filename. str (). c_str ());
85 f << "; The phase space X: " << X. size () << " cubes.\n";
86 f << X;
87 }
88
89 // save the combinatorial map to a file
90 if (false)
91 {
92 sout << "Saving the combinatorial map...\n";
93 std::ostringstream filename;
94 filename << cubesFilePrefix << ".map";
95 std::ofstream f (filename. str (). c_str ());
96 f << "; The combinatorial map: " << X. size () <<
97 " assignments.\n";
98 for (int i = 0; i < X. size (); ++ i)
99 {
100 f << X [i] << " -> {";
101 spcCubes img;
102 theCubMap (X [i], &img, 0, 0, 0, false);
103 for (int j = 0; j < img. size (); ++ j)
104 {
105 if (j)
106 f << ",";
107 f << img [j];
108 }
109 f << "}\n";
110 }
111 }
112
113 // save the graph to a file
114 if (false)
115 {
116 sout << "Saving the graph...\n";
117 std::ostringstream filename;
118 filename << cubesFilePrefix << ".grp";
119 std::ofstream f (filename. str (). c_str ());
120 f << "; The graph: " << g. countVertices () <<
121 " vertices, " << g. countEdges () << " edges.\n";
122 f << g;
123 }
124
125 // save the Morse sets and the exit sets to files
126/* sout << "Saving the index pairs for the Morse sets...\n";
127 for (int m = 0; m < morseDec. count (); ++ m)
128 {
129 // extract the Morse set
130 const spcCubes &mSet = morseDec [m];
131
132 // save the Morse set
133 {
134 std::ostringstream filename;
135 filename << cubesFilePrefix << m << "q.cub";
136 std::ofstream f (filename. str (). c_str ());
137 f << "; The Morse set no. " << m << ": " <<
138 mSet. size () << " cubes.\n";
139 f << mSet;
140 }
141
142 // compute the exit set for the Morse set
143 spcCubes mExit;
144 for (int i = 0; i < mSet. size (); ++ i)
145 theCubMap (mSet [i], &mExit, 0, 0, false);
146 mExit. remove (mSet);
147
148 // save the exit set
149 {
150 std::ostringstream filename;
151 filename << cubesFilePrefix << m << "r.cub";
152 std::ofstream f (filename. str (). c_str ());
153 f << "; The exit set no. " << m << ": " <<
154 mExit. size () << " cubes.\n";
155 f << mExit;
156 }
157 }
158*/
159 return;
160} /* processMorseDec */
161
162
163} // namespace saveMorseDec
164} // namespace custom
165
166
167#endif // _CMGRAPHS_PROCSAVE_H_
168
Choice of configuration settings.
Conley index computation routines.
Morse decompositions.
void processMorseDec(const MorseDecType &morseDec, const CubSetType &X, const GraphType &g, const CubMapType &theCubMap, const CubMapType &, const std::string &cubesFilePrefix, const std::string &procFilePrefix)
Dummy function for post-processing Morse decompositions.
Definition: procsave.h:66
Customizable settings that are supposed to be modified and/or chosen by the user of the software.
Customizable data types for the Conley-Morse graphs computation program.
Data types for the dynamical systems data structures.
chomp::homology::hashedset< spcCube > spcCubes
The type of a set of cubes in the phase space.
Definition: typespace.h:58