4.6. Converting a 2.0 API Reader to a 3.0 API Reader

If you have an existing 2.0 API Reader and you desire to convert it to a 3.0 API reader, to take advantage of new capabilities, or the improved efficiency, the following may be helpful.

First the Good News!

All of your globals will now be contained in one struct, that you create that will be passed in to all of your USERD routines via a pointer.

Second, pretty Good News!

The following routines have minor changes, namely a slight name change and the addition of arguments related to complex data, constant type, or self contained parts vs global coords.


Note:  The name changes are needed so both API's can exist together


The arguments must be added, but depending on your situation, many might simply be place holders.

API 1.0

API 2.0

API 3.0

 

 

USERDHandle

USERD_reader_open

(void)

Creates the handle that contains all the global stuff needed to keep things opaque from the application. It is the starting routine to call. Most other calls must include this handle.

 

 

int

USERD_verbose_level

(USERDHandle handle, int level)

Standardize debugging that can be done from userd_read.c

 

 

int

USERD_get_last_error

(USERDHandle handle,int *error_flag,

char errorString[Z_MAXSTR])

Last error will be contained in the handle. So when any routine returns an error that should go back to you - it can be queried by a call to this routine.

int

USERD_bkup

(FILE *archive_file, int backup_type)

int

USERD_bkup

(FILE *archive_file, int backup_type)

int <optional> USERD_bkup

(USERDHandle handle, FILE *archive_file, int backup_type)

If not defined or Z_NOT_IMPLEMENTED, perform a restore by setting the filename and timeset. Server may need to store additional info in it's own backup space, such as the user-defined GUI options.

 

 

int

USERD_reader_close

(USERDHandle handle)

Destroy the handle

 

void

USERD_exit_routine

( void )

void

USERD_exit_routine

( USERDHandle handle )

Do whatever you need to when exiting the reader.

int

USERD_get_block_coords_by_component

(int block_number,int which_component, float *coord_array)

int

USERD_get_block_coords_by_component

(int block_number,

int which_component, float *coord_array)

Replaced by new routines. See second table.

int

USERD_get_block_iblanking

(int block_number, int *iblank_array)

int

USERD_get_block_iblanking

(int block_number, int *iblank_array)

Replaced by new routines. See second table.

 

int

USERD_get_block_ghost-_flags

(int block_number, int *ghost_flags)

Replaced by new routines. See second table.

int

USERD_get_block_scalar_values

(int block_number, int which_scalar, float *scalar_array)

(See USERD_get_var_by_component)

Replaced by new routines. See second table.

int

USERD_get_block_vector_values_by_component

(int block_number,int which_vector,

int which_component, float *vector_array)

(See USERD_get_var_by_component)

Replaced by new routines. See second table.

 

int

USERD_get_border_availability

(int part_number,

int number_of_elements[Z_MAXTYPE])

Replaced by has_border_geom and border_geom_index in new routine: USERD_get_part_info.

 

int

USERD_get_border_elements_by_type

(int part_number,int element_type,int **conn_array,

short *parent_element_type, int *parent_element_num)

Replaced by has_border_geom and border_geom_index in new routine: USERD_get_part_info. Get the element conns with regular routines for geoms and below.

int

USERD_get_changing_geometry_status

( void )

int

USERD_get_changing_geometry_status

( void )

(This is now a unode, snode, uelem, selem attribute as far as the readers are concerned. See the new routines in the second table. Applications (like EnSight) might still choose to make it model based - or whatever)

float

USERD_get_constant_value

(int which_var)

float

USERD_get_constant_val (int which_var,

int imag_data)

int

USERD_get_number_of_model_constants

(USERDHandle handle)

int

USERD_get_model_constant_info

(USERDHandle handle, int which_constant, char *description,int *complex,

float *freq, int *contran, int *timeset)

float

USERD_get_model_constant_val (USERDHandle handle,

int which_constant, int imag_data)

int

USERD_get_dataset_query_file_info

(Z_QFILES *qfiles)

int

USERD_get_dataset_query_file_info

(Z_QFILES *qfiles)

int

