/* *************************************************************
* Copyright 2017-2024 ANSYS, Inc.
* All Rights Reserved.
*
* Restricted Rights Legend
*
* Use, duplication, or disclosure of this
* software and its documentation by the
* Government is subject to restrictions as
* set forth in subdivision [(b)(3)(ii)] of
* the Rights in Technical Data and Computer
* Software clause at 52.227-7013.
* *************************************************************
*/
#ifndef _DYNAMIC_VISUALIZATION_STORE_API_
#define _DYNAMIC_VISUALIZATION_STORE_API_
#include <stdint.h>
#include "dynamic_visualization_store_enums.h"
#include "dynamic_visualization_store_error_codes.h"
#include "dynamic_visualization_store_version.h"
#include "include/dvs_import_export.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
struct dvs_part_info
{
uint32_t _id;
char* _name;
uint8_t _structured;
uint8_t _chunking;
uint32_t _metadata_num_pairs;
char** _metadata_keys;
char** _metadata_vals;
};
struct dvs_var_info
{
uint32_t _id;
char* _name;
enum dvs_var_type _type;
enum dvs_var_location _location;
char* _unit;
char* _unit_label;
uint32_t _metadata_num_pairs;
char** _metadata_keys;
char** _metadata_vals;
};
struct dvs_plot_info
{
uint32_t _id;
char* _name;
char* _x_axis_title;
char* _x_axis_units;
char* _y_axis_title;
char* _y_axis_units;
uint32_t _metadata_num_pairs;
char** _metadata_keys;
char** _metadata_vals;
};
DVS_DLL_EXPORT dvs_ret dvs_connect(int32_t server_id, enum dvs_client_flags flags, const char* secret, int32_t* session_id);
// Function definition for logging of client messages
// First param is for user defined data
typedef void (*dvs_log_func)(void*, const char*);
DVS_DLL_EXPORT dvs_ret dvs_register_log_func(int32_t session_id, void* user_data, dvs_log_func func, enum dvs_log_flags flags);
DVS_DLL_EXPORT const char* dvs_get_version();
DVS_DLL_EXPORT dvs_ret dvs_begin_init(int32_t session_id, const char* dataset_name, uint32_t current_rank, uint32_t total_ranks, uint32_t num_chunks);
DVS_DLL_EXPORT dvs_ret dvs_set_unit_system(int32_t session_id, const char* system);
DVS_DLL_EXPORT dvs_ret dvs_add_metadata(int32_t session_id, const char* const metadata_keys[], const char* const metadata_vals[], uint32_t num_metadata_pairs);
DVS_DLL_EXPORT dvs_ret dvs_add_part_info(int32_t session_id, const struct dvs_part_info* parts, uint32_t num_parts);
DVS_DLL_EXPORT dvs_ret dvs_add_var_info(int32_t session_id, const struct dvs_var_info* vars, uint32_t num_vars);
DVS_DLL_EXPORT dvs_ret dvs_add_plot_info(int32_t session_id, const struct dvs_plot_info* plots, uint32_t num_plots);
DVS_DLL_EXPORT uint32_t dvs_get_num_part_info(int32_t session_id);
DVS_DLL_EXPORT uint32_t dvs_get_num_var_info(int32_t session_id);
DVS_DLL_EXPORT uint32_t dvs_get_num_plot_info(int32_t session_id);
DVS_DLL_EXPORT const struct dvs_part_info* dvs_get_part_info(int32_t session_id, uint32_t index);
DVS_DLL_EXPORT dvs_ret dvs_get_part_id(int32_t session_id, const char* name, uint32_t* id);
DVS_DLL_EXPORT const struct dvs_var_info* dvs_get_var_info(int32_t session_id, uint32_t index);
DVS_DLL_EXPORT dvs_ret dvs_get_var_id(int32_t session_id, const char* name, uint32_t* id);
DVS_DLL_EXPORT const struct dvs_plot_info* dvs_get_plot_info(int32_t session_id, uint32_t index);
DVS_DLL_EXPORT dvs_ret dvs_get_plot_id(int32_t session_id, const char* name, uint32_t* id);
DVS_DLL_EXPORT dvs_ret dvs_end_init(int32_t session_id);
DVS_DLL_EXPORT dvs_ret dvs_begin_update(int32_t session_id, uint32_t update_num, uint32_t rank, uint32_t chunk, float time);
DVS_DLL_EXPORT dvs_ret dvs_update_copy_previous_part(int32_t session_id, uint32_t part_id, const char* options);
DVS_DLL_EXPORT dvs_ret dvs_update_nodes(int32_t session_id, uint32_t part_id, const float* x, const float* y, const float* z, uint32_t num_values);
DVS_DLL_EXPORT dvs_ret dvs_update_nodes_parallelepiped
(
int32_t session_id,
uint32_t part_id,
const uint32_t global_ijk_max[3],
const uint32_t local_ijk_min[3],
const uint32_t local_ijk_max[3],
const float origin[3],
const float dir_i[3],
const float dir_j[3],
const float dir_k[3],
const float* i_vals,
const float* j_vals,
const float* k_vals
);
DVS_DLL_EXPORT dvs_ret dvs_update_nodes_curvilinear
(
int32_t session_id,
uint32_t part_id,
const uint32_t global_ijk_max[3],
const uint32_t local_ijk_min[3],
const uint32_t local_ijk_max[3],
const float* x_vals,
const float* y_vals,
const float* z_vals
);
DVS_DLL_EXPORT dvs_ret dvs_update_elements(int32_t session_id, uint32_t part_id, enum dvs_element_type type, const uint32_t* indices, uint32_t num_indices);
DVS_DLL_EXPORT dvs_ret dvs_update_elements_polygon
(
int32_t session_id,
uint32_t part_id,
enum dvs_element_type type,
const uint32_t* nodes_per_polygon,
uint32_t nodes_per_polygon_size,
const uint32_t* indices,
uint32_t indices_size
);
DVS_DLL_EXPORT dvs_ret dvs_update_elements_polyhedral
(
int32_t session_id,
uint32_t part_id,
enum dvs_element_type type,
const uint32_t* faces_per_element,
uint32_t faces_per_element_size,
const uint32_t* nodes_per_face,
uint32_t nodes_per_face_size,
const uint32_t* indices,
uint32_t indices_size
);
DVS_DLL_EXPORT dvs_ret dvs_update_var_case_scalar(int32_t session_id, uint32_t var_id, float scalar);
DVS_DLL_EXPORT dvs_ret dvs_update_var_part_scalar(int32_t session_id, uint32_t var_id, uint32_t part_id, float scalar);
DVS_DLL_EXPORT dvs_ret dvs_update_var_case_vector(int32_t session_id, uint32_t var_id, const float* vec);
DVS_DLL_EXPORT dvs_ret dvs_update_var_part_vector(int32_t session_id, uint32_t var_id, uint32_t part_id, const float* vec);
DVS_DLL_EXPORT dvs_ret dvs_update_var_element_scalar(int32_t session_id, uint32_t var_id, uint32_t part_id, enum dvs_element_type type, const float* scalars, uint32_t num_vals);
DVS_DLL_EXPORT dvs_ret dvs_update_var_element_scalar_int64(int32_t session_id, uint32_t var_id, uint32_t part_id, enum dvs_element_type type, const int64_t* scalars, uint32_t num_vals);
DVS_DLL_EXPORT dvs_ret dvs_update_var_node_scalar(int32_t session_id, uint32_t var_id, uint32_t part_id, const float* scalars, uint32_t num_vals);
DVS_DLL_EXPORT dvs_ret dvs_update_var_node_scalar_int64(int32_t session_id, uint32_t var_id, uint32_t part_id, const int64_t* scalars, uint32_t num_vals);
DVS_DLL_EXPORT dvs_ret dvs_update_var_element_vector(int32_t session_id, uint32_t var_id, uint32_t part_id, enum dvs_element_type type, const float* values, uint32_t num_values);
DVS_DLL_EXPORT dvs_ret dvs_update_var_node_vector(int32_t session_id, uint32_t var_id, uint32_t part_id, const float* values, uint32_t num_values);
DVS_DLL_EXPORT dvs_ret dvs_update_plot(int32_t session_id, uint32_t plot_id, const float* x_values, const float* y_values, uint32_t num_values);
DVS_DLL_EXPORT dvs_ret dvs_end_update(int32_t session_id);
DVS_DLL_EXPORT dvs_ret dvs_delete_item(int32_t session_id, uint32_t update_num, uint32_t rank, const char* filter);
DVS_DLL_EXPORT dvs_ret dvs_print_stats(int32_t session_id);
DVS_DLL_EXPORT dvs_ret dvs_session_shutdown(int32_t session_id);
DVS_DLL_EXPORT void dvs_session_shutdown_all();
DVS_DLL_EXPORT void dvs_shutdown();
DVS_DLL_EXPORT dvs_ret dvs_server_create(const char* server_uri, int32_t* server_id);
DVS_DLL_EXPORT dvs_ret dvs_server_set_option(int32_t server_id, const char* key, const char* value);
DVS_DLL_EXPORT dvs_ret dvs_server_start(int32_t server_id, uint32_t server_number, uint32_t local_ranks);
DVS_DLL_EXPORT dvs_ret dvs_server_started(int32_t server_id, uint32_t* running);
DVS_DLL_EXPORT dvs_ret dvs_server_timestep_count(int32_t server_id, uint32_t* num_pending, uint32_t* num_complete);
DVS_DLL_EXPORT dvs_ret dvs_server_shutdown(int32_t server_id);
DVS_DLL_EXPORT void dvs_server_shutdown_all();
DVS_DLL_EXPORT dvs_ret dvs_server_get_uri(int32_t server_id, char* uri, uint32_t* size);
DVS_DLL_EXPORT dvs_ret dvs_add_part_rigid_body_motion(
int32_t session_id,
uint32_t update_num,
uint32_t part_id,
const float* quaternion,
const float* displacement,
const float* cg_offset
);
DVS_DLL_EXPORT dvs_ret dvs_convert_rotation_to_quaternion(
int32_t session_id,
const float* axis_start,
const float* axis_end,
float relative_rotation_angle,
float* quaternion
);
#ifdef __cplusplus
} /* End of extern "C" */
#endif /* __cplusplus */
#endif //_DYNAMIC_VISUALIZATION_STORE_API_