1 | #include <callgfanlib_conversion.h> |
---|
2 | #include <bbfan.h> |
---|
3 | #include <groebnerCone.h> |
---|
4 | #include <tropicalVarietyOfIdeals.h> |
---|
5 | #include <libpolys/coeffs/numbers.h> |
---|
6 | #include <libpolys/misc/options.h> |
---|
7 | #include <kernel/structs.h> |
---|
8 | |
---|
9 | |
---|
10 | BITSET bitsetSave1, bitsetSave2; |
---|
11 | |
---|
12 | /*** |
---|
13 | * sets option(redSB) |
---|
14 | **/ |
---|
15 | static void setOptionRedSB() |
---|
16 | { |
---|
17 | SI_SAVE_OPT(bitsetSave1,bitsetSave2); |
---|
18 | si_opt_1|=Sy_bit(OPT_REDSB); |
---|
19 | } |
---|
20 | |
---|
21 | /*** |
---|
22 | * sets option(noredSB); |
---|
23 | **/ |
---|
24 | static void undoSetOptionRedSB() |
---|
25 | { |
---|
26 | SI_RESTORE_OPT(bitsetSave1,bitsetSave2); |
---|
27 | } |
---|
28 | |
---|
29 | BOOLEAN tropicalVariety(leftv res, leftv args) |
---|
30 | { |
---|
31 | leftv u = args; |
---|
32 | if ((u!=NULL) && (u->Typ()==IDEAL_CMD)) |
---|
33 | { |
---|
34 | ideal I = (ideal) u->CopyD(); |
---|
35 | leftv v = u->next; |
---|
36 | if (v==NULL) |
---|
37 | { |
---|
38 | tropicalStrategy currentStrategy(I,currRing); |
---|
39 | setOptionRedSB(); |
---|
40 | gfan::ZFan* tropI = tropicalVariety(currentStrategy); |
---|
41 | undoSetOptionRedSB(); |
---|
42 | res->rtyp = fanID; |
---|
43 | res->data = (char*) tropI; |
---|
44 | return FALSE; |
---|
45 | } |
---|
46 | if ((v!=NULL) && (v->Typ()==NUMBER_CMD)) |
---|
47 | { |
---|
48 | number p = (number) v->CopyD(); |
---|
49 | tropicalStrategy currentStrategy(I,p,currRing); |
---|
50 | gfan::ZFan* tropI = tropicalVariety(currentStrategy); |
---|
51 | res->rtyp = fanID; |
---|
52 | res->data = (char*) tropI; |
---|
53 | return FALSE; |
---|
54 | } |
---|
55 | return FALSE; |
---|
56 | } |
---|
57 | WerrorS("tropicalVariety: unexpected parameters"); |
---|
58 | return TRUE; |
---|
59 | } |
---|