USERD_get_dataset_query_file_info

(USERDHandle handle, Z_QFILES *qfiles)

int

USERD_get_description_lines

(int which_type,int which_var,

char line1[Z_BUFL], char line2[Z_BUFL])

int

USERD_get_descrip_lines (int which_type,

int which_var,int imag_data,char line1[Z_BUFL], char line2[Z_BUFL])

int

USERD_get_descrip_lines (USERDHandle handle,

int which_type,int which_var,int imag_data,char line1[Z_BUFL], char line2[Z_BUFL])

Probably modify!

int

USERD_get_element_connectivities_for_part

(int part_number,

int **conn_array[Z_MAXTYPE])

int

USERD_get_part_elements_by_type (int part_number,

int element_type,

int **conn_array)

Replaced by new routines. See second table.

 

int <optional>

USERD_get_part_elements_by_type_in_buffers

(int part_number, int element_type, int **conn_array, int first,

int e_beg,int e_end,int buffer_size,int *num_returned)

Replaced by new routines. See second table.

int

USERD_get_element_ids_for_part

(int part_number,

int *elemid_array[Z_MAXTYPE])

int

USERD_get_part_element_ids_by_type (int part_number,

int element_type,

int *elemid_array)

Replaced by new routines. See second table.

 

int <optional>

USERD_get_part_element_ids_by_type_in_buffers

(int part_number, int element_type, int *elemid_array, int first,

int e_beg,int e_end,int buffer_size,int *num_returned)

Replaced by new routines. See second table.

int

USERD_get_element_label_status

( void )

int

USERD_get_element_label_status

( void )

int

USERD_get_element_label_status

(USERDHandle handle)

Or this could be discerned from the info in the new routines. We could check the id arrays against NULL. Or even have a flag. Then this routine would be unnecessary.

 

int <optional>

USERD_get_extra_data

(int *target, int *nint, int *nflt,int *nchr, int *pint, float *pflt, char *pchr)

int <optional>

USERD_get_extra_data

(USERDHandle handle, int *target,int *nint,int *nflt,

int *nchr, int *pint, float *pflt, char *pchr)

int <optional>

USERD_get_extra_gui_defaults

(char **toggle_Title,int *toggle_default_status,char **pulldown_Title,int *pulldown_number_in_list, int *pulldown_default_selection, char ***pulldown_item_strings, char **field_Title,char **field_user_string)

int <optional>

USERD_get_extra_gui_defaults

(char **toggle_Title,int *toggle_default_status,char **pulldown_Title,int *pulldown_number_in_list, int *pulldown_default_selection, char ***pulldown_item_strings, char **field_Title,char **field_user_string)

See Define and Utilize the User Defined Reader GUI Options.

void <optional>

USERD_get_extra_gui_numbers

(int *num_Toggles, int *num_pulldowns, int *num_fields)

void <optional>

USERD_get_extra_gui_numbers

(int *num_Toggles, int *num_pulldowns, int *num_fields)

See Define and Utilize the User Defined Reader GUI Options.

 

int

USERD_get_geom_timeset_-number

( void )

int

USERD_get_geom_timeset_-number

(USERDHandle handle)

 

int

USERD_get_ghosts_in_-block_flag

(int block_number)

int

USERD_get_ghosts_in_-block_flag

(USERDHandle handle, int block_number)

Or this could be discerned from the info in the new routines. We could check the ghost flag arrays against NULL. Or even have a flag. Then this routine would be unnecessary.

 

int

USERD_get_ghosts_in_model_flag

( void )

int

USERD_get_ghosts_in_model_flag

(USERDHandle handle)Or this could be discerned from the info in the new routines. We could check the ghost flag arrays against NULL. Or even have a flag. Then this routine would be unnecessary.

int

USERD_get_global_coords

(CRD *coord_array)

int

USERD_get_part_coords (int part_number,

float **coord_array)

Replaced by new routines. See second table.

 

int <optional>

USERD_get_part_coords_in_buffers

(int part_number, float **coord_array, int first,int n_beg,

int n_end,int buffer_size,int *num_returned)

