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

« back to all changes in this revision

Viewing changes to app_rendernewtonpolytope.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 "buchberger.h"
6
 
#include "wallideal.h"
7
 
#include "lp.h"
8
 
#include "reversesearch.h"
9
 
#include "termorder.h"
10
 
#include "ep_standard.h"
11
 
#include "ep_xfig.h"
12
 
#include "gfanapplication.h"
13
 
#include "renderer.h"
14
 
#include "xfig.h"
15
 
 
16
 
class RenderNewtonPolytopeApplication : public GFanApplication
17
 
{
18
 
  FieldOption theFieldOption;
19
 
  SimpleOption optionListOfPolynomialSets;
20
 
  IntegerOption optionMaxEntry;
21
 
  IntegerOption optionWidth;
22
 
public:
23
 
  bool includeInDefaultInstallation()
24
 
  {
25
 
    return false;
26
 
  }
27
 
  const char *helpText()
28
 
  {
29
 
    return "Renders the Newton polytope of a polynomial in two variables.\n"
30
 
      "The output is an xfig file.\n";
31
 
  }
32
 
  RenderNewtonPolytopeApplication():
33
 
    optionListOfPolynomialSets("-m","undocumented"),
34
 
    optionMaxEntry("-d","undocumented",8),
35
 
    optionWidth("-w","undocumented",5)
36
 
  {
37
 
    registerOptions();
38
 
  }
39
 
 
40
 
  char *name()
41
 
  {
42
 
    return "_rendernewtonpolytope";
43
 
  }
44
 
  
45
 
  int main()
46
 
  {
47
 
    /*    LpSolver::printList(Stderr);
48
 
    lpSetSolver("cddgmp");
49
 
    */    
50
 
    FileParser P(Stdin);
51
 
 
52
 
    Polynomial p=P.parsePolynomialWithRing();
53
 
 
54
 
 
55
 
    XFig f(Stdout);
56
 
 
57
 
    int scale=1000;
58
 
    int maxX=5;
59
 
    int maxY=5;
60
 
 
61
 
    f.beginDrawLine(false,true);
62
 
    f.addPoint(0,0);
63
 
    f.addPoint(maxX*scale,0);
64
 
    f.endDrawLine();
65
 
 
66
 
    f.beginDrawLine(false,true);
67
 
    f.addPoint(0,0);
68
 
    f.addPoint(0,-maxY*scale);
69
 
    f.endDrawLine();
70
 
 
71
 
 
72
 
    for(TermMap::iterator i=p.terms.begin();i!=p.terms.end();i++)
73
 
      {
74
 
        Monomial m=i->first;
75
 
 
76
 
        IntegerVector v=m.exponent;
77
 
        assert(v.size()>=2);
78
 
        int x=v[0];
79
 
        int y=v[1];
80
 
        f.drawDot(scale*x,-scale*y);
81
 
 
82
 
        f.drawString(scale*x+int(0.2*scale),-scale*y+60,i->second.toString());
83
 
      }
84
 
 
85
 
    return 0;
86
 
  }
87
 
};
88
 
 
89
 
static RenderNewtonPolytopeApplication theApplication;