Skip to content

Commit

Permalink
removing soltrace reference from copilot api
Browse files Browse the repository at this point in the history
with SP_USE_SOLTRACE definitions
  • Loading branch information
qualand committed Mar 8, 2024
1 parent 461f05b commit f60f306
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion solarpilot/CoPilot_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ struct CopilotObject
results.clear();
simthread = 0;
//solarfield.getSimInfoObject()->setCallbackFunction()
#ifdef SP_USE_SOLTRACE
sim_control.soltrace_callback = ST_APICallback;
sim_control.soltrace_callback_data = (void*)this;
#endif
sim_control.message_callback = MessageHandler;
sim_control.message_callback_data = (void*)this;
sim_control.layout_log_callback = ProgressHandler;
Expand Down Expand Up @@ -3039,6 +3041,7 @@ SPEXPORT bool sp_dump_varmap(sp_data_t p_data, const char* sp_fname)
return false;
}

#ifdef SP_USE_SOLTRACE
SPEXPORT bool sp_export_soltrace(sp_data_t p_data, const char* sp_fname)
{
CopilotObject* mc = static_cast<CopilotObject*>(p_data);
Expand Down Expand Up @@ -3081,6 +3084,7 @@ SPEXPORT bool sp_load_soltrace_context(sp_data_t p_data, st_context_t* solt_cxt)

return true;
}
#endif

SPEXPORT void _sp_free_var(sp_number_t* m)
{
Expand All @@ -3097,6 +3101,7 @@ SPEXPORT void _sp_free_var(sp_number_t* m)
}


#ifdef SP_USE_SOLTRACE
int ST_APICallback(st_uint_t ntracedtotal, st_uint_t ntraced, st_uint_t ntotrace, st_uint_t curstage, st_uint_t nstages, void* data)
{
/*
Expand All @@ -3118,6 +3123,7 @@ int ST_APICallback(st_uint_t ntracedtotal, st_uint_t ntraced, st_uint_t ntotrace
}
return 1;
};
#endif

int MessageHandler(const char* message, void* data)
{
Expand Down Expand Up @@ -3156,4 +3162,4 @@ int ProgressHandler(double progress, const char* message, void* data)
(*api->external_callback)((sp_number_t)progress, message);
}
return 1;
}
}
8 changes: 6 additions & 2 deletions solarpilot/CoPilot_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ extern "C" {

SPEXPORT bool sp_dump_varmap(sp_data_t p_data, const char* sp_fname);

#ifdef SP_USE_SOLTRACE
SPEXPORT bool sp_export_soltrace(sp_data_t p_data, const char* sp_fname);

SPEXPORT bool sp_load_soltrace_context(sp_data_t p_data, st_context_t* solt_cxt);
#endif

SPEXPORT void _sp_free_var(sp_number_t* m);

Expand All @@ -178,8 +180,10 @@ extern "C" {

#endif // _COPILOT_API_

extern int ST_APICallback(st_uint_t ntracedtotal, st_uint_t ntraced, st_uint_t ntotrace, st_uint_t curstage, st_uint_t nstages, void* data);
#ifdef SP_USE_SOLTRACE
extern int ST_APICallback(st_uint_t ntracedtotal, st_uint_t ntraced, st_uint_t ntotrace, st_uint_t curstage, st_uint_t nstages, void* data);
#endif

extern int MessageHandler(const char* message, void* data);

extern int ProgressHandler(double progress, const char* message, void* data);
extern int ProgressHandler(double progress, const char* message, void* data);

0 comments on commit f60f306

Please sign in to comment.