Replaced by new routines. See second table.

int

USERD_get_global_node_ids

(int *nodeid_array)

int

USERD_get_part_node_ids (int part_number,

int *nodeid_array)

Replaced by new routines. See second table.

 

int <optional>

USERD_get_part_node_ids_-in_buffers

(int part_number, int *nodeid_array, int first,int n_beg,

int n_end,int buffer_size,int *num_returned)

Replaced by new routines. See second table.

 

int <optional>

USERD_get_matf_escalars_desc

(int set_index,char **mesv_desc)

int <optional>

USERD_get_matf_escalars_desc

(USERD, Handle handle,

int set_index,char **mesv_desc)

 

int

USERD_get_matf_set_info

(int *mat_set_ids,

char **mat_set_name)

int

USERD_get_matf_set_info

(USERDHandle handle, int *mat_set_ids,char **mat_set_name)

 

int <optional>

USERD_get_matf_set_type

(int set_index)

int <optional>

USERD_get_matf_set_type

(USERDHandle handle, int set_index)

 

int

USERD_get_matf_var_info

(int set_index,

int *mat_ids, char **mat_desc)

int

USERD_get_matf_var_info

(USERDHandle handle, int set_index,

int *mat_ids, char **mat_desc)

 

int

USERD_get_matsp_info

(int set_index,int *sp_ids,char **sp_desc,

int *sp_per_mat_cnt, int *sp_per_mat_lis)

int

USERD_get_matsp_info

(USERDHandle handleint int *sp_ids,char **sp_desc,int *sp_per_mat_cnt, int *sp_per_mat_lis)

set_index,

 

int

USERD_get_maxsize_info

(int *max_number_of_nodes,

int *max_number_of_elements[Z_MAXTYPE], int *max_ijk_dimensions[3])

int <optional> USERD_get_maxsize_info

(USERDHandle handle,

int *max_number_of_nodes,int *max_number_of_elements[Z_MAXTYPE], int *max_ijk_dimensions[3])

 

int

USERD_get_model_extents

( float extents[6] )

int <optional> USERD_get_model_extents

(USERDHandle handle,

float extents[6] )

int

USERD_get_name_of_reader

(char reader_name[Z_MAX_USERD_NAME-], int *two_fields)

int

USERD_get_name_of_reader

(char reader_name[Z_MAX_USERD_NAME-], int *two_fields)

int

USERD_get_name_of_reader

(char reader_name[Z_MAX_USERD_NAME-], int *two_fields)

 

int

USERD_get_nfaced_conn

(int part_number,

int *nfaced_conn_array)

Replaced by new routines. See second table

 

int <optional>

USERD_get_nfaced_conn-_in_buffers

(int part_number,int *nfaced_fpe_array, int *nfaced_npf_array, int *nfaced_conn_array, int first,int e_beg,int e_end,int buffer_size,int *num_returned)

Replaced by new routines. See second table

 

int

USERD_get_nfaced_nodes-_per_face

(int part_number,

int *nfaced_npf_array)

Replaced by new routines. See second table

int

USERD_get_node_label_status

( void )

int

USERD_get_node_label_status

( void )

int

USERD_get_node_label_status

(USERDHandle handle)Or this could be discerned from the info in the new routines. We could check the id arrays against NULL. Or even have a flag. Then this routine would be unnecessary.

 

int

USERD_get_nsided_conn

(int part_number,

int *nsided_conn_array)

Replaced by new routines. See second table

 

int <optional>

USERD_get_nsided_conn-_in_buffers

(int part_number,int *num_nodes_per_elem_array, int *nsided_conn_array,int first,int e_beg,int e_end,int buffer_size,int *num_returned)

Replaced by new routines. See second table

int <optional>

USERD_get_num_xy_queries

( void )

int <optional>

USERD_get_num_xy_queries

( void )

int <optional>

USERD_get_num_xy_queries

(USERDHandle handle)

int

USERD_get_number_of_files_in_dataset

( void )

int

USERD_get_number_of_files_in_dataset

( void )

int

USERD_get_number_of_files_in_dataset

