Skip to main content

Post-processing tools 2023 R2

dynamic_visualization_store_api.h

Last update: 17.04.2023
Go to the documentation of this file.
1 /* *************************************************************
2  * Copyright 2017-2018 ANSYS, Inc.
3  * All Rights Reserved.
4  *
5  * Restricted Rights Legend
6  *
7  * Use, duplication, or disclosure of this
8  * software and its documentation by the
9  * Government is subject to restrictions as
10  * set forth in subdivision [(b)(3)(ii)] of
11  * the Rights in Technical Data and Computer
12  * Software clause at 52.227-7013.
13  * *************************************************************
14  */
15 
16 #ifndef _DYNAMIC_VISUALIZATION_STORE_API_
17 #define _DYNAMIC_VISUALIZATION_STORE_API_
18 
60 #include <stdint.h>
64 
65 #include "include/dvs_import_export.h"
66 
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif /* __cplusplus */
71 
77 {
78  uint32_t _id;
79  char* _name;
80  uint8_t _structured;
81  uint8_t _chunking;
83  char** _metadata_keys;
84  char** _metadata_vals;
85 };
86 
92 {
93  uint32_t _id;
94  char* _name;
95  enum dvs_var_type _type;
97  char* _unit;
98  char* _unit_label;
100  char** _metadata_keys;
101  char** _metadata_vals;
102 };
103 
109 {
110  uint32_t _id;
111  char* _name;
117  char** _metadata_keys;
118  char** _metadata_vals;
119 };
120 
133 DVS_DLL_EXPORT dvs_ret dvs_connect(int32_t server_id, enum dvs_client_flags flags, const char* secret, int32_t* session_id);
134 
135 // Function definition for logging of client messages
136 // First param is for user defined data
137 
143 typedef void (*dvs_log_func)(void*, const char*);
144 
156 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);
157 
169 DVS_DLL_EXPORT const char* dvs_get_version();
170 
182 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);
183 
193 DVS_DLL_EXPORT dvs_ret dvs_set_unit_system(int32_t session_id, const char* system);
194 
213 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);
214 
225 DVS_DLL_EXPORT dvs_ret dvs_add_part_info(int32_t session_id, const struct dvs_part_info* parts, uint32_t num_parts);
226 
237 DVS_DLL_EXPORT dvs_ret dvs_add_var_info(int32_t session_id, const struct dvs_var_info* vars, uint32_t num_vars);
238 
249 DVS_DLL_EXPORT dvs_ret dvs_add_plot_info(int32_t session_id, const struct dvs_plot_info* plots, uint32_t num_plots);
250 
259 DVS_DLL_EXPORT uint32_t dvs_get_num_part_info(int32_t session_id);
260 
269 DVS_DLL_EXPORT uint32_t dvs_get_num_var_info(int32_t session_id);
270 
271 
280 DVS_DLL_EXPORT uint32_t dvs_get_num_plot_info(int32_t session_id);
281 
291 DVS_DLL_EXPORT const struct dvs_part_info* dvs_get_part_info(int32_t session_id, uint32_t index);
292 
308 DVS_DLL_EXPORT dvs_ret dvs_get_part_id(int32_t session_id, const char* name, uint32_t* id);
309 
319 DVS_DLL_EXPORT const struct dvs_var_info* dvs_get_var_info(int32_t session_id, uint32_t index);
320 
336 DVS_DLL_EXPORT dvs_ret dvs_get_var_id(int32_t session_id, const char* name, uint32_t* id);
337 
347 DVS_DLL_EXPORT const struct dvs_plot_info* dvs_get_plot_info(int32_t session_id, uint32_t index);
348 
364 DVS_DLL_EXPORT dvs_ret dvs_get_plot_id(int32_t session_id, const char* name, uint32_t* id);
365 
374 DVS_DLL_EXPORT dvs_ret dvs_end_init(int32_t session_id);
375 
386 DVS_DLL_EXPORT dvs_ret dvs_begin_update(int32_t session_id, uint32_t update_num, uint32_t rank, uint32_t chunk, float time);
387 
399 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);
400 
443 (
444  int32_t session_id,
445  uint32_t part_id,
446  const uint32_t global_ijk_max[3],
447  const uint32_t local_ijk_min[3],
448  const uint32_t local_ijk_max[3],
449  const float origin[3],
450  const float dir_i[3],
451  const float dir_j[3],
452  const float dir_k[3],
453  const float* i_vals,
454  const float* j_vals,
455  const float* k_vals
456 );
457 
488 (
489  int32_t session_id,
490  uint32_t part_id,
491  const uint32_t global_ijk_max[3],
492  const uint32_t local_ijk_min[3],
493  const uint32_t local_ijk_max[3],
494  const float* x_vals,
495  const float* y_vals,
496  const float* z_vals
497 );
498 
513 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);
514 
534 (
535  int32_t session_id,
536  uint32_t part_id,
537  enum dvs_element_type type,
538  const uint32_t* nodes_per_polygon,
539  uint32_t nodes_per_polygon_size,
540  const uint32_t* indices,
541  uint32_t indices_size
542 );
543 
559 (
560  int32_t session_id,
561  uint32_t part_id,
562  enum dvs_element_type type,
563  const uint32_t* faces_per_element,
564  uint32_t faces_per_element_size,
565  const uint32_t* nodes_per_face,
566  uint32_t nodes_per_face_size,
567  const uint32_t* indices,
568  uint32_t indices_size
569 );
570 
579 DVS_DLL_EXPORT dvs_ret dvs_update_var_case_scalar(int32_t session_id, uint32_t var_id, float scalar);
580 
590 DVS_DLL_EXPORT dvs_ret dvs_update_var_part_scalar(int32_t session_id, uint32_t var_id, uint32_t part_id, float scalar);
591 
600 DVS_DLL_EXPORT dvs_ret dvs_update_var_case_vector(int32_t session_id, uint32_t var_id, const float* vec);
601 
611 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);
612 
624 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);
625 
636 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);
637 
652 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);
653 
667 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);
668 
681 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);
682 
689 DVS_DLL_EXPORT dvs_ret dvs_end_update(int32_t session_id);
690 
712 DVS_DLL_EXPORT dvs_ret dvs_delete_item(int32_t session_id, uint32_t update_num, uint32_t rank, const char* filter);
713 
719 DVS_DLL_EXPORT dvs_ret dvs_print_stats(int32_t session_id);
720 
727 DVS_DLL_EXPORT dvs_ret dvs_session_shutdown(int32_t session_id);
728 
736 DVS_DLL_EXPORT void dvs_session_shutdown_all();
737 
742 DVS_DLL_EXPORT void dvs_shutdown();
743 
751 DVS_DLL_EXPORT dvs_ret dvs_server_create(const char* server_uri, int32_t* server_id);
752 
765 DVS_DLL_EXPORT dvs_ret dvs_server_set_option(int32_t server_id, const char* key, const char* value);
766 
780 DVS_DLL_EXPORT dvs_ret dvs_server_start(int32_t server_id, uint32_t server_number, uint32_t local_ranks);
781 
789 DVS_DLL_EXPORT dvs_ret dvs_server_started(int32_t server_id, uint32_t* running);
790 
799  DVS_DLL_EXPORT dvs_ret dvs_server_timestep_count(int32_t server_id, uint32_t* num_pending, uint32_t* num_complete);
800 
807 DVS_DLL_EXPORT dvs_ret dvs_server_shutdown(int32_t server_id);
808 
813 DVS_DLL_EXPORT void dvs_server_shutdown_all();
814 
815 #ifdef __cplusplus
816 } /* End of extern "C" */
817 #endif /* __cplusplus */
818 
819 #endif //_DYNAMIC_VISUALIZATION_STORE_API_
DVS_DLL_EXPORT const struct dvs_var_info * dvs_get_var_info(int32_t session_id, uint32_t index)
Get the dvs_var_info object for this index.
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)
Update elements for a specific part and element type.
DVS_DLL_EXPORT dvs_ret dvs_server_create(const char *server_uri, int32_t *server_id)
Create a Dynamic Visualization Store server instance for the client to connect.
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)
Update value of part scalar.
DVS_DLL_EXPORT dvs_ret dvs_add_var_info(int32_t session_id, const struct dvs_var_info *vars, uint32_t num_vars)
Add var info for simulation.
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)
Update the nodes for a parallelepiped structured part.
DVS_DLL_EXPORT const struct dvs_plot_info * dvs_get_plot_info(int32_t session_id, uint32_t index)
Get the dvs_plot_info object for this index.
DVS_DLL_EXPORT dvs_ret dvs_set_unit_system(int32_t session_id, const char *system)
Set a unit system (optional but recommended)
DVS_DLL_EXPORT const char * dvs_get_version()
Get the current version of the built library.
DVS_DLL_EXPORT dvs_ret dvs_print_stats(int32_t session_id)
This will be deprecated, just placeholder for printing out stats that the client is collecting for pr...
DVS_DLL_EXPORT dvs_ret dvs_get_var_id(int32_t session_id, const char *name, uint32_t *id)
Get the ID being used by the client for the named var.
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)
begin setup of rank
DVS_DLL_EXPORT dvs_ret dvs_get_plot_id(int32_t session_id, const char *name, uint32_t *id)
Get the ID being used by the client for the named plot.
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)
Update the data for a plot.
DVS_DLL_EXPORT dvs_ret dvs_add_part_info(int32_t session_id, const struct dvs_part_info *parts, uint32_t num_parts)
Add part info for simulation.
DVS_DLL_EXPORT dvs_ret dvs_delete_item(int32_t session_id, uint32_t update_num, uint32_t rank, const char *filter)
Delete an item.
DVS_DLL_EXPORT uint32_t dvs_get_num_part_info(int32_t session_id)
Get the number of dvs_part_info objects for this client session.
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)
Update N-SIDED elements.
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)
Update nodes for a specific part.
void(* dvs_log_func)(void *, const char *)
Function pointer for logging methods.
DVS_DLL_EXPORT void dvs_shutdown()
Shuts down the api, performing any necessary cleanup, also calls dvs_server_shutdown_all() if any ser...
DVS_DLL_EXPORT dvs_ret dvs_update_var_part_scalar(int32_t session_id, uint32_t var_id, uint32_t part_id, float scalar)
Update value of part scalar.
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)
Update a field of vectors on nodes.
DVS_DLL_EXPORT dvs_ret dvs_server_started(int32_t server_id, uint32_t *running)
Check to see if a server was started with this server_num.
DVS_DLL_EXPORT uint32_t dvs_get_num_plot_info(int32_t session_id)
Get the number of dvs_plot_info objects for this client session.
DVS_DLL_EXPORT dvs_ret dvs_server_start(int32_t server_id, uint32_t server_number, uint32_t local_ranks)
Start a Dynamic Visualization Store server in a separate thread to receive data from solver node.
DVS_DLL_EXPORT dvs_ret dvs_begin_update(int32_t session_id, uint32_t update_num, uint32_t rank, uint32_t chunk, float time)
Method to begin an update.
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)
Update a field of scalars on elements.
DVS_DLL_EXPORT const struct dvs_part_info * dvs_get_part_info(int32_t session_id, uint32_t index)
Get the dvs_part_info object for this index.
DVS_DLL_EXPORT dvs_ret dvs_update_var_case_vector(int32_t session_id, uint32_t var_id, const float *vec)
Update value of case vector.
DVS_DLL_EXPORT dvs_ret dvs_connect(int32_t server_id, enum dvs_client_flags flags, const char *secret, int32_t *session_id)
Connect to dvs server.
DVS_DLL_EXPORT dvs_ret dvs_session_shutdown(int32_t session_id)
Shutdown session.
DVS_DLL_EXPORT void dvs_server_shutdown_all()
Shutdown all server threads.
DVS_DLL_EXPORT dvs_ret dvs_end_init(int32_t session_id)
end the initialization of the rank
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)
Add metadata for the current dataset.
DVS_DLL_EXPORT dvs_ret dvs_server_shutdown(int32_t server_id)
Shutdown this server thread.
DVS_DLL_EXPORT uint32_t dvs_get_num_var_info(int32_t session_id)
Get the number of dvs_var_info objects for this client session.
DVS_DLL_EXPORT dvs_ret dvs_update_var_case_scalar(int32_t session_id, uint32_t var_id, float scalar)
Update value of case scalar.
DVS_DLL_EXPORT void dvs_session_shutdown_all()
Shutdown all connected sessions.
DVS_DLL_EXPORT dvs_ret dvs_server_timestep_count(int32_t server_id, uint32_t *num_pending, uint32_t *num_complete)
Query a Dynamic Visualization Store server as to the number of timesteps it contains.
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)
Register logging function for client to call (optional but recommended)
DVS_DLL_EXPORT dvs_ret dvs_end_update(int32_t session_id)
Call to end the update for this timestep/rank/chunk.
DVS_DLL_EXPORT dvs_ret dvs_server_set_option(int32_t server_id, const char *key, const char *value)
Add an option to the server.
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)
Update a field of scalars on nodes.
DVS_DLL_EXPORT dvs_ret dvs_get_part_id(int32_t session_id, const char *name, uint32_t *id)
Get the ID being used by the client for the named part.
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)
Update a field of vectors on elements.
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)
Update the nodes for a curvilinear structured part.
DVS_DLL_EXPORT dvs_ret dvs_add_plot_info(int32_t session_id, const struct dvs_plot_info *plots, uint32_t num_plots)
Add plot info for simulation.
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)
Update N-FACED Elements.
Contains enums used in C/C++ API.
dvs_log_flags
Flags to control logging filters.
dvs_client_flags
Flags for specific server setup.
dvs_element_type
List of macro generated enums.
dvs_var_location
What variable is associated with.
dvs_var_type
Data type of variable.
Contains errors used in the DVS C/C++ API.
int32_t dvs_ret
Return value of methods, TODO.
C API for using Dynamic Visualization Store.
Struct holding information for a part's definition.
char ** _metadata_vals
UTF-8 Compatible value, each array should be null terminate.
char * _name
UTF-8 Compatible name of part [null terminated], max name length visible in GUI == 79,...
uint8_t _structured
Currently Unused.
uint32_t _id
Unique identifier for part, MUST BE > 0.
uint32_t _metadata_num_pairs
Number of arrays in _metadata_keys/_metadata_vals.
char ** _metadata_keys
UTF-8 Compatible key , each array should be null terminated.
uint8_t _chunking
1 if using chunks
Struct holding information for a plot's definition.
char * _name
UTF-8 Compatible name for plot, must be unique from other plot names.
uint32_t _metadata_num_pairs
Number of arrays in _metadata_keys/_metadata_vals.
char * _y_axis_units
///< UTF-8 Compatible unit type, see: https://nexusdemo.ensight.com/docs/python/html/ENS_UNITSSchema....
char ** _metadata_vals
UTF-8 Compatible value, each array should be null terminated.
char ** _metadata_keys
UTF-8 Compatible key , each array should be null terminated.
char * _x_axis_title
UTF-8 Compatible x axis title.
uint32_t _id
Unique id for plot.
char * _x_axis_units
///< UTF-8 Compatible unit type, see: https://nexusdemo.ensight.com/docs/python/html/ENS_UNITSSchema....
char * _y_axis_title
UTF-8 Compatible y axis title.
Struct holding information for a variable's definiton.
char * _unit_label
UTF-8 Compatible label, see: https://nexusdemo.ensight.com/docs/python/html/ENS_UNITSSchema....
char * _unit
UTF-8 Compatible unit type, see: https://nexusdemo.ensight.com/docs/python/html/ENS_UNITSSchema....
enum dvs_var_type _type
Type of variable, see dvs_var_type enum (dynamic_visualization_store_enums.h)
char ** _metadata_keys
UTF-8 Compatible key , each array should be null terminated.
uint32_t _metadata_num_pairs
Number of arrays in _metadata_keys/_metadata_vals.
uint32_t _id
Unique id for variable.
char ** _metadata_vals
UTF-8 Compatible value, each array should be null terminated.
enum dvs_var_location _location
Location of variable (case/part/element/node), see dvs_var_location enum (dynamic_visualization_store...
char * _name
UTF-8 Compatible name of variable [null terminated], max name length visible in the GUI == 49,...