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_fktn.h"
2
3
4
Obj REAL_IS_SIMPLICIAL_OBJECT( Polymake_Data* data, Obj cone ){
5
6
#ifdef MORE_TESTS
7
if(! IS_POLYMAKE_OBJECT(cone) ){
8
ErrorMayQuit(" parameter is not a polymake object.",0,0);
9
return NULL;
10
}
11
#endif
12
13
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
14
data->main_polymake_session->set_application_of(*coneobj);
15
bool i;
16
try{
17
coneobj->give("SIMPLICIAL") >> i;
18
}
19
20
POLYMAKE_GAP_CATCH
21
22
if(i) return True; return False;
23
24
}
25
26
27
Obj REAL_IS_LATTICE_OBJECT( Polymake_Data* data, Obj cone ){
28
29
#ifdef MORE_TESTS
30
if(! IS_POLYMAKE_OBJECT(cone) ){
31
ErrorMayQuit(" parameter is not a polymake object.",0,0);
32
return NULL;
33
}
34
#endif
35
36
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
37
data->main_polymake_session->set_application_of(*coneobj);
38
39
bool i;
40
try{
41
coneobj->give("LATTICE") >> i;
42
}
43
44
POLYMAKE_GAP_CATCH
45
46
if(i) return True; return False;
47
48
}
49
50
51
Obj REAL_IS_NORMAL_OBJECT( Polymake_Data* data, Obj cone ){
52
53
#ifdef MORE_TESTS
54
if(! IS_POLYMAKE_OBJECT(cone) ){
55
ErrorMayQuit(" parameter is not a polymake object.",0,0);
56
return NULL;
57
}
58
#endif
59
60
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
61
data->main_polymake_session->set_application_of(*coneobj);
62
63
bool i;
64
try{
65
coneobj->give("NORMAL") >> i;
66
}
67
68
POLYMAKE_GAP_CATCH
69
70
if(i) return True; return False;
71
72
}
73
74
75
Obj REAL_IS_SMOOTH_OBJECT( Polymake_Data* data, Obj cone ){
76
77
#ifdef MORE_TESTS
78
if(! IS_POLYMAKE_OBJECT(cone) ){
79
ErrorMayQuit(" parameter is not a polymake object.",0,0);
80
return NULL;
81
}
82
#endif
83
84
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
85
data->main_polymake_session->set_application_of(*coneobj);
86
87
bool i;
88
try{
89
coneobj->give("SMOOTH") >> i;
90
}
91
92
POLYMAKE_GAP_CATCH
93
94
if(i) return True; return False;
95
96
}
97
98
99
Obj REAL_IS_VERYAMPLE_OBJECT( Polymake_Data* data, Obj cone ){
100
101
#ifdef MORE_TESTS
102
if(! IS_POLYMAKE_OBJECT(cone) ){
103
ErrorMayQuit(" parameter is not a polymake object.",0,0);
104
return NULL;
105
}
106
#endif
107
108
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
109
data->main_polymake_session->set_application_of(*coneobj);
110
111
bool i;
112
try{
113
coneobj->give("VERY_AMPLE") >> i;
114
}
115
116
POLYMAKE_GAP_CATCH
117
118
if(i) return True; return False;
119
120
}
121
122
123
Obj REAL_OBJECT_HAS_PROPERTY( Polymake_Data* data, Obj cone, const char* prop ){
124
125
#ifdef MORE_TESTS
126
if(! IS_POLYMAKE_OBJECT(cone) ){
127
ErrorMayQuit(" parameter is not a polymake object.",0,0);
128
return NULL;
129
}
130
#endif
131
132
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
133
data->main_polymake_session->set_application_of(*coneobj);
134
135
bool i;
136
try{
137
coneobj->give(prop) >> i;
138
}
139
140
POLYMAKE_GAP_CATCH
141
142
if(i) return True; return False;
143
144
}
145
146
Obj REAL_OBJECT_HAS_INT_PROPERTY( Polymake_Data* data, Obj cone, const char* prop ){
147
148
#ifdef MORE_TESTS
149
if(! IS_POLYMAKE_OBJECT(cone) ){
150
ErrorMayQuit(" parameter is not a polymake object.",0,0);
151
return NULL;
152
}
153
#endif
154
155
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
156
data->main_polymake_session->set_application_of(*coneobj);
157
158
int i;
159
try{
160
coneobj->give(prop) >> i;
161
}
162
163
POLYMAKE_GAP_CATCH
164
165
return INTOBJ_INT( i );
166
}
167
168
169
Obj REAL_POLYMAKE_DRAW( Polymake_Data* data, Obj cone ){
170
171
#ifdef MORE_TESTS
172
if(! IS_POLYMAKE_OBJECT(cone) ){
173
ErrorMayQuit(" parameter is not a polymake object.",0,0);
174
return NULL;
175
}
176
#endif
177
178
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
179
data->main_polymake_session->set_application_of(*coneobj);
180
try{
181
coneobj->VoidCallPolymakeMethod("VISUAL");
182
}
183
184
POLYMAKE_GAP_CATCH
185
186
return True;
187
188
}
189
190
191
void REAL_SET_PROPERTY_TRUE( Polymake_Data* data, Obj conv, const char* prop){
192
193
#ifdef MORE_TESTS
194
if(! IS_POLYMAKE_OBJECT(conv) ){
195
ErrorMayQuit(" parameter is not a polymake object.",0,0);
196
return;
197
}
198
#endif
199
200
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( conv );
201
data->main_polymake_session->set_application_of(*coneobj);
202
try{
203
coneobj->take(prop) << true;
204
}
205
206
POLYMAKE_GAP_CATCH
207
208
}
209
210
Obj REAL_POLYMAKE_SKETCH( Polymake_Data* data, Obj cone ){
211
212
#ifdef MORE_TESTS
213
if(! IS_POLYMAKE_OBJECT(cone) ){
214
ErrorMayQuit(" parameter is not a polymake object.",0,0);
215
return NULL;
216
}
217
#endif
218
219
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
220
data->main_polymake_session->set_application_of(*coneobj);
221
try{
222
VoidCallPolymakeFunction( "sketch", coneobj->CallPolymakeMethod("VISUAL") );
223
}
224
225
POLYMAKE_GAP_CATCH
226
227
return True;
228
229
}
230
231
Obj REAL_POLYMAKE_SKETCH_WITH_OPTIONS( Polymake_Data* data, Obj cone, Obj filename, Obj options ){
232
#ifdef MORE_TESTS
233
if(! IS_POLYMAKE_OBJECT(cone) ){
234
ErrorMayQuit(" parameter is not a polymake object.",0,0);
235
return NULL;
236
}
237
#endif
238
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
239
data->main_polymake_session->set_application_of(*coneobj);
240
pm::perl::Hash sketch_options;
241
if( IS_STRING( filename ) ){
242
sketch_options["File"] << CSTR_STRING( filename );
243
}
244
245
pm::perl::Hash visual_options;
246
if( IS_PLIST( options ) ){
247
for( int i = 1; i <= LEN_PLIST( options ); i++ ){
248
Obj current_option = ELM_PLIST( options, i );
249
Obj description = ELM_PLIST( current_option, 1 );
250
if( ! IS_STRING( description ) ){
251
ErrorMayQuit("first entry in option entry is not a string",0,0);
252
return NULL;
253
}
254
Obj content = ELM_PLIST( current_option, 2 );
255
if( IS_STRING( content ) ){
256
visual_options[ CSTR_STRING( description ) ] << CSTR_STRING( content );
257
}else{
258
if( IS_PLIST( content ) ){
259
pm::Integer* cont = new pm::Integer[ LEN_PLIST( content ) ];
260
for( int j = 1; j <= LEN_PLIST( content ); j++ ){
261
Obj elem = ELM_PLIST( content, j );
262
if( ! IS_INTOBJ( elem ) ){
263
ErrorMayQuit("entry of option array is not an integer",0,0);
264
return NULL;
265
}
266
cont[ j - 1 ] = INT_INTOBJ( elem );
267
}
268
visual_options[ CSTR_STRING( description ) ] << cont;
269
}
270
}
271
}
272
}
273
try{
274
VoidCallPolymakeFunction( "sketch", coneobj->CallPolymakeMethod("VISUAL", visual_options), sketch_options );
275
}
276
277
POLYMAKE_GAP_CATCH
278
279
return True;
280
281
}
282
283
Obj REAL_POLYMAKE_PROPERTIES( Polymake_Data* data, Obj cone ){
284
285
#ifdef MORE_TESTS
286
if(! IS_POLYMAKE_OBJECT(cone) ){
287
ErrorMayQuit(" parameter is not a polymake object.",0,0);
288
return NULL;
289
}
290
#endif
291
292
perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );
293
data->main_polymake_session->set_application_of(*coneobj);
294
try{
295
coneobj->VoidCallPolymakeMethod("properties");
296
}
297
298
POLYMAKE_GAP_CATCH
299
300
return True;
301
302
}
303
304