Go to the documentation of this file.00001
00002
00003
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _CAPD_HOMENGIN_HOMOLOGY_H_
00027 #define _CAPD_HOMENGIN_HOMOLOGY_H_
00028
00029 #include <string>
00030 #include <cstring>
00031 #include "capd/homengin/engines.h"
00032
00033
00053 inline void ComputeBettiNumbers (const void *buffer, int *sizes, int dim,
00054 int *result, const char *engine = 0, const int *wrapping = 0,
00055 bool quiet = false)
00056 {
00057 using namespace chomp::homology;
00058
00059 bool soutput = sout. show;
00060 bool coutput = scon. show;
00061 if (quiet)
00062 {
00063 sout. show = false;
00064 scon. show = false;
00065 fcout. turnOff ();
00066 }
00067 else
00068 fcout. turnOn ();
00069
00070
00071 chomp::homengin::cubitmap X (reinterpret_cast<const char *> (buffer),
00072 sizes, dim);
00073
00074
00075 if (wrapping)
00076 X. setwrapping (wrapping, dim);
00077
00078
00079 const chomp::homengin::engine *e;
00080 if (!engine)
00081 e = chomp::homengin::engine::find (&X);
00082
00083
00084 else
00085 e = chomp::homengin::engine::find (engine);
00086
00087
00088 chomp::homengin::algstruct<chomp::homology::integer> hom;
00089 e -> homology (X, hom);
00090 sout << "The computed homology is " << hom << ".\n";
00091
00092
00093 int levels = hom. countLevels ();
00094 for (int i = 0; i <= dim; ++ i)
00095 result [i] = (i < levels) ? hom. getBetti (i) : 0;
00096
00097
00098 chomp::homology::sout. show = soutput;
00099 chomp::homology::scon. show = coutput;
00100 return;
00101 }
00102
00103
00104
00105 #include "capd/homengin/cubiset.h"
00106
00107
00108 #endif // _CAPD_HOMENGIN_HOMOLOGY_H_
00109
00111