From 7763eb067d44a1ed4911c0596170baf565df6abe Mon Sep 17 00:00:00 2001 From: Alexandre Barbosa Bruno Date: Thu, 26 Sep 2024 19:04:28 -0300 Subject: [PATCH] Make get_wall_material_names return material name for one layer id (#408) * update doc and get_wall_material_name make return only one name --- src/alfasim_sdk/alfasim_sdk_api/api.h | 32 +++++++++++-------- .../alfasim_sdk_api/detail/api_pointers.h | 8 ++--- .../alfasim_sdk_api/detail/bootstrap_linux.h | 2 +- .../alfasim_sdk_api/detail/bootstrap_win.h | 2 +- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/alfasim_sdk/alfasim_sdk_api/api.h b/src/alfasim_sdk/alfasim_sdk_api/api.h index 9c0ebb61..c056a72c 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/api.h +++ b/src/alfasim_sdk/alfasim_sdk_api/api.h @@ -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); /*! Gets the information if the each layer in the wall is fluid or not for a given control volume. diff --git a/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h b/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h index 401aafbf..bbb822cc 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h @@ -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, @@ -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; diff --git a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h index 02b00791..3bcd49ed 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h @@ -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"); diff --git a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h index 9b56fce0..994d1dec 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h @@ -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");