37#include <boost/json.hpp>
67 namespace json = boost::json;
70 auto groups_as_json = [](
auto const& groups) {
72 for (
auto const& grp : groups)
75 for (
auto const& v : grp)
76 names.push_back(json::value(v->name()));
85 json::array homogenizers;
87 homogenizers.push_back(json::value(v->name()));
88 parts[
"homogenizing_variables"] = homogenizers;
94 parts[
"path_variable"] =
nullptr;
100 std::vector<std::shared_ptr<const node::Node>> roots(functions.begin(),
104 std::ostringstream expr;
105 expr << *(ne->EntryNode());
106 named[ne->name()] = expr.str();
109 parts[
"named_subexpressions"] = named;
112 json::array function_texts;
113 for (
auto const& f : functions)
115 std::ostringstream expr;
117 function_texts.push_back(json::value(expr.str()));
119 parts[
"functions"] = function_texts;
134 json::array block_summaries;
135 for (
auto const& b : sys.
Blocks())
137 json::object summary;
138 summary[
"kind"] = std::visit(BlockKindName{}, b);
139 summary[
"num_functions"] =
static_cast<std::int64_t
>(
140 std::visit([](
auto const& blk) {
return blk.NumFunctions(); }, b));
141 block_summaries.push_back(summary);
143 parts[
"blocks"] = block_summaries;
148 parts[
"num_patches"] =
static_cast<std::int64_t
>(sys.
NumPatches());
The fundamental polynomial system class for Bertini2.
Definition system.hpp:106
const Var & GetPathVariable() const
Get the system's path variable (throws if none is defined).
auto HomVariableGroups() const
Get the homogeneous (projective) variable groups in the problem.
Definition system.hpp:1807
bool IsPatched() const
Query whether a system is patched.
Definition system.hpp:1933
std::vector< Block > const & Blocks() const
Read-only access to the system's evaluation blocks (in evaluation order).
Definition system.hpp:1097
bool HavePathVariable() const
Query whether a path variable is set for this system.
size_t NumPatches() const
Get the number of patches in this system.
Definition system.hpp:790
auto VariableGroups() const
Get the affine variable groups in the problem.
Definition system.hpp:1799
std::vector< Nd > NaturalFunctionsAsNodes() const
The system's natural (pre-patch) functions as function-tree expression nodes, expanding any structure...
VariableGroup const & HomogenizingVariables() const
Get the homogenizing variables, one per affine variable group (in group order), or an empty container...
Definition system.hpp:819
A block forming the blend (coupling homotopy) H = sum_i c_i(t) * operand_i of several systems.
Definition blend_block.hpp:80
The polynomial evaluation block: function trees + derivatives + SLP.
Definition polynomial_block.hpp:61
A block of system functions, each a product of linear forms.
Definition products_of_linears_block.hpp:64
A block that randomizes an overdetermined operand system down to a square one (with a constant coeffi...
Definition randomization_block.hpp:80
Discover named nodes of a given kind in a function tree (sympy's find).
Definition json_writer.hpp:47
boost::json::object SystemPartsJson(System const &sys)
A System's structure as a JSON object with fields for its parts.
Definition json_writer.hpp:65
std::vector< std::shared_ptr< T > > Find(std::shared_ptr< const Node > const &n)
All distinct nodes of kind T in the subtree rooted at n, sorted by name.
Definition algorithm_builder.hpp:36
Provides the bertini::System class.