1 /*----------------------------------
2 * User Defined Reader - checker
3 *----------------------------------*/
5 /********************************************************************
7 * ****************************************
8 * Copyright 2004 Computational Engineering International, Inc.
11 * Restricted Rights Legend
13 * Use, duplication, or disclosure of this
14 * software and its documentation by the
15 * Government is subject to restrictions as
16 * set forth in subdivision [(b)(3)(ii)] of
17 * the Rights in Technical Data and Computer
18 * Software clause at 52.227-7013.
19 *******************************************************************/
21 /*----------------------------------------------------------------------
22 * MAJOR ROUTINES ACCESS: (VERSION 2.00) Gold_Userd API
24 * Get the name of the reader
25 * ==========================
26 * USERD_get_name_of_reader
27 * USERD_get_extra_gui_numbers (optional)
28 * USERD_get_extra_gui_defaults (optional)
30 * Get the reader version
31 * ======================
32 * USERD_get_reader_version
34 * Set the filenames, gather timeset and time info
35 * ===============================================
36 * USERD_set_extra_gui_data (optional)
37 * USERD_set_server_number
39 * USERD_get_number_of_timesets
40 * USERD_get_geom_timeset_number
43 * USERD_get_timeset_description
44 * USERD_get_num_of_time_steps
47 * USERD_set_time_set_and_step
50 * Gather variable and time info
51 * =============================
52 * USERD_get_number_of_variables
53 * USERD_get_gold_variable_info
56 * Get initial part building info
57 * ==============================
58 * USERD_set_time_set_and_step
59 * USERD_get_changing_geometry_status
60 * USERD_get_node_label_status
61 * USERD_get_element_label_status
62 * USERD_get_number_of_files_in_dataset
63 * USERD_get_dataset_query_file_info
64 * USERD_get_descrip_lines (geometry)
65 * USERD_get_number_of_model_parts
66 * USERD_get_gold_part_build_info
67 * USERD_get_ghosts_in_model_flag
68 * USERD_get_maxsize_info
69 * USERD_get_ghosts_in_block_flag (if any ghost cells in model)
70 * USERD_get_model_extents **OR**
71 * USERD_get_part_coords **AND/OR**
72 * USERD_get_block_coords_by_component
79 * both unstructured and structured
80 * --------------------------------
81 * USERD_set_time_set_and_step
85 * USERD_get_part_element_ids_by_type
86 * USERD_get_part_elements_by_type
88 * if any nsided elements:
89 * USERD_get_nsided_conn
91 * if any nfaced elements:
92 * USERD_get_nfaced_nodes_per_face
93 * USERD_get_nfaced_conn
95 * USERD_get_part_coords
96 * USERD_get_part_node_ids
100 * USERD_get_block_iblanking
101 * USERD_get_block_coords_by_component
102 * USERD_get_block_ghost_flags
103 * USERD_get_part_node_ids (If node ids given)
104 * USERD_get_part_element_ids_by_type (If element ids given)
108 * USERD_get_border_availability (If border representation
109 * USERD_get_border_elements_by_type is selected)
111 * USERD_stop_part_building
117 * changing coords only
118 * --------------------
119 * USERD_set_time_set_and_step
120 * USERD_get_descrip_lines
121 * USERD_get_part_coords
122 * USERD_get_block_coords_by_component
124 * changing connectivity
125 * ---------------------
126 * USERD_set_time_set_and_step
127 * USERD_get_descrip_lines
128 * USERD_get_number_of_model_parts
129 * USERD_get_gold_part_build_info
130 * USERD_get_ghosts_in_model_flag
131 * USERD_get_ghosts_in_block_flag (If any ghost cells in model)
132 * USERD_get_model_extents **OR**
133 * USERD_get_part_coords **AND/OR**
134 * USERD_get_block_coords_by_component
135 * USERD_get_part_element_ids_by_type
136 * USERD_get_part_elements_by_type
137 * USERD_get_part_coords
138 * USERD_get_part_node_ids
139 * USERD_get_block_iblanking
140 * USERD_get_block_coords_by_component
141 * USERD_get_block_ghost_flags (If ghost cells in part)
142 * USERD_get_part_node_ids (If node ids given)
143 * USERD_get_part_element_ids_by_type (If element ids given)
145 * USERD_get_border_availability (If border representation
146 * USERD_get_border_elements_by_type is selected)
154 * USERD_set_time_set_and_step
155 * USERD_get_constant_val
157 * scalars/vectors/tensors
158 * -----------------------
159 * USERD_get_description_lines
160 * USERD_set_time_set_and_step
161 * USERD_get_var_by_component
164 * Node or Element queries over time
165 * =================================
166 * USERD_get_var_value_at_specific
174 * USERD_get_number_of_material_sets
175 * USERD_get_matf_set_info
177 * If any material sets in the model (calls once per material set)
178 * USERD_get_number_of_materials
179 * USERD_get_matf_var_info
181 * For each element type of each part containing material ids
182 * USERD_size_matf_data
183 * USERD_load_matf_data
188 * USERD_get_uns_failed_params - Sets params used in element failure
191 *----------------------------------------------------------------------*/
193 /*----------------------------------------------------------------------
194 * MAJOR ROUTINES ACCESS: (Version 1.00) original API
196 * Get the name of the reader
197 * ==========================
198 * USERD_get_name_of_reader
199 * USERD_get_extra_gui_numbers (optional -extra_gui on command line)
200 * USERD_get_extra_gui_defaults (optional -extra_gui on command line)
204 * USERD_set_extra_gui_data (optional -extra_gui on command line)
205 * USERD_set_filenames
206 * USERD_get_number_of_time_steps
207 * USERD_get_solution_times
208 * USERD_set_time_step
211 * Gather variable and time info
212 * =============================
213 * USERD_get_number_of_variables
214 * USERD_get_variable_info
217 * Get initial part building info
218 * ==============================
219 * USERD_set_time_step
220 * USERD_get_changing_geometry_status
221 * USERD_get_node_label_status
222 * USERD_get_element_label_status
223 * USERD_get_number_of_files_in_dataset
224 * USERD_get_dataset_query_file_info
225 * USERD_get_description_lines (geometry)
226 * USERD_get_number_of_model_parts
227 * USERD_get_part_build_info
228 * USERD_get_number_global_nodes
229 * USERD_get_global_coords
230 * USERD_get_block_coords_by_component
234 * USERD_get_uns_failed_params
239 * USERD_set_time_step
240 * USERD_get_global_coords
241 * USERD_get_global_node_ids
242 * USERD_get_element_connectivities_for_part
243 * USERD_get_element_ids_for_part
244 * USERD_get_block_iblanking
245 * USERD_get_block_coords_by_component
247 * USERD_stop_part_building
253 * changing coords only
254 * --------------------
255 * USERD_set_time_step
256 * USERD_get_global_coords
257 * USERD_get_block_coords_by_component
259 * changing connectivity
260 * ---------------------
261 * USERD_set_time_step
262 * USERD_get_number_of_model_parts
263 * USERD_get_part_build_info
264 * USERD_get_number_global_nodes
265 * USERD_get_global_coords
266 * USERD_get_global_node_ids
267 * USERD_get_element_connectivities_for_part
268 * USERD_get_element_ids_for_part
269 * USERD_get_block_iblanking
270 * USERD_get_block_coords_by_component
277 * USERD_set_time_step
278 * USERD_get_constant_value
282 * USERD_get_description_lines
283 * USERD_set_time_step
284 * USERD_get_scalar_values
285 * USERD_get_block_scalar_values
289 * USERD_get_description_lines
290 * USERD_set_time_step
291 * USERD_get_vector_values
292 * USERD_get_block_vector_values_by_component
295 * Node or Element queries over time
296 * =================================
297 * USERD_get_variable_value_at_specific
299 *----------------------------------------------------------------------*/
307 #include <sys/types.h>
313 #include "global_extern.h"
315 /* -----------------------------------------------
316 * If you wish to test out various optional routines
317 * you must uncomment the proper #define below
319 * #define _EGS is for extra_gui routines
320 * #define _VES is for var_extract_gui routines
321 *---------------------------------------------------*/
326 #if (defined USERD_API_209)
327 #define GT_USERD_API_100
328 #define GT_USERD_API_200
329 #define GT_USERD_API_201
330 #define GT_USERD_API_202
331 #define GT_USERD_API_203
332 #define GT_USERD_API_204
333 #define GT_USERD_API_205
334 #define GT_USERD_API_206
335 #define GT_USERD_API_207
336 #define GT_USERD_API_208
338 #elif (defined USERD_API_208)
339 #define GT_USERD_API_100
340 #define GT_USERD_API_200
341 #define GT_USERD_API_201
342 #define GT_USERD_API_202
343 #define GT_USERD_API_203
344 #define GT_USERD_API_204
345 #define GT_USERD_API_205
346 #define GT_USERD_API_206
347 #define GT_USERD_API_207
349 #elif (defined USERD_API_207)
350 #define GT_USERD_API_100
351 #define GT_USERD_API_200
352 #define GT_USERD_API_201
353 #define GT_USERD_API_202
354 #define GT_USERD_API_203
355 #define GT_USERD_API_204
356 #define GT_USERD_API_205
357 #define GT_USERD_API_206
359 #elif (defined USERD_API_206)
360 #define GT_USERD_API_100
361 #define GT_USERD_API_200
362 #define GT_USERD_API_201
363 #define GT_USERD_API_202
364 #define GT_USERD_API_203
365 #define GT_USERD_API_204
366 #define GT_USERD_API_205
368 #elif (defined USERD_API_205)
369 #define GT_USERD_API_100
370 #define GT_USERD_API_200
371 #define GT_USERD_API_201
372 #define GT_USERD_API_202
373 #define GT_USERD_API_203
374 #define GT_USERD_API_204
376 #elif (defined USERD_API_204)
377 #define GT_USERD_API_100
378 #define GT_USERD_API_200
379 #define GT_USERD_API_201
380 #define GT_USERD_API_202
381 #define GT_USERD_API_203
383 #elif (defined USERD_API_203)
384 #define GT_USERD_API_100
385 #define GT_USERD_API_200
386 #define GT_USERD_API_201
387 #define GT_USERD_API_202
389 #elif (defined USERD_API_202)
390 #define GT_USERD_API_100
391 #define GT_USERD_API_200
392 #define GT_USERD_API_201
394 #elif (defined USERD_API_201)
395 #define GT_USERD_API_100
396 #define GT_USERD_API_200
398 #elif (defined USERD_API_200)
399 #define GT_USERD_API_100
406 int id
; /* part_id */
407 char desc
[Z_BUFL
]; /* description given in the file */
408 int type
; /* Z_UNSTRUCTURED, Z_STRUCTURED, Z_IBLANKED */
409 int ne
[Z_MAXTYPE
]; /* Number of elements per type (Z_UNSTRUCTURED) */
410 /* or ne[0] = I dimension (Z_STRUCTURED) */
411 /* ne[1] = J dimension */
412 /* ne[2] = K dimension */
413 int nn
; /* Num of unstructured nodes (All_Local only) */
414 int ghosts
; /* TRUE if ghost cells, FALSE otherwise */
418 char description
[Z_BUFL
]; /* description */
419 char filename
[Z_BUFL
]; /* real filename */
420 char ifilename
[Z_BUFL
]; /* imaginary filename */
431 char name
[12]; /* Z_POINT, Z_G_POINT, Z_BAR02, ... */
432 int con_len
; /* Number of nodes per element */
444 int Num_materials_sets
;
447 char Version_number
[Z_MAX_USERD_NAME
];
451 /* ------------------
453 * ------------------ */
455 int Num_pulldowns
= 0;
458 int *Toggle_default_status
;
459 char **Pulldown_title
;
460 int *Pulldown_number_in_list
;
461 int *Pulldown_default_selection
;
462 char ***Pulldown_item_strings
;
464 char **Field_user_string
;
465 int *Toggle_choice
; /* user choice */
466 int *Pulldown_choice
; /* user choice */
468 /* ------------------
470 * ------------------ */
471 int Num_ve_toggles
= 0;
472 int Num_ve_pulldowns
= 0;
473 int Num_ve_fields
= 0;
474 char **Toggle_ve_title
;
475 int *Toggle_ve_default_status
;
476 char **Pulldown_ve_title
;
477 int *Pulldown_ve_number_in_list
;
478 int *Pulldown_ve_default_selection
;
479 char ***Pulldown_ve_item_strings
;
480 char **Field_ve_title
;
481 char **Field_ve_user_string
;
482 int *Toggle_ve_choice
; /* user choice */
483 int *Pulldown_ve_choice
; /* user choice */
485 /* ---------------------------
486 * Failed elements (API 2.04)
487 * --------------------------- */
488 int Any_uns_failed_model_elems
= FALSE
;
490 /* ---------------------------
491 * Rigidbody (API 2.05)
492 * --------------------------- */
493 int Any_Rigid_Body_Present
= FALSE
;
495 /* ---------------------------
496 * Structured Reader Cinching (API 2.06)
497 * --------------------------- */
498 int Doing_Structured_Cinching
= FALSE
;
502 #if (defined USERD_API_100 || defined USERD_API_200)
503 EINFO Elem_info
[Z_MAXTYPE
] = {"Z_POINT",1,
518 #elif defined USERD_API_201
519 EINFO Elem_info
[Z_MAXTYPE
] = {"Z_POINT", 1,
550 EINFO Elem_info
[Z_MAXTYPE
] = {"Z_POINT", 1,
580 "Z_NSIDED", 1, /* Not yet implemented */
581 "Z_G_NSIDED",1, /* Not yet implemented */
582 "Z_NFACED", 1, /* Not yet implemented */
583 "Z_G_NFACED",1}; /* Not yet implemented */
589 static int load_fail_defaults(void);
590 static int prelim_info(int *two_fields
,
592 int *any_var_extract
);
593 static int get_input(int set_server_number
,
595 char playfile
[Z_MAXFILENP
],
600 static int time_info( void );
601 static int part_build_info(int geom_time_step
);
602 static int variable_info( void );
604 #if (defined GT_USERD_API_100)
605 static int gold_part_builder(int geom_time_step
);
606 static int gold_var_loader(int var_time_step
);
608 static int part_builder(int geom_time_step
);
609 static int var_loader(int var_time_step
);
612 #if (defined GT_USERD_API_100)
613 static int materials_info( void );
614 static int gold_materials_loader(int geom_time_step
);
617 static int entity_querys(int var_time_step
);
618 static int exercise_bkup( void );
619 static void usage( void );
626 int main(int argc
, char *argv
[])
628 int main(int argc
, char *argv
[])
631 /* Command line option variables
632 *------------------------------*/
633 int set_server_number
= FALSE
;
634 int use_playfile
= FALSE
;
635 char playfile
[Z_MAXFILENP
];
637 int geom_time_step
= 0;
638 int var_time_step
= 0;
640 /* Other local variables
641 *----------------------*/
645 int any_extra_gui
= FALSE
;
646 int any_var_extract
= FALSE
;
650 /*----------------------------
651 * Command argument processing
652 *----------------------------*/
653 fprintf(stderr
,"\n");
654 fprintf(stderr
,"\n");
655 fprintf(stderr
,"********************************************\n");
656 fprintf(stderr
,"* EnSight User Defined Reader Debug Tool *\n");
657 fprintf(stderr
,"********************************************\n");
658 fprintf(stderr
,"\n");
663 if(!strcmp("-h",argv
[indx
])) {
666 else if(!strcmp("-help",argv
[indx
])) {
670 /* if you want to test the server number routines
673 * > checker -server_number
675 * You will then be prompted for the current and total
677 *-----------------------------------------------*/
678 else if(!strcmp("-server_number",argv
[indx
])) {
679 set_server_number
= TRUE
;
682 /* if you want to use a "playfile" instead of being prompted
683 * for the data loader information
686 * > checker -p <playfile>
688 * This playfile should have 3 [or 4] lines:
691 * line 3: [filename_2] (if two_fields is TRUE)
692 * line 4: 0 or 1, for swapytes (0 is FALSE, 1 is TRUE)
694 * example (two_fields is FALSE, so only 3 lines):
696 * /usr/scratch/stealth/bjn/dat/sp_gold/binary
700 *------------------------------------------------------*/
701 else if(!strcmp("-p",argv
[indx
])) {
703 if((indx
< argc
) && (argv
[indx
][0] != '-')) {
705 memset(playfile
,EOS
,Z_MAXFILENP
);
706 strcpy(playfile
,argv
[indx
]);
713 /* if you want to specify the geometry timestep to test (default is step 0)
718 * Where # is the step number (zero based)
719 *-------------------------------------------------------------------------*/
720 else if(!strcmp("-gts",argv
[indx
])) {
722 if((indx
< argc
) && (argv
[indx
][0] != '-')) {
723 geom_time_step
= atoi(argv
[indx
]);
730 /* if you want to specify the variable timestep to test (default is step 0)
731 * (will use this step for the appropriate timeset of each variable)
736 * Where # is the step number (zero based)
737 *-------------------------------------------------------------------------*/
738 else if(!strcmp("-vts",argv
[indx
])) {
740 if((indx
< argc
) && (argv
[indx
][0] != '-')) {
741 var_time_step
= atoi(argv
[indx
]);
755 /*-------------------------------------------------------------
757 * Now start exercising EnSight
759 *--------------------------------------------------------------*/
764 err
= prelim_info(&two_fields
,&any_extra_gui
,&any_var_extract
);
766 fprintf(stderr
,"Stopping because of error in prelim_info\n");
773 *------------------*/
774 err
= get_input(set_server_number
,
782 fprintf(stderr
,"Stopping because of error in get_input\n");
792 fprintf(stderr
,"Stopping because of error in time_info\n");
800 err
= part_build_info(geom_time_step
);
802 fprintf(stderr
,"Stopping because of error in part_build_info\n");
809 *------------------*/
810 err
= variable_info();
812 fprintf(stderr
,"Stopping because of error in variable_info\n");
817 #if (defined GT_USERD_API_202)
818 /*-------------------
820 *-------------------*/
821 err
= materials_info();
823 fprintf(stderr
,"Stopping because of error in materials_info\n");
828 #if (defined GT_USERD_API_203)
829 if (Z_ERR
== load_fail_defaults()) {
830 fprintf(stderr
,"Stopping due to error in failed element flag routine\n");
835 #if (defined GT_USERD_API_204)
837 /*-----------------------------------------------
838 * Mel needs to do these species routines yet!!!
839 *----------------------------------------------*/
840 /* USERD_get_matsp_info
841 USERD_get_number_of_species */
844 /* See if any rigid body in model
845 *-------------------------------*/
846 fprintf(stderr
,"\n------------- rigid body existence -------------\n");
847 if(USERD_rigidbody_existence() == Z_OK
) {
848 fprintf(stderr
," Rigid Body values exist in the model\n");
849 Any_Rigid_Body_Present
= TRUE
;
852 fprintf(stderr
," N0 Rigid Body values exist in the model\n");
858 #if (defined GT_USERD_API_205)
860 /* See if doing structured cinching
861 *---------------------------------*/
862 fprintf(stderr
,"\n------------- structured reader cinching existence -------------\n");
863 if(USERD_get_structured_reader_cinching() == Z_OK
) {
864 fprintf(stderr
," Doing structured reader cinching\n");
865 fprintf(stderr
," for each of the i,j,k directions,\n");
866 fprintf(stderr
," will send in min and max unchanged, but\n");
867 fprintf(stderr
," will send in stride as 2\n");
868 Doing_Structured_Cinching
= TRUE
;
871 fprintf(stderr
," NOT doing structured reader cinching\n");
875 #if (defined GT_USERD_API_206)
877 /* Probably won't do either of these - trivial
878 *--------------------------------------------*/
879 /* USERD_prefer_auto_distribute <optional> */
880 /* USERD_set_filename_button_labels <optional> */
884 #if (defined GT_USERD_API_207)
886 /* If we choose to do these, Bruce should implement them
887 *------------------------------------------------------*/
888 /* All the _buffer routines! <optional> */
890 /* If we choose to do these, Bill should implement them
891 *-----------------------------------------------------*/
892 /* USERD_get_num_xy_queries <optional>
893 USERD_get_xy_query_data <optional>
894 USERD_get_xy_query_info <optional> */
898 #if (defined GT_USERD_API_208)
900 /* If we choose to do these, Bruce should implement them
901 *------------------------------------------------------*/
902 /* VGLYPH routines <optional> */
905 /*------------------------
906 * Act like building parts
907 *------------------------*/
910 #if (defined GT_USERD_API_100)
911 err
= gold_part_builder(geom_time_step
);
913 err
= part_builder(geom_time_step
);
916 fprintf(stderr
,"Stopping because of error in part_builder\n");
920 USERD_stop_part_building();
925 /*---------------------------
926 * Act like loading variables
927 *---------------------------*/
930 #if (defined GT_USERD_API_100)
931 err
= gold_var_loader(var_time_step
);
933 err
= var_loader(var_time_step
);
936 fprintf(stderr
,"Stopping because of error in var_loader\n");
941 #if (defined GT_USERD_API_202)
942 /*---------------------------
943 * Act like loading materials
944 *---------------------------*/
945 if(Num_materials_sets
> 0) {
946 err
= gold_materials_loader(geom_time_step
);
948 fprintf(stderr
,"Stopping because of error in materials_loader\n");
956 /*----------------------------------------------------
957 * See if can do node and/or element queries over time
958 *----------------------------------------------------*/
961 err
= entity_querys(var_time_step
);
963 fprintf(stderr
,"Stopping because of error in entity_querys\n");
968 /*----------------------------------------
969 * Call the bkup file once in save mode,
970 * then again in restore mode - so someone
971 * could debug if desired
972 *----------------------------------------*/
973 err
= exercise_bkup();
975 fprintf(stderr
,"Stopping due to error in saving and/or restoring archive\n");
982 fprintf(stderr
,"\n----------------- exiting ---------------\n");
984 #if (defined GT_USERD_API_100)
985 USERD_exit_routine();
988 fprintf(stderr
,"\n\n");
999 fprintf(stderr
,"------------------------------------------------------------\n");
1000 fprintf(stderr
,"USAGE: checker [-p pfile] [-server_number] [-gts #] [-vts #]\n");
1001 fprintf(stderr
,"------------------------------------------------------------\n");
1002 fprintf(stderr
," -h, -help Prints out this USAGE text.\n");
1003 fprintf(stderr
," -gts # Specify the geometry time step to use.)\n");
1004 fprintf(stderr
," -p pfile Plays the checker playfile (pfile).\n");
1005 fprintf(stderr
," -server_number Cause servers numbers to be prompted for.\n");
1006 fprintf(stderr
," -vts # Specify the variable time step to use.)\n");
1007 fprintf(stderr
,"\n");
1018 prelim_info(int *two_fields
, int *any_extra_gui
, int *any_var_extract
)
1021 char reader_name
[Z_MAX_USERD_NAME
];
1022 char release_number
[Z_MAX_USERD_NAME
];
1023 char description
[Z_MAXFILENP
];
1026 *any_extra_gui
= FALSE
;
1027 *any_var_extract
= FALSE
;
1029 /* Get the reader name
1030 *--------------------*/
1031 err
= USERD_get_name_of_reader(reader_name
,two_fields
);
1033 fprintf(stderr
," Name of reader: %s\n",reader_name
);
1034 if(*two_fields
==1) {
1035 fprintf(stderr
," two_fields: TRUE\n");
1037 else if(*two_fields
==0){
1038 fprintf(stderr
," two_fields: FALSE\n");
1040 else if(*two_fields
< 0) {
1041 fprintf(stderr
," two_fields: -1 (optional string) \n");
1045 fprintf(stderr
,"Error: Could not get name of reader\n");
1049 /* Get the Extra GUI stuff (optional)
1050 * ---------------------------------------------------------- */
1053 /* Get the Extra GUI numbers of toggles, pulldowns, & fields
1054 * ---------------------------------------------------------- */
1056 USERD_get_extra_gui_numbers( &Num_toggles
,
1060 if ( Num_toggles
> 0 || Num_pulldowns
> 0 || Num_fields
> 0 ) {
1062 *any_extra_gui
= TRUE
;
1064 if (Num_toggles
>0) {
1065 Toggle_title
= (char **) calloc(Num_toggles
,sizeof(char*));
1066 if (Toggle_title
== (char **)NULL
) return(Z_ERR
);
1067 for (i
=0; i
<Num_toggles
; i
++) {
1068 Toggle_title
[i
] = (char *) calloc(Z_LEN_GUI_TITLE_STR
,sizeof(char));
1069 if ( Toggle_title
[i
] == (char *)NULL
) return(Z_ERR
);
1071 Toggle_default_status
= (int *) calloc(Num_toggles
,sizeof(int));
1072 Toggle_choice
= (int *) calloc(Num_toggles
,sizeof(int));
1075 if (Num_pulldowns
> 0) {
1076 Pulldown_title
= (char **) calloc( Num_pulldowns
, sizeof(char*) );
1077 if (Pulldown_title
== (char **)NULL
) return(Z_ERR
);
1079 Pulldown_item_strings
= (char ***) calloc( Num_pulldowns
, sizeof(char**) );
1080 if (Pulldown_item_strings
== (char ***)NULL
) return(Z_ERR
);
1082 for (i
=0; i
<Num_pulldowns
; i
++) {
1083 Pulldown_title
[i
] = (char *) calloc( Z_LEN_GUI_TITLE_STR
, sizeof(char) );
1084 if ( Pulldown_title
[i
] == (char *)NULL
) return(Z_ERR
);
1086 Pulldown_item_strings
[i
] = (char **) calloc( Z_MAX_NUM_GUI_PULL_ITEMS
, sizeof(char *) );
1087 if (Pulldown_item_strings
[i
] == (char **)NULL
) return(Z_ERR
);
1089 for(j
= 0; j
< Z_MAX_NUM_GUI_PULL_ITEMS
; j
++) {
1090 Pulldown_item_strings
[i
][j
] = (char *) calloc( Z_LEN_GUI_PULL_STR
, sizeof(char) );
1091 if ( Pulldown_item_strings
[i
][j
] == (char *)NULL
) return(Z_ERR
);
1094 Pulldown_number_in_list
= (int *) calloc(Num_pulldowns
,sizeof(int));
1095 Pulldown_default_selection
= (int *) calloc(Num_pulldowns
,sizeof(int));
1096 Pulldown_choice
= (int *) calloc(Num_pulldowns
,sizeof(int));
1099 if (Num_fields
> 0) {
1100 Field_title
= (char **) calloc(Num_fields
,sizeof(char*));
1101 Field_user_string
= (char **) calloc(Num_fields
,sizeof(char*));
1102 if (Field_title
== (char **) NULL
) return(Z_ERR
);
1103 for (i
=0; i
<Num_fields
; i
++) {
1104 Field_title
[i
] = (char *) calloc(Z_LEN_GUI_TITLE_STR
,sizeof(char));
1105 if ( Field_title
[i
] == (char *)NULL
) return(Z_ERR
);
1106 Field_user_string
[i
] = (char *) calloc(Z_LEN_GUI_FIELD_STR
,sizeof(char));
1107 if ( Field_user_string
[i
] == (char *)NULL
) return(Z_ERR
);
1112 err
= USERD_get_extra_gui_defaults(
1113 Toggle_title
, /* [num_toggles][Z_LEN_GUI_TITLE_STR] */
1114 Toggle_default_status
, /* [num_toggles] */
1115 Pulldown_title
, /* [num_pulldowns][Z_LEN_GUI_TITLE_STR] */
1116 Pulldown_number_in_list
, /* [num_pulldowns] */
1117 Pulldown_default_selection
, /* [num_pulldowns] */
1118 Pulldown_item_strings
, /* [num_pulldowns][Z_MAX_NUM_GUI_PULL_ITEMS][Z_LEN_GUI_PULL_STR] */
1119 Field_title
, /* [num_fields][Z_LEN_GUI_TITLE_STR] */
1120 Field_user_string
/* [num_fields][Z_LEN_GUI_FIELD_STR] */
1122 if (Z_ERR
== err
) return(Z_ERR
);
1124 fprintf(stderr
,"\n**********************************************\n");
1125 fprintf(stderr
,"**** Extra GUI Information ***\n");
1126 fprintf(stderr
,"**********************************************\n\n");
1128 fprintf(stderr
,"\nTOGGLE INFO: %d active toggles\n",Num_toggles
);
1129 for (i
=0; i
<Num_toggles
; i
++) {
1130 fprintf(stderr
,"Toggle Title %d : %s\n",i
,Toggle_title
[i
]);
1131 fprintf(stderr
,"Default status = %d \n",Toggle_default_status
[i
]);
1134 fprintf(stderr
,"\nPULLDOWN INFO: %d active pulldowns\n",Num_pulldowns
);
1135 for (i
=0; i
<Num_pulldowns
; i
++) {
1136 fprintf(stderr
,"Pulldown Title %d : %s\n", i
, Pulldown_title
[i
] );
1137 for (j
=0; j
<Z_MAX_NUM_GUI_PULL_ITEMS
; j
++) {
1138 fprintf(stderr
,"Pulldown_item %d : %s\n",j
,Pulldown_item_strings
[i
][j
]);
1139 if (strlen(Pulldown_item_strings
[i
][j
]) == 0) {
1140 Pulldown_number_in_list
[i
] = j
;
1144 fprintf(stderr
,"Number of items in list: %d\n",Pulldown_number_in_list
[i
]);
1145 fprintf(stderr
,"Default selection: %d\n\n",Pulldown_default_selection
[i
]);
1147 fprintf(stderr
,"\n");
1149 fprintf(stderr
,"\nFIELDINFO: %d active fields\n",Num_fields
);
1150 for (i
=0; i
<Num_fields
; i
++) {
1151 fprintf(stderr
,"Field Title %d : %s\n",i
,Field_title
[i
]);
1152 fprintf(stderr
,"Field string %d: %s\n",i
,Field_user_string
[i
]);
1154 fprintf(stderr
,"\n\n\n");
1159 /* Get the var_extract stuff (optional)
1160 * ---------------------------------------------------------- */
1163 /* Get the var_extract numbers of toggles, pulldowns, & fields
1164 * ---------------------------------------------------------- */
1165 USERD_get_var_extract_gui_numbers(&Num_ve_toggles
,
1168 if ( Num_ve_toggles
> 0 || Num_ve_pulldowns
> 0 || Num_ve_fields
> 0 ) {
1170 *any_var_extract
= TRUE
;
1172 if (Num_ve_toggles
> 0) {
1173 Toggle_ve_title
= (char **) calloc(Num_ve_toggles
,sizeof(char*));
1174 if (Toggle_ve_title
== (char **)NULL
) return(Z_ERR
);
1175 for (i
=0; i
<Num_ve_toggles
; i
++) {
1176 Toggle_ve_title
[i
] = (char *) calloc(Z_LEN_GUI_TITLE_STR
,sizeof(char));
1177 if ( Toggle_ve_title
[i
] == (char *)NULL
) return(Z_ERR
);
1179 Toggle_ve_default_status
= (int *) calloc(Num_ve_toggles
,sizeof(int));
1180 Toggle_ve_choice
= (int *) calloc(Num_ve_toggles
,sizeof(int));
1183 if (Num_ve_pulldowns
> 0) {
1184 Pulldown_ve_title
= (char **) calloc( Num_ve_pulldowns
, sizeof(char*) );
1185 if (Pulldown_ve_title
== (char **)NULL
) return(Z_ERR
);
1187 Pulldown_ve_item_strings
= (char ***) calloc( Num_ve_pulldowns
, sizeof(char**) );
1188 if (Pulldown_ve_item_strings
== (char ***)NULL
) return(Z_ERR
);
1190 for (i
=0; i
<Num_ve_pulldowns
; i
++) {
1191 Pulldown_ve_title
[i
] = (char *) calloc( Z_LEN_GUI_TITLE_STR
, sizeof(char) );
1192 if ( Pulldown_ve_title
[i
] == (char *)NULL
) return(Z_ERR
);
1194 Pulldown_ve_item_strings
[i
] = (char **)calloc(Z_MAX_NUM_GUI_PULL_ITEMS
, sizeof(char *));
1195 if (Pulldown_ve_item_strings
[i
] == (char **)NULL
) return(Z_ERR
);
1197 for(j
= 0; j
< Z_MAX_NUM_GUI_PULL_ITEMS
; j
++) {
1198 Pulldown_ve_item_strings
[i
][j
] = (char *) calloc( Z_LEN_GUI_PULL_STR
, sizeof(char) );
1199 if ( Pulldown_ve_item_strings
[i
][j
] == (char *)NULL
) return(Z_ERR
);
1202 Pulldown_ve_number_in_list
= (int *) calloc(Num_ve_pulldowns
,sizeof(int));
1203 Pulldown_ve_default_selection
= (int *) calloc(Num_ve_pulldowns
,sizeof(int));
1204 Pulldown_ve_choice
= (int *) calloc(Num_ve_pulldowns
,sizeof(int));
1207 if (Num_ve_fields
> 0) {
1208 Field_ve_title
= (char **) calloc(Num_ve_fields
,sizeof(char*));
1209 Field_ve_user_string
= (char **) calloc(Num_ve_fields
,sizeof(char*));
1210 if (Field_ve_title
== (char **) NULL
) return(Z_ERR
);
1211 for (i
=0; i
<Num_ve_fields
; i
++) {
1212 Field_ve_title
[i
] = (char *) calloc(Z_LEN_GUI_TITLE_STR
,sizeof(char));
1213 if ( Field_ve_title
[i
] == (char *)NULL
) return(Z_ERR
);
1214 Field_ve_user_string
[i
] = (char *) calloc(Z_LEN_GUI_FIELD_STR
,sizeof(char));
1215 if ( Field_ve_user_string
[i
] == (char *)NULL
) return(Z_ERR
);
1220 err
= USERD_get_var_extract_gui_defaults(
1221 Toggle_ve_title
, /* [num_ve_toggles][Z_LEN_GUI_TITLE_STR] */
1222 Toggle_ve_default_status
, /* [num_ve_toggles] */
1223 Pulldown_ve_title
, /* [num_ve_pulldowns][Z_LEN_GUI_TITLE_STR] */
1224 Pulldown_ve_number_in_list
, /* [num_ve_pulldowns] */
1225 Pulldown_ve_default_selection
, /* [num_ve_pulldowns] */
1226 Pulldown_ve_item_strings
, /* [num_ve_pulldowns][Z_MAX_NUM_GUI_PULL_ITEMS][Z_LEN_GUI_PULL_STR] */
1227 Field_ve_title
, /* [num_ve_fields][Z_LEN_GUI_TITLE_STR] */
1228 Field_ve_user_string
/* [num_ve_fields][Z_LEN_GUI_FIELD_STR] */
1230 if (Z_ERR
== err
) return(Z_ERR
);
1232 fprintf(stderr
,"\n**********************************************\n");
1233 fprintf(stderr
,"**** Var Extract Information ***\n");
1234 fprintf(stderr
,"**********************************************\n\n");
1236 fprintf(stderr
,"\nTOGGLE INFO: %d active toggles\n",Num_ve_toggles
);
1237 for (i
=0; i
<Num_ve_toggles
; i
++) {
1238 fprintf(stderr
,"Toggle Title %d : %s\n",i
,Toggle_ve_title
[i
]);
1239 fprintf(stderr
,"Default status = %d \n",Toggle_ve_default_status
[i
]);
1242 fprintf(stderr
,"\nPULLDOWN INFO: %d active pulldowns\n",Num_ve_pulldowns
);
1243 for (i
=0; i
<Num_ve_pulldowns
; i
++) {
1244 fprintf(stderr
,"Pulldown Title %d : %s\n", i
, Pulldown_ve_title
[i
] );
1245 for (j
=0; j
<Z_MAX_NUM_GUI_PULL_ITEMS
; j
++) {
1246 fprintf(stderr
,"Pulldown_item %d : %s\n",j
,Pulldown_ve_item_strings
[i
][j
]);
1247 if (strlen(Pulldown_ve_item_strings
[i
][j
]) == 0) {
1248 Pulldown_ve_number_in_list
[i
] = j
;
1252 fprintf(stderr
,"Number of items in list: %d\n",Pulldown_ve_number_in_list
[i
]);
1253 fprintf(stderr
,"Default selection: %d\n\n",Pulldown_ve_default_selection
[i
]);
1255 fprintf(stderr
,"\n");
1257 fprintf(stderr
,"\nFIELDINFO: %d active fields\n",Num_ve_fields
);
1258 for (i
=0; i
<Num_ve_fields
; i
++) {
1259 fprintf(stderr
,"Field Title %d : %s\n",i
,Field_ve_title
[i
]);
1260 fprintf(stderr
,"Field string %d: %s\n",i
,Field_ve_user_string
[i
]);
1262 fprintf(stderr
,"\n\n\n");
1267 #if (defined GT_USERD_API_100)
1269 /* Get the reader api used
1270 *------------------------*/
1271 err
= USERD_get_reader_version(Version_number
);
1273 fprintf(stderr
," API version: %s\n",Version_number
);
1276 fprintf(stderr
,"Error: Could not get reader api version\n");
1280 /* Get the reader release
1281 *-----------------------*/
1282 err
= USERD_get_reader_release(release_number
);
1284 fprintf(stderr
," Release: %s\n",release_number
);
1287 fprintf(stderr
,"Error: Could not get reader release\n");
1291 fprintf(stderr
," API version: 1.00\n");
1296 /* Get the reader description
1297 *---------------------------*/
1298 err
= USERD_get_reader_descrip(description
);
1300 fprintf(stderr
," Description:\n\n");
1301 fprintf(stderr
,"%s\n\n",description
);
1304 fprintf(stderr
,"Error: Could not get reader description\n");
1308 fprintf(stderr
," Note: Not currently calling USERD_get_reader_descrip\n");
1309 fprintf(stderr
," because it is optional.\n");
1320 get_input(int set_server_number
,
1322 char playfile
[Z_MAXFILENP
],
1325 int any_var_extract
,
1334 char the_path
[Z_MAXFILENP
];
1335 char file1
[Z_MAXFILENP
];
1336 char file2
[Z_MAXFILENP
];
1337 char filename_1
[Z_MAXFILENP
];
1338 char filename_2
[Z_MAXFILENP
];
1341 fprintf(stderr
,"\n-------------- get_input ----------------\n");
1343 /*-----------------------------------------------------
1344 * Prompt for the two input values, as the client would
1345 * And set this info for the reader
1346 *-----------------------------------------------------*/
1348 #if (defined GT_USERD_API_100)
1350 /* Set the server number - if command line option to do so
1351 *--------------------------------------------------------*/
1352 if(set_server_number
) {
1353 fprintf(stderr
," Enter total number of servers: ");
1354 scanf("%d",&tot_servers
);
1356 fprintf(stderr
," Enter current server number: ");
1357 scanf("%d",&cur_server
);
1359 fprintf(stderr
," Setting %d of %d for server number\n",cur_server
,tot_servers
);
1360 USERD_set_server_number(cur_server
,tot_servers
);
1364 /* Set the filenames
1365 *------------------*/
1366 memset(the_path
,EOS
,Z_MAXFILENP
);
1367 memset(file1
,EOS
,Z_MAXFILENP
);
1368 memset(file2
,EOS
,Z_MAXFILENP
);
1369 memset(filename_1
,EOS
,Z_MAXFILENP
);
1370 memset(filename_2
,EOS
,Z_MAXFILENP
);
1374 fprintf(stderr
," Enter the path: ");
1375 scanf("%s",the_path
);
1378 fprintf(stderr
," Enter filename_1: ");
1381 if(two_fields
== TRUE
) {
1382 fprintf(stderr
," Enter filename_2: ");
1386 fprintf(stderr
," Enter Swapbytes (0 if FALSE, 1 if TRUE): ");
1387 scanf("%d",swapbytes
);
1389 if (TRUE
== any_extra_gui
) {
1390 fprintf(stderr
,"\n**********************************************\n");
1391 fprintf(stderr
,"**** Extra GUI INPUT ***\n");
1392 fprintf(stderr
,"**********************************************\n\n");
1394 fprintf(stderr
, "\n TOGGLE INPUT \n");
1395 for (i
=0; i
<Num_toggles
; i
++) {
1396 fprintf(stderr
, " Enter Toggle Value for '%s' (1=toggle on, 0=toggle off)\n",Toggle_title
[i
]);
1397 scanf("%d",&Toggle_choice
[i
]);
1399 fprintf(stderr
, "\n PULLDOWN INPUT \n");
1400 for (i
=0; i
<Num_pulldowns
; i
++) {
1401 fprintf(stderr
, "\n PULLDOWN # %d \n",i
);
1402 for (j
= 0; j
<Pulldown_number_in_list
[i
]; j
++) {
1403 fprintf(stderr
, " %d %s\n",j
,Pulldown_item_strings
[i
][j
]);
1405 fprintf(stderr
, " Enter Pulldown Value for '%s' (0 to %d)\n",Pulldown_title
[i
],Pulldown_number_in_list
[i
]-1);
1406 scanf("%d",&Pulldown_choice
[i
]);
1408 fprintf(stderr
, "\n FIELD INPUT \n");
1409 for (i
=0; i
<Num_fields
; i
++) {
1410 fprintf(stderr
, "Enter string for field %d '%s'\n",i
,Field_title
[i
]);
1411 scanf("%s",Field_user_string
[i
]);
1414 } /* end if there is any extra gui stuff */
1416 if (TRUE
== any_var_extract
) {
1417 fprintf(stderr
,"\n**********************************************\n");
1418 fprintf(stderr
,"**** Var extract INPUT ***\n");
1419 fprintf(stderr
,"**********************************************\n\n");
1421 fprintf(stderr
, "\n TOGGLE INPUT \n");
1422 for (i
=0; i
<Num_ve_toggles
; i
++) {
1423 fprintf(stderr
, " Enter Toggle Value for '%s' (1=toggle on, 0=toggle off)\n",Toggle_ve_title
[i
]);
1424 scanf("%d",&Toggle_ve_choice
[i
]);
1426 fprintf(stderr
, "\n PULLDOWN INPUT \n");
1427 for (i
=0; i
<Num_ve_pulldowns
; i
++) {
1428 fprintf(stderr
, "\n PULLDOWN # %d \n",i
);
1429 for (j
= 0; j
<Pulldown_ve_number_in_list
[i
]; j
++) {
1430 fprintf(stderr
, " %d %s\n",j
,Pulldown_ve_item_strings
[i
][j
]);
1432 fprintf(stderr
, " Enter Pulldown Value for '%s' (0 to %d)\n",Pulldown_ve_title
[i
],Pulldown_ve_number_in_list
[i
]-1);
1433 scanf("%d",&Pulldown_ve_choice
[i
]);
1435 fprintf(stderr
, "\n FIELD INPUT \n");
1436 for (i
=0; i
<Num_ve_fields
; i
++) {
1437 fprintf(stderr
, "Enter string for field %d '%s'\n",i
,Field_ve_title
[i
]);
1438 scanf("%s",Field_ve_user_string
[i
]);
1441 } /* end if there is any var_extract stuff */
1443 } /* end if not using playfile */
1445 fplay
= fopen(playfile
,"rb");
1446 if(fplay
== (FILE *)NULL
) {
1447 fprintf(stderr
,"Error: Opening the playfile %s\n",playfile
);
1451 fscanf(fplay
,"%s",the_path
);
1452 fscanf(fplay
,"%s",file1
);
1453 if(two_fields
== TRUE
) {
1454 fscanf(fplay
,"%s",file2
);
1456 fscanf(fplay
,"%d",swapbytes
);
1458 /* ---------------------
1460 * --------------------- */
1461 if (TRUE
== any_extra_gui
) {
1463 for (i
=0; i
<Num_toggles
; i
++) {
1464 fscanf(fplay
,"%d",&Toggle_choice
[i
]);
1467 for (i
=0; i
<Num_pulldowns
; i
++) {
1468 fscanf(fplay
,"%d",&Pulldown_choice
[i
]);
1471 for (i
=0; i
<Num_fields
; i
++) {
1472 fscanf(fplay
,"%s",Field_user_string
[i
]);
1476 /* ---------------------
1478 * --------------------- */
1479 if (TRUE
== any_var_extract
) {
1481 for (i
=0; i
<Num_ve_toggles
; i
++) {
1482 fscanf(fplay
,"%d",&Toggle_ve_choice
[i
]);
1485 for (i
=0; i
<Num_ve_pulldowns
; i
++) {
1486 fscanf(fplay
,"%d",&Pulldown_ve_choice
[i
]);
1489 for (i
=0; i
<Num_ve_fields
; i
++) {
1490 fscanf(fplay
,"%s",Field_ve_user_string
[i
]);
1499 /* -------------------------------------------
1500 * set the user choices here and run the code
1501 * ------------------------------------------- */
1503 /* set your choices here
1504 Toggle_choice[0..Num_toggles]
1505 Pulldown_choice[0..Num_pulldowns]
1506 Field_user_string[Num_fields][0..Numfields]
1507 amd then send your choices into this routine */
1509 USERD_set_extra_gui_data(Toggle_choice
, /* [num_toggle] */
1510 Pulldown_choice
, /* [num_pulldown] */
1511 Field_user_string
); /* [num_fields][Z_LEN_GUI_FIELD_STR] */
1513 for (i
=0; i
<Num_toggles
; i
++) {
1514 fprintf(stderr
,"Toggle Title %d : %s\n",i
,Toggle_title
[i
]);
1515 fprintf(stderr
,"User selection = %d \n",Toggle_choice
[i
]);
1517 fprintf(stderr
,"\n\n");
1519 for (i
=0; i
<Num_pulldowns
; i
++) {
1520 fprintf(stderr
,"Pulldown Title %d : %s\n", i
, Pulldown_title
[i
] );
1521 fprintf(stderr
,"Pulldown selection is # %d : %s\n",
1522 Pulldown_choice
[i
],Pulldown_item_strings
[i
][Pulldown_choice
[i
]]);
1525 for (i
=0; i
<Num_fields
; i
++) {
1526 fprintf(stderr
,"Field Title %d : %s\n",i
,Field_title
[i
]);
1527 fprintf(stderr
,"Field string %d: %s\n",i
,Field_user_string
[i
]);
1533 /* -------------------------------------------
1534 * set the user choices here and run the code
1535 * ------------------------------------------- */
1537 /* set your choices here
1538 Toggle_ve_choice[0..Num_ve_toggles]
1539 Pulldown_ve_choice[0..Num_ve_pulldowns]
1540 Field_ve_user_string[Num_ve_fields][0..Numfields]
1541 amd then send your choices into this routine */
1543 USERD_set_var_extract_gui_data(Toggle_ve_choice
, /* [num_ve_toggle] */
1544 Pulldown_ve_choice
, /* [num_ve_pulldown] */
1545 Field_ve_user_string
); /*[num_ve_fields][Z_LEN_GUI_FIELD_STR] */
1547 for (i
=0; i
<Num_ve_toggles
; i
++) {
1548 fprintf(stderr
,"Toggle Title %d : %s\n",i
,Toggle_ve_title
[i
]);
1549 fprintf(stderr
,"User selection = %d \n",Toggle_ve_choice
[i
]);
1551 fprintf(stderr
,"\n\n");
1553 for (i
=0; i
<Num_ve_pulldowns
; i
++) {
1554 fprintf(stderr
,"Pulldown Title %d : %s\n", i
, Pulldown_ve_title
[i
] );
1555 fprintf(stderr
,"Pulldown selection is # %d : %s\n",
1556 Pulldown_ve_choice
[i
],Pulldown_ve_item_strings
[i
][Pulldown_ve_choice
[i
]]);
1559 for (i
=0; i
<Num_ve_fields
; i
++) {
1560 fprintf(stderr
,"Field Title %d : %s\n",i
,Field_ve_title
[i
]);
1561 fprintf(stderr
,"Field string %d: %s\n",i
,Field_ve_user_string
[i
]);
1566 if(strncmp(file1
,"/",1)) {
1567 strcpy(filename_1
,the_path
);
1568 strcat(filename_1
,"/");
1569 strcat(filename_1
,file1
);
1571 if(two_fields
== TRUE
) {
1572 if(strncmp(file2
,"/",1)) {
1573 strcpy(filename_2
,the_path
);
1574 strcat(filename_2
,"/");
1575 strcat(filename_2
,file2
);
1578 if(*swapbytes
== 0) {
1587 fprintf(stderr
," path: %s\n",the_path
);
1588 fprintf(stderr
," filename_1: %s\n",filename_1
);
1589 fprintf(stderr
," filename_2: %s\n",filename_2
);
1591 fprintf(stderr
," Swapbytes: TRUE\n");
1594 fprintf(stderr
," Swapbytes: FALSE\n");
1597 err
= USERD_set_filenames(filename_1
,filename_2
,the_path
,*swapbytes
);
1599 fprintf(stderr
,"Error: Trouble setting the filenames\n");
1618 char ts_desc
[Z_BUFL
];
1620 fprintf(stderr
,"\n-------------- time_info ----------------\n");
1622 #if (defined GT_USERD_API_100)
1624 /* Get the number of timesets
1625 *---------------------------*/
1626 Num_time_sets
= USERD_get_number_of_timesets();
1627 fprintf(stderr
," number of timesets: %d\n",Num_time_sets
);
1628 if(Num_time_sets
== 0) {
1629 fprintf(stderr
," So, static geometry and variables\n");
1633 /* Get the timeset used for the geometry
1634 *--------------------------------------*/
1635 geom_time_set
= USERD_get_geom_timeset_number();
1637 fprintf(stderr
," geom timeset number: %d\n",geom_time_set
);
1638 if(geom_time_set
< 1 && Num_time_sets
> 0) {
1639 fprintf(stderr
,"Error: timeset numbers must be 1 or greater\n");
1640 fprintf(stderr
," (unless Num_time_sets is zero also)\n");
1645 *-----------------*/
1646 for(ts
=1; ts
<=Num_time_sets
; ++ts
) {
1648 fprintf(stderr
," Timeset %d:\n",ts
);
1650 /* Get the timeset descriptions
1651 *-----------------------------*/
1652 err
= USERD_get_timeset_description(ts
,ts_desc
);
1654 fprintf(stderr
,"Error: getting timeset description\n");
1658 fprintf(stderr
," description: %s\n",ts_desc
);
1661 /* Get the number of time steps
1662 *-----------------------------*/
1663 Num_time_steps
= USERD_get_num_of_time_steps(ts
);
1664 fprintf(stderr
," number of time steps: %d\n",Num_time_steps
);
1665 if(Num_time_steps
< 1) {
1666 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
1667 fprintf(stderr
," (Must be >0 to be okay)\n");
1672 /* Get the solution times
1673 *-----------------------*/
1674 if(Num_time_steps
> 0) {
1675 sol_times
= (float *) calloc(Num_time_steps
,sizeof(float));
1676 if(sol_times
== (float *)NULL
) {
1677 fprintf(stderr
,"Error: allocating for solution times\n");
1681 err
= USERD_get_sol_times(ts
,sol_times
);
1683 fprintf(stderr
,"Error: getting solution times\n");
1687 for(i
=0; i
<Num_time_steps
; ++i
) {
1688 fprintf(stderr
," At step %d, time = %f\n",i
,sol_times
[i
]);
1699 /* Get the number of time steps
1700 *-----------------------------*/
1701 Num_time_steps
= USERD_get_number_of_time_steps();
1702 fprintf(stderr
," Nnumber of time steps: %d\n",Num_time_steps
);
1703 if(Num_time_steps
< 1) {
1704 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
1705 fprintf(stderr
," (Must be >0 to be okay)\n");
1710 /* Get the solution times
1711 *-----------------------*/
1712 if(Num_time_steps
> 0) {
1713 sol_times
= (float *) calloc(Num_time_steps
,sizeof(float));
1714 if(sol_times
== (float *)NULL
) {
1715 fprintf(stderr
,"Error: allocating for solution times\n");
1719 err
= USERD_get_solution_times(sol_times
);
1721 fprintf(stderr
,"Error: getting solution times\n");
1725 for(i
=0; i
<Num_time_steps
; ++i
) {
1726 fprintf(stderr
," At step %d, time = %f\n",i
,sol_times
[i
]);
1744 part_build_info(int geom_time_step
)
1749 int num_dataset_files
;
1757 int *number_of_nodes
;
1759 int **ijk_dimensions
;
1760 int **iblanking_options
;
1761 char **part_descriptions
;
1763 int ghosts_in_block
;
1766 int **max_num_elems
;
1767 int **max_ijk_dimensions
;
1771 fprintf(stderr
,"\n------------ part_build_info ------------\n");
1773 #if (defined GT_USERD_API_100)
1775 /* Get the timeset used for the geometry
1776 *--------------------------------------*/
1777 geom_time_set
= USERD_get_geom_timeset_number();
1779 /* Get the number of time steps for this timeset
1780 *----------------------------------------------*/
1781 Num_time_steps
= USERD_get_num_of_time_steps(geom_time_set
);
1782 if(Num_time_steps
< 1) {
1783 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
1784 fprintf(stderr
," (Must be >0 to be okay)\n");
1787 if(geom_time_step
> (Num_time_steps
- 1)) {
1788 geom_time_step
= Num_time_steps
- 1;
1791 /* Set the timeset and step - to first step
1792 *-----------------------------------------*/
1793 USERD_set_time_set_and_step(geom_time_set
,geom_time_step
);
1797 /* Set the time step - to first step
1798 *----------------------------------*/
1799 USERD_set_time_step(geom_time_step
);
1803 /* Get the changing geometry status
1804 *---------------------------------*/
1805 Geom_status
= USERD_get_changing_geometry_status();
1806 if(Geom_status
== Z_STATIC
) {
1807 fprintf(stderr
," Geom changing status: Z_STATIC\n");
1809 else if(Geom_status
== Z_CHANGE_COORDS
) {
1810 fprintf(stderr
," Geom changing status: Z_CHANGE_COORDS\n");
1812 else if(Geom_status
== Z_CHANGE_CONN
) {
1813 fprintf(stderr
," Geom changing status: Z_CHANGE_CONN\n");
1816 fprintf(stderr
," Invalid Geom changing status!!\n");
1820 /* Get the node label status
1821 *--------------------------*/
1822 Node_labels
= USERD_get_node_label_status();
1824 fprintf(stderr
," Node labels will be provided\n");
1827 fprintf(stderr
," Node labels will NOT be provided\n");
1830 /* Get the element label status
1831 *-----------------------------*/
1832 Element_labels
= USERD_get_element_label_status();
1833 if(Element_labels
) {
1834 fprintf(stderr
," Element labels will be provided\n");
1837 fprintf(stderr
," Element labels will NOT be provided\n");
1840 fprintf(stderr
,"\n");
1842 /* Get the number of files in the dataset
1843 *---------------------------------------*/
1844 num_dataset_files
= USERD_get_number_of_files_in_dataset();
1845 fprintf(stderr
," Number of files in dataset: %d\n",num_dataset_files
);
1848 /* Get the dataset query file info
1849 *--------------------------------*/
1850 if(num_dataset_files
> 0) {
1852 qfiles
= (Z_QFILES
*) calloc(num_dataset_files
,sizeof(Z_QFILES
));
1853 if(qfiles
== (Z_QFILES
*)NULL
) {
1854 fprintf(stderr
,"Error: allocating for dataset query files\n");
1859 for(i
=0; i
<num_dataset_files
; ++i
) {
1860 qfiles
[i
].f_desc
= (char **) calloc(10,sizeof(char *));
1861 if(qfiles
[i
].f_desc
== (char **)NULL
) {
1862 fprintf(stderr
,"Error: allocating for dataset query descrip lines\n");
1866 for(j
=0; j
<10; ++j
) {
1867 qfiles
[i
].f_desc
[j
] = (char *) calloc(Z_MAXFILENP
,sizeof(char));
1868 if(qfiles
[i
].f_desc
[j
] == (char *)NULL
) {
1869 fprintf(stderr
,"Error: allocating for dataset query descrip lines\n");
1876 err
= USERD_get_dataset_query_file_info(qfiles
);
1878 for(fn
=0; fn
<num_dataset_files
; ++fn
) {
1879 fprintf(stderr
," For dataset file %d:\n",fn
);
1881 fprintf(stderr
," name: %s\n",qfiles
[fn
].name
);
1882 fprintf(stderr
," size: %d\n",qfiles
[fn
].sizeb
);
1883 fprintf(stderr
," time: %s\n",qfiles
[fn
].timemod
);
1884 fprintf(stderr
," num desc lines: %d\n",qfiles
[fn
].num_d_lines
);
1885 for(i
=0; i
<qfiles
[fn
].num_d_lines
; ++i
) {
1886 fprintf(stderr
," desc line %d: %s\n",i
,qfiles
[fn
].f_desc
[i
]);
1891 fprintf(stderr
,"Error: getting dataset query info\n");
1896 /* Free allocated memory
1897 *----------------------*/
1898 for(i
=0; i
<num_dataset_files
; ++i
) {
1899 for(j
=0; j
<10; ++j
) {
1900 free(qfiles
[i
].f_desc
[j
]);
1902 free(qfiles
[i
].f_desc
);
1907 fprintf(stderr
,"\n-----------------------------------------\n");
1909 #if (defined GT_USERD_API_100)
1911 /* Get the geometry description lines
1912 *-----------------------------------*/
1913 err
= USERD_get_descrip_lines(Z_GEOM
,0,FALSE
,line1
,line2
);
1915 fprintf(stderr
," Geom Desc line1: %s\n",line1
);
1916 fprintf(stderr
," Geom Desc line2: %s\n",line2
);
1919 fprintf(stderr
,"Error: getting geom description lines\n");
1925 /* Get the geometry description lines
1926 *-----------------------------------*/
1927 err
= USERD_get_description_lines(Z_GEOM
,0,line1
,line2
);
1929 fprintf(stderr
," Geom Desc line1: %s\n",line1
);
1930 fprintf(stderr
," Geom Desc line2: %s\n",line2
);
1933 fprintf(stderr
,"Error: getting geom description lines\n");
1939 /* Get the number of model parts
1940 *------------------------------*/
1941 Num_parts
= USERD_get_number_of_model_parts();
1943 fprintf(stderr
," Number of parts: %d\n",Num_parts
);
1946 fprintf(stderr
," Problems getting number of parts\n");
1952 /* Get the gold part build info
1953 *-----------------------------*/
1954 Pbuild
= (BUILDINFO
*) calloc(Num_parts
,sizeof(BUILDINFO
));
1955 if(Pbuild
== (BUILDINFO
*)NULL
) {
1956 fprintf(stderr
," Problems allocating for Pbuild structure\n");
1961 part_ids
= (int *) calloc(Num_parts
,sizeof(int));
1962 if(part_ids
== (int *)NULL
) {
1963 fprintf(stderr
," Problems allocating for part ids\n");
1967 part_types
= (int *) calloc(Num_parts
,sizeof(int));
1968 if(part_types
== (int *)NULL
) {
1969 fprintf(stderr
," Problems allocating for part types\n");
1973 part_descriptions
= (char **) calloc(Num_parts
,sizeof(char *));
1974 if(part_descriptions
== (char **)NULL
) {
1975 fprintf(stderr
," Problems allocating for part descriptions\n");
1979 for(i
=0; i
<Num_parts
; ++i
) {
1980 part_descriptions
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
1981 if(part_descriptions
[i
] == (char *)NULL
) {
1982 fprintf(stderr
," Problems allocating for part descriptions\n");
1988 number_of_nodes
= (int *) calloc(Num_parts
,sizeof(int));
1989 if(number_of_nodes
== (int *)NULL
) {
1990 fprintf(stderr
," Problems allocating for part number of nodes\n");
1994 num_elems
= (int **) calloc(Num_parts
,sizeof(int *));
1995 if(num_elems
== (int **)NULL
) {
1996 fprintf(stderr
," Problems allocating for part number of elements\n");
2000 for(i
=0; i
<Num_parts
; ++i
) {
2001 num_elems
[i
] = (int *) calloc(Z_MAXTYPE
,sizeof(int));
2002 if(num_elems
[i
] == (int *)NULL
) {
2003 fprintf(stderr
," Problems allocating for part number of elements\n");
2009 ijk_dimensions
= (int **) calloc(Num_parts
,sizeof(int *));
2010 if(ijk_dimensions
== (int **)NULL
) {
2011 fprintf(stderr
," Problems allocating for part ijk dimensions\n");
2016 #if (defined GT_USERD_API_202)
2017 for(i
=0; i
<Num_parts
; ++i
) {
2018 ijk_dimensions
[i
] = (int *) calloc(9,sizeof(int));
2019 if(ijk_dimensions
[i
] == (int *)NULL
) {
2020 fprintf(stderr
," Problems allocating for part ijk dimensions\n");
2024 for(j
=0; j
<9; ++j
) {
2025 ijk_dimensions
[i
][j
] = -1;
2030 for(i
=0; i
<Num_parts
; ++i
) {
2031 ijk_dimensions
[i
] = (int *) calloc(3,sizeof(int));
2032 if(ijk_dimensions
[i
] == (int *)NULL
) {
2033 fprintf(stderr
," Problems allocating for part ijk dimensions\n");
2040 iblanking_options
= (int **) calloc(Num_parts
,sizeof(int *));
2041 if(iblanking_options
== (int **)NULL
) {
2042 fprintf(stderr
," Problems allocating for part iblanking options\n");
2046 for(i
=0; i
<Num_parts
; ++i
) {
2047 iblanking_options
[i
] = (int *) calloc(6,sizeof(int));
2048 if(iblanking_options
[i
] == (int *)NULL
) {
2049 fprintf(stderr
," Problems allocating for part iblanking options\n");
2056 #if (defined GT_USERD_API_100)
2058 err
= USERD_get_gold_part_build_info(part_ids
,
2067 err
= USERD_get_part_build_info(part_ids
,
2077 fprintf(stderr
," Problems getting part build info\n");
2081 for(i
=0; i
<Num_parts
; ++i
) {
2082 fprintf(stderr
," For part %d:\n",i
+1);
2084 fprintf(stderr
," part id: %d\n",part_ids
[i
]);
2085 Pbuild
[i
].id
= part_ids
[i
];
2087 if(part_types
[i
] == Z_UNSTRUCTURED
) {
2088 fprintf(stderr
," part type: Z_UNSTRUCTURED\n");
2090 else if(part_types
[i
] == Z_STRUCTURED
) {
2091 fprintf(stderr
," part type: Z_STRUCTURED\n");
2093 else if(part_types
[i
] == Z_IBLANKED
) {
2094 fprintf(stderr
," part type: Z_IBLANKED\n");
2097 fprintf(stderr
," Invalid part type\n");
2100 Pbuild
[i
].type
= part_types
[i
];
2102 fprintf(stderr
," part desc: %s\n",part_descriptions
[i
]);
2103 strncpy(Pbuild
[i
].desc
,part_descriptions
[i
],Z_BUFL
);
2105 #if (defined GT_USERD_API_100)
2106 fprintf(stderr
," number of nodes : %d\n",number_of_nodes
[i
]);
2107 Pbuild
[i
].nn
= number_of_nodes
[i
];
2109 Pbuild
[i
].nn
= USERD_get_number_of_global_nodes();
2112 for(j
=0; j
<Z_MAXTYPE
; ++j
) {
2113 if(num_elems
[i
][j
] > 0) {
2114 fprintf(stderr
," # %s elements: %d\n",
2115 Elem_info
[j
].name
,num_elems
[i
][j
]);
2116 Pbuild
[i
].ne
[j
] = num_elems
[i
][j
];
2120 if(part_types
[i
] != Z_UNSTRUCTURED
) {
2122 /* For this checker, we will place the following in the
2123 * Pbuild[].ne[] structure:
2125 * Note this can be used for block size whether ranges or not
2126 * -------------------------------------------------------------
2127 * Pbuild[].ne[0] = i dim of current block (to the range selected)
2128 * Pbuild[].ne[1] = j dim of current block (to the range selected)
2129 * Pbuild[].ne[2] = k dim of current block (to the range selected)
2133 * Pbuild[].ne[3] = i min range (-1 indicates no ranges)
2134 * Pbuild[].ne[4] = i max range
2135 * Pbuild[].ne[5] = i min range
2136 * Pbuild[].ne[6] = i max range
2137 * Pbuild[].ne[7] = i min range
2138 * Pbuild[].ne[8] = i max range
2140 * Pbuild[].ne[9] = i dim of total block (if ranges)
2141 * Pbuild[].ne[10] = j dim of total block (if ranges)
2142 * Pbuild[].ne[11] = k dim of total block (if ranges)
2144 * What comes back from the api is:
2145 * --------------------------------
2146 * before 2.03 (no ranges)
2147 * -----------------------
2148 * ijk_dimensions[][0] = i dim of block
2149 * ijk_dimensions[][1] = j dim of block
2150 * ijk_dimensions[][2] = k dim of block
2152 * at 2.03 (if no ranges)
2154 * ijk_dimensions[][0] = i dim of block
2155 * ijk_dimensions[][1] = j dim of block
2156 * ijk_dimensions[][2] = k dim of block
2157 * ijk_dimensions[][3] = -1
2159 * at 2.03 (if ranges)
2161 * ijk_dimensions[][0] = i dim of total block
2162 * ijk_dimensions[][1] = j dim of total block
2163 * ijk_dimensions[][2] = k dim of total block
2164 * ijk_dimensions[][3] = i min range
2165 * ijk_dimensions[][4] = i max range
2166 * ijk_dimensions[][5] = j min range
2167 * ijk_dimensions[][6] = j max range
2168 * ijk_dimensions[][7] = k min range
2169 * ijk_dimensions[][8] = k max range
2170 *--------------------------------------------------------------*/
2172 #if (defined GT_USERD_API_202)
2173 if(ijk_dimensions
[i
][3] == -1) {
2174 fprintf(stderr
," ijk_dimensions: %d %d %d\n",
2175 ijk_dimensions
[i
][0],
2176 ijk_dimensions
[i
][1],
2177 ijk_dimensions
[i
][2]);
2178 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][0];
2179 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][1];
2180 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][2];
2181 Pbuild
[i
].ne
[3] = ijk_dimensions
[i
][3];
2187 if(ijk_dimensions
[i
][0] == 0 &&
2188 ijk_dimensions
[i
][1] == 0 &&
2189 ijk_dimensions
[i
][2] == 0) {
2190 fprintf(stderr
," ijk_dimensions: %d %d %d\n",
2191 ijk_dimensions
[i
][0],
2192 ijk_dimensions
[i
][1],
2193 ijk_dimensions
[i
][2]);
2194 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][0];
2195 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][1];
2196 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][2];
2197 Pbuild
[i
].ne
[3] = -1;
2203 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][4] - ijk_dimensions
[i
][3] + 1;
2204 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][6] - ijk_dimensions
[i
][5] + 1;
2205 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][8] - ijk_dimensions
[i
][7] + 1;
2207 Pbuild
[i
].ne
[3] = ijk_dimensions
[i
][3];
2208 Pbuild
[i
].ne
[4] = ijk_dimensions
[i
][4];
2209 Pbuild
[i
].ne
[5] = ijk_dimensions
[i
][5];
2210 Pbuild
[i
].ne
[6] = ijk_dimensions
[i
][6];
2211 Pbuild
[i
].ne
[7] = ijk_dimensions
[i
][7];
2212 Pbuild
[i
].ne
[8] = ijk_dimensions
[i
][8];
2214 Pbuild
[i
].ne
[9] = ijk_dimensions
[i
][0];
2215 Pbuild
[i
].ne
[10] = ijk_dimensions
[i
][1];
2216 Pbuild
[i
].ne
[11] = ijk_dimensions
[i
][2];
2218 fprintf(stderr
," Part has ranges:\n");
2219 fprintf(stderr
," ijk dimensions of total block: %d %d %d\n",
2223 fprintf(stderr
," i range: %d to %d\n",
2226 fprintf(stderr
," j range: %d to %d\n",
2229 fprintf(stderr
," k range: %d to %d\n",
2232 fprintf(stderr
," ijk dimensions of range portion: %d %d %d\n",
2239 fprintf(stderr
," ijk_dimensions: %d %d %d\n",
2240 ijk_dimensions
[i
][0],
2241 ijk_dimensions
[i
][1],
2242 ijk_dimensions
[i
][2]);
2243 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][0];
2244 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][1];
2245 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][2];
2246 Pbuild
[i
].ne
[3] = -1;
2248 if(part_types
[i
] == Z_IBLANKED
) {
2249 fprintf(stderr
," Ibanking options on:\n");
2250 if(iblanking_options
[i
][Z_EXT
]) {
2251 fprintf(stderr
," Z_EXT\n");
2253 if(iblanking_options
[i
][Z_INT
]) {
2254 fprintf(stderr
," Z_INT\n");
2256 if(iblanking_options
[i
][Z_BND
]) {
2257 fprintf(stderr
," Z_BND\n");
2259 if(iblanking_options
[i
][Z_INTBND
]) {
2260 fprintf(stderr
," Z_INTBND\n");
2262 if(iblanking_options
[i
][Z_SYM
]) {
2263 fprintf(stderr
," Z_SYM\n");
2271 #if (defined GT_USERD_API_200)
2273 /* Get ghosts in model flag
2274 *-------------------------*/
2275 Ghosts_in_model
= USERD_get_ghosts_in_model_flag();
2276 if(Ghosts_in_model
) {
2277 fprintf(stderr
," Ghosts in Model: TRUE\n");
2280 fprintf(stderr
," Ghosts in Model: FALSE\n");
2283 /* Get ghosts in block flag - if needed
2284 *-------------------------------------*/
2285 for(i
=1; i
<=Num_parts
; ++i
) {
2286 if(part_types
[i
-1] != Z_UNSTRUCTURED
&& Ghosts_in_model
) {
2287 ghosts_in_block
= USERD_get_ghosts_in_block_flag(i
);
2288 Pbuild
[i
-1].ghosts
= ghosts_in_block
;
2289 if(ghosts_in_block
) {
2290 fprintf(stderr
," Ghosts in block part %d: TRUE\n",i
);
2293 fprintf(stderr
," Ghosts in block part %d: FALSE\n",i
);
2301 #if (defined GT_USERD_API_100)
2304 *-----------------*/
2305 max_num_nodes
= (int *) calloc(Num_parts
,sizeof(int));
2306 if(max_num_nodes
== (int *)NULL
) {
2307 fprintf(stderr
," Problems allocating for part max num of nodes\n");
2311 max_num_elems
= (int **) calloc(Num_parts
,sizeof(int *));
2312 if(max_num_elems
== (int **)NULL
) {
2313 fprintf(stderr
," Problems allocating for part max num of elements\n");
2317 for(i
=0; i
<Num_parts
; ++i
) {
2318 max_num_elems
[i
] = (int *) calloc(Z_MAXTYPE
,sizeof(int));
2319 if(max_num_elems
[i
] == (int *)NULL
) {
2320 fprintf(stderr
," Problems allocating for part max_num of elements\n");
2326 max_ijk_dimensions
= (int **) calloc(Num_parts
,sizeof(int *));
2327 if(max_ijk_dimensions
== (int **)NULL
) {
2328 fprintf(stderr
," Problems allocating for part max ijk dimensions\n");
2332 for(i
=0; i
<Num_parts
; ++i
) {
2333 max_ijk_dimensions
[i
] = (int *) calloc(3,sizeof(int));
2334 if(max_ijk_dimensions
[i
] == (int *)NULL
) {
2335 fprintf(stderr
," Problems allocating for part max ijk dimensions\n");
2341 err
= USERD_get_maxsize_info(max_num_nodes
,
2343 max_ijk_dimensions
);
2345 fprintf(stderr
," No maxsize info provided (or error getting them)\n");
2349 for(i
=0; i
<Num_parts
; ++i
) {
2350 fprintf(stderr
," For part %d:\n",i
+1);
2352 fprintf(stderr
," max number of nodes : %d\n",max_num_nodes
[i
]);
2354 for(j
=0; j
<Z_MAXTYPE
; ++j
) {
2355 if(max_num_elems
[i
][j
] > 0) {
2356 fprintf(stderr
," max # %s elems: %d\n",
2357 Elem_info
[j
].name
,max_num_elems
[i
][j
]);
2361 if(part_types
[i
] != Z_UNSTRUCTURED
) {
2362 fprintf(stderr
," max_ijk_dimensions: %d %d %d\n",
2363 max_ijk_dimensions
[i
][0],
2364 max_ijk_dimensions
[i
][1],
2365 max_ijk_dimensions
[i
][2]);
2370 /* Get model extents - if given
2371 *-----------------------------*/
2372 err
= USERD_get_model_extents(extents
);
2374 fprintf(stderr
," No extents given\n");
2377 fprintf(stderr
," Min x: %g\n",extents
[0]);
2378 fprintf(stderr
," Max x: %g\n",extents
[1]);
2379 fprintf(stderr
," Min y: %g\n",extents
[2]);
2380 fprintf(stderr
," Max y: %g\n",extents
[3]);
2381 fprintf(stderr
," Min z: %g\n",extents
[4]);
2382 fprintf(stderr
," Max z: %g\n",extents
[5]);
2387 /* Free the allocated memory
2388 *--------------------------*/
2391 free(number_of_nodes
);
2393 for(i
=0; i
<Num_parts
; ++i
) {
2394 free(ijk_dimensions
[i
]);
2396 free(part_descriptions
[i
]);
2398 free(ijk_dimensions
);
2400 free(iblanking_options
);
2401 free(part_descriptions
);
2403 #if (defined GT_USERD_API_100)
2404 for(i
=0; i
<Num_parts
; ++i
) {
2405 free(max_ijk_dimensions
[i
]);
2406 free(max_num_elems
[i
]);
2408 free(max_num_nodes
);
2409 free(max_num_elems
);
2410 free(max_ijk_dimensions
);
2422 variable_info( void )
2427 char **var_description
;
2428 char **var_filename
;
2432 char **var_ifilename
;
2438 fprintf(stderr
,"\n------------ variable_info --------------\n");
2440 /* Get the number of variables
2441 *----------------------------*/
2442 Num_vars
= USERD_get_number_of_variables();
2444 fprintf(stderr
,"Error: getting the number of variables\n");
2447 fprintf(stderr
," Number of variables: %d\n",Num_vars
);
2451 /* Get the gold variable info
2452 *---------------------------*/
2453 Varinfo
= (VARINFO
*) calloc(Num_vars
,sizeof(VARINFO
));
2454 if(Varinfo
== (VARINFO
*)NULL
) {
2455 fprintf(stderr
," Problems allocating for Varinfo structure\n");
2460 var_description
= (char **) calloc(Num_vars
,sizeof(char *));
2461 if(var_description
== (char **)NULL
) {
2462 fprintf(stderr
," Problems allocating for var description\n");
2466 for(i
=0; i
<Num_vars
; ++i
) {
2467 var_description
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
2468 if(var_description
[i
] == (char *)NULL
) {
2469 fprintf(stderr
," Problems allocating for var description\n");
2475 var_filename
= (char **) calloc(Num_vars
,sizeof(char *));
2476 if(var_filename
== (char **)NULL
) {
2477 fprintf(stderr
," Problems allocating for var filename\n");
2481 for(i
=0; i
<Num_vars
; ++i
) {
2482 var_filename
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
2483 if(var_filename
[i
] == (char *)NULL
) {
2484 fprintf(stderr
," Problems allocating for var filename\n");
2490 var_type
= (int *) calloc(Num_vars
,sizeof(int));
2491 if(var_type
== (int *)NULL
) {
2492 fprintf(stderr
," Problems allocating for var type\n");
2496 var_classify
= (int *) calloc(Num_vars
,sizeof(int));
2497 if(var_classify
== (int *)NULL
) {
2498 fprintf(stderr
," Problems allocating for var classify\n");
2502 var_complex
= (int *) calloc(Num_vars
,sizeof(int));
2503 if(var_complex
== (int *)NULL
) {
2504 fprintf(stderr
," Problems allocating for var complex\n");
2509 var_ifilename
= (char **) calloc(Num_vars
,sizeof(char *));
2510 if(var_ifilename
== (char **)NULL
) {
2511 fprintf(stderr
," Problems allocating for var ifilename\n");
2515 for(i
=0; i
<Num_vars
; ++i
) {
2516 var_ifilename
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
2517 if(var_ifilename
[i
] == (char *)NULL
) {
2518 fprintf(stderr
," Problems allocating for var ifilename\n");
2524 var_freq
= (float *) calloc(Num_vars
,sizeof(float));
2525 if(var_freq
== (float *)NULL
) {
2526 fprintf(stderr
," Problems allocating for var freq\n");
2530 var_contran
= (int *) calloc(Num_vars
,sizeof(int));
2531 if(var_contran
== (int *)NULL
) {
2532 fprintf(stderr
," Problems allocating for var contran\n");
2536 var_timeset
= (int *) calloc(Num_vars
,sizeof(int));
2537 if(var_timeset
== (int *)NULL
) {
2538 fprintf(stderr
," Problems allocating for var timeset\n");
2542 #if (defined GT_USERD_API_100)
2544 err
= USERD_get_gold_variable_info(var_description
,
2555 err
= USERD_get_variable_info(var_description
,
2563 fprintf(stderr
,"Error: getting variable info\n");
2566 for(i
=0; i
<Num_vars
; ++i
) {
2568 /* Loading the global
2569 * (for use in other routines)
2570 *----------------------------*/
2571 strncpy(Varinfo
[i
].description
,var_description
[i
],Z_BUFL
);
2572 strncpy(Varinfo
[i
].filename
,var_filename
[i
],Z_BUFL
);
2573 strncpy(Varinfo
[i
].ifilename
,var_ifilename
[i
],Z_BUFL
);
2574 Varinfo
[i
].type
= var_type
[i
];
2575 Varinfo
[i
].classify
= var_classify
[i
];
2576 Varinfo
[i
].complex = var_complex
[i
];
2577 Varinfo
[i
].freq
= var_freq
[i
];
2578 Varinfo
[i
].contran
= var_contran
[i
];
2579 Varinfo
[i
].timeset
= var_timeset
[i
];
2581 /* Echo some feedback
2582 *-------------------*/
2583 fprintf(stderr
," For Variable %d:\n",i
+1);
2585 fprintf(stderr
," var desc: %s\n",var_description
[i
]);
2586 fprintf(stderr
," var filename: %s\n",var_filename
[i
]);
2588 #if (defined GT_USERD_API_100)
2589 if(var_complex
[i
]) {
2590 fprintf(stderr
," var complex: TRUE\n");
2591 fprintf(stderr
," var ifilename: %s\n",var_ifilename
[i
]);
2592 fprintf(stderr
," var freq: %g\n",var_freq
[i
]);
2595 fprintf(stderr
," var complex: FALSE\n");
2599 if(var_type
[i
] == Z_CONSTANT
) {
2600 fprintf(stderr
," var type: Z_CONSTANT\n");
2602 #if (defined GT_USERD_API_100)
2603 if(var_contran
[i
]) {
2604 fprintf(stderr
," var contran: TRUE\n");
2607 fprintf(stderr
," var contran: FALSE\n");
2612 else if(var_type
[i
] == Z_SCALAR
) {
2613 fprintf(stderr
," var type: Z_SCALAR\n");
2615 else if(var_type
[i
] == Z_VECTOR
) {
2616 fprintf(stderr
," var type: Z_VECTOR\n");
2618 else if(var_type
[i
] == Z_TENSOR
) {
2619 fprintf(stderr
," var type: Z_TENSOR\n");
2621 else if(var_type
[i
] == Z_TENSOR9
) {
2622 fprintf(stderr
," var type: Z_TENSOR9\n");
2625 fprintf(stderr
," Invalid var type\n");
2629 if(var_classify
[i
] == Z_PER_NODE
) {
2630 fprintf(stderr
," var classify: Z_PER_NODE\n");
2632 else if(var_classify
[i
] == Z_PER_ELEM
) {
2633 fprintf(stderr
," var classify: Z_PER_ELEM\n");
2635 else if(var_classify
[i
] != Z_CONSTANT
) {
2636 fprintf(stderr
," Invalid var classify\n");
2640 #if (defined GT_USERD_API_100)
2641 fprintf(stderr
," var timeset: %d\n",var_timeset
[i
]);
2646 /* Free the allocated memory
2647 *--------------------------*/
2648 for(i
=0; i
<Num_vars
; ++i
) {
2649 free(var_description
[i
]);
2650 free(var_filename
[i
]);
2651 free(var_ifilename
[i
]);
2653 free(var_description
);
2655 free(var_ifilename
);
2667 #if (defined GT_USERD_API_100)
2668 /*------------------
2670 *------------------*/
2672 gold_part_builder(int geom_time_step
)
2674 int i
, j
, k
, jj
, kk
;
2695 int num_elems
[Z_MAXTYPE
];
2708 int *fail_flags
= (int *) NULL
;
2709 float values
[14], vals
[10];
2711 fprintf(stderr
,"\n------------- part_builder --------------\n");
2713 if(Num_time_sets
> 0) {
2714 /* Get the timeset used for the geometry
2715 *--------------------------------------*/
2716 geom_timeset
= USERD_get_geom_timeset_number();
2718 /* Get the number of time steps for this timeset
2719 *----------------------------------------------*/
2720 Num_time_steps
= USERD_get_num_of_time_steps(geom_timeset
);
2721 if(Num_time_steps
< 1) {
2722 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
2723 fprintf(stderr
," (Must be >0 to be okay)\n");
2726 if(geom_time_step
> (Num_time_steps
- 1)) {
2727 geom_time_step
= Num_time_steps
- 1;
2730 /* Set the timeset and step - to first step by default, but
2731 * can set it at others using -gts command argument
2732 *---------------------------------------------------------*/
2733 USERD_set_time_set_and_step(geom_timeset
,geom_time_step
);
2735 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
2736 geom_timeset
,0,Num_time_steps
-1);
2737 fprintf(stderr
," Using time step: %d\n",geom_time_step
);
2740 for(p
=0; p
<Num_parts
; ++p
) {
2743 fprintf(stderr
,"\n\n----------------------------------------");
2744 fprintf(stderr
," Part %d:\n",pn
);
2746 /*-----------------------
2747 * For unstructured parts
2748 *-----------------------*/
2749 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
2751 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
2752 ne
= Pbuild
[p
].ne
[et
];
2756 pdata
= (int *)calloc(ne
*Elem_info
[et
].con_len
,sizeof(int));
2757 if(pdata
== (int *) NULL
) {
2758 fprintf(stderr
,"Error: allocating conns array\n");
2762 conns
= (int **) calloc(ne
,sizeof(int *));
2763 if(conns
== (int **) NULL
) {
2764 fprintf(stderr
,"Error: allocating conns array\n");
2767 for(i
=0; i
<ne
; ++i
) {
2769 pdata
+= Elem_info
[et
].con_len
;
2775 *-----------------*/
2776 err
= USERD_get_part_elements_by_type(pn
,et
,conns
);
2778 fprintf(stderr
,"Error: getting element connectivities\n");
2782 if(Element_labels
) {
2783 elemids
= (int *) calloc(ne
,sizeof(int));
2784 if(elemids
== (int *) NULL
) {
2785 fprintf(stderr
,"Error: allocating elemids array\n");
2790 /* Get the element ids - if any
2791 *-----------------------------*/
2792 if(Element_labels
) {
2793 err
= USERD_get_part_element_ids_by_type(pn
,et
,elemids
);
2795 fprintf(stderr
,"Error: getting element ids\n");
2801 *-----------------*/
2803 #if (defined GT_USERD_API_202)
2805 maxcheck
= Z_NSIDED
;
2807 /* Nsided elements, if any
2808 *------------------------*/
2809 if(et
== Z_NSIDED
||
2813 for(i
=0; i
<ne
; ++i
) {
2814 nsid_len
+= conns
[i
][0];
2817 nsid_con
= (int *) calloc(nsid_len
,sizeof(int));
2818 if(nsid_con
== (int *) NULL
) {
2819 fprintf(stderr
,"Error: allocating nsided conn array\n");
2823 err
= USERD_get_nsided_conn(pn
,nsid_con
);
2825 fprintf(stderr
,"Error: getting nsided conn array\n");
2829 /* First element of the type
2830 *--------------------------*/
2832 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2833 if(Element_labels
) {
2834 fprintf(stderr
," id: %d\n",elemids
[i
]);
2836 fprintf(stderr
," connectivity:");
2837 for(j
=0; j
<conns
[i
][0]; ++j
) {
2838 fprintf(stderr
," %d",nsid_con
[j
]);
2840 fprintf(stderr
,"\n");
2842 /* Last element of the type
2843 *-------------------------*/
2846 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2847 if(Element_labels
) {
2848 fprintf(stderr
," id: %d\n",elemids
[i
]);
2850 fprintf(stderr
," connectivity:");
2852 for(j
=nsid_len
-conns
[i
][0]; j
<nsid_len
; ++j
) {
2853 fprintf(stderr
," %d",nsid_con
[j
]);
2855 fprintf(stderr
,"\n");
2859 /* Nfaced elements if any
2860 *-----------------------*/
2861 if(et
== Z_NFACED
||
2865 for(i
=0; i
<ne
; ++i
) {
2866 nface_len
+= conns
[i
][0];
2869 nface_con
= (int *) calloc(nface_len
,sizeof(int));
2870 if(nface_con
== (int *) NULL
) {
2871 fprintf(stderr
,"Error: allocating nfaced face array\n");
2875 err
= USERD_get_nfaced_nodes_per_face(pn
,nface_con
);
2877 fprintf(stderr
,"Error: getting nfaced face array array\n");
2882 for(i
=0; i
<nface_len
; ++i
) {
2883 npf_len
+= nface_con
[i
];
2886 npf_con
= (int *) calloc(npf_len
,sizeof(int));
2887 if(npf_con
== (int *) NULL
) {
2888 fprintf(stderr
,"Error: allocating nfaced npf array\n");
2892 err
= USERD_get_nfaced_conn(pn
,npf_con
);
2894 fprintf(stderr
,"Error: getting nfaced conn array\n");
2898 /* First element of the type
2899 *--------------------------*/
2902 for(i
=0; i
<ne
; ++i
) {
2906 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,
2908 if(Element_labels
) {
2909 fprintf(stderr
," id: %d\n",elemids
[i
]);
2911 for(j
=0; j
<conns
[i
][0]; ++j
) {
2912 fprintf(stderr
," face %d connectivity:",j
+1);
2913 for(k
=0; k
<nface_con
[jj
]; ++k
) {
2914 fprintf(stderr
," %d",npf_con
[kk
]);
2917 fprintf(stderr
,"\n");
2922 for(j
=0; j
<conns
[i
][0]; ++j
) {
2923 for(k
=0; k
<nface_con
[jj
]; ++k
) {
2933 maxcheck
= Z_MAXTYPE
;
2938 *-----------------*/
2941 /* First element of the type
2942 *--------------------------*/
2944 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2945 if(Element_labels
) {
2946 fprintf(stderr
," id: %d\n",elemids
[i
]);
2948 fprintf(stderr
," connectivity:");
2949 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
2950 fprintf(stderr
," %d",conns
[i
][j
]);
2952 fprintf(stderr
,"\n");
2954 /* check the connectivity for negative numbers
2955 * -------------------------------------------*/
2956 #if defined GT_USERD_API_100
2958 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
2959 /* ---------- uncomment to print out connectivity values ---------- */
2960 /* fprintf(stderr," %d",conns[i][j]); */
2961 if (conns
[i
][j
] <= 0 || conns
[i
][j
] > Pbuild
[p
].nn
) {
2962 fprintf(stderr
,"\n****************************\n");
2963 fprintf(stderr
,"Connectivity value out of bounds: \n");
2964 fprintf(stderr
,"Either less than zero or greater than \n");
2965 fprintf(stderr
," number of nodes in part!! \n");
2966 fprintf(stderr
,"i = %d j = %d conns[i][j] = %d \n",i
,j
,conns
[i
][j
]);
2967 fprintf(stderr
,"****************************\n");
2970 /* ---------- uncomment to print out connectivity values ---------- */
2971 /* fprintf(stderr,"\n"); */
2974 /* Last element of the type
2975 *-------------------------*/
2978 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2979 if(Element_labels
) {
2980 fprintf(stderr
," id: %d\n",elemids
[i
]);
2982 fprintf(stderr
," connectivity:");
2983 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
2984 fprintf(stderr
," %d",conns
[i
][j
]);
2986 fprintf(stderr
,"\n");
2990 /* Free the allocated memory
2991 *--------------------------*/
2993 if(NULL
!= *conns
) {
3001 if(Element_labels
) {
3013 coords
= (float **) calloc(3,sizeof(float *));
3014 if(coords
== (float **) NULL
) {
3015 fprintf(stderr
,"Error: allocating coords array\n");
3019 for(i
=0; i
<3; ++i
) {
3020 coords
[i
] = (float *) calloc((nn
+1),sizeof(float));
3021 if(coords
[i
] == (float *) NULL
) {
3022 fprintf(stderr
,"Error: allocating coords array\n");
3029 nodeids
= (int *) calloc((nn
+1),sizeof(int));
3030 if(nodeids
== (int *) NULL
) {
3031 fprintf(stderr
,"Error: allocating nodeids array\n");
3037 err
= USERD_get_part_coords(pn
,coords
);
3039 fprintf(stderr
,"Error: getting unstructured coords\n");
3044 err
= USERD_get_part_node_ids(pn
,nodeids
);
3046 fprintf(stderr
,"Error: getting nodeids\n");
3052 *-----------------*/
3057 fprintf(stderr
," Node %d of %d:\n",i
,nn
);
3059 fprintf(stderr
," id: %d\n",nodeids
[i
]);
3061 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3062 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
3063 mm
[0] = mm
[1] = coords
[0][i
];
3064 mm
[2] = mm
[3] = coords
[1][i
];
3065 mm
[4] = mm
[5] = coords
[2][i
];
3072 fprintf(stderr
," Node %d of %d:\n",i
,nn
);
3074 fprintf(stderr
," id: %d\n",nodeids
[i
]);
3076 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3077 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
3080 /* Min and max coordinate values
3081 *------------------------------*/
3082 for(i
=2; i
<=nn
; ++i
) {
3083 if(coords
[0][i
] < mm
[0]) {
3084 mm
[0] = coords
[0][i
];
3086 if(coords
[0][i
] > mm
[1]) {
3087 mm
[1] = coords
[0][i
];
3089 if(coords
[1][i
] < mm
[2]) {
3090 mm
[2] = coords
[1][i
];
3092 if(coords
[1][i
] > mm
[3]) {
3093 mm
[3] = coords
[1][i
];
3095 if(coords
[2][i
] < mm
[4]) {
3096 mm
[4] = coords
[2][i
];
3098 if(coords
[2][i
] > mm
[5]) {
3099 mm
[5] = coords
[2][i
];
3103 fprintf(stderr
," Coordinate ranges:\n");
3104 fprintf(stderr
," min x: %g\n",mm
[0]);
3105 fprintf(stderr
," max x: %g\n",mm
[1]);
3106 fprintf(stderr
," min y: %g\n",mm
[2]);
3107 fprintf(stderr
," max y: %g\n",mm
[3]);
3108 fprintf(stderr
," min z: %g\n",mm
[4]);
3109 fprintf(stderr
," max z: %g\n",mm
[5]);
3112 /* Free the allocated memory
3113 *--------------------------*/
3114 for(i
=0; i
<3; ++i
) {
3125 /*---------------------
3126 * For structured parts
3127 *---------------------*/
3131 if(Pbuild
[p
].ne
[0] == 0 &&
3132 Pbuild
[p
].ne
[1] == 0 &&
3133 Pbuild
[p
].ne
[2] == 0) {
3139 /* Get the block coords
3140 *---------------------*/
3141 for(comp
=0; comp
<3; ++comp
) {
3142 if(Pbuild
[p
].ne
[comp
] < 1) {
3147 if(Doing_Structured_Cinching
) {
3148 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3151 if((bdim
[comp
] % 2) == 0) {
3152 bdim
[comp
] = (bdim
[comp
]/2) + 1;
3156 bdim
[comp
] = ((bdim
[comp
]-1)/2) + 1;
3161 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3166 nn
= bdim
[0] * bdim
[1] * bdim
[2];
3180 ne
= bd1
* bd2
* bd3
;
3182 /* Determine cell type
3183 *--------------------*/
3185 for(i
=0; i
<3; ++i
) {
3191 cell_type
= Z_HEX08
;
3193 else if(num_dims
== 2) {
3194 cell_type
= Z_QUA04
;
3197 cell_type
= Z_BAR02
;
3200 coords
= (float **) calloc(num_dims
,sizeof(float *));
3201 if(coords
== (float **) NULL
) {
3202 fprintf(stderr
,"Error: allocating coords array\n");
3206 for(i
=0; i
<num_dims
; ++i
) {
3207 coords
[i
] = (float *) calloc(nn
,sizeof(float));
3208 if(coords
[i
] == (float *) NULL
) {
3209 fprintf(stderr
,"Error: allocating coords array\n");
3217 for(comp
=0; comp
<num_dims
; ++comp
) {
3219 /* For structured cinching, send in one less on each end and stride of 2
3220 *----------------------------------------------------------------------*/
3221 if(Doing_Structured_Cinching
) {
3222 err
= USERD_set_block_range_and_stride(pn
,
3223 0, Pbuild
[p
].ne
[0]-1, 2,
3224 0, Pbuild
[p
].ne
[1]-1, 2,
3225 0, Pbuild
[p
].ne
[2]-1, 2);
3228 err
= USERD_get_block_coords_by_component(pn
,comp
,coords
[comp
]);
3230 fprintf(stderr
,"Error: getting block coords\n");
3236 #if (defined GT_USERD_API_200)
3239 nodeids
= (int *) calloc(nn
,sizeof(int));
3240 if(nodeids
== (int *) NULL
) {
3241 fprintf(stderr
,"Error: allocating nodeids array\n");
3245 /* Get the node ids - if any
3246 *--------------------------*/
3248 err
= USERD_get_part_node_ids(pn
,nodeids
);
3250 fprintf(stderr
,"Error: getting nodeids\n");
3257 *-----------------*/
3263 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
3265 #if (defined GT_USERD_API_200)
3268 fprintf(stderr
," id: %d\n",nodeids
[i
]);
3272 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3273 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
3274 mm
[0] = mm
[1] = coords
[0][i
];
3275 mm
[2] = mm
[3] = coords
[1][i
];
3276 mm
[4] = mm
[5] = coords
[2][i
];
3278 else if(num_dims
== 2) {
3279 fprintf(stderr
," x y coordinates: %g %g\n",
3280 coords
[0][i
], coords
[1][i
]);
3281 mm
[0] = mm
[1] = coords
[0][i
];
3282 mm
[2] = mm
[3] = coords
[1][i
];
3285 fprintf(stderr
," x coordinates: %g\n",
3287 mm
[0] = mm
[1] = coords
[0][i
];
3295 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
3297 #if (defined GT_USERD_API_200)
3299 fprintf(stderr
," id: %d\n",nodeids
[i
]);
3303 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3304 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
3306 else if(num_dims
== 2) {
3307 fprintf(stderr
," x y coordinates: %g %g\n",
3308 coords
[0][i
], coords
[1][i
]);
3311 fprintf(stderr
," x coordinates: %g\n",
3317 /* Min and max coordinate values
3318 *------------------------------*/
3319 for(i
=1; i
<nn
; ++i
) {
3320 if(coords
[0][i
] < mm
[0]) {
3321 mm
[0] = coords
[0][i
];
3323 if(coords
[0][i
] > mm
[1]) {
3324 mm
[1] = coords
[0][i
];
3327 if(coords
[1][i
] < mm
[2]) {
3328 mm
[2] = coords
[1][i
];
3330 if(coords
[1][i
] > mm
[3]) {
3331 mm
[3] = coords
[1][i
];
3335 if(coords
[2][i
] < mm
[4]) {
3336 mm
[4] = coords
[2][i
];
3338 if(coords
[2][i
] > mm
[5]) {
3339 mm
[5] = coords
[2][i
];
3344 fprintf(stderr
," Coordinate ranges:\n");
3345 fprintf(stderr
," min x: %g\n",mm
[0]);
3346 fprintf(stderr
," max x: %g\n",mm
[1]);
3348 fprintf(stderr
," min y: %g\n",mm
[2]);
3349 fprintf(stderr
," max y: %g\n",mm
[3]);
3352 fprintf(stderr
," min z: %g\n",mm
[4]);
3353 fprintf(stderr
," max z: %g\n",mm
[5]);
3356 /* Free the allocated memory - so far
3357 *-----------------------------------*/
3358 for(i
=0; i
<num_dims
; ++i
) {
3363 #if (defined GT_USERD_API_200)
3369 /* Get the block iblanking - if any
3370 *---------------------------------*/
3371 if(Pbuild
[p
].type
== Z_IBLANKED
) {
3373 iblanking
= (int *) calloc(nn
,sizeof(int));
3374 if(iblanking
== (int *) NULL
) {
3375 fprintf(stderr
,"Error: allocating iblanking array\n");
3379 err
= USERD_get_block_iblanking(pn
,iblanking
);
3381 fprintf(stderr
,"Error: getting block iblanking\n");
3386 *-----------------*/
3393 for(i
=0; i
<nn
; ++i
) {
3397 fprintf(stderr
," Iblanking breakdown:\n");
3398 fprintf(stderr
," Number of Z_EXT: %d\n",ib
[Z_EXT
]);
3399 fprintf(stderr
," Number of Z_INT: %d\n",ib
[Z_INT
]);
3400 fprintf(stderr
," Number of Z_BND: %d\n",ib
[Z_BND
]);
3401 fprintf(stderr
," Number of Z_INTBND: %d\n",ib
[Z_INTBND
]);
3402 fprintf(stderr
," Number of Z_SYM: %d\n",ib
[Z_SYM
]);
3407 #if (defined GT_USERD_API_200)
3409 /* Get the ghost flags - if any
3410 *-----------------------------*/
3411 if(Pbuild
[p
].ghosts
) {
3413 ghost_flag
= (int *) calloc(ne
,sizeof(int));
3414 if(ghost_flag
== (int *) NULL
) {
3415 fprintf(stderr
,"Error: allocating ghost_flag array\n");
3419 err
= USERD_get_block_ghost_flags(pn
,ghost_flag
);
3421 fprintf(stderr
,"Error: getting block ghost flags\n");
3426 *-----------------*/
3429 for(i
=0; i
<ne
; ++i
) {
3430 if(ghost_flag
[i
] > 0) {
3435 fprintf(stderr
," Block Ghost flag breakdown:\n");
3436 fprintf(stderr
," %d ghost cells out of %d total cells\n",
3442 /* Get the element ids - if any
3443 *-----------------------------*/
3444 if(Element_labels
) {
3446 elemids
= (int *) calloc(ne
,sizeof(int));
3447 if(elemids
== (int *) NULL
) {
3448 fprintf(stderr
,"Error: allocating elemids array\n");
3454 err
= USERD_get_part_element_ids_by_type(pn
,et
,elemids
);
3456 fprintf(stderr
,"Error: getting element ids\n");
3460 /* First element of the type
3461 *--------------------------*/
3463 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
3464 fprintf(stderr
," id: %d\n",elemids
[i
]);
3466 /* Last element of the type
3467 *-------------------------*/
3470 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
3471 fprintf(stderr
," id: %d\n",elemids
[i
]);
3479 fprintf(stderr
," Empty structured part\n");
3483 /* Get border availability
3484 *------------------------*/
3485 err
= USERD_get_border_availability(pn
,num_elems
);
3488 /* Get border elements - if any
3489 *-----------------------------*/
3490 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
3494 conns
= (int **) calloc(ne
,sizeof(int *));
3495 if(conns
== (int **) NULL
) {
3496 fprintf(stderr
,"Error: allocating border conns array\n");
3500 for(i
=0; i
<ne
; ++i
) {
3501 conns
[i
] = (int *) calloc(Elem_info
[et
].con_len
,sizeof(int));
3502 if(conns
[i
] == (int *) NULL
) {
3503 fprintf(stderr
,"Error: allocating border conns array\n");
3509 parent_type
= (short *) calloc(ne
,sizeof(short));
3510 if(parent_type
== (short *) NULL
) {
3511 fprintf(stderr
,"Error: allocating border parent_type array\n");
3515 parent_num
= (int *) calloc(ne
,sizeof(int));
3516 if(parent_num
== (int *) NULL
) {
3517 fprintf(stderr
,"Error: allocating border parent_num array\n");
3522 err
= USERD_get_border_elements_by_type(pn
,
3528 fprintf(stderr
,"Error: getting border elements\n");
3534 *-----------------*/
3536 /* First element of the type
3537 *--------------------------*/
3539 fprintf(stderr
," %s border element %d of %d:\n",
3540 Elem_info
[et
].name
,i
+1,ne
);
3541 fprintf(stderr
," Parent type: %s\n",
3542 Elem_info
[parent_type
[i
]].name
);
3543 fprintf(stderr
," Parent num: %d\n",parent_num
[i
]);
3544 fprintf(stderr
," connectivity:");
3545 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
3546 fprintf(stderr
," %d",conns
[i
][j
]);
3548 fprintf(stderr
,"\n");
3550 /* Last element of the type
3551 *-------------------------*/
3554 fprintf(stderr
," %s border element %d of %d:\n",
3555 Elem_info
[et
].name
,i
+1,ne
);
3556 fprintf(stderr
," Parent type: %s\n",
3557 Elem_info
[parent_type
[i
]].name
);
3558 fprintf(stderr
," Parent num: %d\n",parent_num
[i
]);
3559 fprintf(stderr
," connectivity:");
3560 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
3561 fprintf(stderr
," %d",conns
[i
][j
]);
3563 fprintf(stderr
,"\n");
3567 /* Free the allocated memory
3568 *--------------------------*/
3569 for(i
=0; i
<ne
; ++i
) {
3580 #if (defined GT_USERD_API_204)
3581 /* See if any rigid body in model
3582 *-------------------------------*/
3583 if(Any_Rigid_Body_Present
) {
3585 #if (defined GT_USERD_API_207)
3586 if(USERD_rigidbody_values(pn
,values
) == Z_OK
) {
3587 fprintf(stderr
," Rigid Body values:\n");
3588 fprintf(stderr
," IX = %g\n",values
[0]);
3589 fprintf(stderr
," IY = %g\n",values
[1]);
3590 fprintf(stderr
," IZ = %g\n",values
[2]);
3591 fprintf(stderr
," E0 = %g\n",values
[3]);
3592 fprintf(stderr
," E1 = %g\n",values
[4]);
3593 fprintf(stderr
," E2 = %g\n",values
[5]);
3594 fprintf(stderr
," E3 = %g\n",values
[6]);
3595 fprintf(stderr
," XOFF = %g\n",values
[7]);
3596 fprintf(stderr
," YOFF = %g\n",values
[8]);
3597 fprintf(stderr
," ZOFF = %g\n",values
[9]);
3598 fprintf(stderr
," ROT_ORDER = %g\n",values
[10]);
3599 fprintf(stderr
," XROT = %g\n",values
[11]);
3600 fprintf(stderr
," YROT = %g\n",values
[12]);
3601 fprintf(stderr
," ZROT = %g\n",values
[13]);
3604 if(USERD_rigidbody_values(pn
,vals
) == Z_OK
) {
3605 fprintf(stderr
," Rigid Body values:\n");
3606 fprintf(stderr
," IX = %g\n",vals
[0]);
3607 fprintf(stderr
," IY = %g\n",vals
[1]);
3608 fprintf(stderr
," IZ = %g\n",vals
[2]);
3609 fprintf(stderr
," E0 = %g\n",vals
[3]);
3610 fprintf(stderr
," E1 = %g\n",vals
[4]);
3611 fprintf(stderr
," E2 = %g\n",vals
[5]);
3612 fprintf(stderr
," E3 = %g\n",vals
[6]);
3613 fprintf(stderr
," XOFF = %g\n",vals
[7]);
3614 fprintf(stderr
," YOFF = %g\n",vals
[8]);
3615 fprintf(stderr
," ZOFF = %g\n",vals
[9]);
3621 } /* end for p = 0 to Num_parts */
3631 gold_var_loader(int var_time_step
)
3654 fprintf(stderr
,"\n--------------- var_loader --------------\n");
3656 for(v
=0; v
<Num_vars
; ++v
) {
3660 fprintf(stderr
,"\n");
3662 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
3663 fprintf(stderr
," Z_PER_NODE Variable %d:\n",vn
);
3666 fprintf(stderr
," Z_PER_ELEM Variable %d:\n",vn
);
3670 if(Num_time_sets
> 0) {
3671 /* Get the timeset used for the variable
3672 *---------------------------------------*/
3673 var_timeset
= Varinfo
[v
].timeset
;
3675 /* Get the number of time steps for this timeset
3676 *----------------------------------------------*/
3677 Num_time_steps
= USERD_get_num_of_time_steps(var_timeset
);
3678 if(Num_time_steps
< 1) {
3679 fprintf(stderr
," Error: Number of time steps returned: %d\n",
3681 fprintf(stderr
," (Must be >0 to be okay)\n");
3684 if(var_time_step
> (Num_time_steps
- 1)) {
3685 var_time_step
= Num_time_steps
- 1;
3688 /* Set the timeset and step - to first step by default, but
3689 * can set it at others using -vts command argument
3690 *---------------------------------------------------------*/
3691 USERD_set_time_set_and_step(var_timeset
,var_time_step
);
3693 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
3694 var_timeset
,0,Num_time_steps
-1);
3695 fprintf(stderr
," Using time step: %d\n",var_time_step
);
3701 if(Varinfo
[v
].type
== Z_CONSTANT
) {
3703 constant_val
= USERD_get_constant_val(vn
,FALSE
);
3704 fprintf(stderr
," Constant (%s):\n",Varinfo
[v
].description
);
3705 fprintf(stderr
," value: %g\n",constant_val
);
3707 if(Varinfo
[v
].complex) {
3708 constant_val
= USERD_get_constant_val(vn
,TRUE
);
3709 fprintf(stderr
," value (imag): %g\n",constant_val
);
3713 /* Scalars, Vectors, Tensors
3714 *--------------------------*/
3717 /* Get the var description line
3718 *-----------------------------*/
3719 err
= USERD_get_descrip_lines(Z_VARI
,vn
,FALSE
,line1
,line2
);
3721 fprintf(stderr
," Desc line: %s\n",line1
);
3724 fprintf(stderr
,"Error: getting var description line\n");
3728 if(Varinfo
[v
].complex) {
3729 err
= USERD_get_descrip_lines(Z_VARI
,vn
,TRUE
,line1
,line2
);
3731 fprintf(stderr
," Desc line (imag): %s\n",line1
);
3734 fprintf(stderr
,"Error: getting var description line (imag)\n");
3740 /* Get the values by component
3741 *-----------------------------*/
3742 if(Varinfo
[v
].type
== Z_SCALAR
) {
3745 else if(Varinfo
[v
].type
== Z_VECTOR
) {
3748 else if(Varinfo
[v
].type
== Z_TENSOR
) {
3751 else if(Varinfo
[v
].type
== Z_TENSOR9
) {
3758 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
3760 for(p
=0; p
<Num_parts
; ++p
) {
3763 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3764 nsize
= Pbuild
[p
].nn
;
3767 for(comp
=0; comp
<3; ++comp
) {
3768 if(Pbuild
[p
].ne
[comp
] < 1) {
3773 if(Doing_Structured_Cinching
) {
3774 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3777 if((bdim
[comp
] % 2) == 0) {
3778 bdim
[comp
] = (bdim
[comp
]/2) + 1;
3782 bdim
[comp
] = ((bdim
[comp
]-1)/2) + 1;
3787 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3791 nsize
= bdim
[0] * bdim
[1] * bdim
[2];
3793 /* For structured cinching, send in one less on each end and stride of 2
3794 *----------------------------------------------------------------------*/
3795 if(Doing_Structured_Cinching
) {
3796 err
= USERD_set_block_range_and_stride(pn
,
3797 0, Pbuild
[p
].ne
[0]-1, 2,
3798 0, Pbuild
[p
].ne
[1]-1, 2,
3799 0, Pbuild
[p
].ne
[2]-1, 2);
3804 fprintf(stderr
," For part %d, with %d nodes:\n",pn
,nsize
);
3807 values
= (float *) calloc((nsize
+1),sizeof(float));
3808 if(values
== (float *) NULL
) {
3809 fprintf(stderr
,"Error: alocating variable values\n");
3813 for(comp
=0; comp
<num_comps
; ++comp
) {
3815 err
= USERD_get_var_by_component(vn
,
3822 if(err
== Z_UNDEF
) {
3823 fprintf(stderr
," Variable not defined on this part\n");
3827 /* For the component, show 1st node, last node, min, max values
3828 *-------------------------------------------------------------*/
3829 minv
= maxv
= values
[1];
3830 for(i
=2; i
<=nsize
; ++i
) {
3831 if(values
[i
] < minv
) {
3834 if(values
[i
] > maxv
) {
3839 fprintf(stderr
," For component %d: \n",comp
);
3840 fprintf(stderr
," node %10d value: %g\n",1,values
[1]);
3841 fprintf(stderr
," node %10d value: %g\n",nsize
,values
[nsize
]);
3842 fprintf(stderr
," min value: %g\n",minv
);
3843 fprintf(stderr
," max value: %g\n",maxv
);
3845 if(Varinfo
[v
].complex) {
3846 err
= USERD_get_var_by_component(vn
,
3853 if(err
== Z_UNDEF
) {
3854 fprintf(stderr
," Variable not defined on this part\n");
3857 /* For the component, show 1st node, last node, min, max values
3858 *-------------------------------------------------------------*/
3859 minv
= maxv
= values
[1];
3860 for(i
=2; i
<=nsize
; ++i
) {
3861 if(values
[i
] < minv
) {
3864 if(values
[i
] > maxv
) {
3869 fprintf(stderr
," For component %d (imag): \n",comp
);
3870 fprintf(stderr
," node %10d value: %g\n",1,values
[1]);
3871 fprintf(stderr
," node %10d value: %g\n",nsize
,values
[nsize
]);
3872 fprintf(stderr
," min value: %g\n",minv
);
3873 fprintf(stderr
," max value: %g\n",maxv
);
3884 for(p
=0; p
<Num_parts
; ++p
) {
3887 if(Pbuild
[p
].type
!= Z_UNSTRUCTURED
) {
3889 for(comp
=0; comp
<3; ++comp
) {
3890 if(Pbuild
[p
].ne
[comp
] < 1) {
3894 if(Doing_Structured_Cinching
) {
3895 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3898 if((bdim
[comp
] % 2) == 0) {
3899 bdim
[comp
] = (bdim
[comp
]/2) + 1;
3903 bdim
[comp
] = ((bdim
[comp
]-1)/2) + 1;
3908 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3925 nsize
= bd1
* bd2
* bd3
;
3928 /* Determine cell type
3929 *--------------------*/
3931 for(i
=0; i
<3; ++i
) {
3937 cell_type
= Z_HEX08
;
3939 else if(num_dims
== 2) {
3940 cell_type
= Z_QUA04
;
3943 cell_type
= Z_BAR02
;
3947 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3952 e1
= e2
= cell_type
;
3955 /* For structured cinching, send in one less on each end and stride of 2
3956 *----------------------------------------------------------------------*/
3957 if(Doing_Structured_Cinching
) {
3958 err
= USERD_set_block_range_and_stride(pn
,
3959 0, Pbuild
[p
].ne
[0]-1, 2,
3960 0, Pbuild
[p
].ne
[1]-1, 2,
3961 0, Pbuild
[p
].ne
[2]-1, 2);
3965 for(et
=e1
; et
<=e2
; ++et
) {
3967 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3968 nsize
= Pbuild
[p
].ne
[et
];
3973 fprintf(stderr
," For part %d, with %d elems of type %s:\n",
3974 pn
,nsize
,Elem_info
[et
].name
);
3977 values
= (float *) calloc((nsize
+1),sizeof(float));
3978 if(values
== (float *) NULL
) {
3979 fprintf(stderr
,"Error: alocating variable values\n");
3983 for(comp
=0; comp
<num_comps
; ++comp
) {
3985 err
= USERD_get_var_by_component(vn
,
3992 if(err
== Z_UNDEF
) {
3993 fprintf(stderr
," Variable not defined on this part\n");
3996 /* For the component, show 1st elem, last elem, min, max values
3997 *-------------------------------------------------------------*/
3998 minv
= maxv
= values
[1];
3999 for(i
=2; i
<=nsize
; ++i
) {
4000 if(values
[i
] < minv
) {
4003 if(values
[i
] > maxv
) {
4008 fprintf(stderr
," For component %d: \n",comp
);
4009 fprintf(stderr
," elem %10d value: %g\n",1,values
[1]);
4010 fprintf(stderr
," elem %10d value: %g\n",nsize
,values
[nsize
]);
4011 fprintf(stderr
," min value: %g\n",minv
);
4012 fprintf(stderr
," max value: %g\n",maxv
);
4014 if(Varinfo
[v
].complex) {
4015 err
= USERD_get_var_by_component(vn
,
4022 if(err
== Z_UNDEF
) {
4023 fprintf(stderr
," Variable not defined on this part\n");
4026 /* For the component, show 1st elem, last elem, min, max values
4027 *-------------------------------------------------------------*/
4028 minv
= maxv
= values
[1];
4029 for(i
=2; i
<=nsize
; ++i
) {
4030 if(values
[i
] < minv
) {
4033 if(values
[i
] > maxv
) {
4038 fprintf(stderr
," For component %d (imag): \n",comp
);
4039 fprintf(stderr
," elem %10d value: %g\n",1,values
[1]);
4040 fprintf(stderr
," elem %10d value: %g\n",nsize
,values
[nsize
]);
4041 fprintf(stderr
," min value: %g\n",minv
);
4042 fprintf(stderr
," max value: %g\n",maxv
);
4063 part_builder(int geom_time_step
)
4069 int *elemids
[Z_MAXTYPE
];
4070 int **conns
[Z_MAXTYPE
];
4085 fprintf(stderr
,"\n------------- part_builder --------------\n");
4088 if(Num_time_steps
> 1) {
4089 if(geom_time_step
> (Num_time_steps
- 1)) {
4090 geom_time_step
= Num_time_steps
- 1;
4093 /* Set the time step - to first step by default, but
4094 * can set it at others using -gts command argument
4095 *---------------------------------------------------*/
4096 USERD_set_time_step(geom_time_step
);
4098 fprintf(stderr
," Using time step: %d (where range is %d through %d\n",
4099 geom_time_step
,0,Num_time_steps
-1);
4103 /* Get the global coords
4104 *----------------------*/
4105 nn
= USERD_get_number_of_global_nodes();
4109 crds
= (CRD
*) calloc(nn
,sizeof(CRD
));
4110 if(crds
== (CRD
*) NULL
) {
4111 fprintf(stderr
,"Error: allocating crds array\n");
4116 nodeids
= (int *) calloc(nn
,sizeof(int));
4117 if(nodeids
== (int *) NULL
) {
4118 fprintf(stderr
,"Error: allocating nodeids array\n");
4124 err
= USERD_get_global_coords(crds
);
4126 fprintf(stderr
,"Error: getting unstructured coords\n");
4131 err
= USERD_get_global_node_ids(nodeids
);
4133 fprintf(stderr
,"Error: getting nodeids\n");
4139 *-----------------*/
4144 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
4146 fprintf(stderr
," id: %d\n",nodeids
[i
]);
4148 fprintf(stderr
," x y z coordinates: %g %g %g\n",
4149 crds
[i
].xyz
[0], crds
[i
].xyz
[1], crds
[i
].xyz
[2]);
4150 mm
[0] = mm
[1] = crds
[i
].xyz
[0];
4151 mm
[2] = mm
[3] = crds
[i
].xyz
[1];
4152 mm
[4] = mm
[5] = crds
[i
].xyz
[2];
4159 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
4161 fprintf(stderr
," id: %d\n",nodeids
[i
]);
4163 fprintf(stderr
," x y z coordinates: %g %g %g\n",
4164 crds
[i
].xyz
[0], crds
[i
].xyz
[1], crds
[i
].xyz
[2]);
4167 /* Min and max coordinate values
4168 *------------------------------*/
4169 for(i
=1; i
<nn
; ++i
) {
4170 if(crds
[i
].xyz
[0] < mm
[0]) {
4171 mm
[0] = crds
[i
].xyz
[0];
4173 if(crds
[i
].xyz
[0] > mm
[1]) {
4174 mm
[1] = crds
[i
].xyz
[0];
4176 if(crds
[i
].xyz
[1] < mm
[2]) {
4177 mm
[2] = crds
[i
].xyz
[1];
4179 if(crds
[i
].xyz
[1] > mm
[3]) {
4180 mm
[3] = crds
[i
].xyz
[1];
4182 if(crds
[i
].xyz
[2] < mm
[4]) {
4183 mm
[4] = crds
[i
].xyz
[2];
4185 if(crds
[i
].xyz
[2] > mm
[5]) {
4186 mm
[5] = crds
[i
].xyz
[2];
4190 fprintf(stderr
," Global coordinate ranges:\n");
4191 fprintf(stderr
," min x: %g\n",mm
[0]);
4192 fprintf(stderr
," max x: %g\n",mm
[1]);
4193 fprintf(stderr
," min y: %g\n",mm
[2]);
4194 fprintf(stderr
," max y: %g\n",mm
[3]);
4195 fprintf(stderr
," min z: %g\n",mm
[4]);
4196 fprintf(stderr
," max z: %g\n",mm
[5]);
4199 /* Free the allocated memory
4200 *--------------------------*/
4209 for(p
=0; p
<Num_parts
; ++p
) {
4212 fprintf(stderr
,"\n");
4213 fprintf(stderr
," Part %d:\n",pn
);
4215 /*-----------------------
4216 * For unstructured parts
4217 *-----------------------*/
4218 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4220 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
4221 ne
= Pbuild
[p
].ne
[et
];
4225 conns
[et
] = (int **) calloc(ne
,sizeof(int *));
4226 if(conns
[et
] == (int **) NULL
) {
4227 fprintf(stderr
,"Error: allocating conns array\n");
4231 for(i
=0; i
<ne
; ++i
) {
4232 conns
[et
][i
] = (int *) calloc(Elem_info
[et
].con_len
,sizeof(int));
4233 if(conns
[et
][i
] == (int *) NULL
) {
4234 fprintf(stderr
,"Error: allocating conns array\n");
4240 if(Element_labels
) {
4241 elemids
[et
] = (int *) calloc(ne
,sizeof(int));
4242 if(elemids
[et
] == (int *) NULL
) {
4243 fprintf(stderr
,"Error: allocating elemids array\n");
4251 *-----------------*/
4252 err
= USERD_get_element_connectivities_for_part(pn
,conns
);
4254 fprintf(stderr
,"Error: getting element connectivities\n");
4258 /* Get the element ids - if any
4259 *-----------------------------*/
4260 if(Element_labels
) {
4261 err
= USERD_get_element_ids_for_part(pn
,elemids
);
4263 fprintf(stderr
,"Error: getting element ids\n");
4269 *-----------------*/
4270 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
4271 ne
= Pbuild
[p
].ne
[et
];
4275 /* First element of the type
4276 *--------------------------*/
4278 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
4279 if(Element_labels
) {
4280 fprintf(stderr
," id: %d\n",elemids
[et
][i
]);
4282 fprintf(stderr
," connectivity:");
4283 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
4284 fprintf(stderr
," %d",conns
[et
][i
][j
]);
4286 fprintf(stderr
,"\n");
4288 /* Last element of the type
4289 *-------------------------*/
4292 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
4293 if(Element_labels
) {
4294 fprintf(stderr
," id: %d\n",elemids
[et
][i
]);
4296 fprintf(stderr
," connectivity:");
4297 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
4298 fprintf(stderr
," %d",conns
[et
][i
][j
]);
4300 fprintf(stderr
,"\n");
4305 /* Free the allocated memory
4306 *--------------------------*/
4307 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
4308 ne
= Pbuild
[p
].ne
[et
];
4311 for(i
=0; i
<ne
; ++i
) {
4316 if(Element_labels
) {
4324 /*---------------------
4325 * For structured parts
4326 *---------------------*/
4329 /* Get the block coords
4330 *---------------------*/
4331 for(comp
=0; comp
<3; ++comp
) {
4332 if(Pbuild
[p
].ne
[comp
] < 1) {
4336 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
4339 nn
= bdim
[0] * bdim
[1] * bdim
[2];
4353 ne
= bd1
* bd2
* bd3
;
4356 /* Determine cell type
4357 *--------------------*/
4359 for(i
=0; i
<3; ++i
) {
4365 cell_type
= Z_HEX08
;
4367 else if(num_dims
== 2) {
4368 cell_type
= Z_QUA04
;
4371 cell_type
= Z_BAR02
;
4374 coords
= (float **) calloc(num_dims
,sizeof(float *));
4375 if(coords
== (float **) NULL
) {
4376 fprintf(stderr
,"Error: allocating coords array\n");
4380 for(i
=0; i
<num_dims
; ++i
) {
4381 coords
[i
] = (float *) calloc(nn
,sizeof(float));
4382 if(coords
[i
] == (float *) NULL
) {
4383 fprintf(stderr
,"Error: allocating coords array\n");
4391 for(comp
=0; comp
<num_dims
; ++comp
) {
4392 err
= USERD_get_block_coords_by_component(pn
,comp
,coords
[comp
]);
4394 fprintf(stderr
,"Error: getting block coords\n");
4401 *-----------------*/
4407 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
4410 fprintf(stderr
," x y z coordinates: %g %g %g\n",
4411 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
4412 mm
[0] = mm
[1] = coords
[0][i
];
4413 mm
[2] = mm
[3] = coords
[1][i
];
4414 mm
[4] = mm
[5] = coords
[2][i
];
4416 else if(num_dims
== 2) {
4417 fprintf(stderr
," x y coordinates: %g %g\n",
4418 coords
[0][i
], coords
[1][i
]);
4419 mm
[0] = mm
[1] = coords
[0][i
];
4420 mm
[2] = mm
[3] = coords
[1][i
];
4423 fprintf(stderr
," x coordinates: %g\n",
4425 mm
[0] = mm
[1] = coords
[0][i
];
4433 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
4436 fprintf(stderr
," x y z coordinates: %g %g %g\n",
4437 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
4439 else if(num_dims
== 2) {
4440 fprintf(stderr
," x y coordinates: %g %g\n",
4441 coords
[0][i
], coords
[1][i
]);
4444 fprintf(stderr
," x coordinates: %g\n",
4450 /* Min and max coordinate values
4451 *------------------------------*/
4452 for(i
=2; i
<=nn
; ++i
) {
4453 if(coords
[0][i
] < mm
[0]) {
4454 mm
[0] = coords
[0][i
];
4456 if(coords
[0][i
] > mm
[1]) {
4457 mm
[1] = coords
[0][i
];
4460 if(coords
[1][i
] < mm
[2]) {
4461 mm
[2] = coords
[1][i
];
4463 if(coords
[1][i
] > mm
[3]) {
4464 mm
[3] = coords
[1][i
];
4468 if(coords
[2][i
] < mm
[4]) {
4469 mm
[4] = coords
[2][i
];
4471 if(coords
[2][i
] > mm
[5]) {
4472 mm
[5] = coords
[2][i
];
4477 fprintf(stderr
," Coordinate ranges:\n");
4478 fprintf(stderr
," min x: %g\n",mm
[0]);
4479 fprintf(stderr
," max x: %g\n",mm
[1]);
4481 fprintf(stderr
," min y: %g\n",mm
[2]);
4482 fprintf(stderr
," max y: %g\n",mm
[3]);
4485 fprintf(stderr
," min z: %g\n",mm
[4]);
4486 fprintf(stderr
," max z: %g\n",mm
[5]);
4489 /* Free the allocated memory - so far
4490 *-----------------------------------*/
4491 for(i
=0; i
<num_dims
; ++i
) {
4497 /* Get the block iblanking - if any
4498 *---------------------------------*/
4499 if(Pbuild
[p
].type
== Z_IBLANKED
) {
4501 iblanking
= (int *) calloc(nn
,sizeof(int));
4502 if(iblanking
== (int *) NULL
) {
4503 fprintf(stderr
,"Error: allocating iblanking array\n");
4507 err
= USERD_get_block_iblanking(pn
,iblanking
);
4509 fprintf(stderr
,"Error: getting block iblanking\n");
4514 *-----------------*/
4521 for(i
=0; i
<nn
; ++i
) {
4525 fprintf(stderr
," Iblanking breakdown:\n");
4526 fprintf(stderr
," Number of Z_EXT: %d\n",ib
[Z_EXT
]);
4527 fprintf(stderr
," Number of Z_INT: %d\n",ib
[Z_INT
]);
4528 fprintf(stderr
," Number of Z_BND: %d\n",ib
[Z_BND
]);
4529 fprintf(stderr
," Number of Z_INTBND: %d\n",ib
[Z_INTBND
]);
4530 fprintf(stderr
," Number of Z_SYM: %d\n",ib
[Z_SYM
]);
4545 var_loader(int var_time_step
)
4565 float minv
[3],maxv
[3];
4569 fprintf(stderr
,"\n--------------- var_loader --------------\n");
4571 if(Num_time_steps
> 1 && v
== 0) {
4572 if(var_time_step
> (Num_time_steps
- 1)) {
4573 var_time_step
= Num_time_steps
- 1;
4576 /* Set the time step - to first step by default, but
4577 * can set it at others using -vts command argument
4578 *---------------------------------------------------------*/
4579 USERD_set_time_step(var_time_step
);
4581 fprintf(stderr
," Using time step: %d (where range is %d through %d)\n\n",
4582 var_time_step
,0,Num_time_steps
-1);
4585 for(v
=0; v
<Num_vars
; ++v
) {
4589 fprintf(stderr
,"\n");
4591 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
4592 fprintf(stderr
," Z_PER_NODE Variable %d:\n",vn
);
4595 fprintf(stderr
," Z_PER_ELEM Variable %d:\n",vn
);
4600 if(Varinfo
[v
].type
== Z_CONSTANT
) {
4602 constant_val
= USERD_get_constant_value(vn
);
4603 fprintf(stderr
," Constant (%s):\n",Varinfo
[v
].description
);
4604 fprintf(stderr
," value: %g\n",constant_val
);
4608 /* Scalars, Vectors, Tensors
4609 *--------------------------*/
4612 /* Get the var description line
4613 *-----------------------------*/
4614 err
= USERD_get_description_lines(Z_VARI
,vn
,line1
,line2
);
4616 fprintf(stderr
," Desc line: %s\n",line1
);
4619 fprintf(stderr
,"Error: getting var description line\n");
4624 /* Get the values by component
4625 *-----------------------------*/
4626 if(Varinfo
[v
].type
== Z_SCALAR
) {
4629 else if(Varinfo
[v
].type
== Z_VECTOR
) {
4632 else if(Varinfo
[v
].type
== Z_TENSOR
) {
4635 else if(Varinfo
[v
].type
== Z_TENSOR9
) {
4642 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
4644 for(p
=0; p
<Num_parts
; ++p
) {
4647 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4648 nsize
= Pbuild
[p
].nn
;
4651 for(comp
=0; comp
<3; ++comp
) {
4652 if(Pbuild
[p
].ne
[comp
] < 1) {
4656 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
4659 nsize
= bdim
[0] * bdim
[1] * bdim
[2];
4663 fprintf(stderr
," For part %d, with %d nodes:\n",pn
,nsize
);
4666 values
= (float *) calloc((num_comps
* nsize
),sizeof(float));
4667 if(values
== (float *) NULL
) {
4668 fprintf(stderr
,"Error: alocating variable values\n");
4672 if(num_comps
== 1) {
4674 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4675 err
= USERD_get_scalar_values(vn
,
4680 fprintf(stderr
,"Error: getting scalar values\n");
4685 err
= USERD_get_block_scalar_values(pn
,
4689 fprintf(stderr
,"Error: getting block scalar values\n");
4694 /* For the component, show 1st node, last node, min, max values
4695 *-------------------------------------------------------------*/
4696 minv
[0] = maxv
[0] = values
[0];
4697 for(i
=0; i
<nsize
; ++i
) {
4698 if(values
[i
] < minv
[0]) {
4699 minv
[0] = values
[i
];
4701 if(values
[i
] > maxv
[0]) {
4702 maxv
[0] = values
[i
];
4706 fprintf(stderr
," node %10d value: %g\n",1,values
[0]);
4707 fprintf(stderr
," node %10d value: %g\n",nsize
,values
[nsize
-1]);
4708 fprintf(stderr
," min value: %g\n",minv
[0]);
4709 fprintf(stderr
," max value: %g\n",maxv
[0]);
4713 else if(num_comps
== 3) {
4715 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4716 err
= USERD_get_vector_values(vn
,
4721 fprintf(stderr
,"Error: getting vector values\n");
4727 tvalues
= (float *) calloc(nsize
,sizeof(float));
4728 if(tvalues
== (float *) NULL
) {
4729 fprintf(stderr
,"Error: alocating tvalues array\n");
4733 for(i
=0; i
<3; ++i
) {
4734 err
= USERD_get_block_vector_values_by_component(pn
,
4739 fprintf(stderr
,"Error: getting vector values\n");
4742 for(j
=0; j
<nsize
; ++j
) {
4744 values
[k
] = tvalues
[j
];
4750 /* For the component, show 1st node, last node, min, max values
4751 *-------------------------------------------------------------*/
4752 minv
[0] = maxv
[0] = values
[0];
4753 minv
[1] = maxv
[1] = values
[1];
4754 minv
[2] = maxv
[2] = values
[2];
4755 for(i
=0; i
<nsize
; ++i
) {
4757 for(k
=0; k
<3; ++k
) {
4758 if(values
[j
+k
] < minv
[k
]) {
4759 minv
[k
] = values
[j
+k
];
4761 if(values
[j
+k
] > maxv
[k
]) {
4762 maxv
[k
] = values
[j
+k
];
4767 fprintf(stderr
," node %10d values: %g %g %g\n",1,
4768 values
[0],values
[1],values
[2]);
4769 fprintf(stderr
," node %10d values: %g %g %g\n",nsize
,
4770 values
[3*nsize
-3],values
[3*nsize
-2],values
[3*nsize
-1]);
4771 fprintf(stderr
," min values: %g %g %g\n",
4772 minv
[0],minv
[1],minv
[2]);
4773 fprintf(stderr
," max values: %g %g %g\n",
4774 maxv
[0],maxv
[1],maxv
[2]);
4785 for(p
=0; p
<Num_parts
; ++p
) {
4788 if(Pbuild
[p
].type
!= Z_UNSTRUCTURED
) {
4790 for(comp
=0; comp
<3; ++comp
) {
4791 if(Pbuild
[p
].ne
[comp
] < 1) {
4795 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
4810 nsize
= bd1
* bd2
* bd3
;
4813 /* Determine cell type
4814 *--------------------*/
4816 for(i
=0; i
<3; ++i
) {
4822 cell_type
= Z_HEX08
;
4824 else if(num_dims
== 2) {
4825 cell_type
= Z_QUA04
;
4828 cell_type
= Z_BAR02
;
4832 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4837 e1
= e2
= cell_type
;
4840 for(et
=e1
; et
<=e2
; ++et
) {
4842 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4843 nsize
= Pbuild
[p
].ne
[et
];
4848 fprintf(stderr
," For part %d, with %d elems of type %s:\n",
4849 pn
,nsize
,Elem_info
[et
].name
);
4851 values
= (float *) calloc((num_comps
* nsize
),sizeof(float));
4852 if(values
== (float *) NULL
) {
4853 fprintf(stderr
,"Error: alocating variable values\n");
4857 if(num_comps
== 1) {
4858 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4859 err
= USERD_get_scalar_values(vn
,
4864 fprintf(stderr
,"Error: getting scalar values\n");
4869 err
= USERD_get_block_scalar_values(pn
,
4873 fprintf(stderr
,"Error: getting block scalar values\n");
4878 /* For the component, show 1st node, last node, min, max values
4879 *-------------------------------------------------------------*/
4880 minv
[0] = maxv
[0] = values
[0];
4881 for(i
=1; i
<nsize
; ++i
) {
4882 if(values
[i
] < minv
[0]) {
4883 minv
[0] = values
[i
];
4885 if(values
[i
] > maxv
[0]) {
4886 maxv
[0] = values
[i
];
4890 fprintf(stderr
," elem %10d value: %g\n",1,values
[0]);
4891 fprintf(stderr
," elem %10d value: %g\n",nsize
,values
[nsize
-1]);
4892 fprintf(stderr
," min value: %g\n",minv
[0]);
4893 fprintf(stderr
," max value: %g\n",maxv
[0]);
4897 else if(num_comps
== 3) {
4899 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4900 err
= USERD_get_vector_values(vn
,
4905 fprintf(stderr
,"Error: getting vector values\n");
4911 tvalues
= (float *) calloc(nsize
,sizeof(float));
4912 if(tvalues
== (float *) NULL
) {
4913 fprintf(stderr
,"Error: alocating tvalues array\n");
4917 for(i
=0; i
<3; ++i
) {
4918 err
= USERD_get_block_vector_values_by_component(pn
,
4923 fprintf(stderr
,"Error: getting vector values\n");
4926 for(j
=0; j
<nsize
; ++j
) {
4928 values
[k
] = tvalues
[j
];
4934 /* For the component, show 1st node, last node, min, max values
4935 *-------------------------------------------------------------*/
4936 minv
[0] = maxv
[0] = values
[0];
4937 minv
[1] = maxv
[1] = values
[1];
4938 minv
[2] = maxv
[2] = values
[2];
4939 for(i
=1; i
<=nsize
; ++i
) {
4941 for(k
=0; k
<3; ++k
) {
4942 if(values
[j
+k
] < minv
[k
]) {
4943 minv
[k
] = values
[j
+k
];
4945 if(values
[j
+k
] > maxv
[k
]) {
4946 maxv
[k
] = values
[j
+k
];
4951 fprintf(stderr
," elem %10d values: %g %g %g\n",1,
4952 values
[0],values
[1],values
[2]);
4953 fprintf(stderr
," elem %10d values: %g %g %g\n",nsize
,
4954 values
[3*nsize
-3],values
[3*nsize
-2],values
[3*nsize
-1]);
4955 fprintf(stderr
," min values: %g %g %g\n",
4956 minv
[0],minv
[1],minv
[2]);
4957 fprintf(stderr
," max values: %g %g %g\n",
4958 maxv
[0],maxv
[1],maxv
[2]);
4975 #if (defined GT_USERD_API_202)
4982 materials_info( void )
4993 fprintf(stderr
,"\n------------- materials info --------------\n");
4995 /* Get the number of variables
4996 *----------------------------*/
4997 Num_materials_sets
= USERD_get_number_of_material_sets();
4998 if(Num_materials_sets
< 0) {
4999 fprintf(stderr
,"Error: getting the number of material sets\n");
5003 if(Num_materials_sets
== 0) {
5004 fprintf(stderr
," No materials sets in the model\n");
5007 else if(Num_materials_sets
> 1) {
5008 fprintf(stderr
," Number of materials sets: %d\n",Num_materials_sets
);
5009 fprintf(stderr
," Currently, EnSight 7.6 only supports 1 material set\n");
5013 fprintf(stderr
," Number of materials sets: %d\n",Num_materials_sets
);
5017 /* Get the material set index list and names
5018 *------------------------------------------*/
5019 msids
= (int *) calloc(Num_materials_sets
,sizeof(int));
5020 if(msids
== (int *)NULL
) {
5021 fprintf(stderr
," Problems allocating for material set ids\n");
5025 num_materials
= (int *) calloc(Num_materials_sets
,sizeof(int));
5026 if(num_materials
== (int *)NULL
) {
5027 fprintf(stderr
," Problems allocating for material set num materials\n");
5031 msname
= (char **) calloc(Num_materials_sets
,sizeof(char *));
5032 if(msname
== (char **)NULL
) {
5033 fprintf(stderr
," Problems allocating for material set names\n");
5037 for(i
=0; i
<Num_materials_sets
; ++i
) {
5038 msname
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
5039 if(msname
[i
] == (char *)NULL
) {
5040 fprintf(stderr
," Problems allocating for material set names\n");
5046 err
= USERD_get_matf_set_info(msids
,msname
);
5048 fprintf(stderr
,"Error: getting material set info\n");
5051 for(i
=0; i
<Num_materials_sets
; ++i
) {
5053 /* Echo some feedback
5054 *-------------------*/
5055 fprintf(stderr
," For Material set %d:\n",i
+1);
5057 fprintf(stderr
," id: %d\n",msids
[i
]);
5058 fprintf(stderr
," name: %s\n",msname
[i
]);
5060 num_materials
[i
] = USERD_get_number_of_materials(i
);
5061 if(num_materials
[i
] < 0) {
5062 fprintf(stderr
,"Error: getting the number of materials in set %d\n",i
);
5065 else if(num_materials
[i
] == 0) {
5066 fprintf(stderr
," No materials in Materials set %d\n",i
);
5070 mids
= (int *) calloc(num_materials
[i
],sizeof(int));
5071 if(mids
== (int *)NULL
) {
5072 fprintf(stderr
," Problems allocating for material ids\n");
5076 mdesc
= (char **) calloc(num_materials
[i
],sizeof(char *));
5077 if(mdesc
== (char **)NULL
) {
5078 fprintf(stderr
," Problems allocating for material desc\n");
5082 for(j
=0; j
<num_materials
[i
]; ++j
) {
5083 mdesc
[j
] = (char *) calloc(Z_BUFL
,sizeof(char));
5084 if(mdesc
[j
] == (char *)NULL
) {
5085 fprintf(stderr
," Problems allocating for material desc\n");
5091 err
= USERD_get_matf_var_info(i
,mids
,mdesc
);
5093 fprintf(stderr
,"Error: getting material info\n");
5097 for(j
=0; j
<num_materials
[i
]; ++j
) {
5098 /* Echo some feedback
5099 *-------------------*/
5100 fprintf(stderr
," For Material %d:\n",j
+1);
5102 fprintf(stderr
," index: %d\n",mids
[j
]);
5103 fprintf(stderr
," description: %s\n",mdesc
[j
]);
5110 /* Free the allocated memory
5111 *--------------------------*/
5112 for(i
=0; i
<Num_materials_sets
; ++i
) {
5115 for(j
=0; j
<num_materials
[i
]; ++j
) {
5121 free(num_materials
);
5129 /*----------------------
5130 * gold_materials_loader
5131 *----------------------*/
5133 gold_materials_loader(int geom_time_step
)
5135 int i
, j
, k
, ms
, nn
;
5136 int err
, err1
, err2
;
5150 int matf_size
, matfv_size
;
5153 fprintf(stderr
,"\n-------------- materials_loader --------------\n");
5155 if(Num_time_sets
> 0) {
5156 /* Get the timeset used for the geometry
5157 *--------------------------------------*/
5158 geom_timeset
= USERD_get_geom_timeset_number();
5160 /* Get the number of time steps for this timeset
5161 *----------------------------------------------*/
5162 Num_time_steps
= USERD_get_num_of_time_steps(geom_timeset
);
5163 if(Num_time_steps
< 1) {
5164 fprintf(stderr
," Error: Num time steps returned: %d\n",Num_time_steps
);
5165 fprintf(stderr
," (Must be >0 to be okay)\n");
5168 if(geom_time_step
> (Num_time_steps
- 1)) {
5169 geom_time_step
= Num_time_steps
- 1;
5172 /* Set the timeset and step - to first step by default, but
5173 * can set it at others using -gts command argument
5174 *---------------------------------------------------------*/
5175 USERD_set_time_set_and_step(geom_timeset
,geom_time_step
);
5177 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
5178 geom_timeset
,0,Num_time_steps
-1);
5179 fprintf(stderr
," Using time step: %d\n",geom_time_step
);
5182 for(ms
=0; ms
<Num_materials_sets
; ++ms
) {
5183 fprintf(stderr
,"\n");
5184 fprintf(stderr
," Materials Set %d:\n",ms
+1);
5186 for(p
=0; p
<Num_parts
; ++p
) {
5189 fprintf(stderr
,"\n");
5190 fprintf(stderr
," Part %d:\n",pn
);
5192 /*-----------------------
5193 * For unstructured parts
5194 *-----------------------*/
5195 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5201 for(comp
=0; comp
<3; ++comp
) {
5202 if(Pbuild
[p
].ne
[comp
] < 1) {
5206 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
5209 nn
= bdim
[0] * bdim
[1] * bdim
[2];
5223 ne
= bd1
* bd2
* bd3
;
5225 /* Determine cell type
5226 *--------------------*/
5228 for(i
=0; i
<3; ++i
) {
5234 cell_type
= Z_HEX08
;
5236 else if(num_dims
== 2) {
5237 cell_type
= Z_QUA04
;
5240 cell_type
= Z_BAR02
;
5248 for(et
=e1
; et
<e2
; ++et
) {
5250 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5251 ne
= Pbuild
[p
].ne
[et
];
5256 /* Get the material ids, if any
5257 *-----------------------------*/
5258 err
= USERD_size_matf_data(ms
,
5263 if(err
== Z_OK
&& matf_size
> 0) {
5266 /* Go get the material ids
5267 *------------------------*/
5268 ivals
= (int *) calloc(matf_size
,sizeof(int));
5269 if(ivals
== (int *)NULL
) {
5270 fprintf(stderr
," Problems allocating for material ids\n");
5273 err
= USERD_load_matf_data(ms
,
5280 if(matf_size
< 20) {
5281 fprintf(stderr
," Printing all mat ids for %s elements\n",
5282 Elem_info
[et
].name
);
5286 fprintf(stderr
," Printing first 20 mat ids for %s elements\n",
5287 Elem_info
[et
].name
);
5291 /* See if any mixed materials
5292 *---------------------------*/
5293 mixed_present
= FALSE
;
5294 for(k
=0; k
<matf_size
; ++k
) {
5296 mixed_present
= TRUE
;
5303 for(k
=0; k
<do_num
; ++k
) {
5304 fprintf(stderr
," mat id[%d] = %d\n",k
,ivals
[k
]);
5309 fprintf(stderr
," Trouble getting mat ids for %s elements\n",
5310 Elem_info
[et
].name
);
5316 fprintf(stderr
," %s elements have no material ids\n",
5317 Elem_info
[et
].name
);
5321 /* Get the mixed material ids, if any
5322 *-----------------------------------*/
5324 err1
= USERD_size_matf_data(ms
,
5329 err2
= USERD_size_matf_data(ms
,
5340 /* Go get the material ids
5341 *------------------------*/
5342 ivals
= (int *) calloc(matf_size
,sizeof(int));
5343 if(ivals
== (int *)NULL
) {
5344 fprintf(stderr
," Problems allocating for mixed material ids\n");
5347 fvals
= (float *) calloc(matfv_size
,sizeof(float));
5348 if(fvals
== (float *)NULL
) {
5349 fprintf(stderr
," Problems allocating for mixed material values\n");
5353 err1
= USERD_load_matf_data(ms
,
5360 err2
= USERD_load_matf_data(ms
,
5368 if(matf_size
< 20) {
5369 fprintf(stderr
," Printing all mixed mat ids for %s elements\n",
5370 Elem_info
[et
].name
);
5374 fprintf(stderr
," Printing first 20 mixed mat ids for %s elements\n",
5375 Elem_info
[et
].name
);
5378 for(k
=0; k
<do_num
; ++k
) {
5379 fprintf(stderr
," mixed mat id[%d] = %d\n",k
,ivals
[k
]);
5383 if(matfv_size
< 20) {
5384 fprintf(stderr
," Printing all mixed mat values for %s elements\n",
5385 Elem_info
[et
].name
);
5386 do_num
= matfv_size
;
5389 fprintf(stderr
," Printing first 20 mixed mat values for %s elements\n",
5390 Elem_info
[et
].name
);
5393 for(k
=0; k
<do_num
; ++k
) {
5394 fprintf(stderr
," mixed mat val[%d] = %f\n",k
,fvals
[k
]);
5399 fprintf(stderr
," Trouble getting mixed mat ids or vals for %s elements\n",
5400 Elem_info
[et
].name
);
5407 fprintf(stderr
," Trouble getting mixed mat sizes for %s elements\n",
5408 Elem_info
[et
].name
);
5413 fprintf(stderr
," (%s elements have no mixed material ids)\n",
5414 Elem_info
[et
].name
);
5430 entity_querys(int var_time_step
)
5451 fprintf(stderr
,"\n-------------- entity_querys ------------\n");
5452 fprintf(stderr
," (scalar & vector variables only) \n");
5453 fprintf(stderr
,"\n");
5455 #if (defined USERD_API_100)
5457 if(Num_time_steps
> 1) {
5458 /* Get the number of time steps for this timeset
5459 *----------------------------------------------*/
5460 if(var_time_step
> (Num_time_steps
- 1)) {
5461 var_time_step
= Num_time_steps
- 1;
5464 /* Set the time step - to first step by default, but
5465 * can set it at others using -vts command argument
5466 *---------------------------------------------------------*/
5467 USERD_set_time_step(var_time_step
);
5469 fprintf(stderr
," Using time step: %d (where range is %d through %d)\n\n",
5470 var_time_step
,0,Num_time_steps
-1);
5474 for(v
=0; v
<Num_vars
; ++v
) {
5477 /* Scalar or vectors only
5478 *-----------------------*/
5479 if(Varinfo
[v
].type
== Z_SCALAR
|| Varinfo
[v
].type
== Z_VECTOR
) {
5482 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
5483 fprintf(stderr
," Z_PER_NODE Variable %d:\n",vn
);
5486 fprintf(stderr
," Z_PER_ELEM Variable %d:\n",vn
);
5489 #if (defined GT_USERD_API_100)
5491 if(Num_time_sets
> 0) {
5492 /* Get the timeset used for the variable
5493 *---------------------------------------*/
5494 var_timeset
= Varinfo
[v
].timeset
;
5496 /* Get the number of time steps for this timeset
5497 *----------------------------------------------*/
5498 Num_time_steps
= USERD_get_num_of_time_steps(var_timeset
);
5499 if(Num_time_steps
< 1) {
5500 fprintf(stderr
," Error: Number of time steps returned: %d\n",
5502 fprintf(stderr
," (Must be >0 to be okay)\n");
5505 if(var_time_step
> (Num_time_steps
- 1)) {
5506 var_time_step
= Num_time_steps
- 1;
5509 /* Set the timeset and step - to first step by default, but
5510 * can set it at others using -vts command argument
5511 *---------------------------------------------------------*/
5512 USERD_set_time_set_and_step(var_timeset
,var_time_step
);
5514 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
5515 var_timeset
,0,Num_time_steps
-1);
5516 fprintf(stderr
," Using time step: %d\n",var_time_step
);
5521 /* Get the var description line
5522 *-----------------------------*/
5523 #if (defined GT_USERD_API_100)
5524 err
= USERD_get_descrip_lines(Z_VARI
,vn
,FALSE
,line1
,line2
);
5526 fprintf(stderr
," Desc line: %s\n",line1
);
5529 fprintf(stderr
,"Error: getting var description line\n");
5533 if(Varinfo
[v
].complex) {
5534 err
= USERD_get_descrip_lines(Z_VARI
,vn
,TRUE
,line1
,line2
);
5536 fprintf(stderr
," Desc line (imag): %s\n",line1
);
5539 fprintf(stderr
,"Error: getting var description line (imag)\n");
5545 err
= USERD_get_description_lines(Z_VARI
,vn
,line1
,line2
);
5547 fprintf(stderr
," Desc line: %s\n",line1
);
5550 fprintf(stderr
,"Error: getting var description line\n");
5556 /* Get the values by component
5557 *-----------------------------*/
5558 if(Varinfo
[v
].type
== Z_SCALAR
) {
5561 else if(Varinfo
[v
].type
== Z_VECTOR
) {
5567 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
5569 for(p
=0; p
<Num_parts
; ++p
) {
5572 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5573 nsize
= Pbuild
[p
].nn
;
5576 for(comp
=0; comp
<3; ++comp
) {
5577 if(Pbuild
[p
].ne
[comp
] < 1) {
5581 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
5584 nsize
= bdim
[0] * bdim
[1] * bdim
[2];
5591 fprintf(stderr
," For part %d, using node %d:\n",pn
,nsize
);
5593 #if (defined GT_USERD_API_100)
5594 err
= USERD_get_var_value_at_specific(vn
,
5602 err
= USERD_get_variable_value_at_specific(vn
,
5609 if(err
== Z_NOT_IMPLEMENTED
) {
5610 fprintf(stderr
," Node and element queries not implemented\n");
5613 else if(err
== Z_ERR
) {
5614 fprintf(stderr
," Could not get value\n");
5618 /* For the component, show 1st node, last node, min, max values
5619 *-------------------------------------------------------------*/
5620 if(Varinfo
[v
].type
== Z_SCALAR
) {
5621 fprintf(stderr
," Scalar value is: %g\n",qvals
[0]);
5624 fprintf(stderr
," Vector values are: %g %g %g\n",
5625 qvals
[0],qvals
[1],qvals
[2]);
5628 #if (defined GT_USERD_API_100)
5629 if(Varinfo
[v
].complex) {
5631 err
= USERD_get_var_value_at_specific(vn
,
5640 fprintf(stderr
," Could not get imag value\n");
5644 /* For the component, show 1st node, last node, min, max values
5645 *-------------------------------------------------------------*/
5646 if(Varinfo
[v
].type
== Z_SCALAR
) {
5647 fprintf(stderr
," Scalar value (imag) is: %g\n",qvals
[0]);
5650 fprintf(stderr
," Vector values (imag) are: %g %g %g\n",
5651 qvals
[0],qvals
[1],qvals
[2]);
5665 for(p
=0; p
<Num_parts
; ++p
) {
5668 if(Pbuild
[p
].type
!= Z_UNSTRUCTURED
) {
5670 for(comp
=0; comp
<3; ++comp
) {
5671 if(Pbuild
[p
].ne
[comp
] < 1) {
5675 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
5690 nsize
= bd1
* bd2
* bd3
;
5693 /* Determine cell type
5694 *--------------------*/
5696 for(i
=0; i
<3; ++i
) {
5702 cell_type
= Z_HEX08
;
5704 else if(num_dims
== 2) {
5705 cell_type
= Z_QUA04
;
5708 cell_type
= Z_BAR02
;
5712 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5717 e1
= e2
= cell_type
;
5720 for(et
=e1
; et
<=e2
; ++et
) {
5722 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5723 nsize
= Pbuild
[p
].ne
[et
];
5729 fprintf(stderr
," For part %d, using elem %d of type %s:\n",
5730 pn
,nsize
,Elem_info
[et
].name
);
5733 #if (defined GT_USERD_API_100)
5734 err
= USERD_get_var_value_at_specific(vn
,
5742 err
= USERD_get_variable_value_at_specific(vn
,
5750 if(err
== Z_NOT_IMPLEMENTED
) {
5751 fprintf(stderr
," Node and element queries not implemented\n");
5754 else if(err
== Z_ERR
) {
5755 fprintf(stderr
," Could not get value\n");
5758 if(Varinfo
[v
].type
== Z_SCALAR
) {
5759 fprintf(stderr
," Scalar value is: %g\n",qvals
[0]);
5762 fprintf(stderr
," Vector values are: %g %g %g\n",
5763 qvals
[0],qvals
[1],qvals
[2]);
5766 #if (defined GT_USERD_API_100)
5767 if(Varinfo
[v
].complex) {
5769 err
= USERD_get_var_value_at_specific(vn
,
5777 fprintf(stderr
," Could not get imag value\n");
5780 if(Varinfo
[v
].type
== Z_SCALAR
) {
5781 fprintf(stderr
," Scalar value (imag) is: %g\n",qvals
[0]);
5784 fprintf(stderr
," Vector values (imag) are: %g %g %g\n",
5785 qvals
[0],qvals
[1],qvals
[2]);
5806 exercise_bkup( void )
5811 fprintf(stderr
,"\n------------ exercise_archive -----------\n");
5813 arcfile
= fopen("test.arc","wb");
5814 if(arcfile
== (FILE *)NULL
) {
5815 fprintf(stderr
,"Error: opening test archive file\n");
5818 err
= USERD_bkup(arcfile
,Z_SAVE_ARCHIVE
);
5820 fprintf(stderr
,"Error: saving to test archive file\n");
5825 arcfile
= fopen("test.arc","rb");
5826 err
= USERD_bkup(arcfile
,Z_REST_ARCHIVE
);
5828 fprintf(stderr
,"Error: restoring from test archive file\n");
5832 fprintf(stderr
," Archive test completed\n");
5839 /* -------------------------------------------------------
5840 * threshold_operator1 & 2 can be one of the following
5841 * Z_ELE_FAILED_NONE, - disables checking
5842 * Z_ELE_FAILED_GREATER, - greater than
5843 * Z_ELE_FAILED_LESS, - less than
5844 * Z_ELE_FAILED_EQUAL, - equal
5845 * Z_ELE_FAILED_NOT_EQUAL, - not equal
5846 * Z_ELE_FAILED_MANY - not used
5849 * Z_ELE_FAILED_LOGIC_NONE,
5850 * Z_ELE_FAILED_LOGIC_AND,
5851 * Z_ELE_FAILED_LOGIC_OR,
5852 * Z_ELE_FAILED_LOGIC_MANY
5854 * ------------------------------------------------------ */
5855 int load_fail_defaults(void)
5857 int check_for_failed
= FALSE
;
5858 int cri1
= 0; /* Criteria1 ELE_FAILED_GREATER, etc */
5860 int logic_cri2
= 0; /* Logic for criteria 2 ELE_FAILED_LOGIC_NONE, AND, etc */
5861 float val1
= 0.0; /* failure threshold 1 */
5862 float val2
= 0.0; /* failure threshold 2 */
5863 char failed_var_name
[Z_MXVARIABLEDESC
]={EOS
};
5865 check_for_failed
= USERD_get_uns_failed_params( failed_var_name
,
5866 &val1
, &val2
, &cri1
, &cri2
,
5868 fprintf(stderr
,"\n------------- failed element info -------------\n");
5869 if (check_for_failed
== TRUE
) {
5870 fprintf(stderr
," Failed element criteria info \n");
5871 fprintf(stderr
," Variable name = %s\n",failed_var_name
);
5872 fprintf(stderr
," Criteria 1 = %d\n",cri1
);
5873 fprintf(stderr
," Criteria 2 = %d\n",cri1
);
5874 fprintf(stderr
," Logic criteria = %d\n",logic_cri2
);
5875 fprintf(stderr
," Value 1 = %f\n",val1
);
5876 fprintf(stderr
," Value 2 = %f\n",val2
);
5878 fprintf(stderr
," No Failed elements\n");