File: ComputeTriangs.hh

package info (click to toggle)
topcom 1.2.0~beta%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 148,596 kB
  • sloc: cpp: 40,956; sh: 4,663; makefile: 679; ansic: 55
file content (169 lines) | stat: -rw-r--r-- 5,226 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//////////////////////////////////////////////////////////////////////////
// ComputeTriangs.hh
// produced: 25 Nov 1999 jr
/////////////////////////////////////////////////////////////////////////
#ifndef COMPUTETRIANGS_HH
#define COMPUTETRIANGS_HH

#include "Global.hh"
#include "Message.hh"
#include "SimplicialComplex.hh"
#include "PointConfiguration.hh"
#include "Chirotope.hh"
#include "Symmetry.hh"
#include "RegularityCheck.hh"
#include "Signal.hh"

namespace topcom {

  class ComputeTriangs {
  public:

    // flags:
    static constexpr int INPUT_CHIRO    = 0x0001;
    static constexpr int COMPUTE_ALL    = 0x0002;
    static constexpr int FINE_ONLY      = 0x0004;
    static constexpr int OUTPUT_TRIANGS = 0x0008;
    static constexpr int PREPROCESS     = 0x0010;
    static constexpr int FINDFLIPS      = 0x0020;
    static constexpr int UNIMODULAR     = 0x0040;
    static constexpr int FINDMIN        = 0x0080;    
  private:
    parameter_type        _no;
    parameter_type        _rank;
    PointConfiguration*   _pointsptr;
    Chirotope*            _chiroptr;
    SymmetryGroup*        _symmetriesptr;
    SymmetryGroup*        _required_symmetriesptr;
    SimplicialComplex*    _seedptr;
    symmetryptr_datapair* _seed_symmetryptrsptr;
    Volumes*              _voltableptr;
  public:
    bool                  input_chiro;
    bool                  compute_all;
    bool                  fine_only;
    bool                  output_triangs;
    bool                  preprocess;
    bool                  findflips;
    bool                  unimodular;
    bool                  findmin;    
  public:
    inline ComputeTriangs() :
      _no(-1),
      _rank(-1),
      _pointsptr(0),
      _chiroptr(0),
      _symmetriesptr(0),
      _required_symmetriesptr(0),
      _seedptr(0),
      _seed_symmetryptrsptr(0),
      _voltableptr(0),
      input_chiro(false),
      compute_all(false),
      fine_only(false),
      output_triangs(false),
      preprocess(false),
      findflips(false),
      unimodular(false),
      findmin(false) {
      if (CommandlineOptions::lp_solver_needed()) {
	
	// some solvers need initialization of global constants etc.:
	RegularityCheck::init();
      }
    }
    inline ComputeTriangs(const int flags) :
      _no(-1),
      _rank(-1),
      _pointsptr(0),
      _chiroptr(0),
      _symmetriesptr(0),
      _required_symmetriesptr(0),
      _seedptr(0),
      _seed_symmetryptrsptr(0),
      _voltableptr(0),
      input_chiro(flags & INPUT_CHIRO),
      compute_all(flags & COMPUTE_ALL),
      fine_only(flags & FINE_ONLY),
      output_triangs(flags & OUTPUT_TRIANGS),
      preprocess(flags & PREPROCESS),
      findflips(flags & FINDFLIPS),
      unimodular(flags & UNIMODULAR),
      findmin(flags & FINDMIN) {
      if (CommandlineOptions::lp_solver_needed()) {

	// some solvers need initialization of global constants etc.:
	RegularityCheck::init();
      }
    }
    
    inline ~ComputeTriangs() {
      if (CommandlineOptions::lp_solver_needed()) {
	
	// some solvers need termination of global constants etc.:
	RegularityCheck::term();
      }
      if (_pointsptr) {
	delete _pointsptr;
      }
      if (_chiroptr) {
	delete _chiroptr;
      }
      if (_symmetriesptr) {
	delete _symmetriesptr;
      }
      if (_required_symmetriesptr) {
	delete _required_symmetriesptr;
      }
      if (_seedptr) {
	delete _seedptr;
      }
      if (_seed_symmetryptrsptr) {
	delete _seed_symmetryptrsptr;
      }
      if (_voltableptr) {
	delete _voltableptr;
      }
    }

    int run();

    Message& write_header(Message&) const;
    std::istream& read_input(std::istream&);
    
    const std::pair<size_type, SimplicialComplex> findmin_by_extension(const parameter_type      no,
								       const parameter_type      rank,
								       const PointConfiguration* pointsptr,
								       const Chirotope*          chiroptr,
								       const SymmetryGroup*      symmetriesptr,
								       const SymmetryGroup*      required_symmetriesptr,
								       const bool                output_triangs,
								       const bool                only_fine_triangs);
    const size_type enumerate_by_extension(const parameter_type      no,
					   const parameter_type      rank,
					   const PointConfiguration* pointsptr,
					   const Chirotope*          chiroptr,
					   const SymmetryGroup*      symmetriesptr,
					   const SymmetryGroup*      required_symmetriesptr,
					   const bool                output_triangs,
					   const bool                only_fine_triangs);

    const size_type enumerate_by_flips(const parameter_type        no,
				       const parameter_type        rank,
				       const PointConfiguration*   pointsptr,
				       const Chirotope*            chiroptr,
				       const SymmetryGroup*        symmetriesptr,
				       const SymmetryGroup*        required_symmetriesptr,
				       const SimplicialComplex*    seedptr,
				       const symmetryptr_datapair* seed_symmetryptrs,
				       const Volumes*              voltableptr,
				       const bool                  output_triangs,
				       const bool                  fine_only);
    
  };
  
}; // namespace topcom

#endif

// eof ComputeTriangs.hh