carl  24.04
Computer ARithmetic Library
LPContext.cpp
Go to the documentation of this file.
1 #include <carl-common/config.h>
2 #ifdef USE_LIBPOLY
3 
4 #include "LPContext.h"
5 
6 namespace carl {
7 
8 LPContext::Data::Data(const std::vector<Variable>& v) : variable_order(v) {
9  lp_var_order = lp_variable_order_new();
10  // lp_context = lp_polynomial_context_new(0, LPVariables::getInstance().lp_var_db, lp_var_order);
11  lp_context = (lp_polynomial_context_t*) malloc(sizeof(lp_polynomial_context_t));
12  //lp_polynomial_context_construct(lp_context, 0, LPVariables::getInstance().lp_var_db, lp_var_order);
13  lp_context->ref_count = 0;
14  lp_context->var_db = LPVariables::getInstance().lp_var_db;
15  lp_context->K = 0;
16  lp_context->var_order = lp_var_order;
17  #define TEMP_VARIABLE_SIZE 10
18  lp_context->var_tmp = (lp_variable_t*)malloc(sizeof(lp_variable_t)*TEMP_VARIABLE_SIZE);
19  for (size_t i = 0; i < TEMP_VARIABLE_SIZE; ++ i) {
20  lp_context->var_tmp[i] = LPVariables::getInstance().lp_var_tmp[i];
21  }
22  lp_context->var_tmp_size = 0;
23  lp_polynomial_context_attach(lp_context);
24 }
25 
26 LPContext::Data::~Data() {
27  lp_variable_order_detach(lp_var_order);
28  lp_polynomial_context_detach(lp_context);
29 }
30 
31 }
32 
33 #endif
carl is the main namespace for the library.