Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logger capability to plugins developers #399

Merged
merged 8 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/source/plugins/99_1_solver_api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ ALFAsim's Solver Data

.. doxygenfunction:: get_flow_pattern

.. doxygenfunction:: set_warning_message

.. doxygenfunction:: set_information_message

alexandrebbruno marked this conversation as resolved.
Show resolved Hide resolved


Unit Cell Model (UCM) helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
18 changes: 18 additions & 0 deletions src/alfasim_sdk/alfasim_sdk_api/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,24 @@ DLL_EXPORT int get_deposition_thickness(
void* ctx, double** out, int phase_id, enum TimestepScope ts_scope, int* size
);

/*!
Sets a warning message at the solver logger.

@param[in] ctx ALFAsim's plugins context.
@param[in] warning_message Warning Message.
@return An #error_code value.
*/
DLL_EXPORT int set_warning_message(const char* warning_message);

/*!
Sets an information message at the solver logger.

@param[in] ctx ALFAsim's plugins context.
@param[in] info_message Information Message.
@return An #error_code value.
*/
DLL_EXPORT int set_information_message(const char* info_message);
alexandrebbruno marked this conversation as resolved.
Show resolved Hide resolved

/*!
Retrieves the tracer ID given a tracer reference. A tracer reference may be obtained from the
user input data (See #get_plugin_input_data_reference API function for an example).
Expand Down
5 changes: 5 additions & 0 deletions src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ using get_flow_pattern_func = int (*)(
int* size
);
using get_deposition_thickness_func = int (*)(void* ctx, double** out, int phase_id, enum TimestepScope ts_scope, int* size);
using set_warning_message_func = int (*)(const char* warning_message);
using set_information_message_func = int (*)(const char* information_message);
using get_tracer_id_func = int (*)(void* ctx, int* tracer_id, void* reference);
using get_tracer_name_size_func = int (*)(void* ctx, int* tracer_name_size, void* reference);
using get_tracer_name_func = int (*)(void* ctx, char* tracer_name, void* reference, int size);
Expand Down Expand Up @@ -146,6 +148,9 @@ struct ALFAsimSDK_API {

get_deposition_thickness_func get_deposition_thickness;

set_warning_message_func set_warning_message;
set_information_message_func set_information_message;

get_tracer_id_func get_tracer_id;
get_tracer_name_size_func get_tracer_name_size;
get_tracer_name_func get_tracer_name;
Expand Down
2 changes: 2 additions & 0 deletions src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api)
api->get_flow_pattern = (get_flow_pattern_func)dlsym(api->handle, "get_flow_pattern");
api->get_liqliq_flow_pattern = (get_flow_pattern_func)dlsym(api->handle, "get_liqliq_flow_pattern");
api->get_deposition_thickness = (get_deposition_thickness_func)dlsym(api->handle, "get_deposition_thickness");
api->set_warning_message = (set_warning_message_func)dlsym(api->handle, "set_warning_message");
api->set_information_message = (set_information_message_func)dlsym(api->handle, "set_information_message");
api->get_plugin_input_data_table_quantity = (get_plugin_input_data_table_quantity_func)dlsym(api->handle, "get_plugin_input_data_table_quantity");
api->get_tracer_id = (get_tracer_id_func)dlsym(api->handle, "get_tracer_id");
api->get_tracer_name_size = (get_tracer_name_size_func)dlsym(api->handle, "get_tracer_name_size");
Expand Down
2 changes: 2 additions & 0 deletions src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api)
api->get_flow_pattern = (get_flow_pattern_func)GetProcAddress(api->handle, "get_flow_pattern");
api->get_liqliq_flow_pattern = (get_flow_pattern_func)GetProcAddress(api->handle, "get_liqliq_flow_pattern");
api->get_deposition_thickness = (get_deposition_thickness_func)GetProcAddress(api->handle, "get_deposition_thickness");
api->set_warning_message = (set_warning_message_func)GetProcAddress(api->handle, "set_warning_message");
api->set_information_message = (set_information_message_func)GetProcAddress(api->handle, "set_information_message");
api->get_plugin_input_data_table_quantity = (get_plugin_input_data_table_quantity_func)GetProcAddress(api->handle, "get_plugin_input_data_table_quantity");
api->get_tracer_id = (get_tracer_id_func)GetProcAddress(api->handle, "get_tracer_id");
api->get_tracer_name_size = (get_tracer_name_size_func)GetProcAddress(api->handle, "get_tracer_name_size");
Expand Down
Loading