Macaulay2 Engine
Loading...
Searching...
No Matches
comp.cpp
Go to the documentation of this file.
1// Copyright 2004 Michael E. Stillman
2
3#include "comp.hpp"
4
5#include <stdio.h>
6
7#include "buffer.hpp"
8#include "exceptions.hpp"
9#include "finalize.hpp"
10
12 M2_bool always_stop,
13 M2_arrayint degree_limit,
14 int basis_element_limit,
15 int syzygy_limit,
16 int pair_limit,
17 int codim_limit,
18 int subring_limit,
19 M2_bool just_min_gens,
20 M2_arrayint length_limit)
21{
22 stop_.always_stop = always_stop;
23 stop_.stop_after_degree = (degree_limit != nullptr && degree_limit->len > 0);
24 stop_.degree_limit = degree_limit;
25 stop_.basis_element_limit = basis_element_limit;
26 stop_.syzygy_limit = syzygy_limit;
27 stop_.pair_limit = pair_limit;
28 stop_.use_codim_limit = (codim_limit >= 0);
29 stop_.codim_limit = codim_limit;
30 stop_.subring_limit = subring_limit;
31 stop_.just_min_gens = just_min_gens;
32 stop_.length_limit = length_limit;
33
35 return this;
36 else
37 return nullptr;
38}
39
41{
43
44 stop_.always_stop = false;
45 stop_.stop_after_degree = false;
46 stop_.degree_limit = nullptr;
47 stop_.basis_element_limit = 0;
48 stop_.syzygy_limit = 0;
49 stop_.pair_limit = 0;
50 stop_.use_codim_limit = false;
51 stop_.codim_limit = 0;
52 stop_.subring_limit = 0;
53 stop_.just_min_gens = false;
54 stop_.length_limit = nullptr;
55}
56
58
59void Computation::text_out(buffer &o) const { o << "-- computation --"; }
60
62{
63 printf("No show method available for this computation type\n");
64}
65
67{
68 switch (computation_status)
69 {
70 case COMP_OVERFLOWED:
71 // if (computation_status == COMP_NEED_RESIZE) break;
73 "attempted to reset status of a computation that overflowed"));
74 default:
75 return computation_status = c;
76 }
77}
78
79// Local Variables:
80// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
81// indent-tabs-mode: nil
82// End:
Append-only GC-backed byte buffer used throughout the engine for text output.
enum ComputationStatusCode computation_status
Definition comp.hpp:72
Computation * set_stop_conditions(M2_bool always_stop, M2_arrayint degree_limit, int basis_element_limit, int syzygy_limit, int pair_limit, int codim_limit, int subring_limit, M2_bool just_min_gens, M2_arrayint length_limit)
Definition comp.cpp:11
virtual void text_out(buffer &o) const
Definition comp.cpp:59
enum ComputationStatusCode set_status(enum ComputationStatusCode)
Definition comp.cpp:66
StopConditions stop_
Definition comp.hpp:75
virtual ~Computation()
Definition comp.cpp:57
virtual bool stop_conditions_ok()=0
Computation()
Definition comp.cpp:40
virtual void show() const
Definition comp.cpp:61
Abstract Computation base class — stop-condition machinery for incremental engine work.
ComputationStatusCode
Definition computation.h:53
@ COMP_OVERFLOWED
Definition computation.h:72
@ COMP_NOT_STARTED
Definition computation.h:58
namespace exc — internal C++ exception types and the TRY / CATCH macro pair.
intern_* helpers that register long-lived engine objects with bdwgc finalisers.
char M2_bool
Definition m2-types.h:82