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
|
#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 FanConesApplication : public GFanApplication
{
StringOption inputOption;
SimpleOption resultantOption;
public:
bool includeInDefaultInstallation()
{
return false;
}
const char *helpText()
{
return "This program lists the cones of a polyhedral fan.\n";
}
FanConesApplication():
inputOption("-i","Specify the name of the input file.","polymake.out"),
resultantOption("--resultant","Take codim 1 skeleton and wipe out bad cones.")
{
registerOptions();
}
const char *name()
{
return "_fancones";
}
bool zeroOrTwo(int v)
{
return (v==0) || (v==2);
}
int main()
{
PolyhedralFan f1=PolyhedralFan::readFan(inputOption.getValue(),true,0,0,0);
AsciiPrinter P(Stdout);
if(resultantOption.getValue())
{
PolyhedralFan f2=f1.facetComplex();
PolyhedralFan f3(f2.getAmbientDimension());
for(PolyhedralFan::coneIterator i=f2.conesBegin();i!=f2.conesEnd();i++)
{
IntegerVector v=i->getEquations().front();
IntegerVector u=v.supportAsZeroOneVector();
if(zeroOrTwo(u[0]+u[1]+u[2]+u[3]) &&
zeroOrTwo(u[4]+u[5]+u[6]) &&
zeroOrTwo(u[7]+u[8]/*+u[5]*/))
f3.insert(*i);
}
f3.printWithIndices(&pout);
// pout << f2;
}
else
for(PolyhedralFan::coneIterator i=f1.conesBegin();i!=f1.conesEnd();i++)
{
P<<*i;
P<<"-------------------------------------\n";
}
return 0;
}
};
static FanConesApplication theApplication;
|