(USERDHandle handle)

int

USERD_get_number_of_global_nodes

( void )

(See USERD_get_gold_part_build_info)

 

 

int

USERD_get_number_of_material_sets

( void )

int

USERD_get_number_of_material_sets

(USERDHandle handle)

 

int

USERD_get_number_of_materials

(int set_index )

int

USERD_get_number_of_materials

(USERDHandle handle, int set_index )

int

USERD_get_number_of_model_parts

( void )

int

USERD_get_number_of_model_parts

( void )

int

USERD_get_number_of_model_parts

(USERDHandle handle)

int

USERD_get_number_of_time_steps

( void )

int

USERD_get_num_of_time-_steps (int timeset_number )

int

USERD_get_num_of_time-_steps (USERDHandle handle,

int timeset_number )

 

int

USERD_get_number_of_species

(int set_index )

int

USERD_get_number_of_species

(USERDHandle handle, int set_index )

 

int

USERD_get_number_of_timesets

( void )

int

USERD_get_number_of_timesets

(USERDHandle handle)

int

USERD_get_number_of_variables

( void )

int

USERD_get_number_of_variables

( void )

Replaced by new routines. See second table.

Will need to accumulate intelligently as you get Pbuild info.

int

USERD_get_part_build_info

(int *part_id,int *part_types,char *part_description[Z_BUFL],int *number_of_elements[Z_MAXTYPE], int *ijk_dimensions[3],

int *iblanking_options[6])

int

USERD_get_gold_part_-build_info (int *part_id,

int *part_types,char *part_description[Z_BUFL],int *number_of_nodes,int *number_of_elements[Z_MAXTYPE], int *ijk_dimensions[9],int *iblanking_options[6])

Replaced by new routines. See second table.

int <optional>

USERD_get_reader_descrip

(char descrip[Z_MAXFILENP])

int <optional>

USERD_get_reader_descrip

(char descrip[Z_MAXFILENP])

int <optional>

USERD_get_reader_descrip

(char descrip[Z_MAXFILENP])

int <optional>

USERD_get_reader_release

(char version_number[Z_MAX_USERD_NAME])

int <optional>

USERD_get_reader_release

(char version_number[Z_MAX_USERD_NAME])

int <optional>

USERD_get_reader_release

(char version_number[Z_MAX_USERD_NAME])

 

int

USERD_get_reader_version

(char version_number[Z_MAX_USERD_NAME])

int

USERD_get_reader_version

(char version_number[Z_MAX_USERD_NAME])

int

USERD_get_scalar_values

(int which_scalar, int which_part,

int which_type, float *scalar_array)

(See USERD_get_var_by_component)

 

int

USERD_get_solution_times

(float *solution_times)

int

USERD_get_sol_times (int timeset_number,

float *solution_times)

int

USERD_get_sol_times (USERDHandle handle,

int timeset_number, float *solution_times)

 

int

USERD_get_structured_reader_cinching

( void )

int

USERD_get_structured_reader_cinching

(USERDHandle handle)

 

int

USERD_get_timeset_description

(int timeset_number,

char timeset_description[Z_BUFL])

int

USERD_get_timeset_description

(USERDHandle handle,int timeset_number,char timeset_description[Z_BUFL])

 

int

USERD_get_uns_failed-_params

(char *fail_var_name, float *threshold_val1, float *threshold_val2,

int *threshold_operator1, int *threshold_operator2, int *logic_criteria2)

int USERD_get_uns_failed-_params( USERDHandle handle,

char *fail_var_name

float *threshold_val1,

float *threshold_val2,

int *threshold_operator1,

int *threshold_operator2,

int *logic_criteria2 )

int <optional>

USERD_get_var_extract_gui_defaults

(char **toggle_Title,int *toggle_default_status,char **pulldown_Title,int *pulldown_number_in_list, int *pulldown_default_selection, char ***pulldown_item_strings, char **field_Title,char **field_user_string)

int <optional>

USERD_get_var_extract_gui_defaults

