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

Make get_wall_material_names return material name for one layer id #408

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 18 additions & 14 deletions src/alfasim_sdk/alfasim_sdk_api/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -922,34 +922,38 @@ DLL_EXPORT int get_wall_properties(void* ctx, double** prop_values, const char*
DLL_EXPORT int set_wall_properties(void* ctx, const char* prop_name, double prop_value, int control_volume_id, int layer_id);

/*!
Gets the names of the materials presented in each layer of the wall for a given control volume.
The names will be given as an array of char pointers.
Gets the name of the material for a given control volume and layer.
The names will be given as char pointer.


Example of usage:

~~~~~{.cpp}

[material_name_4]
[material_name_3] [material_name_3]
[material_name_2] [material_name_2] [material_name_2]
[material_name_1] [material_name_1] [material_name_1]
[material_name_0] [material_name_0] [material_name_0]
| | |
--[control_volume_1]--[control_volume_2]--[control_volume_3]--> (Pipe)
[material_name_4_cv_3]
[material_name_3_cv_1] [material_name_3_cv_3]
[material_name_2_cv_1] [material_name_2_cv_2] [material_name_2_cv_3]
[material_name_1_cv_1] [material_name_1_cv_2] [material_name_1_cv_3]
[material_name_0_cv_1] [material_name_0_cv_2] [material_name_0_cv_3]
| | |
--[control_volume_1]----------[control_volume_2]---------[control_volume_3]---------> (Pipe)
~~~~~

~~~~~{.cpp}
errcode = get_wall_material_names(
ctx, &material_names_in_wall, control_volume_id, &size_wall);
int layer_id = 1
int control_volume = control_volume_2

errcode = get_wall_material_name(
ctx, &material_name, control_volume_id, layer_id);
~~~~~

@param[in] ctx ALFAsim's plugins context.
@param[out] material_names_in_wall Names of the material presented in the wall.
@param[out] material_name Name of the material presented in the wall.
@param[in] control_volume_id Control volume id.
@param[out] size Size of the `material_names_in_wall` array.
@param[in] layer_id Layer id.
@return An #error_code value.
*/
DLL_EXPORT int get_wall_material_names(void* ctx, char*** material_names_in_wall, int control_volume_id, int* size);
DLL_EXPORT int get_wall_material_name(void* ctx, char** material_name, int control_volume_id, int layer_id);
Copy link
Member

@prusse-martin prusse-martin Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the old signature already released?

I ask because if it did be released this will probably cause a binary incompatibility. No?

The API has been broken, but that is kind of "OK". The next release will change major version to indicate we are moving back to semantic versioning. Otherwise major version update would be required to indicate we did break the old API.


/*!
Gets the information if the each layer in the wall is fluid or not for a given control volume.
Expand Down
8 changes: 4 additions & 4 deletions src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ using set_wall_properties_func = int (*) (
int control_volume_id,
int layer_id
);
using get_wall_material_names_func = int (*) (
using get_wall_material_name_func = int (*) (
void* ctx,
char*** wall_names,
char** wall_name,
int control_volume_id,
int* size
int layer_id
);
using get_wall_material_type_func = int (*) (
void* ctx,
Expand Down Expand Up @@ -187,7 +187,7 @@ struct ALFAsimSDK_API {

get_wall_properties_func get_wall_properties;
set_wall_properties_func set_wall_properties;
get_wall_material_names_func get_wall_material_names;
get_wall_material_name_func get_wall_material_name;
get_wall_material_type_func get_wall_material_type;

get_input_variable_func get_ucm_friction_factor_input_variable;
Expand Down
2 changes: 1 addition & 1 deletion src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api)
api->get_wall_interfaces_temperature = (get_wall_interfaces_temperature_func)dlsym(api->handle, "get_wall_interfaces_temperature");
api->get_wall_properties = (get_wall_properties_func)dlsym(api->handle, "get_wall_properties");
api->set_wall_properties = (set_wall_properties_func)dlsym(api->handle, "set_wall_properties");
api->get_wall_material_names = (get_wall_material_names_func)dlsym(api->handle, "get_wall_material_names");
api->get_wall_material_name = (get_wall_material_name_func)dlsym(api->handle, "get_wall_material_name");
api->get_wall_material_type = (get_wall_material_type_func)dlsym(api->handle, "get_wall_material_type");
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");
Expand Down
2 changes: 1 addition & 1 deletion src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api)
api->get_wall_interfaces_temperature = (get_wall_interfaces_temperature_func)GetProcAddress(api->handle, "get_wall_interfaces_temperature");
api->get_wall_properties = (get_wall_properties_func)GetProcAddress(api->handle, "get_wall_properties");
api->set_wall_properties = (set_wall_properties_func)GetProcAddress(api->handle, "set_wall_properties");
api->get_wall_material_names = (get_wall_material_names_func)GetProcAddress(api->handle, "get_wall_material_names");
api->get_wall_material_name = (get_wall_material_name_func)GetProcAddress(api->handle, "get_wall_material_name");
api->get_wall_material_type = (get_wall_material_type_func)GetProcAddress(api->handle, "get_wall_material_type");
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");
Expand Down
Loading