~ubuntu-branches/ubuntu/saucy/gfan/saucy-proposed

« back to all changes in this revision

Viewing changes to app_fancones.cpp

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2013-07-09 10:44:01 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130709104401-5q66ozz5j5af0dak
Tags: 0.5+dfsg-3
* Upload to unstable.
* modify remove_failing_tests_on_32bits.patch to replace command of
  0009RenderStairCase test with an empty one instead of deleting it.
* remove lintian override about spelling error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "parser.h"
 
2
#include "printer.h"
 
3
#include "polynomial.h"
 
4
#include "division.h"
 
5
#include "lp.h"
 
6
#include "gfanapplication.h"
 
7
#include "polyhedralcone.h"
 
8
#include "polyhedralfan.h"
 
9
#include "symmetry.h"
 
10
 
 
11
#include "polymakefile.h"
 
12
 
 
13
class FanConesApplication : public GFanApplication
 
14
{
 
15
  StringOption inputOption;
 
16
  SimpleOption resultantOption;
 
17
public:
 
18
  bool includeInDefaultInstallation()
 
19
  {
 
20
    return false;
 
21
  }
 
22
  const char *helpText()
 
23
  {
 
24
    return "This program lists the cones of a polyhedral fan.\n";
 
25
  }
 
26
  FanConesApplication():
 
27
    inputOption("-i","Specify the name of the input file.","polymake.out"),
 
28
    resultantOption("--resultant","Take codim 1 skeleton and wipe out bad cones.")
 
29
  {
 
30
    registerOptions();
 
31
  }
 
32
 
 
33
  const char *name()
 
34
  {
 
35
    return "_fancones";
 
36
  }
 
37
 
 
38
  bool zeroOrTwo(int v)
 
39
  {
 
40
    return (v==0) || (v==2);
 
41
  }
 
42
  int main()
 
43
  {
 
44
    PolyhedralFan f1=PolyhedralFan::readFan(inputOption.getValue(),true,0,0,0);
 
45
    AsciiPrinter P(Stdout);
 
46
 
 
47
    if(resultantOption.getValue())
 
48
      {
 
49
        PolyhedralFan f2=f1.facetComplex();
 
50
        PolyhedralFan f3(f2.getAmbientDimension());
 
51
        for(PolyhedralFan::coneIterator i=f2.conesBegin();i!=f2.conesEnd();i++)
 
52
          {
 
53
            IntegerVector v=i->getEquations().front();
 
54
            IntegerVector u=v.supportAsZeroOneVector();
 
55
 
 
56
            if(zeroOrTwo(u[0]+u[1]+u[2]+u[3]) &&
 
57
                zeroOrTwo(u[4]+u[5]+u[6]) &&
 
58
                zeroOrTwo(u[7]+u[8]/*+u[5]*/))
 
59
              f3.insert(*i);
 
60
          }
 
61
        f3.printWithIndices(&pout);
 
62
        //        pout << f2;
 
63
      }
 
64
    else
 
65
    for(PolyhedralFan::coneIterator i=f1.conesBegin();i!=f1.conesEnd();i++)
 
66
      {
 
67
        P<<*i;
 
68
        P<<"-------------------------------------\n";
 
69
      }
 
70
 
 
71
 
 
72
 
 
73
    return 0;
 
74
  }
 
75
};
 
76
 
 
77
static FanConesApplication theApplication;
 
78