File: app_isconnected.cpp

package info (click to toggle)
gfan 0.5%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,348 kB
  • ctags: 5,683
  • sloc: cpp: 39,675; makefile: 454; sh: 1
file content (61 lines) | stat: -rw-r--r-- 1,594 bytes parent folder | download | duplicates (6)
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
#include "parser.h"
#include "printer.h"
#include "polynomial.h"
#include "division.h"
#include "lp.h"
#include "gfanapplication.h"
#include "polyhedralcone.h"
#include "polyhedralfan.h"
#include "symmetry.h"

#include "polymakefile.h"

class IsConnectedApplication : public GFanApplication
{
  StringOption inputOption;
  SimpleOption optionSymmetry;
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  const char *helpText()
  {
    return "This program checks if a PURE d-dimensional fan is connected in codimension one (in the sense of [Bogart, Jensen, Speyer, Sturmfels, Thomas]).\n";
  }
  IsConnectedApplication():
    inputOption("-i","Specify the name of the input file.","polymake.out"),
    optionSymmetry("--symmetry",
		   "Reads in the cone stored with symmetry. The generators of the symmetry group are given on the input. IF SYMMETRY IS SPECIFIED THEN "
		   "THE CHECK IS NOT COMPLETE AND IT WILL ONLY BE CHECKED IF THAT GIVEN"
		   "TWO CONES THAT EXIST ELEMENTS IN THE TWO RESPECTIVE ORBITS"
		   "WHICH ARE CONNECTED BY A RIDGE PATH\n")
  {
    registerOptions();
  }

  const char *name()
  {
    return "_isconnected";
  }

  int main()
  {
    PolyhedralFan f=PolyhedralFan::readFan(inputOption.getValue(),true,0,0,0,true);
    int n=f.getAmbientDimension();
    SymmetryGroup s(n);

    if(optionSymmetry.getValue())
      {
	IntegerVectorList generators=FileParser(Stdin).parseIntegerVectorList();
	s.computeClosure(generators);
      }

    cout << f.isConnected(&s) << endl;

    return 0;
  }
};

static IsConnectedApplication theApplication;