3.5. Converting a 1.0 API Reader to a 2.0 API Reader

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

First the Good News!

The following routines were identical in both API's at the time that the 2.0 API was produced.

USERD_bkup

USERD_get_block_coords_by_component

USERD_get_block_iblanking

USERD_get_changing_geometry_status

USERD_get_dataset_query_file_info

USERD_get_element_label_status

USERD_get_name_of_reader

USERD_get_node_label_status

USERD_get_number_of_files_in_dataset

USERD_get_number_of_model_parts

USERD_get_number_of_variables

USERD_set_filenames

USERD_stop_part_building

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.

A) Changes related to imaginary flag for complex data

If you don't deal with complex variables, simply add this flag to your argument list and ignore its value.

API 1.0

API 2.0

USERD_get_constant_value

(

int which var

)

USERD_get_constant_val

(

int which_var,

int imag_data

)

USERD_get_description_lines

(

int which_type,

int which_var,

char line1[Z_BUFL],

char line2[Z_BUFL]

)

USERD_get_descrip_lines

(

int which_type,

int which_var,

int imag_data,

char line1[Z_BUFL],

char line2[Z_BUFL]

)

USERD_get_variable_value_at_specific

(

int which_var,

int which_node_or_elem,

int which_part,

int which_elem_type,

int time_dtep,

float values[3]

)

USERD_get_var_value_at_specific

(

int which_var,

int which_node_or_elem,

int which_part,

int which_elem_type,

int time_dtep,

float values[3],

int imag_data

)

B) Changes related to complex data info, and constant type (and some of the multiple timeset support).

If you don't deal with complex variables, simply add the arguments for var_complex, var_ifilename, and var_freq and assign var_complex to be FALSE.

The argument var_contran needs to be added, and set appropriately if you have constant variables, to indicate if the constant variable is fixed for all time or varies over time.

The argument var_timeset needs to be added, and set appropriately.

API 1.0

API 2.0

USERD_get_variable_info

(

char **var_description,

char **var_filename,

int *var_type,

int *var_classify

)

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

)

C) Changes related to self contained part coordinates.

The number_of_nodes argument needs to be added and set for each part. This one is critical for you to do.

API 1.0

API 2.0

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]

)

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]

)

D) Changes related to multiple timeset support.

The timeset_number argument needs to be added for the following three routines.

The multiple timeset support also includes the change in B) above for USERD_get_gold_variable_info and the three new routines in the next section.

API 1.0

API 2.0

USERD_get_number_of_time_steps

(

void

)

USERD_get_num_of_time_steps

(

int timeset_number

)

USERD_get_solution_times

(

float *solution_times

)

USERD_get_sol_times

(

int timeset_number,

float *solution_times

)

USERD_set_time_step

(

int time_step

}

USERD_set_time_set_and_step

(

int timeset_number,

int time_step

)

Third, deleted and new routines. (Here is where the work lies).

Several old routines are gone. You will have to create the new routines that replace them. I think you will find in most cases that your old routines will form the basis of the new routines, and that it isn't too difficult to provide the information in the new way.

See Detailed Specifications for the needed information on these new routines.

API 1.0

API 2.0

These routines:

USERD_get_block_scalar_values

USERD_get_block_vector_values_by_component

USERD_get_scalar_values

USERD_get_vector_values

replaced by the single routine:

USERD_get_var_by_component

These global coordinate routines:

USERD_get_global_coords

USERD_get_global_node_ids

USERD_get_number_of_global_nodes

replaced by part coord routines:

USERD_get_part_coords

USERD_get_part_node_ids

These par connectivity routines:

USERD_get_element_connectivities_for_part

USERD_get_element_ids_for_part

replaced by part by type routines:

USERD_get_part_elements_by_type

USERD_get_part_element_ids_by_type

(Can be a sample) ->

(Can be a sample) ->

(Required) ->

These are new routines:

USERD_exit_routine

USERD_get_model_extents

USERD_get_reader_version

(Required) ->

(Required) ->

(Required) ->

multiple timeset related:

USERD_get_number_of_timesets

USERD_get_timeset_description

USERD_get_geom_timeset_number

(Required) ->

(Can be a sample) ->

border provided by the reader option:

USERD_get_border_availability

USERD_get_border_elements_by_type

(Can be a sample) ->

transient model allocation efficiency:

USERD_get_maxsize_info

(Can be a sample) ->

possible use with Server-of-Servers:

USERD_set_server_number

Required routines added after version 2.00 (Many can be sample routines, depending on features needed):

USERD_get_block_ghost_flags

USERD_get_ghosts_in_block_flag

USERD_get_ghosts_in_model_flag

USERD_get_matf_set_info

USERD_get_matf_var_info

USERD_get_number_of_material_sets

USERD_get_number_of_materials

USERD_load_matf_data

USERD_size_matf_data

USERD_get_nfaced_conn

USERD_get_nfaced_nodes_per_face

USERD_get_nsided_conn

USERD_get_uns_failed_params

USERD_get_matsp_info

USERD_get_number_of_species

USERD_rigidbody_existence

USERD_rigidbody_values

USERD_get_structured_reader_cinching

USERD_set_block_range_and_stride

Also note the various optional routines which can be in the 2.0 API. See the Routine History for an easy identification of these routines