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 #define _EGS)
200 * USERD_get_extra_gui_defaults (optional #define _EGS)
204 * USERD_set_extra_gui_data (optional #define _EGS)
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 the Extra GUI stuff
317 * you need to uncomment this section
321 * ----------------------------------------------- */
323 #if (!defined USERD_API_100)
324 #define GT_USERD_API_100
327 #if (!defined USERD_API_100 && !defined USERD_API_200)
328 #define GT_USERD_API_200
331 #if (!defined USERD_API_100 && !defined USERD_API_200 && !defined USERD_API_201 && !defined USERD_API_202)
332 #define GT_USERD_API_202
335 #if (!defined USERD_API_100 && !defined USERD_API_200 && !defined USERD_API_201 && !defined USERD_API_202 && !defined USERD_API_203)
336 #define GT_USERD_API_203
343 int id
; /* part_id */
344 char desc
[Z_BUFL
]; /* description given in the file */
345 int type
; /* Z_UNSTRUCTURED, Z_STRUCTURED, Z_IBLANKED */
346 int ne
[Z_MAXTYPE
]; /* Number of elements per type (Z_UNSTRUCTURED) */
347 /* or ne[0] = I dimension (Z_STRUCTURED) */
348 /* ne[1] = J dimension */
349 /* ne[2] = K dimension */
350 int nn
; /* Num of unstructured nodes (All_Local only) */
351 int ghosts
; /* TRUE if ghost cells, FALSE otherwise */
355 char description
[Z_BUFL
]; /* description */
356 char filename
[Z_BUFL
]; /* real filename */
357 char ifilename
[Z_BUFL
]; /* imaginary filename */
368 char name
[12]; /* Z_POINT, Z_G_POINT, Z_BAR02, ... */
369 int con_len
; /* Number of nodes per element */
381 int Num_materials_sets
;
384 char Version_number
[Z_MAX_USERD_NAME
];
388 /* ------------------
390 * ------------------ */
392 int Num_pulldowns
= 0;
395 int *Toggle_default_status
;
396 char **Pulldown_title
;
397 int *Pulldown_number_in_list
;
398 int *Pulldown_default_selection
;
399 char ***Pulldown_item_strings
;
401 char **Field_user_string
;
402 int *Toggle_choice
; /* user choice */
403 int *Pulldown_choice
; /* user choice */
405 /* ---------------------------
406 * Failed elements (API 2.04)
407 * --------------------------- */
408 int Any_uns_failed_model_elems
= FALSE
;
411 #if (defined USERD_API_100 || defined USERD_API_200)
412 EINFO Elem_info
[Z_MAXTYPE
] = {"Z_POINT",1,
427 #elif defined USERD_API_201
428 EINFO Elem_info
[Z_MAXTYPE
] = {"Z_POINT", 1,
459 EINFO Elem_info
[Z_MAXTYPE
] = {"Z_POINT", 1,
489 "Z_NSIDED", 1, /* Not yet implemented */
490 "Z_G_NSIDED",1, /* Not yet implemented */
491 "Z_NFACED", 1, /* Not yet implemented */
492 "Z_G_NFACED",1}; /* Not yet implemented */
498 static int load_fail_defaults(void);
499 static int prelim_info(int *two_fields
, int *any_extra_gui
);
500 static int get_input(int set_server_number
,
502 char playfile
[Z_MAXFILENP
],
506 static int time_info( void );
507 static int part_build_info(int geom_time_step
);
508 static int variable_info( void );
510 #if (defined GT_USERD_API_100)
511 static int gold_part_builder(int geom_time_step
);
512 static int gold_var_loader(int var_time_step
);
514 static int part_builder(int geom_time_step
);
515 static int var_loader(int var_time_step
);
518 #if (defined GT_USERD_API_100)
519 static int materials_info( void );
520 static int gold_materials_loader(int geom_time_step
);
523 static int entity_querys(int var_time_step
);
524 static int exercise_bkup( void );
525 static void usage( void );
532 int main(int argc
, char *argv
[])
534 int main(int argc
, char *argv
[])
537 /* Command line option variables
538 *------------------------------*/
539 int set_server_number
= FALSE
;
540 int use_playfile
= FALSE
;
541 char playfile
[Z_MAXFILENP
];
543 int geom_time_step
= 0;
544 int var_time_step
= 0;
546 /* Other local variables
547 *----------------------*/
551 int any_extra_gui
= FALSE
;
555 /*----------------------------
556 * Command argument processing
557 *----------------------------*/
558 fprintf(stderr
,"\n");
559 fprintf(stderr
,"\n");
560 fprintf(stderr
,"********************************************\n");
561 fprintf(stderr
,"* EnSight User Defined Reader Debug Tool *\n");
562 fprintf(stderr
,"********************************************\n");
563 fprintf(stderr
,"\n");
568 if(!strcmp("-h",argv
[indx
])) {
571 else if(!strcmp("-help",argv
[indx
])) {
575 /* if you want to test the server number routines
578 * > checker -server_number
580 * You will then be prompted for the current and total
582 *-----------------------------------------------*/
583 else if(!strcmp("-server_number",argv
[indx
])) {
584 set_server_number
= TRUE
;
588 /* if you want to use a "playfile" instead of being prompted
589 * for the data loader information
592 * > checker -p <playfile>
594 * This playfile should have 3 [or 4] lines:
597 * line 3: [filename_2] (if two_fields is TRUE)
598 * line 4: 0 or 1, for swapytes (0 is FALSE, 1 is TRUE)
600 * example (two_fields is FALSE, so only 3 lines):
602 * /usr/scratch/stealth/bjn/dat/sp_gold/binary
606 *------------------------------------------------------*/
607 else if(!strcmp("-p",argv
[indx
])) {
609 if((indx
< argc
) && (argv
[indx
][0] != '-')) {
611 memset(playfile
,EOS
,Z_MAXFILENP
);
612 strcpy(playfile
,argv
[indx
]);
619 /* if you want to specify the geometry timestep to test (default is step 0)
624 * Where # is the step number (zero based)
625 *-------------------------------------------------------------------------*/
626 else if(!strcmp("-gts",argv
[indx
])) {
628 if((indx
< argc
) && (argv
[indx
][0] != '-')) {
629 geom_time_step
= atoi(argv
[indx
]);
636 /* if you want to specify the variable timestep to test (default is step 0)
637 * (will use this step for the appropriate timeset of each variable)
642 * Where # is the step number (zero based)
643 *-------------------------------------------------------------------------*/
644 else if(!strcmp("-vts",argv
[indx
])) {
646 if((indx
< argc
) && (argv
[indx
][0] != '-')) {
647 var_time_step
= atoi(argv
[indx
]);
661 /*-------------------------------------------------------------
663 * Now start exercising EnSight
665 *--------------------------------------------------------------*/
670 err
= prelim_info(&two_fields
,&any_extra_gui
);
672 fprintf(stderr
,"Stopping because of error in prelim_info\n");
679 *------------------*/
680 err
= get_input(set_server_number
,
687 fprintf(stderr
,"Stopping because of error in get_input\n");
697 fprintf(stderr
,"Stopping because of error in time_info\n");
705 err
= part_build_info(geom_time_step
);
707 fprintf(stderr
,"Stopping because of error in part_build_info\n");
714 *------------------*/
715 err
= variable_info();
717 fprintf(stderr
,"Stopping because of error in variable_info\n");
722 #if (defined GT_USERD_API_202)
723 /*-------------------
725 *-------------------*/
726 err
= materials_info();
728 fprintf(stderr
,"Stopping because of error in materials_info\n");
733 #if (defined GT_USERD_API_203)
734 if (Z_ERR
== load_fail_defaults()) {
735 fprintf(stderr
,"Stopping due to error in failed element flag routine\n");
740 /*------------------------
741 * Act like building parts
742 *------------------------*/
745 #if (defined GT_USERD_API_100)
746 err
= gold_part_builder(geom_time_step
);
748 err
= part_builder(geom_time_step
);
751 fprintf(stderr
,"Stopping because of error in part_builder\n");
755 USERD_stop_part_building();
760 /*---------------------------
761 * Act like loading variables
762 *---------------------------*/
765 #if (defined GT_USERD_API_100)
766 err
= gold_var_loader(var_time_step
);
768 err
= var_loader(var_time_step
);
771 fprintf(stderr
,"Stopping because of error in var_loader\n");
776 #if (defined GT_USERD_API_202)
777 /*---------------------------
778 * Act like loading materials
779 *---------------------------*/
780 if(Num_materials_sets
> 0) {
781 err
= gold_materials_loader(geom_time_step
);
783 fprintf(stderr
,"Stopping because of error in materials_loader\n");
791 /*----------------------------------------------------
792 * See if can do node and/or element queries over time
793 *----------------------------------------------------*/
796 err
= entity_querys(var_time_step
);
798 fprintf(stderr
,"Stopping because of error in entity_querys\n");
803 /*----------------------------------------
804 * Call the bkup file once in save mode,
805 * then again in restore mode - so someone
806 * could debug if desired
807 *----------------------------------------*/
808 err
= exercise_bkup();
810 fprintf(stderr
,"Stopping due to error in saving and/or restoring archive\n");
817 fprintf(stderr
,"\n----------------- exiting ---------------\n");
819 #if (defined GT_USERD_API_100)
820 USERD_exit_routine();
823 fprintf(stderr
,"\n\n");
832 fprintf(stderr
,"------------------------------------------------------------\n");
833 fprintf(stderr
,"USAGE: checker [-p pfile] [-server_number] [-gts #] [-vts #]\n");
834 fprintf(stderr
,"------------------------------------------------------------\n");
835 fprintf(stderr
," -h, -help Prints out this USAGE text.\n");
836 fprintf(stderr
," -gts # Specify the geometry times step to use.)\n");
837 fprintf(stderr
," -p pfile Plays the checker playfile (pfile).\n");
838 fprintf(stderr
," -server_number Cause servers numbers to be prompted for.\n");
839 fprintf(stderr
," -vts # Specify the variable times step to use.)\n");
840 fprintf(stderr
,"\n");
851 prelim_info(int *two_fields
, int *any_extra_gui
)
854 char reader_name
[Z_MAX_USERD_NAME
];
855 char release_number
[Z_MAX_USERD_NAME
];
856 char description
[Z_MAXFILENP
];
859 *any_extra_gui
= FALSE
;
861 /* Get the reader name
862 *--------------------*/
863 err
= USERD_get_name_of_reader(reader_name
,two_fields
);
865 fprintf(stderr
," Name of reader: %s\n",reader_name
);
867 fprintf(stderr
," two_fields: TRUE\n");
869 else if(*two_fields
==0){
870 fprintf(stderr
," two_fields: FALSE\n");
872 else if(*two_fields
< 0) {
873 fprintf(stderr
," two_fields: -1 (optional string) \n");
877 fprintf(stderr
,"Error: Could not get name of reader\n");
881 /* Get the Extra GUI stuff (optional)
882 * ---------------------------------------------------------- */
885 /* Get the Extra GUI numbers of toggles, pulldowns, & fields
886 * ---------------------------------------------------------- */
888 USERD_get_extra_gui_numbers( &Num_toggles
,
892 if ( Num_toggles
> 0 || Num_pulldowns
> 0 || Num_fields
> 0 ) {
895 *any_extra_gui
= TRUE
;
898 Toggle_title
= (char **) calloc(Num_toggles
,sizeof(char*));
899 if (Toggle_title
== (char **)NULL
) return(Z_ERR
);
900 for (i
=0; i
<Num_toggles
; i
++) {
901 Toggle_title
[i
] = (char *) calloc(Z_LEN_GUI_TITLE_STR
,sizeof(char));
902 if ( Toggle_title
[i
] == (char *)NULL
) return(Z_ERR
);
904 Toggle_default_status
= (int *) calloc(Num_toggles
,sizeof(int));
905 Toggle_choice
= (int *) calloc(Num_toggles
,sizeof(int));
908 if (Num_pulldowns
> 0) {
909 Pulldown_title
= (char **) calloc( Num_pulldowns
, sizeof(char*) );
910 if (Pulldown_title
== (char **)NULL
) return(Z_ERR
);
912 Pulldown_item_strings
= (char ***) calloc( Num_pulldowns
, sizeof(char**) );
913 if (Pulldown_item_strings
== (char ***)NULL
) return(Z_ERR
);
915 for (i
=0; i
<Num_pulldowns
; i
++) {
916 Pulldown_title
[i
] = (char *) calloc( Z_LEN_GUI_TITLE_STR
, sizeof(char) );
917 if ( Pulldown_title
[i
] == (char *)NULL
) return(Z_ERR
);
919 Pulldown_item_strings
[i
] = (char **) calloc( Z_MAX_NUM_GUI_PULL_ITEMS
, sizeof(char *) );
920 if (Pulldown_item_strings
[i
] == (char **)NULL
) return(Z_ERR
);
922 for(j
= 0; j
< Z_MAX_NUM_GUI_PULL_ITEMS
; j
++) {
923 Pulldown_item_strings
[i
][j
] = (char *) calloc( Z_LEN_GUI_PULL_STR
, sizeof(char) );
924 if ( Pulldown_item_strings
[i
][j
] == (char *)NULL
) return(Z_ERR
);
927 Pulldown_number_in_list
= (int *) calloc(Num_pulldowns
,sizeof(int));
928 Pulldown_default_selection
= (int *) calloc(Num_pulldowns
,sizeof(int));
929 Pulldown_choice
= (int *) calloc(Num_pulldowns
,sizeof(int));
932 if (Num_fields
> 0) {
933 Field_title
= (char **) calloc(Num_fields
,sizeof(char*));
934 Field_user_string
= (char **) calloc(Num_fields
,sizeof(char*));
935 if (Field_title
== (char **) NULL
) return(Z_ERR
);
936 for (i
=0; i
<Num_fields
; i
++) {
937 Field_title
[i
] = (char *) calloc(Z_LEN_GUI_TITLE_STR
,sizeof(char));
938 if ( Field_title
[i
] == (char *)NULL
) return(Z_ERR
);
939 Field_user_string
[i
] = (char *) calloc(Z_LEN_GUI_FIELD_STR
,sizeof(char));
940 if ( Field_user_string
[i
] == (char *)NULL
) return(Z_ERR
);
945 err
= USERD_get_extra_gui_defaults(
946 Toggle_title
, /* [num_toggles][Z_LEN_GUI_TITLE_STR] */
947 Toggle_default_status
, /* [num_toggles] */
948 Pulldown_title
, /* [num_pulldowns][Z_LEN_GUI_TITLE_STR] */
949 Pulldown_number_in_list
, /* [num_pulldowns] */
950 Pulldown_default_selection
, /* [num_pulldowns] */
951 Pulldown_item_strings
, /* [num_pulldowns][Z_MAX_NUM_GUI_PULL_ITEMS][Z_LEN_GUI_PULL_STR] */
952 Field_title
, /* [num_fields][Z_LEN_GUI_TITLE_STR] */
953 Field_user_string
/* [num_fields][Z_LEN_GUI_FIELD_STR] */
955 if (Z_ERR
== err
) return(Z_ERR
);
957 fprintf(stderr
,"\n**********************************************\n");
958 fprintf(stderr
,"**** Extra GUI Information ***\n");
959 fprintf(stderr
,"**********************************************\n\n");
961 fprintf(stderr
,"\nTOGGLE INFO: %d active toggles\n",Num_toggles
);
962 for (i
=0; i
<Num_toggles
; i
++) {
963 fprintf(stderr
,"Toggle Title %d : %s\n",i
,Toggle_title
[i
]);
964 fprintf(stderr
,"Default status = %d \n",Toggle_default_status
[i
]);
967 fprintf(stderr
,"\nPULLDOWN INFO: %d active pulldowns\n",Num_pulldowns
);
968 for (i
=0; i
<Num_pulldowns
; i
++) {
969 fprintf(stderr
,"Pulldown Title %d : %s\n", i
, Pulldown_title
[i
] );
970 for (j
=0; j
<Z_MAX_NUM_GUI_PULL_ITEMS
; j
++) {
971 fprintf(stderr
,"Pulldown_item %d : %s\n",j
,Pulldown_item_strings
[i
][j
]);
972 if (strlen(Pulldown_item_strings
[i
][j
]) == 0) {
973 Pulldown_number_in_list
[i
] = j
;
977 fprintf(stderr
,"Number of items in list: %d\n",Pulldown_number_in_list
[i
]);
978 fprintf(stderr
,"Default selection: %d\n\n",Pulldown_default_selection
[i
]);
980 fprintf(stderr
,"\n");
982 fprintf(stderr
,"\nFIELDINFO: %d active fields\n",Num_fields
);
983 for (i
=0; i
<Num_fields
; i
++) {
984 fprintf(stderr
,"Field Title %d : %s\n",i
,Field_title
[i
]);
985 fprintf(stderr
,"Field string %d: %s\n",i
,Field_user_string
[i
]);
987 fprintf(stderr
,"\n\n\n");
993 #if (defined GT_USERD_API_100)
995 /* Get the reader api used
996 *------------------------*/
997 err
= USERD_get_reader_version(Version_number
);
999 fprintf(stderr
," API version: %s\n",Version_number
);
1002 fprintf(stderr
,"Error: Could not get reader api version\n");
1006 /* Get the reader release
1007 *-----------------------*/
1008 err
= USERD_get_reader_release(release_number
);
1010 fprintf(stderr
," Release: %s\n",release_number
);
1013 fprintf(stderr
,"Error: Could not get reader release\n");
1017 fprintf(stderr
," API version: 1.00\n");
1022 /* Get the reader description
1023 *---------------------------*/
1024 err
= USERD_get_reader_descrip(description
);
1026 fprintf(stderr
," Description:\n\n");
1027 fprintf(stderr
,"%s\n\n",description
);
1030 fprintf(stderr
,"Error: Could not get reader description\n");
1034 fprintf(stderr
," Note: Not currently calling USERD_get_reader_descrip\n");
1035 fprintf(stderr
," because it is optional.\n");
1046 get_input(int set_server_number
,
1048 char playfile
[Z_MAXFILENP
],
1059 char the_path
[Z_MAXFILENP
];
1060 char file1
[Z_MAXFILENP
];
1061 char file2
[Z_MAXFILENP
];
1062 char filename_1
[Z_MAXFILENP
];
1063 char filename_2
[Z_MAXFILENP
];
1066 fprintf(stderr
,"\n-------------- get_input ----------------\n");
1068 /*-----------------------------------------------------
1069 * Prompt for the two input values, as the client would
1070 * And set this info for the reader
1071 *-----------------------------------------------------*/
1073 #if (defined GT_USERD_API_100)
1075 /* Set the server number - if command line option to do so
1076 *--------------------------------------------------------*/
1077 if(set_server_number
) {
1078 fprintf(stderr
," Enter total number of servers: ");
1079 scanf("%d",&tot_servers
);
1081 fprintf(stderr
," Enter current server number: ");
1082 scanf("%d",&cur_server
);
1084 fprintf(stderr
," Setting %d of %d for server number\n",cur_server
,tot_servers
);
1085 USERD_set_server_number(cur_server
,tot_servers
);
1089 /* Set the filenames
1090 *------------------*/
1091 memset(the_path
,EOS
,Z_MAXFILENP
);
1092 memset(file1
,EOS
,Z_MAXFILENP
);
1093 memset(file2
,EOS
,Z_MAXFILENP
);
1094 memset(filename_1
,EOS
,Z_MAXFILENP
);
1095 memset(filename_2
,EOS
,Z_MAXFILENP
);
1099 fprintf(stderr
," Enter the path: ");
1100 scanf("%s",the_path
);
1103 fprintf(stderr
," Enter filename_1: ");
1106 if(two_fields
== TRUE
) {
1107 fprintf(stderr
," Enter filename_2: ");
1111 fprintf(stderr
," Enter Swapbytes (0 if FALSE, 1 if TRUE): ");
1112 scanf("%d",swapbytes
);
1114 if (TRUE
== any_extra_gui
) {
1115 fprintf(stderr
,"\n**********************************************\n");
1116 fprintf(stderr
,"**** Extra GUI INPUT ***\n");
1117 fprintf(stderr
,"**********************************************\n\n");
1119 fprintf(stderr
, "\n TOGGLE INPUT \n");
1120 for (i
=0; i
<Num_toggles
; i
++) {
1121 fprintf(stderr
, " Enter Toggle Value for '%s' (1=toggle on, 0=toggle off)\n",Toggle_title
[i
]);
1122 scanf("%d",&Toggle_choice
[i
]);
1124 fprintf(stderr
, "\n PULLDOWN INPUT \n");
1125 for (i
=0; i
<Num_pulldowns
; i
++) {
1126 fprintf(stderr
, "\n PULLDOWN # %d \n",i
);
1127 for (j
= 0; j
<Pulldown_number_in_list
[i
]; j
++) {
1128 fprintf(stderr
, " %d %s\n",j
,Pulldown_item_strings
[i
][j
]);
1130 fprintf(stderr
, " Enter Pulldown Value for '%s' (0 to %d)\n",Pulldown_title
[i
],Pulldown_number_in_list
[i
]-1);
1131 scanf("%d",&Pulldown_choice
[i
]);
1133 fprintf(stderr
, "\n FIELD INPUT \n");
1134 for (i
=0; i
<Num_fields
; i
++) {
1135 fprintf(stderr
, "Enter string for field %d '%s'\n",i
,Field_title
[i
]);
1136 scanf("%s",Field_user_string
[i
]);
1139 } /* end if there is any extra gui stuff */
1140 } /* end if not using playfile */
1142 fplay
= fopen(playfile
,"rb");
1143 if(fplay
== (FILE *)NULL
) {
1144 fprintf(stderr
,"Error: Opening the playfile %s\n",playfile
);
1148 fscanf(fplay
,"%s",the_path
);
1149 fscanf(fplay
,"%s",file1
);
1150 if(two_fields
== TRUE
) {
1151 fscanf(fplay
,"%s",file2
);
1153 fscanf(fplay
,"%d",swapbytes
);
1155 /* ---------------------
1157 * --------------------- */
1158 if (TRUE
== any_extra_gui
) {
1160 for (i
=0; i
<Num_toggles
; i
++) {
1161 fscanf(fplay
,"%d",&Toggle_choice
[i
]);
1164 for (i
=0; i
<Num_pulldowns
; i
++) {
1165 fscanf(fplay
,"%d",&Pulldown_choice
[i
]);
1168 for (i
=0; i
<Num_fields
; i
++) {
1169 fscanf(fplay
,"%s",Field_user_string
[i
]);
1177 /* -------------------------------------------
1178 * set the user choices here and run the code
1179 * ------------------------------------------- */
1181 /* set your choices here
1182 Toggle_choice[0..Num_toggles]
1183 Pulldown_choice[0..Num_pulldowns]
1184 Field_user_string[Num_fields][0..Numfields]
1185 amd then send your choices into this routine */
1187 USERD_set_extra_gui_data(
1188 Toggle_choice
, /* [num_toggle] */
1189 Pulldown_choice
, /* [num_pulldown] */
1190 Field_user_string
); /* [num_fields][Z_LEN_GUI_FIELD_STR] */
1192 for (i
=0; i
<Num_toggles
; i
++) {
1193 fprintf(stderr
,"Toggle Title %d : %s\n",i
,Toggle_title
[i
]);
1194 fprintf(stderr
,"User selection = %d \n",Toggle_choice
[i
]);
1196 fprintf(stderr
,"\n\n");
1198 for (i
=0; i
<Num_pulldowns
; i
++) {
1199 fprintf(stderr
,"Pulldown Title %d : %s\n", i
, Pulldown_title
[i
] );
1200 fprintf(stderr
,"Pulldown selection is # %d : %s\n",Pulldown_choice
[i
],Pulldown_item_strings
[i
][Pulldown_choice
[i
]]);
1203 for (i
=0; i
<Num_fields
; i
++) {
1204 fprintf(stderr
,"Field Title %d : %s\n",i
,Field_title
[i
]);
1205 fprintf(stderr
,"Field string %d: %s\n",i
,Field_user_string
[i
]);
1212 if(strncmp(file1
,"/",1)) {
1213 strcpy(filename_1
,the_path
);
1214 strcat(filename_1
,"/");
1215 strcat(filename_1
,file1
);
1217 if(two_fields
== TRUE
) {
1218 if(strncmp(file2
,"/",1)) {
1219 strcpy(filename_2
,the_path
);
1220 strcat(filename_2
,"/");
1221 strcat(filename_2
,file2
);
1224 if(*swapbytes
== 0) {
1233 fprintf(stderr
," path: %s\n",the_path
);
1234 fprintf(stderr
," filename_1: %s\n",filename_1
);
1235 fprintf(stderr
," filename_2: %s\n",filename_2
);
1237 fprintf(stderr
," Swapbytes: TRUE\n");
1240 fprintf(stderr
," Swapbytes: FALSE\n");
1243 err
= USERD_set_filenames(filename_1
,filename_2
,the_path
,*swapbytes
);
1245 fprintf(stderr
,"Error: Trouble setting the filenames\n");
1264 char ts_desc
[Z_BUFL
];
1266 fprintf(stderr
,"\n-------------- time_info ----------------\n");
1268 #if (defined GT_USERD_API_100)
1270 /* Get the number of timesets
1271 *---------------------------*/
1272 Num_time_sets
= USERD_get_number_of_timesets();
1273 fprintf(stderr
," number of timesets: %d\n",Num_time_sets
);
1274 if(Num_time_sets
== 0) {
1275 fprintf(stderr
," So, static geometry and variables\n");
1279 /* Get the timeset used for the geometry
1280 *--------------------------------------*/
1281 geom_time_set
= USERD_get_geom_timeset_number();
1283 fprintf(stderr
," geom timeset number: %d\n",geom_time_set
);
1284 if(geom_time_set
< 1 && Num_time_sets
> 0) {
1285 fprintf(stderr
,"Error: timeset numbers must be 1 or greater\n");
1286 fprintf(stderr
," (unless Num_time_sets is zero also)\n");
1291 *-----------------*/
1292 for(ts
=1; ts
<=Num_time_sets
; ++ts
) {
1294 fprintf(stderr
," Timeset %d:\n",ts
);
1296 /* Get the timeset descriptions
1297 *-----------------------------*/
1298 err
= USERD_get_timeset_description(ts
,ts_desc
);
1300 fprintf(stderr
,"Error: getting timeset description\n");
1304 fprintf(stderr
," description: %s\n",ts_desc
);
1307 /* Get the number of time steps
1308 *-----------------------------*/
1309 Num_time_steps
= USERD_get_num_of_time_steps(ts
);
1310 fprintf(stderr
," number of time steps: %d\n",Num_time_steps
);
1311 if(Num_time_steps
< 1) {
1312 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
1313 fprintf(stderr
," (Must be >0 to be okay)\n");
1318 /* Get the solution times
1319 *-----------------------*/
1320 if(Num_time_steps
> 0) {
1321 sol_times
= (float *) calloc(Num_time_steps
,sizeof(float));
1322 if(sol_times
== (float *)NULL
) {
1323 fprintf(stderr
,"Error: allocating for solution times\n");
1327 err
= USERD_get_sol_times(ts
,sol_times
);
1329 fprintf(stderr
,"Error: getting solution times\n");
1333 for(i
=0; i
<Num_time_steps
; ++i
) {
1334 fprintf(stderr
," At step %d, time = %f\n",i
,sol_times
[i
]);
1345 /* Get the number of time steps
1346 *-----------------------------*/
1347 Num_time_steps
= USERD_get_number_of_time_steps();
1348 fprintf(stderr
," Nnumber of time steps: %d\n",Num_time_steps
);
1349 if(Num_time_steps
< 1) {
1350 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
1351 fprintf(stderr
," (Must be >0 to be okay)\n");
1356 /* Get the solution times
1357 *-----------------------*/
1358 if(Num_time_steps
> 0) {
1359 sol_times
= (float *) calloc(Num_time_steps
,sizeof(float));
1360 if(sol_times
== (float *)NULL
) {
1361 fprintf(stderr
,"Error: allocating for solution times\n");
1365 err
= USERD_get_solution_times(sol_times
);
1367 fprintf(stderr
,"Error: getting solution times\n");
1371 for(i
=0; i
<Num_time_steps
; ++i
) {
1372 fprintf(stderr
," At step %d, time = %f\n",i
,sol_times
[i
]);
1390 part_build_info(int geom_time_step
)
1395 int num_dataset_files
;
1403 int *number_of_nodes
;
1405 int **ijk_dimensions
;
1406 int **iblanking_options
;
1407 char **part_descriptions
;
1409 int ghosts_in_block
;
1412 int **max_num_elems
;
1413 int **max_ijk_dimensions
;
1417 fprintf(stderr
,"\n------------ part_build_info ------------\n");
1419 #if (defined GT_USERD_API_100)
1421 /* Get the timeset used for the geometry
1422 *--------------------------------------*/
1423 geom_time_set
= USERD_get_geom_timeset_number();
1425 /* Set the timeset and step - to first step
1426 *-----------------------------------------*/
1428 USERD_set_time_set_and_step(geom_time_set
,geom_time_step
);
1432 /* Set the time step - to first step
1433 *----------------------------------*/
1434 USERD_set_time_step(geom_time_step
);
1438 /* Get the changing geometry status
1439 *---------------------------------*/
1440 Geom_status
= USERD_get_changing_geometry_status();
1441 if(Geom_status
== Z_STATIC
) {
1442 fprintf(stderr
," Geom changing status: Z_STATIC\n");
1444 else if(Geom_status
== Z_CHANGE_COORDS
) {
1445 fprintf(stderr
," Geom changing status: Z_CHANGE_COORDS\n");
1447 else if(Geom_status
== Z_CHANGE_CONN
) {
1448 fprintf(stderr
," Geom changing status: Z_CHANGE_CONN\n");
1451 fprintf(stderr
," Invalid Geom changing status!!\n");
1455 /* Get the node label status
1456 *--------------------------*/
1457 Node_labels
= USERD_get_node_label_status();
1459 fprintf(stderr
," Node labels will be provided\n");
1462 fprintf(stderr
," Node labels will NOT be provided\n");
1465 /* Get the element label status
1466 *-----------------------------*/
1467 Element_labels
= USERD_get_element_label_status();
1468 if(Element_labels
) {
1469 fprintf(stderr
," Element labels will be provided\n");
1472 fprintf(stderr
," Element labels will NOT be provided\n");
1475 fprintf(stderr
,"\n");
1477 /* Get the number of files in the dataset
1478 *---------------------------------------*/
1479 num_dataset_files
= USERD_get_number_of_files_in_dataset();
1480 fprintf(stderr
," Number of files in dataset: %d\n",num_dataset_files
);
1483 /* Get the dataset query file info
1484 *--------------------------------*/
1485 if(num_dataset_files
> 0) {
1487 qfiles
= (Z_QFILES
*) calloc(num_dataset_files
,sizeof(Z_QFILES
));
1488 if(qfiles
== (Z_QFILES
*)NULL
) {
1489 fprintf(stderr
,"Error: allocating for dataset query files\n");
1494 for(i
=0; i
<num_dataset_files
; ++i
) {
1495 qfiles
[i
].f_desc
= (char **) calloc(10,sizeof(char *));
1496 if(qfiles
[i
].f_desc
== (char **)NULL
) {
1497 fprintf(stderr
,"Error: allocating for dataset query descrip lines\n");
1501 for(j
=0; j
<10; ++j
) {
1502 qfiles
[i
].f_desc
[j
] = (char *) calloc(Z_MAXFILENP
,sizeof(char));
1503 if(qfiles
[i
].f_desc
[j
] == (char *)NULL
) {
1504 fprintf(stderr
,"Error: allocating for dataset query descrip lines\n");
1511 err
= USERD_get_dataset_query_file_info(qfiles
);
1513 for(fn
=0; fn
<num_dataset_files
; ++fn
) {
1514 fprintf(stderr
," For dataset file %d:\n",fn
);
1516 fprintf(stderr
," name: %s\n",qfiles
[fn
].name
);
1517 fprintf(stderr
," size: %d\n",qfiles
[fn
].sizeb
);
1518 fprintf(stderr
," time: %s\n",qfiles
[fn
].timemod
);
1519 fprintf(stderr
," num desc lines: %d\n",qfiles
[fn
].num_d_lines
);
1520 for(i
=0; i
<qfiles
[fn
].num_d_lines
; ++i
) {
1521 fprintf(stderr
," desc line %d: %s\n",i
,qfiles
[fn
].f_desc
[i
]);
1526 fprintf(stderr
,"Error: getting dataset query info\n");
1531 /* Free allocated memory
1532 *----------------------*/
1533 for(i
=0; i
<num_dataset_files
; ++i
) {
1534 for(j
=0; j
<10; ++j
) {
1535 free(qfiles
[i
].f_desc
[j
]);
1537 free(qfiles
[i
].f_desc
);
1542 fprintf(stderr
,"\n-----------------------------------------\n");
1544 #if (defined GT_USERD_API_100)
1546 /* Get the geometry description lines
1547 *-----------------------------------*/
1548 err
= USERD_get_descrip_lines(Z_GEOM
,0,FALSE
,line1
,line2
);
1550 fprintf(stderr
," Geom Desc line1: %s\n",line1
);
1551 fprintf(stderr
," Geom Desc line2: %s\n",line2
);
1554 fprintf(stderr
,"Error: getting geom description lines\n");
1560 /* Get the geometry description lines
1561 *-----------------------------------*/
1562 err
= USERD_get_description_lines(Z_GEOM
,0,line1
,line2
);
1564 fprintf(stderr
," Geom Desc line1: %s\n",line1
);
1565 fprintf(stderr
," Geom Desc line2: %s\n",line2
);
1568 fprintf(stderr
,"Error: getting geom description lines\n");
1574 /* Get the number of model parts
1575 *------------------------------*/
1576 Num_parts
= USERD_get_number_of_model_parts();
1578 fprintf(stderr
," Number of parts: %d\n",Num_parts
);
1581 fprintf(stderr
," Problems getting number of parts\n");
1587 /* Get the gold part build info
1588 *-----------------------------*/
1589 Pbuild
= (BUILDINFO
*) calloc(Num_parts
,sizeof(BUILDINFO
));
1590 if(Pbuild
== (BUILDINFO
*)NULL
) {
1591 fprintf(stderr
," Problems allocating for Pbuild structure\n");
1596 part_ids
= (int *) calloc(Num_parts
,sizeof(int));
1597 if(part_ids
== (int *)NULL
) {
1598 fprintf(stderr
," Problems allocating for part ids\n");
1602 part_types
= (int *) calloc(Num_parts
,sizeof(int));
1603 if(part_types
== (int *)NULL
) {
1604 fprintf(stderr
," Problems allocating for part types\n");
1608 part_descriptions
= (char **) calloc(Num_parts
,sizeof(char *));
1609 if(part_descriptions
== (char **)NULL
) {
1610 fprintf(stderr
," Problems allocating for part descriptions\n");
1614 for(i
=0; i
<Num_parts
; ++i
) {
1615 part_descriptions
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
1616 if(part_descriptions
[i
] == (char *)NULL
) {
1617 fprintf(stderr
," Problems allocating for part descriptions\n");
1623 number_of_nodes
= (int *) calloc(Num_parts
,sizeof(int));
1624 if(number_of_nodes
== (int *)NULL
) {
1625 fprintf(stderr
," Problems allocating for part number of nodes\n");
1629 num_elems
= (int **) calloc(Num_parts
,sizeof(int *));
1630 if(num_elems
== (int **)NULL
) {
1631 fprintf(stderr
," Problems allocating for part number of elements\n");
1635 for(i
=0; i
<Num_parts
; ++i
) {
1636 num_elems
[i
] = (int *) calloc(Z_MAXTYPE
,sizeof(int));
1637 if(num_elems
[i
] == (int *)NULL
) {
1638 fprintf(stderr
," Problems allocating for part number of elements\n");
1644 ijk_dimensions
= (int **) calloc(Num_parts
,sizeof(int *));
1645 if(ijk_dimensions
== (int **)NULL
) {
1646 fprintf(stderr
," Problems allocating for part ijk dimensions\n");
1651 #if (defined GT_USERD_API_202)
1652 for(i
=0; i
<Num_parts
; ++i
) {
1653 ijk_dimensions
[i
] = (int *) calloc(9,sizeof(int));
1654 if(ijk_dimensions
[i
] == (int *)NULL
) {
1655 fprintf(stderr
," Problems allocating for part ijk dimensions\n");
1659 for(j
=0; j
<9; ++j
) {
1660 ijk_dimensions
[i
][j
] = -1;
1665 for(i
=0; i
<Num_parts
; ++i
) {
1666 ijk_dimensions
[i
] = (int *) calloc(3,sizeof(int));
1667 if(ijk_dimensions
[i
] == (int *)NULL
) {
1668 fprintf(stderr
," Problems allocating for part ijk dimensions\n");
1675 iblanking_options
= (int **) calloc(Num_parts
,sizeof(int *));
1676 if(iblanking_options
== (int **)NULL
) {
1677 fprintf(stderr
," Problems allocating for part iblanking options\n");
1681 for(i
=0; i
<Num_parts
; ++i
) {
1682 iblanking_options
[i
] = (int *) calloc(6,sizeof(int));
1683 if(iblanking_options
[i
] == (int *)NULL
) {
1684 fprintf(stderr
," Problems allocating for part iblanking options\n");
1691 #if (defined GT_USERD_API_100)
1693 err
= USERD_get_gold_part_build_info(part_ids
,
1702 err
= USERD_get_part_build_info(part_ids
,
1712 fprintf(stderr
," Problems getting part build info\n");
1716 for(i
=0; i
<Num_parts
; ++i
) {
1717 fprintf(stderr
," For part %d:\n",i
+1);
1719 fprintf(stderr
," part id: %d\n",part_ids
[i
]);
1720 Pbuild
[i
].id
= part_ids
[i
];
1722 if(part_types
[i
] == Z_UNSTRUCTURED
) {
1723 fprintf(stderr
," part type: Z_UNSTRUCTURED\n");
1725 else if(part_types
[i
] == Z_STRUCTURED
) {
1726 fprintf(stderr
," part type: Z_STRUCTURED\n");
1728 else if(part_types
[i
] == Z_IBLANKED
) {
1729 fprintf(stderr
," part type: Z_IBLANKED\n");
1732 fprintf(stderr
," Invalid part type\n");
1735 Pbuild
[i
].type
= part_types
[i
];
1737 fprintf(stderr
," part desc: %s\n",part_descriptions
[i
]);
1738 strncpy(Pbuild
[i
].desc
,part_descriptions
[i
],Z_BUFL
);
1740 #if (defined GT_USERD_API_100)
1741 fprintf(stderr
," number of nodes : %d\n",number_of_nodes
[i
]);
1742 Pbuild
[i
].nn
= number_of_nodes
[i
];
1744 Pbuild
[i
].nn
= USERD_get_number_of_global_nodes();
1747 for(j
=0; j
<Z_MAXTYPE
; ++j
) {
1748 if(num_elems
[i
][j
] > 0) {
1749 fprintf(stderr
," # %s elements: %d\n",
1750 Elem_info
[j
].name
,num_elems
[i
][j
]);
1751 Pbuild
[i
].ne
[j
] = num_elems
[i
][j
];
1755 if(part_types
[i
] != Z_UNSTRUCTURED
) {
1757 /* For this checker, we will place the following in the
1758 * Pbuild[].ne[] structure:
1760 * Note this is can be used for block size whether ranges or not
1761 * -------------------------------------------------------------
1762 * Pbuild[].ne[0] = i dim of current block (to the range selected)
1763 * Pbuild[].ne[1] = j dim of current block (to the range selected)
1764 * Pbuild[].ne[2] = k dim of current block (to the range selected)
1768 * Pbuild[].ne[3] = i min range (-1 indicates no ranges)
1769 * Pbuild[].ne[4] = i max range
1770 * Pbuild[].ne[5] = i min range
1771 * Pbuild[].ne[6] = i max range
1772 * Pbuild[].ne[7] = i min range
1773 * Pbuild[].ne[8] = i max range
1775 * Pbuild[].ne[9] = i dim of total block (if ranges)
1776 * Pbuild[].ne[10] = j dim of total block (if ranges)
1777 * Pbuild[].ne[11] = k dim of total block (if ranges)
1779 * What comes back from the api is:
1780 * --------------------------------
1781 * before 2.03 (no ranges)
1782 * -----------------------
1783 * ijk_dimensions[][0] = i dim of block
1784 * ijk_dimensions[][1] = j dim of block
1785 * ijk_dimensions[][2] = k dim of block
1787 * at 2.03 (if no ranges)
1789 * ijk_dimensions[][0] = i dim of block
1790 * ijk_dimensions[][1] = j dim of block
1791 * ijk_dimensions[][2] = k dim of block
1792 * ijk_dimensions[][3] = -1
1794 * at 2.03 (if ranges)
1796 * ijk_dimensions[][0] = i dim of total block
1797 * ijk_dimensions[][1] = j dim of total block
1798 * ijk_dimensions[][2] = k dim of total block
1799 * ijk_dimensions[][3] = i min range
1800 * ijk_dimensions[][4] = i max range
1801 * ijk_dimensions[][5] = j min range
1802 * ijk_dimensions[][6] = j max range
1803 * ijk_dimensions[][7] = k min range
1804 * ijk_dimensions[][8] = k max range
1805 *--------------------------------------------------------------*/
1807 #if (defined GT_USERD_API_202)
1808 if(ijk_dimensions
[i
][3] == -1) {
1809 fprintf(stderr
," ijk_dimensions: %d %d %d\n",
1810 ijk_dimensions
[i
][0],
1811 ijk_dimensions
[i
][1],
1812 ijk_dimensions
[i
][2]);
1813 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][0];
1814 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][1];
1815 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][2];
1816 Pbuild
[i
].ne
[3] = ijk_dimensions
[i
][3];
1822 if(ijk_dimensions
[i
][0] == 0 &&
1823 ijk_dimensions
[i
][1] == 0 &&
1824 ijk_dimensions
[i
][2] == 0) {
1825 fprintf(stderr
," ijk_dimensions: %d %d %d\n",
1826 ijk_dimensions
[i
][0],
1827 ijk_dimensions
[i
][1],
1828 ijk_dimensions
[i
][2]);
1829 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][0];
1830 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][1];
1831 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][2];
1832 Pbuild
[i
].ne
[3] = -1;
1838 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][4] - ijk_dimensions
[i
][3] + 1;
1839 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][6] - ijk_dimensions
[i
][5] + 1;
1840 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][8] - ijk_dimensions
[i
][7] + 1;
1842 Pbuild
[i
].ne
[3] = ijk_dimensions
[i
][3];
1843 Pbuild
[i
].ne
[4] = ijk_dimensions
[i
][4];
1844 Pbuild
[i
].ne
[5] = ijk_dimensions
[i
][5];
1845 Pbuild
[i
].ne
[6] = ijk_dimensions
[i
][6];
1846 Pbuild
[i
].ne
[7] = ijk_dimensions
[i
][7];
1847 Pbuild
[i
].ne
[8] = ijk_dimensions
[i
][8];
1849 Pbuild
[i
].ne
[9] = ijk_dimensions
[i
][0];
1850 Pbuild
[i
].ne
[10] = ijk_dimensions
[i
][1];
1851 Pbuild
[i
].ne
[11] = ijk_dimensions
[i
][2];
1853 fprintf(stderr
," Part has ranges:\n");
1854 fprintf(stderr
," ijk dimensions of total block: %d %d %d\n",
1858 fprintf(stderr
," i range: %d to %d\n",
1861 fprintf(stderr
," j range: %d to %d\n",
1864 fprintf(stderr
," k range: %d to %d\n",
1867 fprintf(stderr
," ijk dimensions of range portion: %d %d %d\n",
1874 fprintf(stderr
," ijk_dimensions: %d %d %d\n",
1875 ijk_dimensions
[i
][0],
1876 ijk_dimensions
[i
][1],
1877 ijk_dimensions
[i
][2]);
1878 Pbuild
[i
].ne
[0] = ijk_dimensions
[i
][0];
1879 Pbuild
[i
].ne
[1] = ijk_dimensions
[i
][1];
1880 Pbuild
[i
].ne
[2] = ijk_dimensions
[i
][2];
1881 Pbuild
[i
].ne
[3] = -1;
1883 if(part_types
[i
] == Z_IBLANKED
) {
1884 fprintf(stderr
," Ibanking options on:\n");
1885 if(iblanking_options
[i
][Z_EXT
]) {
1886 fprintf(stderr
," Z_EXT\n");
1888 if(iblanking_options
[i
][Z_INT
]) {
1889 fprintf(stderr
," Z_INT\n");
1891 if(iblanking_options
[i
][Z_BND
]) {
1892 fprintf(stderr
," Z_BND\n");
1894 if(iblanking_options
[i
][Z_INTBND
]) {
1895 fprintf(stderr
," Z_INTBND\n");
1897 if(iblanking_options
[i
][Z_SYM
]) {
1898 fprintf(stderr
," Z_SYM\n");
1906 #if (defined GT_USERD_API_200)
1908 /* Get ghosts in model flag
1909 *-------------------------*/
1910 Ghosts_in_model
= USERD_get_ghosts_in_model_flag();
1911 if(Ghosts_in_model
) {
1912 fprintf(stderr
," Ghosts in Model: TRUE\n");
1915 fprintf(stderr
," Ghosts in Model: FALSE\n");
1918 /* Get ghosts in block flag - if needed
1919 *-------------------------------------*/
1920 for(i
=1; i
<=Num_parts
; ++i
) {
1921 if(part_types
[i
-1] != Z_UNSTRUCTURED
&& Ghosts_in_model
) {
1922 ghosts_in_block
= USERD_get_ghosts_in_block_flag(i
);
1923 Pbuild
[i
-1].ghosts
= ghosts_in_block
;
1924 if(ghosts_in_block
) {
1925 fprintf(stderr
," Ghosts in block part %d: TRUE\n",i
);
1928 fprintf(stderr
," Ghosts in block part %d: FALSE\n",i
);
1936 #if (defined GT_USERD_API_100)
1939 *-----------------*/
1940 max_num_nodes
= (int *) calloc(Num_parts
,sizeof(int));
1941 if(max_num_nodes
== (int *)NULL
) {
1942 fprintf(stderr
," Problems allocating for part max num of nodes\n");
1946 max_num_elems
= (int **) calloc(Num_parts
,sizeof(int *));
1947 if(max_num_elems
== (int **)NULL
) {
1948 fprintf(stderr
," Problems allocating for part max num of elements\n");
1952 for(i
=0; i
<Num_parts
; ++i
) {
1953 max_num_elems
[i
] = (int *) calloc(Z_MAXTYPE
,sizeof(int));
1954 if(max_num_elems
[i
] == (int *)NULL
) {
1955 fprintf(stderr
," Problems allocating for part max_num of elements\n");
1961 max_ijk_dimensions
= (int **) calloc(Num_parts
,sizeof(int *));
1962 if(max_ijk_dimensions
== (int **)NULL
) {
1963 fprintf(stderr
," Problems allocating for part max ijk dimensions\n");
1967 for(i
=0; i
<Num_parts
; ++i
) {
1968 max_ijk_dimensions
[i
] = (int *) calloc(3,sizeof(int));
1969 if(max_ijk_dimensions
[i
] == (int *)NULL
) {
1970 fprintf(stderr
," Problems allocating for part max ijk dimensions\n");
1976 err
= USERD_get_maxsize_info(max_num_nodes
,
1978 max_ijk_dimensions
);
1980 fprintf(stderr
," No maxsize info provided (or error getting them)\n");
1984 for(i
=0; i
<Num_parts
; ++i
) {
1985 fprintf(stderr
," For part %d:\n",i
+1);
1987 fprintf(stderr
," max number of nodes : %d\n",max_num_nodes
[i
]);
1989 for(j
=0; j
<Z_MAXTYPE
; ++j
) {
1990 if(max_num_elems
[i
][j
] > 0) {
1991 fprintf(stderr
," max # %s elems: %d\n",
1992 Elem_info
[j
].name
,max_num_elems
[i
][j
]);
1996 if(part_types
[i
] != Z_UNSTRUCTURED
) {
1997 fprintf(stderr
," max_ijk_dimensions: %d %d %d\n",
1998 max_ijk_dimensions
[i
][0],
1999 max_ijk_dimensions
[i
][1],
2000 max_ijk_dimensions
[i
][2]);
2005 /* Get model extents - if given
2006 *-----------------------------*/
2007 err
= USERD_get_model_extents(extents
);
2009 fprintf(stderr
," No extents given\n");
2012 fprintf(stderr
," Min x: %g\n",extents
[0]);
2013 fprintf(stderr
," Max x: %g\n",extents
[1]);
2014 fprintf(stderr
," Min y: %g\n",extents
[2]);
2015 fprintf(stderr
," Max y: %g\n",extents
[3]);
2016 fprintf(stderr
," Min z: %g\n",extents
[4]);
2017 fprintf(stderr
," Max z: %g\n",extents
[5]);
2022 /* Free the allocated memory
2023 *--------------------------*/
2026 free(number_of_nodes
);
2028 for(i
=0; i
<Num_parts
; ++i
) {
2029 free(ijk_dimensions
[i
]);
2031 free(part_descriptions
[i
]);
2033 free(ijk_dimensions
);
2035 free(iblanking_options
);
2036 free(part_descriptions
);
2038 #if (defined GT_USERD_API_100)
2039 for(i
=0; i
<Num_parts
; ++i
) {
2040 free(max_ijk_dimensions
[i
]);
2041 free(max_num_elems
[i
]);
2043 free(max_num_nodes
);
2044 free(max_num_elems
);
2045 free(max_ijk_dimensions
);
2057 variable_info( void )
2062 char **var_description
;
2063 char **var_filename
;
2067 char **var_ifilename
;
2073 fprintf(stderr
,"\n------------ variable_info --------------\n");
2075 /* Get the number of variables
2076 *----------------------------*/
2077 Num_vars
= USERD_get_number_of_variables();
2079 fprintf(stderr
,"Error: getting the number of variables\n");
2082 fprintf(stderr
," Number of variables: %d\n",Num_vars
);
2086 /* Get the gold variable info
2087 *---------------------------*/
2088 Varinfo
= (VARINFO
*) calloc(Num_vars
,sizeof(VARINFO
));
2089 if(Varinfo
== (VARINFO
*)NULL
) {
2090 fprintf(stderr
," Problems allocating for Varinfo structure\n");
2095 var_description
= (char **) calloc(Num_vars
,sizeof(char *));
2096 if(var_description
== (char **)NULL
) {
2097 fprintf(stderr
," Problems allocating for var description\n");
2101 for(i
=0; i
<Num_vars
; ++i
) {
2102 var_description
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
2103 if(var_description
[i
] == (char *)NULL
) {
2104 fprintf(stderr
," Problems allocating for var description\n");
2110 var_filename
= (char **) calloc(Num_vars
,sizeof(char *));
2111 if(var_filename
== (char **)NULL
) {
2112 fprintf(stderr
," Problems allocating for var filename\n");
2116 for(i
=0; i
<Num_vars
; ++i
) {
2117 var_filename
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
2118 if(var_filename
[i
] == (char *)NULL
) {
2119 fprintf(stderr
," Problems allocating for var filename\n");
2125 var_type
= (int *) calloc(Num_vars
,sizeof(int));
2126 if(var_type
== (int *)NULL
) {
2127 fprintf(stderr
," Problems allocating for var type\n");
2131 var_classify
= (int *) calloc(Num_vars
,sizeof(int));
2132 if(var_classify
== (int *)NULL
) {
2133 fprintf(stderr
," Problems allocating for var classify\n");
2137 var_complex
= (int *) calloc(Num_vars
,sizeof(int));
2138 if(var_complex
== (int *)NULL
) {
2139 fprintf(stderr
," Problems allocating for var complex\n");
2144 var_ifilename
= (char **) calloc(Num_vars
,sizeof(char *));
2145 if(var_ifilename
== (char **)NULL
) {
2146 fprintf(stderr
," Problems allocating for var ifilename\n");
2150 for(i
=0; i
<Num_vars
; ++i
) {
2151 var_ifilename
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
2152 if(var_ifilename
[i
] == (char *)NULL
) {
2153 fprintf(stderr
," Problems allocating for var ifilename\n");
2159 var_freq
= (float *) calloc(Num_vars
,sizeof(float));
2160 if(var_freq
== (float *)NULL
) {
2161 fprintf(stderr
," Problems allocating for var freq\n");
2165 var_contran
= (int *) calloc(Num_vars
,sizeof(int));
2166 if(var_contran
== (int *)NULL
) {
2167 fprintf(stderr
," Problems allocating for var contran\n");
2171 var_timeset
= (int *) calloc(Num_vars
,sizeof(int));
2172 if(var_timeset
== (int *)NULL
) {
2173 fprintf(stderr
," Problems allocating for var timeset\n");
2177 #if (defined GT_USERD_API_100)
2179 err
= USERD_get_gold_variable_info(var_description
,
2190 err
= USERD_get_variable_info(var_description
,
2198 fprintf(stderr
,"Error: getting variable info\n");
2201 for(i
=0; i
<Num_vars
; ++i
) {
2203 /* Loading the global
2204 * (for use in other routines)
2205 *----------------------------*/
2206 strncpy(Varinfo
[i
].description
,var_description
[i
],Z_BUFL
);
2207 strncpy(Varinfo
[i
].filename
,var_filename
[i
],Z_BUFL
);
2208 strncpy(Varinfo
[i
].ifilename
,var_ifilename
[i
],Z_BUFL
);
2209 Varinfo
[i
].type
= var_type
[i
];
2210 Varinfo
[i
].classify
= var_classify
[i
];
2211 Varinfo
[i
].complex = var_complex
[i
];
2212 Varinfo
[i
].freq
= var_freq
[i
];
2213 Varinfo
[i
].contran
= var_contran
[i
];
2214 Varinfo
[i
].timeset
= var_timeset
[i
];
2216 /* Echo some feedback
2217 *-------------------*/
2218 fprintf(stderr
," For Variable %d:\n",i
+1);
2220 fprintf(stderr
," var desc: %s\n",var_description
[i
]);
2221 fprintf(stderr
," var filename: %s\n",var_filename
[i
]);
2223 #if (defined GT_USERD_API_100)
2224 if(var_complex
[i
]) {
2225 fprintf(stderr
," var complex: TRUE\n");
2226 fprintf(stderr
," var ifilename: %s\n",var_ifilename
[i
]);
2227 fprintf(stderr
," var freq: %g\n",var_freq
[i
]);
2230 fprintf(stderr
," var complex: FALSE\n");
2234 if(var_type
[i
] == Z_CONSTANT
) {
2235 fprintf(stderr
," var type: Z_CONSTANT\n");
2237 #if (defined GT_USERD_API_100)
2238 if(var_contran
[i
]) {
2239 fprintf(stderr
," var contran: TRUE\n");
2242 fprintf(stderr
," var contran: FALSE\n");
2247 else if(var_type
[i
] == Z_SCALAR
) {
2248 fprintf(stderr
," var type: Z_SCALAR\n");
2250 else if(var_type
[i
] == Z_VECTOR
) {
2251 fprintf(stderr
," var type: Z_VECTOR\n");
2253 else if(var_type
[i
] == Z_TENSOR
) {
2254 fprintf(stderr
," var type: Z_TENSOR\n");
2256 else if(var_type
[i
] == Z_TENSOR9
) {
2257 fprintf(stderr
," var type: Z_TENSOR9\n");
2260 fprintf(stderr
," Invalid var type\n");
2264 if(var_classify
[i
] == Z_PER_NODE
) {
2265 fprintf(stderr
," var classify: Z_PER_NODE\n");
2267 else if(var_classify
[i
] == Z_PER_ELEM
) {
2268 fprintf(stderr
," var classify: Z_PER_ELEM\n");
2270 else if(var_classify
[i
] != Z_CONSTANT
) {
2271 fprintf(stderr
," Invalid var classify\n");
2275 #if (defined GT_USERD_API_100)
2276 fprintf(stderr
," var timeset: %d\n",var_timeset
[i
]);
2281 /* Free the allocated memory
2282 *--------------------------*/
2283 for(i
=0; i
<Num_vars
; ++i
) {
2284 free(var_description
[i
]);
2285 free(var_filename
[i
]);
2286 free(var_ifilename
[i
]);
2288 free(var_description
);
2290 free(var_ifilename
);
2302 #if (defined GT_USERD_API_100)
2303 /*------------------
2305 *------------------*/
2307 gold_part_builder(int geom_time_step
)
2309 int i
, j
, k
, jj
, kk
;
2330 int num_elems
[Z_MAXTYPE
];
2343 int *fail_flags
= (int *) NULL
;
2345 fprintf(stderr
,"\n------------- part_builder --------------\n");
2347 if(Num_time_sets
> 0) {
2348 /* Get the timeset used for the geometry
2349 *--------------------------------------*/
2350 geom_timeset
= USERD_get_geom_timeset_number();
2352 /* Get the number of time steps for this timeset
2353 *----------------------------------------------*/
2354 Num_time_steps
= USERD_get_num_of_time_steps(geom_timeset
);
2355 if(Num_time_steps
< 1) {
2356 fprintf(stderr
," Error: Number of time steps returned: %d\n",Num_time_steps
);
2357 fprintf(stderr
," (Must be >0 to be okay)\n");
2360 if(geom_time_step
> (Num_time_steps
- 1)) {
2361 geom_time_step
= Num_time_steps
- 1;
2364 /* Set the timeset and step - to first step by default, but
2365 * can set it at others using -gts command argument
2366 *---------------------------------------------------------*/
2367 USERD_set_time_set_and_step(geom_timeset
,geom_time_step
);
2369 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
2370 geom_timeset
,0,Num_time_steps
-1);
2371 fprintf(stderr
," Using time step: %d\n",geom_time_step
);
2374 for(p
=0; p
<Num_parts
; ++p
) {
2377 fprintf(stderr
,"\n\n----------------------------------------");
2378 fprintf(stderr
," Part %d:\n",pn
);
2380 /*-----------------------
2381 * For unstructured parts
2382 *-----------------------*/
2383 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
2385 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
2386 ne
= Pbuild
[p
].ne
[et
];
2390 pdata
= (int *)calloc(ne
*Elem_info
[et
].con_len
,sizeof(int));
2391 if(pdata
== (int *) NULL
) {
2392 fprintf(stderr
,"Error: allocating conns array\n");
2396 conns
= (int **) calloc(ne
,sizeof(int *));
2397 if(conns
== (int **) NULL
) {
2398 fprintf(stderr
,"Error: allocating conns array\n");
2401 for(i
=0; i
<ne
; ++i
) {
2403 pdata
+= Elem_info
[et
].con_len
;
2409 *-----------------*/
2410 err
= USERD_get_part_elements_by_type(pn
,et
,conns
);
2412 fprintf(stderr
,"Error: getting element connectivities\n");
2416 if(Element_labels
) {
2417 elemids
= (int *) calloc(ne
,sizeof(int));
2418 if(elemids
== (int *) NULL
) {
2419 fprintf(stderr
,"Error: allocating elemids array\n");
2424 /* Get the element ids - if any
2425 *-----------------------------*/
2426 if(Element_labels
) {
2427 err
= USERD_get_part_element_ids_by_type(pn
,et
,elemids
);
2429 fprintf(stderr
,"Error: getting element ids\n");
2435 *-----------------*/
2437 #if (defined GT_USERD_API_202)
2439 maxcheck
= Z_NSIDED
;
2441 /* Nsided elements, if any
2442 *------------------------*/
2443 if(et
== Z_NSIDED
||
2447 for(i
=0; i
<ne
; ++i
) {
2448 nsid_len
+= conns
[i
][0];
2451 nsid_con
= (int *) calloc(nsid_len
,sizeof(int));
2452 if(nsid_con
== (int *) NULL
) {
2453 fprintf(stderr
,"Error: allocating nsided conn array\n");
2457 err
= USERD_get_nsided_conn(pn
,nsid_con
);
2459 fprintf(stderr
,"Error: getting nsided conn array\n");
2463 /* First element of the type
2464 *--------------------------*/
2466 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2467 if(Element_labels
) {
2468 fprintf(stderr
," id: %d\n",elemids
[i
]);
2470 fprintf(stderr
," connectivity:");
2471 for(j
=0; j
<conns
[i
][0]; ++j
) {
2472 fprintf(stderr
," %d",nsid_con
[j
]);
2474 fprintf(stderr
,"\n");
2476 /* Last element of the type
2477 *-------------------------*/
2480 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2481 if(Element_labels
) {
2482 fprintf(stderr
," id: %d\n",elemids
[i
]);
2484 fprintf(stderr
," connectivity:");
2486 for(j
=nsid_len
-conns
[i
][0]; j
<nsid_len
; ++j
) {
2487 fprintf(stderr
," %d",nsid_con
[j
]);
2489 fprintf(stderr
,"\n");
2493 /* Nfaced elements if any
2494 *-----------------------*/
2495 if(et
== Z_NFACED
||
2499 for(i
=0; i
<ne
; ++i
) {
2500 nface_len
+= conns
[i
][0];
2503 nface_con
= (int *) calloc(nface_len
,sizeof(int));
2504 if(nface_con
== (int *) NULL
) {
2505 fprintf(stderr
,"Error: allocating nfaced face array\n");
2509 err
= USERD_get_nfaced_nodes_per_face(pn
,nface_con
);
2511 fprintf(stderr
,"Error: getting nfaced face array array\n");
2516 for(i
=0; i
<nface_len
; ++i
) {
2517 npf_len
+= nface_con
[i
];
2520 npf_con
= (int *) calloc(npf_len
,sizeof(int));
2521 if(npf_con
== (int *) NULL
) {
2522 fprintf(stderr
,"Error: allocating nfaced npf array\n");
2526 err
= USERD_get_nfaced_conn(pn
,npf_con
);
2528 fprintf(stderr
,"Error: getting nfaced conn array\n");
2532 /* First element of the type
2533 *--------------------------*/
2536 for(i
=0; i
<ne
; ++i
) {
2540 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,
2542 if(Element_labels
) {
2543 fprintf(stderr
," id: %d\n",elemids
[i
]);
2545 for(j
=0; j
<conns
[i
][0]; ++j
) {
2546 fprintf(stderr
," face %d connectivity:",j
+1);
2547 for(k
=0; k
<nface_con
[jj
]; ++k
) {
2548 fprintf(stderr
," %d",npf_con
[kk
]);
2551 fprintf(stderr
,"\n");
2556 for(j
=0; j
<conns
[i
][0]; ++j
) {
2557 for(k
=0; k
<nface_con
[jj
]; ++k
) {
2567 maxcheck
= Z_MAXTYPE
;
2572 *-----------------*/
2575 /* First element of the type
2576 *--------------------------*/
2578 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2579 if(Element_labels
) {
2580 fprintf(stderr
," id: %d\n",elemids
[i
]);
2582 fprintf(stderr
," connectivity:");
2583 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
2584 fprintf(stderr
," %d",conns
[i
][j
]);
2586 fprintf(stderr
,"\n");
2588 /* check the connectivity for negative numbers
2589 * -------------------------------------------*/
2590 #if defined GT_USERD_API_100
2592 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
2593 /* ---------- uncomment to print out connectivity values ---------- */
2594 /* fprintf(stderr," %d",conns[i][j]); */
2595 if (conns
[i
][j
] <= 0 || conns
[i
][j
] > Pbuild
[p
].nn
) {
2596 fprintf(stderr
,"\n****************************\n");
2597 fprintf(stderr
,"Connectivity value out of bounds: \n");
2598 fprintf(stderr
,"Either less than zero or greater than \n");
2599 fprintf(stderr
," number of nodes in part!! \n");
2600 fprintf(stderr
,"i = %d j = %d conns[i][j] = %d \n",i
,j
,conns
[i
][j
]);
2601 fprintf(stderr
,"****************************\n");
2604 /* ---------- uncomment to print out connectivity values ---------- */
2605 /* fprintf(stderr,"\n"); */
2608 /* Last element of the type
2609 *-------------------------*/
2612 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
2613 if(Element_labels
) {
2614 fprintf(stderr
," id: %d\n",elemids
[i
]);
2616 fprintf(stderr
," connectivity:");
2617 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
2618 fprintf(stderr
," %d",conns
[i
][j
]);
2620 fprintf(stderr
,"\n");
2624 /* Free the allocated memory
2625 *--------------------------*/
2627 if(NULL
!= *conns
) {
2635 if(Element_labels
) {
2647 coords
= (float **) calloc(3,sizeof(float *));
2648 if(coords
== (float **) NULL
) {
2649 fprintf(stderr
,"Error: allocating coords array\n");
2653 for(i
=0; i
<3; ++i
) {
2654 coords
[i
] = (float *) calloc((nn
+1),sizeof(float));
2655 if(coords
[i
] == (float *) NULL
) {
2656 fprintf(stderr
,"Error: allocating coords array\n");
2663 nodeids
= (int *) calloc((nn
+1),sizeof(int));
2664 if(nodeids
== (int *) NULL
) {
2665 fprintf(stderr
,"Error: allocating nodeids array\n");
2671 err
= USERD_get_part_coords(pn
,coords
);
2673 fprintf(stderr
,"Error: getting unstructured coords\n");
2678 err
= USERD_get_part_node_ids(pn
,nodeids
);
2680 fprintf(stderr
,"Error: getting nodeids\n");
2686 *-----------------*/
2691 fprintf(stderr
," Node %d of %d:\n",i
,nn
);
2693 fprintf(stderr
," id: %d\n",nodeids
[i
]);
2695 fprintf(stderr
," x y z coordinates: %g %g %g\n",
2696 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
2697 mm
[0] = mm
[1] = coords
[0][i
];
2698 mm
[2] = mm
[3] = coords
[1][i
];
2699 mm
[4] = mm
[5] = coords
[2][i
];
2706 fprintf(stderr
," Node %d of %d:\n",i
,nn
);
2708 fprintf(stderr
," id: %d\n",nodeids
[i
]);
2710 fprintf(stderr
," x y z coordinates: %g %g %g\n",
2711 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
2714 /* Min and max coordinate values
2715 *------------------------------*/
2716 for(i
=2; i
<=nn
; ++i
) {
2717 if(coords
[0][i
] < mm
[0]) {
2718 mm
[0] = coords
[0][i
];
2720 if(coords
[0][i
] > mm
[1]) {
2721 mm
[1] = coords
[0][i
];
2723 if(coords
[1][i
] < mm
[2]) {
2724 mm
[2] = coords
[1][i
];
2726 if(coords
[1][i
] > mm
[3]) {
2727 mm
[3] = coords
[1][i
];
2729 if(coords
[2][i
] < mm
[4]) {
2730 mm
[4] = coords
[2][i
];
2732 if(coords
[2][i
] > mm
[5]) {
2733 mm
[5] = coords
[2][i
];
2737 fprintf(stderr
," Coordinate ranges:\n");
2738 fprintf(stderr
," min x: %g\n",mm
[0]);
2739 fprintf(stderr
," max x: %g\n",mm
[1]);
2740 fprintf(stderr
," min y: %g\n",mm
[2]);
2741 fprintf(stderr
," max y: %g\n",mm
[3]);
2742 fprintf(stderr
," min z: %g\n",mm
[4]);
2743 fprintf(stderr
," max z: %g\n",mm
[5]);
2746 /* Free the allocated memory
2747 *--------------------------*/
2748 for(i
=0; i
<3; ++i
) {
2759 /*---------------------
2760 * For structured parts
2761 *---------------------*/
2765 if(Pbuild
[p
].ne
[0] == 0 &&
2766 Pbuild
[p
].ne
[1] == 0 &&
2767 Pbuild
[p
].ne
[2] == 0) {
2773 /* Get the block coords
2774 *---------------------*/
2775 for(comp
=0; comp
<3; ++comp
) {
2776 if(Pbuild
[p
].ne
[comp
] < 1) {
2780 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
2783 nn
= bdim
[0] * bdim
[1] * bdim
[2];
2797 ne
= bd1
* bd2
* bd3
;
2799 /* Determine cell type
2800 *--------------------*/
2802 for(i
=0; i
<3; ++i
) {
2808 cell_type
= Z_HEX08
;
2810 else if(num_dims
== 2) {
2811 cell_type
= Z_QUA04
;
2814 cell_type
= Z_BAR02
;
2817 coords
= (float **) calloc(num_dims
,sizeof(float *));
2818 if(coords
== (float **) NULL
) {
2819 fprintf(stderr
,"Error: allocating coords array\n");
2823 for(i
=0; i
<num_dims
; ++i
) {
2824 coords
[i
] = (float *) calloc(nn
,sizeof(float));
2825 if(coords
[i
] == (float *) NULL
) {
2826 fprintf(stderr
,"Error: allocating coords array\n");
2834 for(comp
=0; comp
<num_dims
; ++comp
) {
2835 err
= USERD_get_block_coords_by_component(pn
,comp
,coords
[comp
]);
2837 fprintf(stderr
,"Error: getting block coords\n");
2843 #if (defined GT_USERD_API_200)
2846 nodeids
= (int *) calloc(nn
,sizeof(int));
2847 if(nodeids
== (int *) NULL
) {
2848 fprintf(stderr
,"Error: allocating nodeids array\n");
2852 /* Get the node ids - if any
2853 *--------------------------*/
2855 err
= USERD_get_part_node_ids(pn
,nodeids
);
2857 fprintf(stderr
,"Error: getting nodeids\n");
2864 *-----------------*/
2870 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
2872 #if (defined GT_USERD_API_200)
2875 fprintf(stderr
," id: %d\n",nodeids
[i
]);
2879 fprintf(stderr
," x y z coordinates: %g %g %g\n",
2880 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
2881 mm
[0] = mm
[1] = coords
[0][i
];
2882 mm
[2] = mm
[3] = coords
[1][i
];
2883 mm
[4] = mm
[5] = coords
[2][i
];
2885 else if(num_dims
== 2) {
2886 fprintf(stderr
," x y coordinates: %g %g\n",
2887 coords
[0][i
], coords
[1][i
]);
2888 mm
[0] = mm
[1] = coords
[0][i
];
2889 mm
[2] = mm
[3] = coords
[1][i
];
2892 fprintf(stderr
," x coordinates: %g\n",
2894 mm
[0] = mm
[1] = coords
[0][i
];
2902 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
2904 #if (defined GT_USERD_API_200)
2906 fprintf(stderr
," id: %d\n",nodeids
[i
]);
2910 fprintf(stderr
," x y z coordinates: %g %g %g\n",
2911 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
2913 else if(num_dims
== 2) {
2914 fprintf(stderr
," x y coordinates: %g %g\n",
2915 coords
[0][i
], coords
[1][i
]);
2918 fprintf(stderr
," x coordinates: %g\n",
2924 /* Min and max coordinate values
2925 *------------------------------*/
2926 for(i
=1; i
<nn
; ++i
) {
2927 if(coords
[0][i
] < mm
[0]) {
2928 mm
[0] = coords
[0][i
];
2930 if(coords
[0][i
] > mm
[1]) {
2931 mm
[1] = coords
[0][i
];
2934 if(coords
[1][i
] < mm
[2]) {
2935 mm
[2] = coords
[1][i
];
2937 if(coords
[1][i
] > mm
[3]) {
2938 mm
[3] = coords
[1][i
];
2942 if(coords
[2][i
] < mm
[4]) {
2943 mm
[4] = coords
[2][i
];
2945 if(coords
[2][i
] > mm
[5]) {
2946 mm
[5] = coords
[2][i
];
2951 fprintf(stderr
," Coordinate ranges:\n");
2952 fprintf(stderr
," min x: %g\n",mm
[0]);
2953 fprintf(stderr
," max x: %g\n",mm
[1]);
2955 fprintf(stderr
," min y: %g\n",mm
[2]);
2956 fprintf(stderr
," max y: %g\n",mm
[3]);
2959 fprintf(stderr
," min z: %g\n",mm
[4]);
2960 fprintf(stderr
," max z: %g\n",mm
[5]);
2963 /* Free the allocated memory - so far
2964 *-----------------------------------*/
2965 for(i
=0; i
<num_dims
; ++i
) {
2970 #if (defined GT_USERD_API_200)
2976 /* Get the block iblanking - if any
2977 *---------------------------------*/
2978 if(Pbuild
[p
].type
== Z_IBLANKED
) {
2980 iblanking
= (int *) calloc(nn
,sizeof(int));
2981 if(iblanking
== (int *) NULL
) {
2982 fprintf(stderr
,"Error: allocating iblanking array\n");
2986 err
= USERD_get_block_iblanking(pn
,iblanking
);
2988 fprintf(stderr
,"Error: getting block iblanking\n");
2993 *-----------------*/
3000 for(i
=0; i
<nn
; ++i
) {
3004 fprintf(stderr
," Iblanking breakdown:\n");
3005 fprintf(stderr
," Number of Z_EXT: %d\n",ib
[Z_EXT
]);
3006 fprintf(stderr
," Number of Z_INT: %d\n",ib
[Z_INT
]);
3007 fprintf(stderr
," Number of Z_BND: %d\n",ib
[Z_BND
]);
3008 fprintf(stderr
," Number of Z_INTBND: %d\n",ib
[Z_INTBND
]);
3009 fprintf(stderr
," Number of Z_SYM: %d\n",ib
[Z_SYM
]);
3014 #if (defined GT_USERD_API_200)
3016 /* Get the ghost flags - if any
3017 *-----------------------------*/
3018 if(Pbuild
[p
].ghosts
) {
3020 ghost_flag
= (int *) calloc(ne
,sizeof(int));
3021 if(ghost_flag
== (int *) NULL
) {
3022 fprintf(stderr
,"Error: allocating ghost_flag array\n");
3026 err
= USERD_get_block_ghost_flags(pn
,ghost_flag
);
3028 fprintf(stderr
,"Error: getting block ghost flags\n");
3033 *-----------------*/
3036 for(i
=0; i
<ne
; ++i
) {
3037 if(ghost_flag
[i
] > 0) {
3042 fprintf(stderr
," Block Ghost flag breakdown:\n");
3043 fprintf(stderr
," %d ghost cells out of %d total cells\n",
3049 /* Get the element ids - if any
3050 *-----------------------------*/
3051 if(Element_labels
) {
3053 elemids
= (int *) calloc(ne
,sizeof(int));
3054 if(elemids
== (int *) NULL
) {
3055 fprintf(stderr
,"Error: allocating elemids array\n");
3061 err
= USERD_get_part_element_ids_by_type(pn
,et
,elemids
);
3063 fprintf(stderr
,"Error: getting element ids\n");
3067 /* First element of the type
3068 *--------------------------*/
3070 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
3071 fprintf(stderr
," id: %d\n",elemids
[i
]);
3073 /* Last element of the type
3074 *-------------------------*/
3077 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
3078 fprintf(stderr
," id: %d\n",elemids
[i
]);
3086 fprintf(stderr
," Empty structured part\n");
3090 /* Get border availability
3091 *------------------------*/
3092 err
= USERD_get_border_availability(pn
,num_elems
);
3095 /* Get border elements - if any
3096 *-----------------------------*/
3097 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
3101 conns
= (int **) calloc(ne
,sizeof(int *));
3102 if(conns
== (int **) NULL
) {
3103 fprintf(stderr
,"Error: allocating border conns array\n");
3107 for(i
=0; i
<ne
; ++i
) {
3108 conns
[i
] = (int *) calloc(Elem_info
[et
].con_len
,sizeof(int));
3109 if(conns
[i
] == (int *) NULL
) {
3110 fprintf(stderr
,"Error: allocating border conns array\n");
3116 parent_type
= (short *) calloc(ne
,sizeof(short));
3117 if(parent_type
== (short *) NULL
) {
3118 fprintf(stderr
,"Error: allocating border parent_type array\n");
3122 parent_num
= (int *) calloc(ne
,sizeof(int));
3123 if(parent_num
== (int *) NULL
) {
3124 fprintf(stderr
,"Error: allocating border parent_num array\n");
3129 err
= USERD_get_border_elements_by_type(pn
,
3135 fprintf(stderr
,"Error: getting border elements\n");
3141 *-----------------*/
3143 /* First element of the type
3144 *--------------------------*/
3146 fprintf(stderr
," %s border element %d of %d:\n",
3147 Elem_info
[et
].name
,i
+1,ne
);
3148 fprintf(stderr
," Parent type: %s\n",
3149 Elem_info
[parent_type
[i
]].name
);
3150 fprintf(stderr
," Parent num: %d\n",parent_num
[i
]);
3151 fprintf(stderr
," connectivity:");
3152 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
3153 fprintf(stderr
," %d",conns
[i
][j
]);
3155 fprintf(stderr
,"\n");
3157 /* Last element of the type
3158 *-------------------------*/
3161 fprintf(stderr
," %s border element %d of %d:\n",
3162 Elem_info
[et
].name
,i
+1,ne
);
3163 fprintf(stderr
," Parent type: %s\n",
3164 Elem_info
[parent_type
[i
]].name
);
3165 fprintf(stderr
," Parent num: %d\n",parent_num
[i
]);
3166 fprintf(stderr
," connectivity:");
3167 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
3168 fprintf(stderr
," %d",conns
[i
][j
]);
3170 fprintf(stderr
,"\n");
3174 /* Free the allocated memory
3175 *--------------------------*/
3176 for(i
=0; i
<ne
; ++i
) {
3185 } /* end for p = 0 to Num_parts */
3195 gold_var_loader(int var_time_step
)
3218 fprintf(stderr
,"\n--------------- var_loader --------------\n");
3220 for(v
=0; v
<Num_vars
; ++v
) {
3224 fprintf(stderr
,"\n");
3226 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
3227 fprintf(stderr
," Z_PER_NODE Variable %d:\n",vn
);
3230 fprintf(stderr
," Z_PER_ELEM Variable %d:\n",vn
);
3234 if(Num_time_sets
> 0) {
3235 /* Get the timeset used for the variable
3236 *---------------------------------------*/
3237 var_timeset
= Varinfo
[v
].timeset
;
3239 /* Get the number of time steps for this timeset
3240 *----------------------------------------------*/
3241 Num_time_steps
= USERD_get_num_of_time_steps(var_timeset
);
3242 if(Num_time_steps
< 1) {
3243 fprintf(stderr
," Error: Number of time steps returned: %d\n",
3245 fprintf(stderr
," (Must be >0 to be okay)\n");
3248 if(var_time_step
> (Num_time_steps
- 1)) {
3249 var_time_step
= Num_time_steps
- 1;
3252 /* Set the timeset and step - to first step by default, but
3253 * can set it at others using -vts command argument
3254 *---------------------------------------------------------*/
3255 USERD_set_time_set_and_step(var_timeset
,var_time_step
);
3257 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
3258 var_timeset
,0,Num_time_steps
-1);
3259 fprintf(stderr
," Using time step: %d\n",var_time_step
);
3265 if(Varinfo
[v
].type
== Z_CONSTANT
) {
3267 constant_val
= USERD_get_constant_val(vn
,FALSE
);
3268 fprintf(stderr
," Constant (%s):\n",Varinfo
[v
].description
);
3269 fprintf(stderr
," value: %g\n",constant_val
);
3271 if(Varinfo
[v
].complex) {
3272 constant_val
= USERD_get_constant_val(vn
,TRUE
);
3273 fprintf(stderr
," value (imag): %g\n",constant_val
);
3277 /* Scalars, Vectors, Tensors
3278 *--------------------------*/
3281 /* Get the var description line
3282 *-----------------------------*/
3283 err
= USERD_get_descrip_lines(Z_VARI
,vn
,FALSE
,line1
,line2
);
3285 fprintf(stderr
," Desc line: %s\n",line1
);
3288 fprintf(stderr
,"Error: getting var description line\n");
3292 if(Varinfo
[v
].complex) {
3293 err
= USERD_get_descrip_lines(Z_VARI
,vn
,TRUE
,line1
,line2
);
3295 fprintf(stderr
," Desc line (imag): %s\n",line1
);
3298 fprintf(stderr
,"Error: getting var description line (imag)\n");
3304 /* Get the values by component
3305 *-----------------------------*/
3306 if(Varinfo
[v
].type
== Z_SCALAR
) {
3309 else if(Varinfo
[v
].type
== Z_VECTOR
) {
3312 else if(Varinfo
[v
].type
== Z_TENSOR
) {
3315 else if(Varinfo
[v
].type
== Z_TENSOR9
) {
3322 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
3324 for(p
=0; p
<Num_parts
; ++p
) {
3327 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3328 nsize
= Pbuild
[p
].nn
;
3331 for(comp
=0; comp
<3; ++comp
) {
3332 if(Pbuild
[p
].ne
[comp
] < 1) {
3336 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3339 nsize
= bdim
[0] * bdim
[1] * bdim
[2];
3343 fprintf(stderr
," For part %d, with %d nodes:\n",pn
,nsize
);
3346 values
= (float *) calloc((nsize
+1),sizeof(float));
3347 if(values
== (float *) NULL
) {
3348 fprintf(stderr
,"Error: alocating variable values\n");
3352 for(comp
=0; comp
<num_comps
; ++comp
) {
3354 err
= USERD_get_var_by_component(vn
,
3361 if(err
== Z_UNDEF
) {
3362 fprintf(stderr
," Variable not defined on this part\n");
3366 /* For the component, show 1st node, last node, min, max values
3367 *-------------------------------------------------------------*/
3368 minv
= maxv
= values
[1];
3369 for(i
=2; i
<=nsize
; ++i
) {
3370 if(values
[i
] < minv
) {
3373 if(values
[i
] > maxv
) {
3378 fprintf(stderr
," For component %d: \n",comp
);
3379 fprintf(stderr
," node %10d value: %g\n",1,values
[1]);
3380 fprintf(stderr
," node %10d value: %g\n",nsize
,values
[nsize
]);
3381 fprintf(stderr
," min value: %g\n",minv
);
3382 fprintf(stderr
," max value: %g\n",maxv
);
3384 if(Varinfo
[v
].complex) {
3385 err
= USERD_get_var_by_component(vn
,
3392 if(err
== Z_UNDEF
) {
3393 fprintf(stderr
," Variable not defined on this part\n");
3396 /* For the component, show 1st node, last node, min, max values
3397 *-------------------------------------------------------------*/
3398 minv
= maxv
= values
[1];
3399 for(i
=2; i
<=nsize
; ++i
) {
3400 if(values
[i
] < minv
) {
3403 if(values
[i
] > maxv
) {
3408 fprintf(stderr
," For component %d (imag): \n",comp
);
3409 fprintf(stderr
," node %10d value: %g\n",1,values
[1]);
3410 fprintf(stderr
," node %10d value: %g\n",nsize
,values
[nsize
]);
3411 fprintf(stderr
," min value: %g\n",minv
);
3412 fprintf(stderr
," max value: %g\n",maxv
);
3423 for(p
=0; p
<Num_parts
; ++p
) {
3426 if(Pbuild
[p
].type
!= Z_UNSTRUCTURED
) {
3428 for(comp
=0; comp
<3; ++comp
) {
3429 if(Pbuild
[p
].ne
[comp
] < 1) {
3433 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3449 nsize
= bd1
* bd2
* bd3
;
3452 /* Determine cell type
3453 *--------------------*/
3455 for(i
=0; i
<3; ++i
) {
3461 cell_type
= Z_HEX08
;
3463 else if(num_dims
== 2) {
3464 cell_type
= Z_QUA04
;
3467 cell_type
= Z_BAR02
;
3471 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3476 e1
= e2
= cell_type
;
3479 for(et
=e1
; et
<=e2
; ++et
) {
3481 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3482 nsize
= Pbuild
[p
].ne
[et
];
3487 fprintf(stderr
," For part %d, with %d elems of type %s:\n",
3488 pn
,nsize
,Elem_info
[et
].name
);
3491 values
= (float *) calloc((nsize
+1),sizeof(float));
3492 if(values
== (float *) NULL
) {
3493 fprintf(stderr
,"Error: alocating variable values\n");
3497 for(comp
=0; comp
<num_comps
; ++comp
) {
3499 err
= USERD_get_var_by_component(vn
,
3506 if(err
== Z_UNDEF
) {
3507 fprintf(stderr
," Variable not defined on this part\n");
3510 /* For the component, show 1st elem, last elem, min, max values
3511 *-------------------------------------------------------------*/
3512 minv
= maxv
= values
[1];
3513 for(i
=2; i
<=nsize
; ++i
) {
3514 if(values
[i
] < minv
) {
3517 if(values
[i
] > maxv
) {
3522 fprintf(stderr
," For component %d: \n",comp
);
3523 fprintf(stderr
," elem %10d value: %g\n",1,values
[1]);
3524 fprintf(stderr
," elem %10d value: %g\n",nsize
,values
[nsize
]);
3525 fprintf(stderr
," min value: %g\n",minv
);
3526 fprintf(stderr
," max value: %g\n",maxv
);
3528 if(Varinfo
[v
].complex) {
3529 err
= USERD_get_var_by_component(vn
,
3536 if(err
== Z_UNDEF
) {
3537 fprintf(stderr
," Variable not defined on this part\n");
3540 /* For the component, show 1st elem, last elem, min, max values
3541 *-------------------------------------------------------------*/
3542 minv
= maxv
= values
[1];
3543 for(i
=2; i
<=nsize
; ++i
) {
3544 if(values
[i
] < minv
) {
3547 if(values
[i
] > maxv
) {
3552 fprintf(stderr
," For component %d (imag): \n",comp
);
3553 fprintf(stderr
," elem %10d value: %g\n",1,values
[1]);
3554 fprintf(stderr
," elem %10d value: %g\n",nsize
,values
[nsize
]);
3555 fprintf(stderr
," min value: %g\n",minv
);
3556 fprintf(stderr
," max value: %g\n",maxv
);
3577 part_builder(int geom_time_step
)
3583 int *elemids
[Z_MAXTYPE
];
3584 int **conns
[Z_MAXTYPE
];
3599 fprintf(stderr
,"\n------------- part_builder --------------\n");
3602 if(Num_time_steps
> 1) {
3603 if(geom_time_step
> (Num_time_steps
- 1)) {
3604 geom_time_step
= Num_time_steps
- 1;
3607 /* Set the time step - to first step by default, but
3608 * can set it at others using -gts command argument
3609 *---------------------------------------------------*/
3610 USERD_set_time_step(geom_time_step
);
3612 fprintf(stderr
," Using time step: %d (where range is %d through %d\n",
3613 geom_time_step
,0,Num_time_steps
-1);
3617 /* Get the global coords
3618 *----------------------*/
3619 nn
= USERD_get_number_of_global_nodes();
3623 crds
= (CRD
*) calloc(nn
,sizeof(CRD
));
3624 if(crds
== (CRD
*) NULL
) {
3625 fprintf(stderr
,"Error: allocating crds array\n");
3630 nodeids
= (int *) calloc(nn
,sizeof(int));
3631 if(nodeids
== (int *) NULL
) {
3632 fprintf(stderr
,"Error: allocating nodeids array\n");
3638 err
= USERD_get_global_coords(crds
);
3640 fprintf(stderr
,"Error: getting unstructured coords\n");
3645 err
= USERD_get_global_node_ids(nodeids
);
3647 fprintf(stderr
,"Error: getting nodeids\n");
3653 *-----------------*/
3658 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
3660 fprintf(stderr
," id: %d\n",nodeids
[i
]);
3662 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3663 crds
[i
].xyz
[0], crds
[i
].xyz
[1], crds
[i
].xyz
[2]);
3664 mm
[0] = mm
[1] = crds
[i
].xyz
[0];
3665 mm
[2] = mm
[3] = crds
[i
].xyz
[1];
3666 mm
[4] = mm
[5] = crds
[i
].xyz
[2];
3673 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
3675 fprintf(stderr
," id: %d\n",nodeids
[i
]);
3677 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3678 crds
[i
].xyz
[0], crds
[i
].xyz
[1], crds
[i
].xyz
[2]);
3681 /* Min and max coordinate values
3682 *------------------------------*/
3683 for(i
=1; i
<nn
; ++i
) {
3684 if(crds
[i
].xyz
[0] < mm
[0]) {
3685 mm
[0] = crds
[i
].xyz
[0];
3687 if(crds
[i
].xyz
[0] > mm
[1]) {
3688 mm
[1] = crds
[i
].xyz
[0];
3690 if(crds
[i
].xyz
[1] < mm
[2]) {
3691 mm
[2] = crds
[i
].xyz
[1];
3693 if(crds
[i
].xyz
[1] > mm
[3]) {
3694 mm
[3] = crds
[i
].xyz
[1];
3696 if(crds
[i
].xyz
[2] < mm
[4]) {
3697 mm
[4] = crds
[i
].xyz
[2];
3699 if(crds
[i
].xyz
[2] > mm
[5]) {
3700 mm
[5] = crds
[i
].xyz
[2];
3704 fprintf(stderr
," Global coordinate ranges:\n");
3705 fprintf(stderr
," min x: %g\n",mm
[0]);
3706 fprintf(stderr
," max x: %g\n",mm
[1]);
3707 fprintf(stderr
," min y: %g\n",mm
[2]);
3708 fprintf(stderr
," max y: %g\n",mm
[3]);
3709 fprintf(stderr
," min z: %g\n",mm
[4]);
3710 fprintf(stderr
," max z: %g\n",mm
[5]);
3713 /* Free the allocated memory
3714 *--------------------------*/
3723 for(p
=0; p
<Num_parts
; ++p
) {
3726 fprintf(stderr
,"\n");
3727 fprintf(stderr
," Part %d:\n",pn
);
3729 /*-----------------------
3730 * For unstructured parts
3731 *-----------------------*/
3732 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
3734 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
3735 ne
= Pbuild
[p
].ne
[et
];
3739 conns
[et
] = (int **) calloc(ne
,sizeof(int *));
3740 if(conns
[et
] == (int **) NULL
) {
3741 fprintf(stderr
,"Error: allocating conns array\n");
3745 for(i
=0; i
<ne
; ++i
) {
3746 conns
[et
][i
] = (int *) calloc(Elem_info
[et
].con_len
,sizeof(int));
3747 if(conns
[et
][i
] == (int *) NULL
) {
3748 fprintf(stderr
,"Error: allocating conns array\n");
3754 if(Element_labels
) {
3755 elemids
[et
] = (int *) calloc(ne
,sizeof(int));
3756 if(elemids
[et
] == (int *) NULL
) {
3757 fprintf(stderr
,"Error: allocating elemids array\n");
3765 *-----------------*/
3766 err
= USERD_get_element_connectivities_for_part(pn
,conns
);
3768 fprintf(stderr
,"Error: getting element connectivities\n");
3772 /* Get the element ids - if any
3773 *-----------------------------*/
3774 if(Element_labels
) {
3775 err
= USERD_get_element_ids_for_part(pn
,elemids
);
3777 fprintf(stderr
,"Error: getting element ids\n");
3783 *-----------------*/
3784 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
3785 ne
= Pbuild
[p
].ne
[et
];
3789 /* First element of the type
3790 *--------------------------*/
3792 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
3793 if(Element_labels
) {
3794 fprintf(stderr
," id: %d\n",elemids
[et
][i
]);
3796 fprintf(stderr
," connectivity:");
3797 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
3798 fprintf(stderr
," %d",conns
[et
][i
][j
]);
3800 fprintf(stderr
,"\n");
3802 /* Last element of the type
3803 *-------------------------*/
3806 fprintf(stderr
," %s Element %d of %d:\n",Elem_info
[et
].name
,i
+1,ne
);
3807 if(Element_labels
) {
3808 fprintf(stderr
," id: %d\n",elemids
[et
][i
]);
3810 fprintf(stderr
," connectivity:");
3811 for(j
=0; j
<Elem_info
[et
].con_len
; ++j
) {
3812 fprintf(stderr
," %d",conns
[et
][i
][j
]);
3814 fprintf(stderr
,"\n");
3819 /* Free the allocated memory
3820 *--------------------------*/
3821 for(et
=0; et
<Z_MAXTYPE
; ++et
) {
3822 ne
= Pbuild
[p
].ne
[et
];
3825 for(i
=0; i
<ne
; ++i
) {
3830 if(Element_labels
) {
3838 /*---------------------
3839 * For structured parts
3840 *---------------------*/
3843 /* Get the block coords
3844 *---------------------*/
3845 for(comp
=0; comp
<3; ++comp
) {
3846 if(Pbuild
[p
].ne
[comp
] < 1) {
3850 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
3853 nn
= bdim
[0] * bdim
[1] * bdim
[2];
3867 ne
= bd1
* bd2
* bd3
;
3870 /* Determine cell type
3871 *--------------------*/
3873 for(i
=0; i
<3; ++i
) {
3879 cell_type
= Z_HEX08
;
3881 else if(num_dims
== 2) {
3882 cell_type
= Z_QUA04
;
3885 cell_type
= Z_BAR02
;
3888 coords
= (float **) calloc(num_dims
,sizeof(float *));
3889 if(coords
== (float **) NULL
) {
3890 fprintf(stderr
,"Error: allocating coords array\n");
3894 for(i
=0; i
<num_dims
; ++i
) {
3895 coords
[i
] = (float *) calloc(nn
,sizeof(float));
3896 if(coords
[i
] == (float *) NULL
) {
3897 fprintf(stderr
,"Error: allocating coords array\n");
3905 for(comp
=0; comp
<num_dims
; ++comp
) {
3906 err
= USERD_get_block_coords_by_component(pn
,comp
,coords
[comp
]);
3908 fprintf(stderr
,"Error: getting block coords\n");
3915 *-----------------*/
3921 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
3924 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3925 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
3926 mm
[0] = mm
[1] = coords
[0][i
];
3927 mm
[2] = mm
[3] = coords
[1][i
];
3928 mm
[4] = mm
[5] = coords
[2][i
];
3930 else if(num_dims
== 2) {
3931 fprintf(stderr
," x y coordinates: %g %g\n",
3932 coords
[0][i
], coords
[1][i
]);
3933 mm
[0] = mm
[1] = coords
[0][i
];
3934 mm
[2] = mm
[3] = coords
[1][i
];
3937 fprintf(stderr
," x coordinates: %g\n",
3939 mm
[0] = mm
[1] = coords
[0][i
];
3947 fprintf(stderr
," Node %d of %d:\n",i
+1,nn
);
3950 fprintf(stderr
," x y z coordinates: %g %g %g\n",
3951 coords
[0][i
], coords
[1][i
], coords
[2][i
]);
3953 else if(num_dims
== 2) {
3954 fprintf(stderr
," x y coordinates: %g %g\n",
3955 coords
[0][i
], coords
[1][i
]);
3958 fprintf(stderr
," x coordinates: %g\n",
3964 /* Min and max coordinate values
3965 *------------------------------*/
3966 for(i
=2; i
<=nn
; ++i
) {
3967 if(coords
[0][i
] < mm
[0]) {
3968 mm
[0] = coords
[0][i
];
3970 if(coords
[0][i
] > mm
[1]) {
3971 mm
[1] = coords
[0][i
];
3974 if(coords
[1][i
] < mm
[2]) {
3975 mm
[2] = coords
[1][i
];
3977 if(coords
[1][i
] > mm
[3]) {
3978 mm
[3] = coords
[1][i
];
3982 if(coords
[2][i
] < mm
[4]) {
3983 mm
[4] = coords
[2][i
];
3985 if(coords
[2][i
] > mm
[5]) {
3986 mm
[5] = coords
[2][i
];
3991 fprintf(stderr
," Coordinate ranges:\n");
3992 fprintf(stderr
," min x: %g\n",mm
[0]);
3993 fprintf(stderr
," max x: %g\n",mm
[1]);
3995 fprintf(stderr
," min y: %g\n",mm
[2]);
3996 fprintf(stderr
," max y: %g\n",mm
[3]);
3999 fprintf(stderr
," min z: %g\n",mm
[4]);
4000 fprintf(stderr
," max z: %g\n",mm
[5]);
4003 /* Free the allocated memory - so far
4004 *-----------------------------------*/
4005 for(i
=0; i
<num_dims
; ++i
) {
4011 /* Get the block iblanking - if any
4012 *---------------------------------*/
4013 if(Pbuild
[p
].type
== Z_IBLANKED
) {
4015 iblanking
= (int *) calloc(nn
,sizeof(int));
4016 if(iblanking
== (int *) NULL
) {
4017 fprintf(stderr
,"Error: allocating iblanking array\n");
4021 err
= USERD_get_block_iblanking(pn
,iblanking
);
4023 fprintf(stderr
,"Error: getting block iblanking\n");
4028 *-----------------*/
4035 for(i
=0; i
<nn
; ++i
) {
4039 fprintf(stderr
," Iblanking breakdown:\n");
4040 fprintf(stderr
," Number of Z_EXT: %d\n",ib
[Z_EXT
]);
4041 fprintf(stderr
," Number of Z_INT: %d\n",ib
[Z_INT
]);
4042 fprintf(stderr
," Number of Z_BND: %d\n",ib
[Z_BND
]);
4043 fprintf(stderr
," Number of Z_INTBND: %d\n",ib
[Z_INTBND
]);
4044 fprintf(stderr
," Number of Z_SYM: %d\n",ib
[Z_SYM
]);
4059 var_loader(int var_time_step
)
4079 float minv
[3],maxv
[3];
4083 fprintf(stderr
,"\n--------------- var_loader --------------\n");
4085 if(Num_time_steps
> 1 && v
== 0) {
4086 if(var_time_step
> (Num_time_steps
- 1)) {
4087 var_time_step
= Num_time_steps
- 1;
4090 /* Set the time step - to first step by default, but
4091 * can set it at others using -vts command argument
4092 *---------------------------------------------------------*/
4093 USERD_set_time_step(var_time_step
);
4095 fprintf(stderr
," Using time step: %d (where range is %d through %d)\n\n",
4096 var_time_step
,0,Num_time_steps
-1);
4099 for(v
=0; v
<Num_vars
; ++v
) {
4103 fprintf(stderr
,"\n");
4105 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
4106 fprintf(stderr
," Z_PER_NODE Variable %d:\n",vn
);
4109 fprintf(stderr
," Z_PER_ELEM Variable %d:\n",vn
);
4114 if(Varinfo
[v
].type
== Z_CONSTANT
) {
4116 constant_val
= USERD_get_constant_value(vn
);
4117 fprintf(stderr
," Constant (%s):\n",Varinfo
[v
].description
);
4118 fprintf(stderr
," value: %g\n",constant_val
);
4122 /* Scalars, Vectors, Tensors
4123 *--------------------------*/
4126 /* Get the var description line
4127 *-----------------------------*/
4128 err
= USERD_get_description_lines(Z_VARI
,vn
,line1
,line2
);
4130 fprintf(stderr
," Desc line: %s\n",line1
);
4133 fprintf(stderr
,"Error: getting var description line\n");
4138 /* Get the values by component
4139 *-----------------------------*/
4140 if(Varinfo
[v
].type
== Z_SCALAR
) {
4143 else if(Varinfo
[v
].type
== Z_VECTOR
) {
4146 else if(Varinfo
[v
].type
== Z_TENSOR
) {
4149 else if(Varinfo
[v
].type
== Z_TENSOR9
) {
4156 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
4158 for(p
=0; p
<Num_parts
; ++p
) {
4161 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4162 nsize
= Pbuild
[p
].nn
;
4165 for(comp
=0; comp
<3; ++comp
) {
4166 if(Pbuild
[p
].ne
[comp
] < 1) {
4170 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
4173 nsize
= bdim
[0] * bdim
[1] * bdim
[2];
4177 fprintf(stderr
," For part %d, with %d nodes:\n",pn
,nsize
);
4180 values
= (float *) calloc((num_comps
* nsize
),sizeof(float));
4181 if(values
== (float *) NULL
) {
4182 fprintf(stderr
,"Error: alocating variable values\n");
4186 if(num_comps
== 1) {
4188 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4189 err
= USERD_get_scalar_values(vn
,
4194 fprintf(stderr
,"Error: getting scalar values\n");
4199 err
= USERD_get_block_scalar_values(pn
,
4203 fprintf(stderr
,"Error: getting block scalar values\n");
4208 /* For the component, show 1st node, last node, min, max values
4209 *-------------------------------------------------------------*/
4210 minv
[0] = maxv
[0] = values
[0];
4211 for(i
=0; i
<nsize
; ++i
) {
4212 if(values
[i
] < minv
[0]) {
4213 minv
[0] = values
[i
];
4215 if(values
[i
] > maxv
[0]) {
4216 maxv
[0] = values
[i
];
4220 fprintf(stderr
," node %10d value: %g\n",1,values
[0]);
4221 fprintf(stderr
," node %10d value: %g\n",nsize
,values
[nsize
-1]);
4222 fprintf(stderr
," min value: %g\n",minv
[0]);
4223 fprintf(stderr
," max value: %g\n",maxv
[0]);
4227 else if(num_comps
== 3) {
4229 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4230 err
= USERD_get_vector_values(vn
,
4235 fprintf(stderr
,"Error: getting vector values\n");
4241 tvalues
= (float *) calloc(nsize
,sizeof(float));
4242 if(tvalues
== (float *) NULL
) {
4243 fprintf(stderr
,"Error: alocating tvalues array\n");
4247 for(i
=0; i
<3; ++i
) {
4248 err
= USERD_get_block_vector_values_by_component(pn
,
4253 fprintf(stderr
,"Error: getting vector values\n");
4256 for(j
=0; j
<nsize
; ++j
) {
4258 values
[k
] = tvalues
[j
];
4264 /* For the component, show 1st node, last node, min, max values
4265 *-------------------------------------------------------------*/
4266 minv
[0] = maxv
[0] = values
[0];
4267 minv
[1] = maxv
[1] = values
[1];
4268 minv
[2] = maxv
[2] = values
[2];
4269 for(i
=0; i
<nsize
; ++i
) {
4271 for(k
=0; k
<3; ++k
) {
4272 if(values
[j
+k
] < minv
[k
]) {
4273 minv
[k
] = values
[j
+k
];
4275 if(values
[j
+k
] > maxv
[k
]) {
4276 maxv
[k
] = values
[j
+k
];
4281 fprintf(stderr
," node %10d values: %g %g %g\n",1,
4282 values
[0],values
[1],values
[2]);
4283 fprintf(stderr
," node %10d values: %g %g %g\n",nsize
,
4284 values
[3*nsize
-3],values
[3*nsize
-2],values
[3*nsize
-1]);
4285 fprintf(stderr
," min values: %g %g %g\n",
4286 minv
[0],minv
[1],minv
[2]);
4287 fprintf(stderr
," max values: %g %g %g\n",
4288 maxv
[0],maxv
[1],maxv
[2]);
4299 for(p
=0; p
<Num_parts
; ++p
) {
4302 if(Pbuild
[p
].type
!= Z_UNSTRUCTURED
) {
4304 for(comp
=0; comp
<3; ++comp
) {
4305 if(Pbuild
[p
].ne
[comp
] < 1) {
4309 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
4324 nsize
= bd1
* bd2
* bd3
;
4327 /* Determine cell type
4328 *--------------------*/
4330 for(i
=0; i
<3; ++i
) {
4336 cell_type
= Z_HEX08
;
4338 else if(num_dims
== 2) {
4339 cell_type
= Z_QUA04
;
4342 cell_type
= Z_BAR02
;
4346 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4351 e1
= e2
= cell_type
;
4354 for(et
=e1
; et
<=e2
; ++et
) {
4356 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4357 nsize
= Pbuild
[p
].ne
[et
];
4362 fprintf(stderr
," For part %d, with %d elems of type %s:\n",
4363 pn
,nsize
,Elem_info
[et
].name
);
4365 values
= (float *) calloc((num_comps
* nsize
),sizeof(float));
4366 if(values
== (float *) NULL
) {
4367 fprintf(stderr
,"Error: alocating variable values\n");
4371 if(num_comps
== 1) {
4372 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4373 err
= USERD_get_scalar_values(vn
,
4378 fprintf(stderr
,"Error: getting scalar values\n");
4383 err
= USERD_get_block_scalar_values(pn
,
4387 fprintf(stderr
,"Error: getting block scalar values\n");
4392 /* For the component, show 1st node, last node, min, max values
4393 *-------------------------------------------------------------*/
4394 minv
[0] = maxv
[0] = values
[0];
4395 for(i
=1; i
<nsize
; ++i
) {
4396 if(values
[i
] < minv
[0]) {
4397 minv
[0] = values
[i
];
4399 if(values
[i
] > maxv
[0]) {
4400 maxv
[0] = values
[i
];
4404 fprintf(stderr
," elem %10d value: %g\n",1,values
[0]);
4405 fprintf(stderr
," elem %10d value: %g\n",nsize
,values
[nsize
-1]);
4406 fprintf(stderr
," min value: %g\n",minv
[0]);
4407 fprintf(stderr
," max value: %g\n",maxv
[0]);
4411 else if(num_comps
== 3) {
4413 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4414 err
= USERD_get_vector_values(vn
,
4419 fprintf(stderr
,"Error: getting vector values\n");
4425 tvalues
= (float *) calloc(nsize
,sizeof(float));
4426 if(tvalues
== (float *) NULL
) {
4427 fprintf(stderr
,"Error: alocating tvalues array\n");
4431 for(i
=0; i
<3; ++i
) {
4432 err
= USERD_get_block_vector_values_by_component(pn
,
4437 fprintf(stderr
,"Error: getting vector values\n");
4440 for(j
=0; j
<nsize
; ++j
) {
4442 values
[k
] = tvalues
[j
];
4448 /* For the component, show 1st node, last node, min, max values
4449 *-------------------------------------------------------------*/
4450 minv
[0] = maxv
[0] = values
[0];
4451 minv
[1] = maxv
[1] = values
[1];
4452 minv
[2] = maxv
[2] = values
[2];
4453 for(i
=1; i
<=nsize
; ++i
) {
4455 for(k
=0; k
<3; ++k
) {
4456 if(values
[j
+k
] < minv
[k
]) {
4457 minv
[k
] = values
[j
+k
];
4459 if(values
[j
+k
] > maxv
[k
]) {
4460 maxv
[k
] = values
[j
+k
];
4465 fprintf(stderr
," elem %10d values: %g %g %g\n",1,
4466 values
[0],values
[1],values
[2]);
4467 fprintf(stderr
," elem %10d values: %g %g %g\n",nsize
,
4468 values
[3*nsize
-3],values
[3*nsize
-2],values
[3*nsize
-1]);
4469 fprintf(stderr
," min values: %g %g %g\n",
4470 minv
[0],minv
[1],minv
[2]);
4471 fprintf(stderr
," max values: %g %g %g\n",
4472 maxv
[0],maxv
[1],maxv
[2]);
4489 #if (defined GT_USERD_API_202)
4496 materials_info( void )
4507 fprintf(stderr
,"\n------------ materials_info --------------\n");
4509 /* Get the number of variables
4510 *----------------------------*/
4511 Num_materials_sets
= USERD_get_number_of_material_sets();
4512 if(Num_materials_sets
< 0) {
4513 fprintf(stderr
,"Error: getting the number of material sets\n");
4517 if(Num_materials_sets
== 0) {
4518 fprintf(stderr
," No materials sets in the model\n");
4521 else if(Num_materials_sets
> 1) {
4522 fprintf(stderr
," Number of materials sets: %d\n",Num_materials_sets
);
4523 fprintf(stderr
," Currently, EnSight 7.6 only supports 1 material set\n");
4527 fprintf(stderr
," Number of materials sets: %d\n",Num_materials_sets
);
4531 /* Get the material set index list and names
4532 *------------------------------------------*/
4533 msids
= (int *) calloc(Num_materials_sets
,sizeof(int));
4534 if(msids
== (int *)NULL
) {
4535 fprintf(stderr
," Problems allocating for material set ids\n");
4539 num_materials
= (int *) calloc(Num_materials_sets
,sizeof(int));
4540 if(num_materials
== (int *)NULL
) {
4541 fprintf(stderr
," Problems allocating for material set num materials\n");
4545 msname
= (char **) calloc(Num_materials_sets
,sizeof(char *));
4546 if(msname
== (char **)NULL
) {
4547 fprintf(stderr
," Problems allocating for material set names\n");
4551 for(i
=0; i
<Num_materials_sets
; ++i
) {
4552 msname
[i
] = (char *) calloc(Z_BUFL
,sizeof(char));
4553 if(msname
[i
] == (char *)NULL
) {
4554 fprintf(stderr
," Problems allocating for material set names\n");
4560 err
= USERD_get_matf_set_info(msids
,msname
);
4562 fprintf(stderr
,"Error: getting material set info\n");
4565 for(i
=0; i
<Num_materials_sets
; ++i
) {
4567 /* Echo some feedback
4568 *-------------------*/
4569 fprintf(stderr
," For Material set %d:\n",i
+1);
4571 fprintf(stderr
," id: %d\n",msids
[i
]);
4572 fprintf(stderr
," name: %s\n",msname
[i
]);
4574 num_materials
[i
] = USERD_get_number_of_materials(i
);
4575 if(num_materials
[i
] < 0) {
4576 fprintf(stderr
,"Error: getting the number of materials in set %d\n",i
);
4579 else if(num_materials
[i
] == 0) {
4580 fprintf(stderr
," No materials in Materials set %d\n",i
);
4584 mids
= (int *) calloc(num_materials
[i
],sizeof(int));
4585 if(mids
== (int *)NULL
) {
4586 fprintf(stderr
," Problems allocating for material ids\n");
4590 mdesc
= (char **) calloc(num_materials
[i
],sizeof(char *));
4591 if(mdesc
== (char **)NULL
) {
4592 fprintf(stderr
," Problems allocating for material desc\n");
4596 for(j
=0; j
<num_materials
[i
]; ++j
) {
4597 mdesc
[j
] = (char *) calloc(Z_BUFL
,sizeof(char));
4598 if(mdesc
[j
] == (char *)NULL
) {
4599 fprintf(stderr
," Problems allocating for material desc\n");
4605 err
= USERD_get_matf_var_info(i
,mids
,mdesc
);
4607 fprintf(stderr
,"Error: getting material info\n");
4611 for(j
=0; j
<num_materials
[i
]; ++j
) {
4612 /* Echo some feedback
4613 *-------------------*/
4614 fprintf(stderr
," For Material %d:\n",j
+1);
4616 fprintf(stderr
," index: %d\n",mids
[j
]);
4617 fprintf(stderr
," description: %s\n",mdesc
[j
]);
4624 /* Free the allocated memory
4625 *--------------------------*/
4626 for(i
=0; i
<Num_materials_sets
; ++i
) {
4629 for(j
=0; j
<num_materials
[i
]; ++j
) {
4635 free(num_materials
);
4643 /*----------------------
4644 * gold_materials_loader
4645 *----------------------*/
4647 gold_materials_loader(int geom_time_step
)
4649 int i
, j
, k
, ms
, nn
;
4650 int err
, err1
, err2
;
4664 int matf_size
, matfv_size
;
4667 fprintf(stderr
,"\n-------------- materials_loader --------------\n");
4669 if(Num_time_sets
> 0) {
4670 /* Get the timeset used for the geometry
4671 *--------------------------------------*/
4672 geom_timeset
= USERD_get_geom_timeset_number();
4674 /* Get the number of time steps for this timeset
4675 *----------------------------------------------*/
4676 Num_time_steps
= USERD_get_num_of_time_steps(geom_timeset
);
4677 if(Num_time_steps
< 1) {
4678 fprintf(stderr
," Error: Num time steps returned: %d\n",Num_time_steps
);
4679 fprintf(stderr
," (Must be >0 to be okay)\n");
4682 if(geom_time_step
> (Num_time_steps
- 1)) {
4683 geom_time_step
= Num_time_steps
- 1;
4686 /* Set the timeset and step - to first step by default, but
4687 * can set it at others using -gts command argument
4688 *---------------------------------------------------------*/
4689 USERD_set_time_set_and_step(geom_timeset
,geom_time_step
);
4691 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
4692 geom_timeset
,0,Num_time_steps
-1);
4693 fprintf(stderr
," Using time step: %d\n",geom_time_step
);
4696 for(ms
=0; ms
<Num_materials_sets
; ++ms
) {
4697 fprintf(stderr
,"\n");
4698 fprintf(stderr
," Materials Set %d:\n",ms
+1);
4700 for(p
=0; p
<Num_parts
; ++p
) {
4703 fprintf(stderr
,"\n");
4704 fprintf(stderr
," Part %d:\n",pn
);
4706 /*-----------------------
4707 * For unstructured parts
4708 *-----------------------*/
4709 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4715 for(comp
=0; comp
<3; ++comp
) {
4716 if(Pbuild
[p
].ne
[comp
] < 1) {
4720 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
4723 nn
= bdim
[0] * bdim
[1] * bdim
[2];
4737 ne
= bd1
* bd2
* bd3
;
4739 /* Determine cell type
4740 *--------------------*/
4742 for(i
=0; i
<3; ++i
) {
4748 cell_type
= Z_HEX08
;
4750 else if(num_dims
== 2) {
4751 cell_type
= Z_QUA04
;
4754 cell_type
= Z_BAR02
;
4762 for(et
=e1
; et
<e2
; ++et
) {
4764 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
4765 ne
= Pbuild
[p
].ne
[et
];
4770 /* Get the material ids, if any
4771 *-----------------------------*/
4772 err
= USERD_size_matf_data(ms
,
4777 if(err
== Z_OK
&& matf_size
> 0) {
4780 /* Go get the material ids
4781 *------------------------*/
4782 ivals
= (int *) calloc(matf_size
,sizeof(int));
4783 if(ivals
== (int *)NULL
) {
4784 fprintf(stderr
," Problems allocating for material ids\n");
4787 err
= USERD_load_matf_data(ms
,
4794 if(matf_size
< 20) {
4795 fprintf(stderr
," Printing all mat ids for %s elements\n",
4796 Elem_info
[et
].name
);
4800 fprintf(stderr
," Printing first 20 mat ids for %s elements\n",
4801 Elem_info
[et
].name
);
4805 /* See if any mixed materials
4806 *---------------------------*/
4807 mixed_present
= FALSE
;
4808 for(k
=0; k
<matf_size
; ++k
) {
4810 mixed_present
= TRUE
;
4817 for(k
=0; k
<do_num
; ++k
) {
4818 fprintf(stderr
," mat id[%d] = %d\n",k
,ivals
[k
]);
4823 fprintf(stderr
," Trouble getting mat ids for %s elements\n",
4824 Elem_info
[et
].name
);
4830 fprintf(stderr
," %s elements have no material ids\n",
4831 Elem_info
[et
].name
);
4835 /* Get the mixed material ids, if any
4836 *-----------------------------------*/
4838 err1
= USERD_size_matf_data(ms
,
4843 err2
= USERD_size_matf_data(ms
,
4854 /* Go get the material ids
4855 *------------------------*/
4856 ivals
= (int *) calloc(matf_size
,sizeof(int));
4857 if(ivals
== (int *)NULL
) {
4858 fprintf(stderr
," Problems allocating for mixed material ids\n");
4861 fvals
= (float *) calloc(matfv_size
,sizeof(float));
4862 if(fvals
== (float *)NULL
) {
4863 fprintf(stderr
," Problems allocating for mixed material values\n");
4867 err1
= USERD_load_matf_data(ms
,
4874 err2
= USERD_load_matf_data(ms
,
4882 if(matf_size
< 20) {
4883 fprintf(stderr
," Printing all mixed mat ids for %s elements\n",
4884 Elem_info
[et
].name
);
4888 fprintf(stderr
," Printing first 20 mixed mat ids for %s elements\n",
4889 Elem_info
[et
].name
);
4892 for(k
=0; k
<do_num
; ++k
) {
4893 fprintf(stderr
," mixed mat id[%d] = %d\n",k
,ivals
[k
]);
4897 if(matfv_size
< 20) {
4898 fprintf(stderr
," Printing all mixed mat values for %s elements\n",
4899 Elem_info
[et
].name
);
4900 do_num
= matfv_size
;
4903 fprintf(stderr
," Printing first 20 mixed mat values for %s elements\n",
4904 Elem_info
[et
].name
);
4907 for(k
=0; k
<do_num
; ++k
) {
4908 fprintf(stderr
," mixed mat val[%d] = %f\n",k
,fvals
[k
]);
4913 fprintf(stderr
," Trouble getting mixed mat ids or vals for %s elements\n",
4914 Elem_info
[et
].name
);
4921 fprintf(stderr
," Trouble getting mixed mat sizes for %s elements\n",
4922 Elem_info
[et
].name
);
4927 fprintf(stderr
," (%s elements have no mixed material ids)\n",
4928 Elem_info
[et
].name
);
4943 entity_querys(int var_time_step
)
4964 fprintf(stderr
,"\n-------------- entity_querys ------------\n");
4965 fprintf(stderr
," (scalar & vector variables only) \n");
4966 fprintf(stderr
,"\n");
4968 #if (defined USERD_API_100)
4970 if(Num_time_steps
> 1) {
4971 /* Get the number of time steps for this timeset
4972 *----------------------------------------------*/
4973 if(var_time_step
> (Num_time_steps
- 1)) {
4974 var_time_step
= Num_time_steps
- 1;
4977 /* Set the time step - to first step by default, but
4978 * can set it at others using -vts command argument
4979 *---------------------------------------------------------*/
4980 USERD_set_time_step(var_time_step
);
4982 fprintf(stderr
," Using time step: %d (where range is %d through %d)\n\n",
4983 var_time_step
,0,Num_time_steps
-1);
4987 for(v
=0; v
<Num_vars
; ++v
) {
4990 /* Scalar or vectors only
4991 *-----------------------*/
4992 if(Varinfo
[v
].type
== Z_SCALAR
|| Varinfo
[v
].type
== Z_VECTOR
) {
4995 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
4996 fprintf(stderr
," Z_PER_NODE Variable %d:\n",vn
);
4999 fprintf(stderr
," Z_PER_ELEM Variable %d:\n",vn
);
5002 #if (defined GT_USERD_API_100)
5004 if(Num_time_sets
> 0) {
5005 /* Get the timeset used for the variable
5006 *---------------------------------------*/
5007 var_timeset
= Varinfo
[v
].timeset
;
5009 /* Get the number of time steps for this timeset
5010 *----------------------------------------------*/
5011 Num_time_steps
= USERD_get_num_of_time_steps(var_timeset
);
5012 if(Num_time_steps
< 1) {
5013 fprintf(stderr
," Error: Number of time steps returned: %d\n",
5015 fprintf(stderr
," (Must be >0 to be okay)\n");
5018 if(var_time_step
> (Num_time_steps
- 1)) {
5019 var_time_step
= Num_time_steps
- 1;
5022 /* Set the timeset and step - to first step by default, but
5023 * can set it at others using -vts command argument
5024 *---------------------------------------------------------*/
5025 USERD_set_time_set_and_step(var_timeset
,var_time_step
);
5027 fprintf(stderr
," Using timeset: %d (step range is %d through %d)\n",
5028 var_timeset
,0,Num_time_steps
-1);
5029 fprintf(stderr
," Using time step: %d\n",var_time_step
);
5034 /* Get the var description line
5035 *-----------------------------*/
5036 #if (defined GT_USERD_API_100)
5037 err
= USERD_get_descrip_lines(Z_VARI
,vn
,FALSE
,line1
,line2
);
5039 fprintf(stderr
," Desc line: %s\n",line1
);
5042 fprintf(stderr
,"Error: getting var description line\n");
5046 if(Varinfo
[v
].complex) {
5047 err
= USERD_get_descrip_lines(Z_VARI
,vn
,TRUE
,line1
,line2
);
5049 fprintf(stderr
," Desc line (imag): %s\n",line1
);
5052 fprintf(stderr
,"Error: getting var description line (imag)\n");
5058 err
= USERD_get_description_lines(Z_VARI
,vn
,line1
,line2
);
5060 fprintf(stderr
," Desc line: %s\n",line1
);
5063 fprintf(stderr
,"Error: getting var description line\n");
5069 /* Get the values by component
5070 *-----------------------------*/
5071 if(Varinfo
[v
].type
== Z_SCALAR
) {
5074 else if(Varinfo
[v
].type
== Z_VECTOR
) {
5080 if(Varinfo
[v
].classify
== Z_PER_NODE
) {
5082 for(p
=0; p
<Num_parts
; ++p
) {
5085 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5086 nsize
= Pbuild
[p
].nn
;
5089 for(comp
=0; comp
<3; ++comp
) {
5090 if(Pbuild
[p
].ne
[comp
] < 1) {
5094 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
5097 nsize
= bdim
[0] * bdim
[1] * bdim
[2];
5104 fprintf(stderr
," For part %d, using node %d:\n",pn
,nsize
);
5106 #if (defined GT_USERD_API_100)
5107 err
= USERD_get_var_value_at_specific(vn
,
5115 err
= USERD_get_variable_value_at_specific(vn
,
5122 if(err
== Z_NOT_IMPLEMENTED
) {
5123 fprintf(stderr
," Node and element queries not implemented\n");
5126 else if(err
== Z_ERR
) {
5127 fprintf(stderr
," Could not get value\n");
5131 /* For the component, show 1st node, last node, min, max values
5132 *-------------------------------------------------------------*/
5133 if(Varinfo
[v
].type
== Z_SCALAR
) {
5134 fprintf(stderr
," Scalar value is: %g\n",qvals
[0]);
5137 fprintf(stderr
," Vector values are: %g %g %g\n",
5138 qvals
[0],qvals
[1],qvals
[2]);
5141 #if (defined GT_USERD_API_100)
5142 if(Varinfo
[v
].complex) {
5144 err
= USERD_get_var_value_at_specific(vn
,
5153 fprintf(stderr
," Could not get imag value\n");
5157 /* For the component, show 1st node, last node, min, max values
5158 *-------------------------------------------------------------*/
5159 if(Varinfo
[v
].type
== Z_SCALAR
) {
5160 fprintf(stderr
," Scalar value (imag) is: %g\n",qvals
[0]);
5163 fprintf(stderr
," Vector values (imag) are: %g %g %g\n",
5164 qvals
[0],qvals
[1],qvals
[2]);
5178 for(p
=0; p
<Num_parts
; ++p
) {
5181 if(Pbuild
[p
].type
!= Z_UNSTRUCTURED
) {
5183 for(comp
=0; comp
<3; ++comp
) {
5184 if(Pbuild
[p
].ne
[comp
] < 1) {
5188 bdim
[comp
] = Pbuild
[p
].ne
[comp
];
5203 nsize
= bd1
* bd2
* bd3
;
5206 /* Determine cell type
5207 *--------------------*/
5209 for(i
=0; i
<3; ++i
) {
5215 cell_type
= Z_HEX08
;
5217 else if(num_dims
== 2) {
5218 cell_type
= Z_QUA04
;
5221 cell_type
= Z_BAR02
;
5225 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5230 e1
= e2
= cell_type
;
5233 for(et
=e1
; et
<=e2
; ++et
) {
5235 if(Pbuild
[p
].type
== Z_UNSTRUCTURED
) {
5236 nsize
= Pbuild
[p
].ne
[et
];
5242 fprintf(stderr
," For part %d, using elem %d of type %s:\n",
5243 pn
,nsize
,Elem_info
[et
].name
);
5246 #if (defined GT_USERD_API_100)
5247 err
= USERD_get_var_value_at_specific(vn
,
5255 err
= USERD_get_variable_value_at_specific(vn
,
5263 if(err
== Z_NOT_IMPLEMENTED
) {
5264 fprintf(stderr
," Node and element queries not implemented\n");
5267 else if(err
== Z_ERR
) {
5268 fprintf(stderr
," Could not get value\n");
5271 if(Varinfo
[v
].type
== Z_SCALAR
) {
5272 fprintf(stderr
," Scalar value is: %g\n",qvals
[0]);
5275 fprintf(stderr
," Vector values are: %g %g %g\n",
5276 qvals
[0],qvals
[1],qvals
[2]);
5279 #if (defined GT_USERD_API_100)
5280 if(Varinfo
[v
].complex) {
5282 err
= USERD_get_var_value_at_specific(vn
,
5290 fprintf(stderr
," Could not get imag value\n");
5293 if(Varinfo
[v
].type
== Z_SCALAR
) {
5294 fprintf(stderr
," Scalar value (imag) is: %g\n",qvals
[0]);
5297 fprintf(stderr
," Vector values (imag) are: %g %g %g\n",
5298 qvals
[0],qvals
[1],qvals
[2]);
5319 exercise_bkup( void )
5324 fprintf(stderr
,"\n------------ exercise_archive -----------\n");
5326 arcfile
= fopen("test.arc","wb");
5327 if(arcfile
== (FILE *)NULL
) {
5328 fprintf(stderr
,"Error: opening test archive file\n");
5331 err
= USERD_bkup(arcfile
,Z_SAVE_ARCHIVE
);
5333 fprintf(stderr
,"Error: saving to test archive file\n");
5338 arcfile
= fopen("test.arc","rb");
5339 err
= USERD_bkup(arcfile
,Z_REST_ARCHIVE
);
5341 fprintf(stderr
,"Error: restoring from test archive file\n");
5345 fprintf(stderr
," Archive test completed\n");
5352 /* -------------------------------------------------------
5353 * threshold_operator1 & 2 can be one of the following
5354 * Z_ELE_FAILED_NONE, - disables checking
5355 * Z_ELE_FAILED_GREATER, - greater than
5356 * Z_ELE_FAILED_LESS, - less than
5357 * Z_ELE_FAILED_EQUAL, - equal
5358 * Z_ELE_FAILED_NOT_EQUAL, - not equal
5359 * Z_ELE_FAILED_MANY - not used
5362 * Z_ELE_FAILED_LOGIC_NONE,
5363 * Z_ELE_FAILED_LOGIC_AND,
5364 * Z_ELE_FAILED_LOGIC_OR,
5365 * Z_ELE_FAILED_LOGIC_MANY
5367 * ------------------------------------------------------ */
5368 int load_fail_defaults(void)
5370 int check_for_failed
= FALSE
;
5371 int cri1
= 0; /* Criteria1 ELE_FAILED_GREATER, etc */
5373 int logic_cri2
= 0; /* Logic for criteria 2 ELE_FAILED_LOGIC_NONE, AND, etc */
5374 float val1
= 0.0; /* failure threshold 1 */
5375 float val2
= 0.0; /* failure threshold 2 */
5376 char failed_var_name
[Z_MXVARIABLEDESC
]={EOS
};
5378 check_for_failed
= USERD_get_uns_failed_params( failed_var_name
,
5379 &val1
, &val2
, &cri1
, &cri2
,
5381 if (check_for_failed
== TRUE
) {
5382 fprintf(stderr
,"Failed element criteria info \n");
5383 fprintf(stderr
,"Variable name = %s\n",failed_var_name
);
5384 fprintf(stderr
,"Criteria 1 = %d\n",cri1
);
5385 fprintf(stderr
,"Criteria 2 = %d\n",cri1
);
5386 fprintf(stderr
,"Logic criteria = %d\n",logic_cri2
);
5387 fprintf(stderr
,"Value 1 = %f\n",val1
);
5388 fprintf(stderr
,"Value 2 = %f\n",val2
);
5390 fprintf(stderr
,"No Failed elements\n");