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
|
Description: Use --memopt option when calling TOPCOM
Saves memory using caching to avoid example/test failures.
Author: Doug Torrance <dtorrance@debian.org>
Bug: https://github.com/Macaulay2/M2/issues/1707
Bug: https://github.com/Macaulay2/M2/issues/2712
Last-Update: 2022-12-15
--- a/M2/Macaulay2/packages/Topcom.m2
+++ b/M2/Macaulay2/packages/Topcom.m2
@@ -121,7 +121,7 @@
topcomIsRegularTriangulation = method(Options=>{Homogenize=>true})
topcomIsRegularTriangulation(Matrix, List) := Boolean => opts -> (A, tri) -> (
-- now create the output file
- (outfile, errfile) := callTopcom("checkregularity --checktriang -v", {topcomPoints(A, opts), [], tri });
+ (outfile, errfile) := callTopcom("checkregularity --checktriang --memopt -v", {topcomPoints(A, opts), [], tri });
match("[Cc]hecked 1 triangulations, 0 non-regular so far", get errfile)
)
@@ -136,7 +136,7 @@
-- returns null if the triangulation is not regular.
-- otherwise returns a list of rational numbers which are the
-- heights that result in the triangulation.
- (outfile, errfile) := callTopcom("checkregularity --heights", {topcomPoints(A, opts), [], tri });
+ (outfile, errfile) := callTopcom("checkregularity --heights --memopt", {topcomPoints(A, opts), [], tri });
output := get outfile;
if match("non-regular", output) then return null;
result := (
@@ -149,7 +149,7 @@
topcomRegularFineTriangulation = method(Options => options topcomIsRegularTriangulation)
topcomRegularFineTriangulation Matrix := List => opts -> (A) -> (
- (outfile,errfile) := callTopcom("points2finetriang --regular", {topcomPoints(A, opts)});
+ (outfile,errfile) := callTopcom("points2finetriang --regular --memopt", {topcomPoints(A, opts)});
value get outfile
)
@@ -247,7 +247,7 @@
topcomAllTriangulations Matrix := List => opts -> (A) -> (
if not opts.ConnectedToRegular and opts.RegularOnly then error "cannot have both RegularOnly=>true and ConnectedToRegular=>false";
executable := allTriangsExecutable#(opts.Fine, opts.ConnectedToRegular);
- args := if opts.RegularOnly then " --regular" else "";
+ args := (if opts.RegularOnly then " --regular" else "") | " --memopt";
(outfile, errfile) := callTopcom(executable | args, {topcomPoints(A, Homogenize=>opts.Homogenize)});
tris := lines get outfile;
-- if ConnectToRegular is true, then the output is different, and needs to be parsed.
@@ -319,7 +319,7 @@
<< "Index sets do not correspond to full-dimensional simplices" << endl;
return false;
);
- (outfile, errfile) := callTopcom("points2nflips --checktriang -v", {topcomPoints(V, Homogenize=>false), [], T });
+ (outfile, errfile) := callTopcom("points2nflips --checktriang --memopt -v", {topcomPoints(V, Homogenize=>false), [], T });
not match("not valid", get errfile)
)
|