CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
#include "polymake_data.h"
2
3
extern Obj TheTypeExternalPolymakeCone;
4
extern Obj TheTypeExternalPolymakeFan;
5
extern Obj TheTypeExternalPolymakePolytope;
6
extern Obj TheTypeExternalPolymakeTropicalHypersurface;
7
extern Obj TheTypeExternalPolymakeTropicalPolytope;
8
9
Obj NewPolymakeExternalObject(enum polymake_object_type t) {
10
Obj o;
11
o = NewBag(T_POLYMAKE, 2*sizeof(Obj));
12
13
switch(t) {
14
case T_POLYMAKE_EXTERNAL_CONE:
15
ADDR_OBJ(o)[0] = TheTypeExternalPolymakeCone;
16
break;
17
case T_POLYMAKE_EXTERNAL_FAN:
18
ADDR_OBJ(o)[0] = TheTypeExternalPolymakeFan;
19
break;
20
case T_POLYMAKE_EXTERNAL_POLYTOPE:
21
ADDR_OBJ(o)[0] = TheTypeExternalPolymakePolytope;
22
break;
23
case T_POLYMAKE_EXTERNAL_TROPICAL_HYPERSURFACE:
24
ADDR_OBJ(o)[0] = TheTypeExternalPolymakeTropicalHypersurface;
25
break;
26
case T_POLYMAKE_EXTERNAL_TROPICAL_POLYTOPE:
27
ADDR_OBJ(o)[0] = TheTypeExternalPolymakeTropicalPolytope;
28
break;
29
}
30
ADDR_OBJ(o)[1] = NULL;
31
return o;
32
}
33
34
/* Free function */
35
void ExternalPolymakeObjectFreeFunc(Obj o) {
36
perlobj* p = PERLOBJ_POLYMAKEOBJ(o);
37
if(p != NULL)
38
delete p;
39
}
40
41
/* Type object function for the polymake object */
42
Obj ExternalPolymakeObjectTypeFunc(Obj o) {
43
return ADDR_OBJ(o)[0];
44
}
45
46
void polymake_start( Polymake_Data* data ){
47
if( ! data->initialized ){
48
data->main_polymake_session = new polymake::Main;
49
data->main_polymake_scope = new polymake::perl::Scope(data->main_polymake_session->newScope());
50
data->initialized = true;
51
}
52
return;
53
}
54
55