(char **toggle_Title,int *toggle_default_status,char **pulldown_Title,int *pulldown_number_in_list, int *pulldown_default_selection, char ***pulldown_item_strings, char **field_Title,char **field_user_string)

See Define and Utilize the User Defined Reader GUI Options.

void <optional>

USERD_get_var_extract_gui_numbers

(int *num_Toggles, int *num_pulldowns, int *num_fields)

void <optional>

USERD_get_var_extract_gui_numbers

(int *num_Toggles, int *num_pulldowns, int *num_fields)

See Define and Utilize the User Defined Reader GUI Options.

int

USERD_get_variable_info

(char **var_description, char **var_filename, int *var_type,

int *var_classify)

int

USERD_get_gold_variable_info (char **var_description,

char **var_filename, int *var_type,int *var_classify,int *var_complex, char **var_ifilename, float *var_freq,

int *var_contran, int *var_timeset)

Replaced by new routines. See second table. and model constants have their own routines now.

(See USERD_get_scalar_values & USERD_get_vector_values routines)

int

USERD_get_var_by_component

(int which_variable, int which_part,int var_type,

int which_type,

int imag_data, int component, float *var_array)

Replaced by new routines. See second table.

 

int <optional>

USERD_get_var_by_component_in_buffers

(int which_variable, int which_part,int var_type,int which_type,

int imag_data, int component, float *var_array, int first,

int ne_beg,int ne_end,int buffer_size,int leftside,int *num_returned)

Replaced by new routines. See second table.

int

USERD_get_variable_value_at_specific

(int which_var,int which_node_or_elem, int which_part,int which_elem_type,int time_step,

float values[3])

int

USERD_get_var_value_at-_specific (int which_var,

int which_node_or_elem, int which_part,int which_elem_type,int time_step,

float values[3], int imag_data)

int

USERD_get_var_value_at-_specific (USERDHandle handle,

int which_var,int which_node_or_elem, int which_part,int which_elem_type,int time_step,float values[3],int imag_data)

int

USERD_get_vector_values

(int which_vector, int which_part,

int which_type, float *vector_array)

(See USERD_get_var_by_component)

 

 

int <optional>

USERD_get_vglyph_counts

(int *num_vglyph_vectors, int *num_vglyph_timelines)

int <optional>

USERD_get_vglyph_counts

(USERDHandle handle,int *num_vglyph_vectors, int *num_vglyph_timelines)

 

int <optional>

USERD_get_vglyph-_timeline_info

(int vtl,int *id,int *numtimes, int *before,int *amidst,int *after)

int <optional>

USERD_get_vglyph-_timeline_info

(USERDHandle handle, int vtl,int *id,int *numtimes,

int *before, int *amidst, int *after)

 

int <optional>

USERD_get_vglyph-_timeline_times

(int vtl,float *times)

int <optional>

USERD_get_vglyph-_timeline_times

(USERDHandle handle, int vtl,float *times)

 

int <optional>

USERD_get_vglyph_vector_info

(int vg,int *id,char *description, int *type,int *time_condition, int *time_line,int *part,int *nidloc,int *eidloc)

int <optional>

USERD_get_vglyph_vector_info

(USERDHandle handle, int vg,int *id,char *description,

int *type,int *time_condition, int *time_line,int *part,int *nidloc,int *eidloc)

 

int <optional>

USERD_get_vglyph_vector_values

(int vg,float **values)

int <optional>

USERD_get_vglyph_vector_values

(USERDHandle handle, int vg,float **values)

 

int <optional>

USERD_get_vglyph_vector_xyzloc

(int vg,float **xyzloc)

int <optional>

USERD_get_vglyph_vector_xyzloc

(USERDHandle handle, int vg,float **xyzloc)

int <optional>

USERD_get_xy_query_data

(int query_num, int num_vals, float *xvals, float *yvals)

int <optional>

USERD_get_xy_query_data

(int query_num, int num_vals, float *xvals, float *yvals)

int <optional>

USERD_get_xy_query_data

(USERDHandle handle, int query_num,int num_vals,float *xvals,

float *yvals)

int <optional>

USERD_get_xy_query_info

