The Original CHomP Software
cubfiles.h
Go to the documentation of this file.
1
3
14
15// This file copyright (C) 1997-2016 by Pawel Pilarczyk.
16//
17// This file is part of the "chomp" program. It is free software;
18// you can redistribute it and/or modify it under the terms of the GNU
19// General Public License as published by the Free Software Foundation,
20// either version 3 of the License, or (at your option) any later version.
21//
22// This software is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with this software; see the file "license.txt". If not,
29// please, see <https://www.gnu.org/licenses/>.
30
31// Started in March 2006. Last revision: July 6, 2007.
32
33
34#ifndef _CAPD_HOMENGIN_CUBFILES_H_
35#define _CAPD_HOMENGIN_CUBFILES_H_
36
37#include "chomp/system/config.h"
40#include "chomp/system/arg.h"
42
43#include <cstdlib>
44#include <ctime>
45#include <new>
46#include <exception>
47#include <iostream>
48#include <fstream>
49#include <iomanip>
50#include <vector>
51#include <sstream>
52#include <algorithm>
53
54namespace chomp {
55namespace homengin {
56
57// --------------------------------------------------
58// -------------- ABSTRACT CUBICAL SET --------------
59// --------------------------------------------------
60
63{
64public:
66 cubfile (const char *_filename);
67
69 virtual ~cubfile ();
70
71/* /// Copy constructor.
72 cubfile (const cubfile &c);
73
75 cubfile &operator = (const cubfile &c);
76*/
78 const char *filename () const
79 {
80 return _filename. c_str ();
81 }
82
84 virtual int dim () const
85 {
86 if (_dim > 0)
87 return _dim;
88 throw "Undefined dimension of a set of cubes.";
89 }
90
92 virtual int count () const
93 {
94 if (_count >= 0)
95 return _count;
96 throw "Undefined number of cubes in a set.";
97 }
98
100 virtual bool bitmaptype () const
101 {
102 throw "Undefined bitmapness of a set of cubes.";
103 }
104
106 virtual bool elementary () const
107 {
108 throw "Undefined type of a set of cubes.";
109 }
110
112 virtual bool spacewrapping () const
113 {
114 return (_wrapping. size () != 0);
115 }
116
119 virtual int *spacewrapping (int *table) const
120 {
121 if (_wrapping. size ())
122 {
123 std::copy (_wrapping. begin (), _wrapping. end (),
124 table);
125 return table;
126 }
127 throw "Unknown space wrapping of a set of cubes.";
128 }
129
131 virtual void setwrapping (const int *table, int count = 0)
132 {
133 _wrapping. clear ();
134 int d = count ? count : dim ();
135 _wrapping. assign (table, table + d);
136 return;
137 }
138
143 virtual int boundingbox (int *mincoord, int *maxcoord) const
144 {
145 if (_min. size () && _max. size ())
146 {
147 if (mincoord)
148 std::copy (_min. begin (), _min. end (),
149 mincoord);
150 if (maxcoord)
151 std::copy (_max. begin (), _max. end (),
152 maxcoord);
153 return 0;
154 }
155 throw "Undefined bounding box of a set of cubes.";
156 }
157
163 int volume (int chunk = 0, bool power2 = false) const;
164
166 static const char *name ()
167 {
168 return "unknown set of cubes";
169 }
170
172 static std::ostream &describe (std::ostream &out)
173 {
174 out << "This is an unknown set of cubes.";
175 return out;
176 }
177
179 static bool compatible (const char *filename)
180 {
181 return false;
182 }
183
186 {
187 throw "Unable to read a set of cells.";
188 }
189
192 {
193 throw "Unable to read a set of cubes.";
194 }
195
201 virtual int readcubes (int *&sizes, char *&bytes, int padding = 0,
202 bool power2 = false) const
203 {
204 throw "Unable to read a bitmap set of cubes.";
205 }
206
207protected:
209 std::string _filename;
210
212 mutable int _dim;
213
215 mutable int _count;
216
218 mutable std::vector<int> _min;
219
221 mutable std::vector<int> _max;
222
224 mutable std::vector<int> _wrapping;
225
226}; /* class cubfile */
227
228// --------------------------------------------------
229
230inline cubfile::cubfile (const char *filename): _filename (filename),
231 _dim (0), _count (-1), _min (), _max (), _wrapping ()
232{
233 return;
234} /* cubfile::cubfile */
235
237{
238 return;
239} /* cubfile::~cubfile */
240
241
242// --------------------------------------------------
243// ------------- TYPES OF CUBICAL SETS --------------
244// --------------------------------------------------
245
248{
249public:
251 typedef std::vector<const cubtype *> cubtypelist;
252
255
256protected:
259 {
260 cubtypes. push_back (this);
261 return;
262 }
263
265 virtual ~cubtype ()
266 {
267 cubtypelist::iterator it = find (cubtypes. begin (),
268 cubtypes. end (), this);
269 if (it != cubtypes. end ())
270 cubtypes. erase (it);
271 return;
272 }
273
274public:
276 virtual const char *name () const = 0;
277
279 virtual std::ostream &describe (std::ostream &out) const = 0;
280
282 virtual bool compatible (const char *filename) const = 0;
283
285 virtual cubfile *newcubfile (const char *filename) const = 0;
286
288 static std::ostream &showlist (std::ostream &out,
290
294 static cubfile *newfile (const char *filename,
296
297}; /* class cubtypes */
298
301template <class cubfileT>
303{
304public:
307 {
308 return;
309 }
310
313 {
314 return;
315 }
316
318 const char *name () const
319 {
320 return cubfileT::name ();
321 }
322
324 std::ostream &describe (std::ostream &out) const
325 {
326 return cubfileT::describe (out);
327 }
328
330 bool compatible (const char *filename) const
331 {
332 return cubfileT::compatible (filename);
333 }
334
336 cubfile *newcubfile (const char *filename) const
337 {
338 return new cubfileT (filename);
339 }
340
341}; /* class cubfile_traits */
342
343
344// --------------------------------------------------
345// --------------- TEXT LIST OF CUBES ---------------
346// --------------------------------------------------
347
349class cublistfile: public cubfile
350{
351public:
353 cublistfile (const char *filename);
354
356 int dim () const;
357
359 int count () const
360 {
361 if (_count < 0)
362 analyze ();
363 return _count;
364 }
365
367 bool bitmaptype () const
368 {
369 return false;
370 }
371
373 bool elementary () const
374 {
375 return false;
376 }
377
379 int boundingbox (int *mincoord, int *maxcoord) const
380 {
381 if (!_min. size ())
382 analyze ();
383 return cubfile::boundingbox (mincoord, maxcoord);
384 }
385
387 static const char *name ()
388 {
389 return "text list of cubes";
390 }
391
393 static std::ostream &describe (std::ostream &out);
394
396 static bool compatible (const char *filename);
397
400
403
405 int readcubes (int *&sizes, char *&bytes, int padding = 0,
406 bool power2 = false) const;
407
408private:
411 void analyze () const;
412
415
416}; /* class cublistfile */
417
418// --------------------------------------------------
419
420inline cublistfile::cublistfile (const char *filename): cubfile (filename)
421{
422 return;
423} /* cublistfile::cublistfile */
424
425
426// --------------------------------------------------
427// --------------- TEXT LIST OF CELLS ---------------
428// --------------------------------------------------
429
431class cellistfile: public cubfile
432{
433public:
435 cellistfile (const char *filename);
436
438 int dim () const;
439
441 int count () const
442 {
443 if (_count < 0)
444 analyze ();
445 return _count;
446 }
447
449 bool bitmaptype () const
450 {
451 return false;
452 }
453
455 bool elementary () const
456 {
457 return true;
458 }
459
461 int boundingbox (int *mincoord, int *maxcoord) const
462 {
463 if (!_min. size ())
464 analyze ();
465 return cubfile::boundingbox (mincoord, maxcoord);
466 }
467
469 static const char *name ()
470 {
471 return "text list of cubical cells";
472 }
473
475 static std::ostream &describe (std::ostream &out);
476
478 static bool compatible (const char *filename);
479
482
485 {
486 throw "Trying to read cubical cells as a set of full cubes.";
487 }
488
490 int readcubes (int *&sizes, char *&bytes, int padding = 0,
491 bool power2 = false) const
492 {
493 throw "Trying to read cubical cells as a bitmap.";
494 }
495
496private:
499 void analyze () const;
500
503
504}; /* class cellistfile */
505
506// --------------------------------------------------
507
508inline cellistfile::cellistfile (const char *filename): cubfile (filename)
509{
510 return;
511} /* cellistfile::cellistfile */
512
513
514// --------------------------------------------------
515// -------------- BILL KALIES' BITCODE --------------
516// --------------------------------------------------
517
519class bitcodefile: public cubfile
520{
521public:
523 bitcodefile (const char *filename);
524
526 int dim () const
527 {
528 if (_dim <= 0)
529 analyze ();
530 return _dim;
531 }
532
534 int count () const
535 {
536 if (_count < 0)
537 analyze ();
538 return _count;
539 }
540
542 bool bitmaptype () const
543 {
544 return false;
545 }
546
548 bool elementary () const
549 {
550 return false;
551 }
552
554 static const char *name ()
555 {
556 return "text bitcodes";
557 }
558
560 static std::ostream &describe (std::ostream &out);
561
563 static bool compatible (const char *filename);
564
567
570
572 int readcubes (int *&sizes, char *&bytes, int padding = 0,
573 bool power2 = false) const;
574
575private:
578 void analyze () const;
579
582
583}; /* class bitcodefile */
584
585// --------------------------------------------------
586
587inline bitcodefile::bitcodefile (const char *filename): cubfile (filename)
588{
589 return;
590} /* bitcodefile::bitcodefile */
591
592
593// --------------------------------------------------
594// ----------------- WINDOWS BITMAP -----------------
595// --------------------------------------------------
596
598class winbmpfile: public cubfile
599{
600public:
602 winbmpfile (const char *filename);
603
605 int count () const;
606
608 bool bitmaptype () const
609 {
610 return true;
611 }
612
614 bool elementary () const
615 {
616 return false;
617 }
618
620 int boundingbox (int *mincoord, int *maxcoord) const;
621
623 static const char *name ()
624 {
625 return "windows bitmap";
626 }
627
629 static std::ostream &describe (std::ostream &out);
630
632 static bool compatible (const char *filename);
633
636 {
637 throw "Trying to read a set of cells from a Win BMP file.";
638 }
639
642
644 int readcubes (int *&sizes, char *&bytes, int padding = 0,
645 bool power2 = false) const;
646
647private:
650
651}; /* class winbmpfile */
652
653// --------------------------------------------------
654
655inline winbmpfile::winbmpfile (const char *filename): cubfile (filename)
656{
657 _dim = 2;
658 return;
659} /* winbmpfile::winbmpfile */
660
661
662// --------------------------------------------------
663// ----------------- MROZEK'S BITMAP -----------------
664// --------------------------------------------------
665
672{
673public:
675 bmdheader (const char *filename);
676
678 bool little;
679
682
684 int dim;
685
688
691
693 std::vector<int> width;
694
696 int readbytes (std::istream &f, int n) const;
697
698}; /* class bmdheader */
699
700// --------------------------------------------------
701
704std::ostream &operator << (std::ostream &out, const bmdheader &header);
705
706// --------------------------------------------------
707
708
710class bmdfile: public cubfile
711{
712public:
714 bmdfile (const char *filename);
715
717 int count () const;
718
720 bool bitmaptype () const
721 {
722 return true;
723 }
724
726 bool elementary () const
727 {
728 return false;
729 }
730
732 static const char *name ()
733 {
734 return "multi-dimensional bitmap";
735 }
736
738 static std::ostream &describe (std::ostream &out);
739
741 static bool compatible (const char *filename);
742
745 {
746 throw "Trying to read a set of cells from a BMD file.";
747 }
748
751
753 int readcubes (int *&sizes, char *&bytes, int padding = 0,
754 bool power2 = false) const;
755
756private:
759
762
763}; /* class bmdfile */
764
765// --------------------------------------------------
766
767inline bmdfile::bmdfile (const char *filename): cubfile (filename),
768 header (filename)
769{
770 _dim = header. dim;
771 _min. assign (_dim, 0);
772 _max. assign (header. width. begin (), header. width. end ());
773 return;
774} /* bmdfile::bmdfile */
775
776
777// --------------------------------------------------
778// ----------------- BITMAP BUFFER ------------------
779// --------------------------------------------------
780
782class cubitmap: public cubfile
783{
784public:
786 cubitmap (const char *buffer, const int *sizes, int dim);
787
789 int count () const;
790
792 bool bitmaptype () const
793 {
794 return true;
795 }
796
798 bool elementary () const
799 {
800 return false;
801 }
802
804 static const char *name ()
805 {
806 return "bitmap buffer (memory)";
807 }
808
810 static std::ostream &describe (std::ostream &out);
811
813 static bool compatible (const char */*filename*/)
814 {
815 return false;
816 }
817
820 {
821 throw "Trying to read a set of cells from a bitmap buffer.";
822 }
823
826
828 int readcubes (int *&sizes, char *&bytes, int padding = 0,
829 bool power2 = false) const;
830
831private:
833 const char *buf;
834
837
838}; /* class cubitmap */
839
840// --------------------------------------------------
841
842inline cubitmap::cubitmap (const char *buffer, const int *sizes, int dim):
843 cubfile ("(memory)"), buf (buffer)
844{
845 _dim = dim;
846 _min. assign (_dim, 0);
847 _max. assign (sizes, sizes + _dim);
848 if (sizes [0] & 0x1F)
849 throw "The x-size of a bitmap must be a multiple of 32.";
850 buflength = sizes [0] >> 3;
851 for (int i = 1; i < _dim; ++ i)
852 buflength *= sizes [i];
853 if (buflength <= 0)
854 throw "Non-positive buffer size - something went wrong.";
855 return;
856} /* cubitmap::cubitmap */
857
858
859} // namespace homengin
860} // namespace chomp
861
862#endif // _CAPD_HOMENGIN_CUBFILES_H_
863
865
This file contains the definition of a class which can be used to parse the command line of a program...
Text-encoded bitcodes.
Definition: cubfiles.h:520
void analyze() const
Analyzes the file to determine the number of cubes and the scope of their coordinates.
int dim() const
What is the dimension of the set of cubes?
Definition: cubfiles.h:526
bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:542
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:548
int readcubes(chomp::homology::SetOfCubes &s) const
Reads a cubical set from the file.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
static cubfile_traits< bitcodefile > t
Add this type of a cubical set to the list.
Definition: cubfiles.h:581
int count() const
How many cubes are there in the set?
Definition: cubfiles.h:534
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:554
bitcodefile(const char *filename)
The constructor.
Definition: cubfiles.h:587
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
Marian Mrozek's BMD binary file as a set of full cubes.
Definition: cubfiles.h:711
bmdfile(const char *filename)
The constructor.
Definition: cubfiles.h:767
int readcubes(chomp::homology::SetOfCubes &s) const
Read a cubical set from the file.
int count() const
How many cubes are there in the set?
bmdheader header
The header of the file.
Definition: cubfiles.h:758
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
Definition: cubfiles.h:744
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:732
static cubfile_traits< bmdfile > t
Add this type of a cubical set to the list.
Definition: cubfiles.h:761
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:726
bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:720
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
This class helps interpret files in the BMD format defined by Marian Mrozek.
Definition: cubfiles.h:672
bool little
Is this little endian data?
Definition: cubfiles.h:678
int dim
The dimension of the bitmap.
Definition: cubfiles.h:684
int offset
The offset of binary data in the file.
Definition: cubfiles.h:681
std::vector< int > width
The size of the picture in each direction.
Definition: cubfiles.h:693
int readbytes(std::istream &f, int n) const
Reads an n-byte integer from the file.
int length
The length of the bitmap in the file.
Definition: cubfiles.h:687
bmdheader(const char *filename)
The only allowed constructor.
int zerowidth
The width of the actual bitmap in the first direction.
Definition: cubfiles.h:690
Text list of cubical cells.
Definition: cubfiles.h:432
void analyze() const
Analyzes the file to determine the number of cubes and the scope of their coordinates.
int boundingbox(int *mincoord, int *maxcoord) const
Determines the bounding box of the set of cubical cells.
Definition: cubfiles.h:461
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:455
bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:449
int count() const
How many cubes are there in the set?
Definition: cubfiles.h:441
int readcubes(chomp::homology::SetOfCubes &s) const
Reads a cubical set from the file.
Definition: cubfiles.h:484
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
int dim() const
What is the dimension of the set of cubes?
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:469
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
static cubfile_traits< cellistfile > t
Add this type of a cubical set to the list.
Definition: cubfiles.h:502
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
Definition: cubfiles.h:490
cellistfile(const char *filename)
The constructor.
Definition: cubfiles.h:508
This class defines some common properties of the corresponding classes which define various types of ...
Definition: cubfiles.h:303
cubfile * newcubfile(const char *filename) const
Creates a new cubfile object of the desired type.
Definition: cubfiles.h:336
std::ostream & describe(std::ostream &out) const
Describe the given type of cubical sets.
Definition: cubfiles.h:324
const char * name() const
The name of the corresponding cubical set.
Definition: cubfiles.h:318
cubfile_traits()
The default constructor.
Definition: cubfiles.h:306
bool compatible(const char *filename) const
Verifies if the file format is compatible with this cubfile type.
Definition: cubfiles.h:330
~cubfile_traits()
The destructor.
Definition: cubfiles.h:312
An abstract class that is inherited by all the cubical sets.
Definition: cubfiles.h:63
virtual ~cubfile()
The destructor.
Definition: cubfiles.h:236
std::vector< int > _wrapping
The space wrapping information if any.
Definition: cubfiles.h:224
virtual void setwrapping(const int *table, int count=0)
Sets the space wrapping according to the given table.
Definition: cubfiles.h:131
int _count
The number of cubes in the set, -1 if unknown.
Definition: cubfiles.h:215
std::vector< int > _min
The minimal coordinates of the cubes' corners (bounding box).
Definition: cubfiles.h:218
int volume(int chunk=0, bool power2=false) const
Determine the volume of the bounding box of the set of cubes.
virtual int readcubes(chomp::homology::SetOfCubes &s) const
Reads a set of cubes from the file.
Definition: cubfiles.h:191
virtual bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:100
std::vector< int > _max
The maximal coordinates of the cubes' corners (bounding box).
Definition: cubfiles.h:221
virtual int count() const
How many cubes are there in the set?
Definition: cubfiles.h:92
virtual int * spacewrapping(int *table) const
Fills in the space wrapping table if applicable.
Definition: cubfiles.h:119
virtual bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:106
virtual int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
Definition: cubfiles.h:185
cubfile(const char *_filename)
The default constructor.
Definition: cubfiles.h:230
virtual bool spacewrapping() const
Does this set include the definition of space wrapping?
Definition: cubfiles.h:112
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
Definition: cubfiles.h:172
virtual int dim() const
What is the dimension of the set of cubes?
Definition: cubfiles.h:84
std::string _filename
The name of the corresponding disk file.
Definition: cubfiles.h:209
virtual int boundingbox(int *mincoord, int *maxcoord) const
Determines the bounding box of the set of cubes.
Definition: cubfiles.h:143
virtual int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
Definition: cubfiles.h:201
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:166
const char * filename() const
What is the name of the associated disk file?
Definition: cubfiles.h:78
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
Definition: cubfiles.h:179
int _dim
The dimension of the space, 0 if unknown.
Definition: cubfiles.h:212
A bitmap buffer stored in the memory, not in a file.
Definition: cubfiles.h:783
cubitmap(const char *buffer, const int *sizes, int dim)
The constructor.
Definition: cubfiles.h:842
const char * buf
The actual bitmap buffer.
Definition: cubfiles.h:833
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:804
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
Definition: cubfiles.h:819
int buflength
The length of the buffer in bytes.
Definition: cubfiles.h:836
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
static bool compatible(const char *)
Verifies if the file format is compatible with this cubfile type.
Definition: cubfiles.h:813
int readcubes(chomp::homology::SetOfCubes &s) const
Read a cubical set from the file.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:798
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:792
int count() const
How many cubes are there in the set?
Text list of cubes.
Definition: cubfiles.h:350
int boundingbox(int *mincoord, int *maxcoord) const
Determines the bounding box of the set of cubes.
Definition: cubfiles.h:379
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:387
int count() const
How many cubes are there in the set?
Definition: cubfiles.h:359
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
cublistfile(const char *filename)
The constructor.
Definition: cubfiles.h:420
void analyze() const
Analyzes the file to determine the number of cubes and the scope of their coordinates.
int dim() const
What is the dimension of the set of cubes?
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int readcubes(chomp::homology::SetOfCubes &s) const
Reads a cubical set from the file.
bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:367
static cubfile_traits< cublistfile > t
Add this type of a cubical set to the list.
Definition: cubfiles.h:414
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:373
A class that holds pointers to the traits of all the cubical file types.
Definition: cubfiles.h:248
virtual const char * name() const =0
The name of the set of cubes.
virtual std::ostream & describe(std::ostream &out) const =0
Describe the given type of cubical sets.
std::vector< const cubtype * > cubtypelist
The type of a list of engines.
Definition: cubfiles.h:251
virtual bool compatible(const char *filename) const =0
Verifies if the file format is compatible with this cubfile type.
static cubtypelist cubtypes
A list of all the engines that have been defined so far.
Definition: cubfiles.h:254
virtual cubfile * newcubfile(const char *filename) const =0
Creates a new cubfile object of the desired type.
virtual ~cubtype()
The destructor: Remove the cubical file traits from the list.
Definition: cubfiles.h:265
cubtype()
The constructor: Add the cubical file traits to the list.
Definition: cubfiles.h:258
static std::ostream & showlist(std::ostream &out, const cubtype::cubtypelist &types=cubtype::cubtypes)
Shows a list of available cubical set types with descriptions.
static cubfile * newfile(const char *filename, const cubtype::cubtypelist &types=cubtype::cubtypes)
Creates an appropriate cubical set corresponding to the given file.
Windows bitmap as a set of full cubes.
Definition: cubfiles.h:599
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
Definition: cubfiles.h:614
bool bitmaptype() const
Is this a bitmap type of set of cubes?
Definition: cubfiles.h:608
int boundingbox(int *mincoord, int *maxcoord) const
Determine the bounding box of the set of cubes.
static const char * name()
The name of this type of a cubical set.
Definition: cubfiles.h:623
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
Definition: cubfiles.h:635
static cubfile_traits< winbmpfile > t
Add this type of a cubical set to the list.
Definition: cubfiles.h:649
winbmpfile(const char *filename)
The constructor.
Definition: cubfiles.h:655
int readcubes(chomp::homology::SetOfCubes &s) const
Read a cubical set from the file.
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int count() const
How many cubes are there in the set?
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
The class that defines a geometric complex - a set of cells (cubes, simplices, etc).
Definition: gcomplex.h:85
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
This file contains various small procedures that might be useful in programs which compute homology.
std::ostream & operator<<(std::ostream &out, const algstruct< euclidom > &s)
Outputs the structure to the output stream in a human-readable form.
Definition: algstruct.h:288
This namespace contains the entire CHomP library interface.
Definition: bitmaps.h:51
This file contains some useful functions related to the text input/output procedures.
This file defines a simple data structure which can be used to measure time used by the program (or s...