(int query_num,char *query_name, char *query_xtitle, char *query_ytitle,int *query_num_pairs )

int <optional>

USERD_get_xy_query_info

(int query_num,char *query_name, char *query_xtitle, char *query_ytitle,int *query_num_pairs )

int <optional>

USERD_get_xy_query_info

(USERDHandle handle, int query_num,char *query_name, char *query_xtitle,

char *query_ytitle,int *query_num_pairs )

 

int

USERD_load_matf_data

(int set_index, int part_id, int wtyp,

int mat_type, int *ids_list, float *val_list)

int

USERD_load_matf_data

(USERDHandle handle, int set_index,int part_id,int wtyp,

int mat_type, int *ids_list, float *val_list)

int <optional>

USERD_prefer_auto_distribute

(void)

int <optional>

USERD_prefer_auto_distribute

(void)

int <optional>

USERD_prefer_auto_distribute has been replaced by a member of the handle.

handle.server.iUseAutoDistribute

  • = TRUE (Reader takes care of it)

  • = FALSE (Server takes care of it)

(USERDHandle handle)

 

int

USERD_rigidbody_existence

( void )

int

USERD_rigidbody_existence

(USERDHandle handle)

 

int

USERD_rigidbody_values

(int part_number,

float values[14]) /* Prior to Version 2.08,float values[10] */

int

USERD_rigidbody_values

(USERDHandle handle, int part_number,float values[14])

 

int

USERD_set_block_range-_and_stride

(int part_number,

int mini, int maxi, int stepi, int minj, int maxj, int stepj, int mink, int maxk, int stepk)

int

USERD_set_block_range-_and_stride

(USERDHandle handle,int part_number,int mini, int maxi, int stepi, int minj, int maxj, int stepj, int mink, int maxk, int stepk)

void <optional>

USERD_set_extra_gui_data

(int *toggle,int *pulldown, char **field_text)

void <optional>

USERD_set_extra_gui_data

(int *toggle,int *pulldown, char **field_text)

See Define and Utilize the User Defined Reader GUI Options.

void <optional>

USERD_set_filename_button_labels

(char filename_label_1[Z_MAX_USERD_NAME], char filename_label_2[Z_MAX_USERD_NAME])

void <optional>

USERD_set_filename_button_labels

(char filename_label_1[Z_MAX_USERD_NAME], char filename_label_2[Z_MAX_USERD_NAME])

void <optional>

USERD_set_filename_button_labels

(USERDHandle handle,char filename_label_1[Z_MAX_USERD_NAME], char filename_label_2[Z_MAX_USERD_NAME])

int

USERD_set_filenames

(char filename_1[], char param_2[], char the_path[], int swapbytes)

int

USERD_set_filenames

(char filename_1[], char filename_2[], char the_path[], int swapbytes)

int

USERD_set_filenames

(USERDHandle handle, char filename_1[],char filename_2[],char the_path[],

int swapbytes)

 

void <optional>

USERD_set_right_side

( void )

void <optional>

USERD_set_right_side

(USERDHandle handle, void )

 

void

USERD_set_server_number

(int cur_serv, int tot_servs)

void

USERD_set_server_number

(USERDHandle handle, int cur_serv,int tot_servs)

void

USERD_set_time_step

(int time_step)

void

USERD_set_time_set-_and_step (int timeset_number,

int time_step)

void

USERD_set_time_set-_and_step (USERDHandle handle,

int timeset_number, int time_step)

void <optional>

USERD_set_var_extract_gui_data

(int *toggle, int *pulldown,

char **field_text)

void <optional>

USERD_set_var_extract_gui_data

(int *toggle, int *pulldown,

char **field_text)

See Define and Utilize the User Defined Reader GUI Options.

 

int

USERD_size_matf_data

(int set_index, int part_id,int wtyp,

int mat_type, int *matf_size)

int

USERD_size_matf_data

(USERDHandle handle, int set_index,int part_id,int wtyp,

int mat_type, int *matf_size)

void

USERD_stop_part_building

( void )

void

USERD_stop_part_building

( void )

void

USERD_stop_part_building

(USERDHandle handle)