20 while (buf[i] !=
'\n') {
35 else if ((buf[0] ==
'!') && (buf[1] ==
'!'))
45 while ((buf[i] ==
',') || (buf[i] ==
' ') || (buf[i] ==
'=')) i++;
47 fprintf(stderr,
"No string value for %s\n", para);
49 "ERROR: HEC-MW-VIS-E0002: The control parameter format error: should "
53 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
69 while ((buf[i] ==
',') || (buf[i] ==
' ') || (buf[i] ==
'=')) i++;
72 "ERROR: HEC-MW-VIS-E0003:The control parameter format error:No integer "
76 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
82 if ((isdigit(para2[0]) == 0) && (para2[0] !=
'+') && (para2[0] !=
'-')) {
83 fprintf(stderr,
"ERROR: HEC-MW-VIS-E0004: %s should be integer \n", para);
97 while ((buf[i] ==
',') || (buf[i] ==
' ') || (buf[i] ==
'=')) i++;
99 fprintf(stderr,
"No integer value for %s\n", para);
103 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
109 if ((isdigit(para2[0]) == 0) && (para2[0] !=
'+') && (para2[0] !=
'-')) {
110 fprintf(stderr,
"ERROR: HEC-MW-VIS-E0005:%s should be a real \n", para);
121 while (buf[i] ==
' ') i++;
123 fprintf(stderr,
"Please check the line %s\n", buf);
128 while ((buf[i] !=
' ') && (buf[i] !=
'=') && (buf[i] !=
',') &&
138 static int identify_surface(
char *buf) {
139 int i, j, ii, len_tmp;
141 char para[128], para1[128];
143 while (buf[i] ==
' ') i++;
146 "ERROR: HEC-MW-VIS-E0002: The control parameter format error: should "
150 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
157 len_tmp = strlen(para);
158 sprintf(para1,
"%s", para);
159 for (ii = 0; ii < len_tmp; ii++) {
162 if (strlen(para) > 8)
164 else if ((strncmp(para,
"SURFACE", 7) != 0) &&
165 (strncmp(para,
"surface", 7) != 0))
171 int identify_rendering(
char *buf) {
172 int i,j, ii, len_tmp;
179 HECMW_vis_print_exit(
"ERROR: HEC-MW-VIS-E0002: The control parameter format error: should start from !");
181 while((buf[i]!=
' ') && (buf[i]!=
',') && (buf[i]!=
'\n')) {
188 len_tmp=strlen(para);
189 for(ii=0;ii<len_tmp;ii++) {
195 else if((strncmp(para,
"SURFACE", 7)!=0) && (strncmp(para,
"surface", 7)!=0))
201 static int get_keyword_visual(
char *buf) {
202 int i, j, ii, len_tmp;
207 while (buf[i] ==
' ') i++;
210 "ERROR: HEC-MW-VIS-E0002: The control parameter format error: should "
214 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
221 len_tmp = strlen(para);
222 for (ii = 0; ii < len_tmp; ii++) {
226 if ((strncmp(para,
"VISUAL", 6) != 0) && (strncmp(para,
"visual", 6) != 0)) {
230 while ((buf[i] !=
'=') && (buf[i] !=
'\n')) i++;
233 "ERROR: HEC-MW-VIS-E0006:The control parameter format error: visual "
236 while ((buf[i] ==
' ') && (buf[i] !=
'\n')) i++;
239 "ERROR: HEC-MW-VIS-E0006:The control parameter format error: visual "
242 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'=') &&
249 len_tmp = strlen(para);
250 for (ii = 0; ii < len_tmp; ii++) {
254 if ((strncmp(para,
"PSR", 3) == 0) || (strncmp(para,
"psr", 3) == 0)) {
259 if ((strncmp(para,
"PVR", 3) == 0) || (strncmp(para,
"pvr", 3) == 0)) {
265 "ERROR: HEC-MW-VIS-E0007:The control parameter format error: method only "
266 "can be PSR or PVR");
271 int i, j, ii, len_tmp;
277 while (buf[i] ==
' ') i++;
280 "ERROR: HEC-MW-VIS-E0002: The control parameter format error: should "
284 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
291 len_tmp = strlen(para);
292 for (ii = 0; ii < len_tmp; ii++) {
296 if ((strncmp(para,
"VISUAL", 6) != 0) && (strncmp(para,
"visual", 6) != 0)) {
300 while ((buf[i] !=
'=') && (buf[i] !=
'\n')) i++;
303 "ERROR: HEC-MW-VIS-E0006:The control parameter format error: visual "
306 while ((buf[i] ==
' ') && (buf[i] !=
'\n')) i++;
309 "ERROR: HEC-MW-VIS-E0006:The control parameter format error: visual "
312 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'=') &&
319 len_tmp = strlen(para);
320 for (ii = 0; ii < len_tmp; ii++) {
324 if ((strncmp(para,
"PSR", 3) == 0) || (strncmp(para,
"psr", 3) == 0)) {
336 while ((buf[i] ==
',') || (buf[i] ==
' ')) i++;
337 while (buf[i] !=
'\n') {
339 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'=') &&
346 len_tmp = strlen(para);
347 for (ii = 0; ii < len_tmp; ii++) {
351 if (strncmp(para,
"visual_start_step", 12) == 0)
353 else if (strncmp(para,
"visual_end_step", 10) == 0)
355 else if (strncmp(para,
"visual_interval_step", 14) == 0)
357 while ((buf[i] ==
',') || (buf[i] ==
' ')) i++;
364 if ((strncmp(para,
"PVR", 3) == 0) || (strncmp(para,
"pvr", 3) == 0)) {
376 while ((buf[i] ==
',') || (buf[i] ==
' ')) i++;
377 while (buf[i] !=
'\n') {
379 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'=') &&
386 len_tmp = strlen(para);
387 for (ii = 0; ii < len_tmp; ii++) {
391 if (strncmp(para,
"visual_start_step", 12) == 0)
393 else if (strncmp(para,
"visual_end_step", 10) == 0)
395 else if (strncmp(para,
"visual_interval_step", 14) == 0)
397 while ((buf[i] ==
',') || (buf[i] ==
' ')) i++;
405 "ERROR: HEC-MW-VIS-E0007:The control parameter format error: method only "
406 "can be PSR or PVR");
410 static int get_keyword_surface_num(
char *buf) {
411 int i, j, ii, len_tmp;
417 "ERROR: HEC-MW-VIS-E0002: The control parameter format error: should "
421 while ((buf[i] !=
' ') && (buf[i] !=
'=') && (buf[i] !=
',') &&
428 len_tmp = strlen(para);
429 for (ii = 0; ii < len_tmp; ii++) {
432 if ((strncmp(para,
"surface_num", 11) != 0) &&
433 (strncmp(para,
"SURFACE_NUM", 6) != 0)) {
435 "ERROR: HEC-MW-VIS-E0008:The control parameter format error: "
436 "surface_num should be defined");
438 while ((buf[i] !=
'=') && (buf[i] !=
'\n')) i++;
441 "ERROR: HEC-MW-VIS-E0008:The control parameter format error: "
442 "surface_num should be defined");
444 while ((buf[i] ==
' ') && (buf[i] !=
'\n')) i++;
447 "ERROR: HEC-MW-VIS-E0008:The control parameter format error: "
448 "surface_num should be defined");
450 while ((buf[i] !=
' ') && (buf[i] !=
',') && (buf[i] !=
'\n')) {
456 surface_num = atoi(para);
458 return (surface_num);
463 int i, j, k, ii, len_tmp;
468 char para[128], para1[128];
472 int location, visual_method;
492 if (cont_flag == 1) visual_method = get_keyword_visual(buf);
493 while ((visual_method > 0) && (cont_flag == 1)) {
494 set_keyword_visual(buf,
psf,
pvr);
501 if ((visual_method == 1) && (cont_flag == 1)) {
503 surface_num = get_keyword_surface_num(buf);
515 parameters[i] = (
char *)
HECMW_calloc(128,
sizeof(
char));
516 if (parameters[i] ==
NULL)
519 strcpy(parameters[0],
"surface_style");
521 strcpy(parameters[1],
"group_name");
523 strcpy(parameters[2],
"defined_style");
525 strcpy(parameters[3],
"data_comp_name");
527 strcpy(parameters[4],
"data_comp");
529 strcpy(parameters[5],
"data_subcomp_name");
531 strcpy(parameters[6],
"data_subcomp");
533 strcpy(parameters[7],
"iso_value");
535 strcpy(parameters[8],
"method");
537 strcpy(parameters[9],
"point");
539 strcpy(parameters[10],
"radius");
541 strcpy(parameters[11],
"length");
543 strcpy(parameters[12],
"coef");
545 strcpy(parameters[13],
"display_method");
547 strcpy(parameters[14],
"color_comp_name");
549 strcpy(parameters[15],
"color_comp");
551 strcpy(parameters[16],
"color_subcomp_name");
553 strcpy(parameters[17],
"color_subcomp");
555 strcpy(parameters[18],
"isoline_number");
557 strcpy(parameters[19],
"specified_color");
559 strcpy(parameters[20],
"output_type");
561 strcpy(parameters[21],
"range_filename");
563 strcpy(parameters[22],
"normalize_on");
566 strcpy(parameters[23],
"x_resolution");
567 strcpy(parameters[24],
"y_resolution");
568 len_para[23] = len_para[24] = 12;
569 strcpy(parameters[25],
"num_of_lights");
571 strcpy(parameters[26],
"position_of_lights");
573 strcpy(parameters[27],
"viewpoint");
575 strcpy(parameters[28],
"look_at_point");
577 strcpy(parameters[29],
"up_direction");
579 strcpy(parameters[30],
"ambient_coef");
581 strcpy(parameters[31],
"diffuse_coef");
583 strcpy(parameters[32],
"specular_coef");
585 strcpy(parameters[33],
"color_mapping_style");
587 strcpy(parameters[34],
"interval_mapping_num");
589 strcpy(parameters[35],
"interval_mapping");
591 strcpy(parameters[36],
"rotate_style");
593 strcpy(parameters[37],
"rotate_num_of_frames");
595 strcpy(parameters[38],
"color_mapping_bar_on");
597 strcpy(parameters[39],
"scale_marking_on");
599 strcpy(parameters[40],
"background_color");
601 strcpy(parameters[41],
"font_color");
603 strcpy(parameters[42],
"color_system_type");
605 strcpy(parameters[43],
"font_size");
607 strcpy(parameters[44],
"color_bar_style");
609 strcpy(parameters[45],
"fixed_range_on");
611 strcpy(parameters[46],
"range_value");
613 strcpy(parameters[47],
"num_of_scale");
615 strcpy(parameters[48],
"mark_0_on");
617 strcpy(parameters[49],
"opacity_mapping_style");
619 strcpy(parameters[50],
"opa_value");
621 strcpy(parameters[51],
"num_of_features");
623 strcpy(parameters[52],
"fea_point");
625 strcpy(parameters[53],
"lookup_filename");
627 strcpy(parameters[54],
"histogram_on");
629 strcpy(parameters[55],
"boundary_line_on");
631 strcpy(parameters[56],
"isoline_color");
633 strcpy(parameters[57],
"time_mark_on");
635 strcpy(parameters[58],
"fixed_scale_mark");
637 strcpy(parameters[59],
"deform_display_on");
639 strcpy(parameters[60],
"deform_scale");
641 strcpy(parameters[61],
"initial_style");
643 strcpy(parameters[62],
"deform_style");
645 strcpy(parameters[63],
"deform_comp_name");
647 strcpy(parameters[64],
"deform_comp");
649 strcpy(parameters[65],
"initial_line_color");
651 strcpy(parameters[66],
"deform_line_color");
653 strcpy(parameters[67],
"deform_num_of_frames");
655 strcpy(parameters[68],
"smooth_shading_on");
657 strcpy(parameters[69],
"real_deform_scale");
659 strcpy(parameters[70],
"fixed_mesh_range");
661 strcpy(parameters[71],
"start_time");
663 strcpy(parameters[72],
"time_interval");
670 while (cont_flag == 1) {
676 for (k = 1; k < surface_num + 1; k++) {
690 for (i = 0; i < 23; i++) {
693 for (i = 59; i < 67; i++) stat_para[i] = 0;
695 if ((get_keyword_visual(buf) == 0) && (identify_surface(buf) == 1)) {
696 while (cont_flag == 1) {
704 while ((get_keyword_visual(buf) == 0) &&
705 (identify_surface(buf) == 0)) {
708 len_tmp = strlen(para);
709 for (ii = 0; ii < len_tmp; ii++) {
713 if ((strncmp(para, parameters[i], len_para[i])) == 0) {
755 for (j = 0; j < 3; j++) {
765 for (j = 0; j < 3; j++) {
770 for (j = 0; j < 10; j++) {
804 len_tmp = strlen(para1);
805 for (ii = 0; ii < len_tmp; ii++) {
806 para1[ii] =
toupper(para1[ii]);
808 if (strncmp(para1,
"AVS", 3) == 0)
810 else if (strncmp(para1,
"GPPVIEW", 7) == 0)
812 else if (strncmp(para1,
"BMP", 3) == 0)
814 else if (strncmp(para1,
"VIS_FEMAP_NEUTRAL", 17) == 0)
816 else if (strncmp(para1,
"FSTR_FEMAP_NEUTRAL", 18) == 0)
818 else if (strncmp(para1,
"COMPLETE_AVS", 12) == 0)
820 else if (strncmp(para1,
"BIN_COMPLETE_AVS", 16) == 0)
822 else if (strncmp(para1,
"COMPLETE_REORDER_AVS", 20) == 0)
824 else if (strncmp(para1,
"COMPLETE_MICROAVS", 17) == 0)
826 else if (strncmp(para1,
"SEPARATE_COMPLETE_AVS", 21) == 0)
828 else if (strncmp(para1,
"BIN_COMPLETE_REORDER_AVS", 24) ==
831 else if (strncmp(para1,
"BIN_SEPARATE_COMPLETE_AVS",
834 else if (strncmp(para1,
"COMP_COMPLETE_REORDER_AVS",
837 else if (strncmp(para1,
"COMP_SEPARATE_COMPLETE_AVS",
840 else if (strncmp(para1,
"VTK", 3) == 0)
842 else if (strncmp(para1,
"BIN_VTK", 7) == 0)
844 else if (strncmp(para1,
"COMP_VTK", 8) == 0)
848 "ERROR: HEC-MW-VIS-E1001: output_type is not "
851 "AVS or BMP or VIS_FEMAP_NEUTRAL or "
852 "FSTR_FEMAP_NEUTRAL");
888 for (i = 0; i < 3; i++) {
895 for (i = 0; i < 3; i++) {
901 for (i = 0; i < 3; i++) {
971 for (i = 0; i < 3; i++) {
977 for (i = 0; i < 3; i++) {
996 for (i = 0; i < 2; i++) {
1059 for (i = 0; i < 3; i++) {
1091 for (i = 0; i < 3; i++) {
1097 for (i = 0; i < 3; i++) {
1114 for (i = 0; i < 6; i++) {
1135 if (cont_flag == 0)
break;
1141 "ERROR: HEC-MW-VIS-E1002: surface_style only can be 1, 2 or "
1151 if (stat_para[2] == 0) {
1156 if ((stat_para[3] == 0) && (stat_para[4] == 0))
1158 if ((stat_para[5] == 0) && (stat_para[6] == 0))
1160 if (stat_para[7] == 0)
1162 "ERROR: HEC-MW-VIS-E1002: iso_value should be defined for "
1167 if (stat_para[8] == 0) sf[k].
method = 5;
1169 if (stat_para[9] == 0) {
1171 sf[k].
point[2] = 0.0;
1175 "The default center point (0.0, 0.0, 0.0) is used\n");
1177 if (stat_para[10] == 0) {
1180 fprintf(stderr,
"The default radius 1.0 is used\n");
1182 }
else if ((sf[k].
method == 2) || (sf[k].
method == 3) ||
1184 if (stat_para[9] == 0) {
1185 sf[k].
point[0] = 0.0;
1186 sf[k].
point[1] = 0.0;
1187 sf[k].
point[2] = 0.0;
1191 "The default center point (0.0, 0.0, 0.0) is used\n");
1193 if (stat_para[11] == 0) {
1199 "The default length (1.0, 1.0, 1.0) is used\n");
1201 }
else if (sf[k].
method == 5) {
1202 if (stat_para[12] == 0) {
1205 "ERROR: HEC-MW-VIS-E1003:The 10 coefficients of "
1206 "the equation should be defined \n");
1216 "ERROR: HEC-MW-VIS-E1004:display_method is not in the "
1217 "reasonable range\n");
1221 if ((stat_para[14] == 0) && (stat_para[15] == 0))
1223 if ((stat_para[16] == 0) && (stat_para[17] == 0))
1228 if (stat_para[18] == 0) {
1231 "No value for the number of isolines. Now using the "
1232 "default value 10");
1237 if (stat_para[19] == 0) {
1241 "The number of specified_color has not been defined\n");
1242 fprintf(stderr,
"Now using the default value 0.5\n");
1250 fprintf(stderr,
"the output_type only can be 1 -- 16\n");
1258 "ERROR: HEC-MW-VIS-E1037: deform_display_on should be 0 "
1273 if (stat_para[60] == 0) sf[k].
disp_scale = -1.0;
1284 "ERROR: HEC-MW-VIS-E1037: initial_display_style should "
1290 "ERROR: HEC-MW-VIS-E1037: deform_display_style should be "
1294 if ((stat_para[63] == 0) && (stat_para[64] == 0))
1296 if (stat_para[65] == 0) {
1301 if (stat_para[66] == 0) {
1306 for (i = 0; i < 3; i++) {
1319 else if (get_keyword_visual(buf) > 0) {
1320 visual_method = get_keyword_visual(buf);
1333 if (stat_para[23] == 0) {
1336 fprintf(stderr,
"No value for xr. Now use the default value 512\n");
1340 sr->
xr = (int)(sr->
xr / 8) * 8;
1342 if (stat_para[24] == 0) {
1344 fprintf(stderr,
"No value for yr. Now use the default value 512\n");
1349 "ERROR: HEC-MW-VIS-E1005: The x_resolution should be greater "
1354 "ERROR: HEC-MW-VIS-E1006: The y_resolution should be greater "
1358 if (stat_para[25] == 0) {
1362 "No value for num_of_lights. Now use the default value 1\n");
1368 "ERROR: HEC-MW-VIS-E1007: The number of light sources should be "
1371 if (stat_para[29] == 0) {
1375 "No value for up_direction. The default value (0.0, 0.0, "
1381 if (stat_para[30] == 0) {
1385 if ((stat_para[30] == 1) && (sr->
k_ads[0] < 0)) {
1387 "ERROR: HEC-MW-VIS-E1008: The ambient_coef is not correct. "
1388 "Should be >=0.0\n");
1390 "Please re-input the ambient_coef in your control file");
1392 if (stat_para[31] == 0) {
1396 if ((stat_para[31] == 1) && (sr->
k_ads[1] < 0)) {
1398 "ERROR: HEC-MW-VIS-E1009: The diffuse_coef is not correct. "
1399 "Should be >=0.0\n");
1401 "Please re-input the diffuse_coef in your control file");
1403 if (stat_para[32] == 0) {
1407 if ((stat_para[32] == 1) && (sr->
k_ads[2] < 0)) {
1409 "ERROR: HEC-MW-VIS-E1010: The specular_coef is not correct. "
1410 "Should be >=0.0\n");
1412 "Please re-input the specular_coef in your control file");
1414 if (stat_para[33] == 0) {
1420 "ERROR: HEC-MW-VIS-E1011: color_mapping_style should be "
1421 "between 1 and 4\n");
1426 "ERROR: HEC-MW-VIS-E1012:For color_mapping_style 3, "
1427 "interval_mapping_num is required\n");
1429 "Please re-input the value of interval_mapping_num");
1433 "ERROR: HEC-MW-VIS-E1013: For color_mapping_style 3, the "
1434 "interval_mapping_num should be greater than 0");
1438 (stat_para[35] == 0)) {
1440 "ERROR: HEC-MW-VIS-E1014: For color_mapping_style =2 or 3, "
1441 "the interval_point should be defined\n");
1444 if (stat_para[36] == 0) {
1452 "ERROR: HEC-MW-VIS-E1015: The parameter "
1453 "rotate_num_of_frames cannot be less than 1.\n");
1462 "ERROR: HEC-MW-VIS-E1016: color_mapping_bar_on parameter "
1463 "only can be defined as 0 or 1\n");
1469 "ERROR: HEC-MW-VIS-E1017: scale_marking_on parameter only "
1470 "can be defined as 0 or 1\n");
1476 "ERROR: HEC-MW-VIS-E1018: x resolution should be larger than "
1477 "40 for adding color_mapping_bar case\n");
1482 "ERROR: HEC-MW-VIS-E1019: x resolution should be larger than "
1483 "65 for adding color_mapping and scale marking case\n");
1486 if (stat_para[40] == 0)
1489 if (stat_para[41] == 0)
1494 "ERROR: HEC-MW-VIS-E1020:color_system_type should be between "
1505 "ERROR: HEC-MW-VIS-E1021:The background color should be in "
1506 "the interval of (0.0, 1.0)\n");
1516 "ERROR: HEC-MW-VIS-E1022: The font color should be in the "
1517 "interval of (0.0, 1.0)\n");
1520 if (stat_para[43] == 0) sr->
font_size = 1.0;
1523 "ERROR: HEC-MW-VIS-E1023: font_size parameters cannot be "
1524 "between 1.0 and 4.0\n");
1532 "ERROR: HEC-MW-VIS-E1024: color_bar_style only can be 1 or 2\n");
1537 fprintf(stderr,
"fixed_range_on only can be 0 or 1\n");
1543 "ERROR: HEC-MW-VIS-E1025: num_of_scale only can be greater "
1549 "ERROR: HEC-MW-VIS-E1026: range_value is required for "
1550 "fixed_range_on style\n");
1553 if (stat_para[48] == 0) sr->
mark_0_on = 0;
1556 "ERROR: HEC-MW-VIS-E1027: mark_0_on only can be 0 or 1\n");
1560 if (stat_para[49] == 0) {
1569 "ERROR: HEC-MW-VIS-E1028: transfer_function_style should be "
1570 "between 1 and 8\n");
1573 if ((stat_para[50] == 1) && (sr->
opa_value < 0)) {
1575 "ERROR: HEC-MW-VIS-E1029: opacity_value cannot be less than "
1581 (stat_para[51] == 0)) {
1583 "ERROR: HEC-MW-VIS-E1030:When transfer_function_style =3 or "
1584 "4, num_of_features should be defined\n");
1589 "ERROR: HEC-MW-VIS-E1031: When transfer_function_style =3 or "
1590 "4, num_of_features should be greater than 0\n");
1593 if ((stat_para[51] == 1) && (stat_para[52] == 0)) {
1595 "ERROR: HEC-MW-VIS-E1032:For transfer_function_style =3 or "
1596 "4, feature_points should be defined\n");
1601 "ERROR: HEC-MW-VIS-E1033:For transfer_function_style=8, "
1602 "lookup_filename should be specified\n");
1608 "ERROR: HEC-MW-VIS-E1034: histogram_on value should be 0,1, "
1616 "ERROR: HEC-MW-VIS-E1035: histogram_on value should be 0 or 1");
1619 if (stat_para[56] == 0) {
1628 "ERROR: HEC-MW-VIS-E1036: time_mark_on value should be 0 or 1");
1634 "ERROR: HEC-MW-VIS-E1037: fixed_scale_mark value should be 0 "
1665 else if ((visual_method == 2) && (cont_flag == 1)) {
1675 parameters[i] = (
char *)
HECMW_calloc(128,
sizeof(
char));
1676 if (parameters[i] ==
NULL)
1682 strcpy(parameters[0],
"maximum_refinement");
1684 strcpy(parameters[1],
"x_resolution");
1685 strcpy(parameters[2],
"y_resolution");
1686 len_para[1] = len_para[2] = 12;
1687 strcpy(parameters[3],
"num_of_lights");
1689 strcpy(parameters[4],
"position_of_lights");
1691 strcpy(parameters[5],
"viewpoint");
1693 strcpy(parameters[6],
"look_at_point");
1695 strcpy(parameters[7],
"up_direction");
1697 strcpy(parameters[8],
"ambient_coef");
1699 strcpy(parameters[9],
"diffuse_coef");
1701 strcpy(parameters[10],
"specular_coef");
1703 strcpy(parameters[11],
"surface_on");
1705 strcpy(parameters[12],
"surface_opacity");
1707 strcpy(parameters[13],
"color_mapping_style");
1709 strcpy(parameters[14],
"interval_mapping_num");
1711 strcpy(parameters[15],
"interval_mapping");
1713 strcpy(parameters[16],
"opacity_mapping_style");
1715 strcpy(parameters[17],
"opacity_value");
1717 strcpy(parameters[18],
"num_of_features");
1719 strcpy(parameters[19],
"feature_points");
1721 strcpy(parameters[20],
"lookup_filename");
1723 strcpy(parameters[21],
"rotate_style");
1725 strcpy(parameters[22],
"voxel_filename");
1727 strcpy(parameters[23],
"color_mapping_bar_on");
1729 strcpy(parameters[24],
"scale_marking_on");
1731 strcpy(parameters[25],
"color_comp_name");
1733 strcpy(parameters[26],
"color_subcomp_name");
1735 strcpy(parameters[27],
"n_voxel_x");
1737 strcpy(parameters[28],
"n_voxel_y");
1739 strcpy(parameters[29],
"n_voxel_z");
1741 strcpy(parameters[30],
"surface_filename");
1743 strcpy(parameters[31],
"num_of_frames");
1745 strcpy(parameters[32],
"background_color");
1747 strcpy(parameters[33],
"font_color");
1749 strcpy(parameters[34],
"color_system_type");
1751 strcpy(parameters[35],
"font_size");
1753 strcpy(parameters[36],
"color_bar_style");
1755 strcpy(parameters[37],
"fixed_range_on");
1757 strcpy(parameters[38],
"range_value");
1759 strcpy(parameters[39],
"num_of_scale");
1761 strcpy(parameters[40],
"mark_0_on");
1763 strcpy(parameters[41],
"remove_0_display_on");
1765 strcpy(parameters[42],
"x_specified_level");
1767 strcpy(parameters[43],
"y_specified_level");
1769 strcpy(parameters[44],
"z_specified_level");
1771 strcpy(parameters[45],
"histogram_on");
1773 strcpy(parameters[46],
"display_range");
1775 strcpy(parameters[47],
"time_mark_on");
1777 strcpy(parameters[48],
"fixed_scale_mark");
1779 strcpy(parameters[49],
"color_comp");
1781 strcpy(parameters[50],
"color_subcomp");
1794 while (get_keyword_visual(buf) == 0) {
1797 len_tmp = strlen(para);
1798 for (ii = 0; ii < len_tmp; ii++) {
1802 if ((strncmp(para, parameters[i], len_para[i])) == 0) {
1841 for (i = 0; i < 3; i++) {
1847 for (i = 0; i < 3; i++) {
1852 for (i = 0; i < 3; i++) {
1982 for (i = 0; i < 3; i++) {
1988 for (i = 0; i < 3; i++) {
2005 for (i = 0; i < 2; i++) {
2032 for (i = 0; i < 6; i++) {
2059 else if (get_keyword_visual(buf) > 0) {
2060 visual_method = get_keyword_visual(buf);
2065 if (stat_para[0] == 0) {
2069 if ((vr->
max_level <= 0) && (stat_para[0] == 1)) {
2071 "ERROR: HEC-MW-VIS-E1038: maximum_refinement parameter should "
2072 "be greater than 0\n");
2075 if (stat_para[1] == 0) {
2080 vr->
xr = (int)(vr->
xr / 8) * 8;
2082 if (stat_para[2] == 0) {
2087 "ERROR: HEC-MW-VIS-E1005: The x_resolution should be greater "
2093 "ERROR: HEC-MW-VIS-E1006: The y_resolution should be greater "
2097 if (stat_para[3] == 0) {
2103 "ERROR: HEC-MW-VIS-E1007: The number of light sources should be "
2106 if (stat_para[7] == 0) {
2112 if (stat_para[8] == 0) {
2116 if ((stat_para[8] == 1) && (vr->
k_ads[0] < 0)) {
2118 "ERROR: HEC-MW-VIS-E1008: The ambient_coef is not correct. "
2119 "Should be >=0.0\n");
2121 "Please re-input the ambient_coef in your control file");
2123 if (stat_para[9] == 0) {
2127 if ((stat_para[9] == 1) && (vr->
k_ads[1] < 0)) {
2129 "ERROR: HEC-MW-VIS-E1009: The diffuse_coef is not correct. "
2130 "Should be >=0.0\n");
2132 "Please re-input the diffuse_coef in your control file");
2134 if (stat_para[10] == 0) {
2138 if ((stat_para[10] == 1) && (vr->
k_ads[2] < 0)) {
2140 "ERROR: HEC-MW-VIS-E1010: The specular_coef is not correct. "
2141 "Should be >=0.0\n");
2143 "Please re-input the specular_coef in your control file");
2164 if (stat_para[13] == 0) {
2170 "ERROR: HEC-MW-VIS-E1011:color_mapping_style should be between "
2176 "ERROR: HEC-MW-VIS-E1012:For color_mapping_style 3, the "
2177 "parameter interval_mapping_num is required\n");
2179 "Please re-input the value of interval_mapping_num");
2183 "ERROR: HEC-MW-VIS-E1013:For color_mapping_style 3, the "
2184 "interval_mapping_num should be greater than 0");
2187 (stat_para[15] == 0)) {
2189 "ERROR: HEC-MW-VIS-E1014:For color_mapping_style =2 or 3, the "
2190 "interval_point should be defined\n");
2193 if (stat_para[16] == 0) {
2202 "ERROR: HEC-MW-VIS-E1028:transfer_function_style should be "
2203 "between 1 and 8\n");
2206 if ((stat_para[17] == 1) && (vr->
opa_value < 0)) {
2209 "ERROR: HEC-MW-VIS-E1029:opacity_value cannot be less than 0.0\n");
2210 fprintf(stderr,
"Please re-input and run again\n");
2215 (stat_para[18] == 0)) {
2217 "ERROR: HEC-MW-VIS-E1030:When transfer_function_style =3 or 4, "
2218 "num_of_features should be defined\n");
2223 "ERROR: HEC-MW-VIS-E1031:When transfer_function_style =3 or 4, "
2224 "num_of_features should be greater than 0\n");
2227 if ((stat_para[18] == 1) && (stat_para[19] == 0)) {
2229 "ERROR: HEC-MW-VIS-E1032:For transfer_function_style =3 or 4, "
2230 "feature_points should be defined\n");
2235 "ERROR: HEC-MW-VIS-E1033:For transfer_function_style=8, "
2236 "lookup_filename should be specified\n");
2242 "ERROR: HEC-MW-VIS-E1039:The rotate_style parameter is wrong. "
2243 "Please input one within (0, 4)");
2248 "ERROR: HEC-MW-VIS-E1016:color_mapping_bar_on parameter only "
2249 "can be defined as 0 or 1\n");
2255 "ERROR: HEC-MW-VIS-E1017:scale_marking_on parameter only can "
2256 "be defined as 0 or 1\n");
2262 "ERROR: HEC-MW-VIS-E1018:x resolution should be larger than 40 "
2263 "for adding color_mapping_bar case\n");
2268 " ERROR: HEC-MW-VIS-E1019: x resolution should be larger than "
2269 "65 for adding color_mapping and scale marking case\n");
2272 if (stat_para[25] == 0) {
2275 if (stat_para[26] == 0) {
2278 if (stat_para[22] == 1) {
2282 }
else if (stat_para[22] == 0) {
2283 if ((stat_para[27] == 0) && (stat_para[28] == 0) &&
2284 (stat_para[29] == 0)) {
2289 }
else if ((stat_para[27] == 0) || (stat_para[28] == 0) ||
2290 (stat_para[29] == 0)) {
2292 "ERROR: HEC-MW-VIS-E1040: please define all the n_voxel_x, "
2293 "n_voxel_y, n_voxel_z parameters");
2296 "ERROR: HEC-MW-VIS-E1041: n_voxel_x*n_voxel_y*n_voxel_z "
2297 "should be equal to the number of pes\n");
2299 }
else if ((vr->
nv_xyz[0] <= 0) || (vr->
nv_xyz[1] <= 0) ||
2302 "ERROR: HEC-MW-VIS-E1042: n_voxel_x,n_voxel_y, and n_voxel_z "
2303 "cannot be less or equal to 0\n");
2318 "ERROR: HEC-MW-VIS-E1015: The parameter num_of_frames cannot "
2319 "be less than 1.\n");
2324 if (stat_para[32] == 0)
2327 if (stat_para[33] == 0)
2332 "ERROR: HEC-MW-VIS-E1020: color_system_type should be between "
2343 "ERROR: HEC-MW-VIS-E1021: The background color should be in "
2344 "the interval of (0.0, 1.0)\n");
2354 "ERROR: HEC-MW-VIS-E1022: The font color should be in the "
2355 "interval of (0.0, 1.0)\n");
2358 if (stat_para[35] == 0) vr->
font_size = 1.0;
2361 "ERROR: HEC-MW-VIS-E1023: font_size parameters cannot be "
2362 "between 1.0 and 4.0\n");
2370 "ERROR: HEC-MW-VIS-E1024: color_bar_style only can be 1 or 2\n");
2376 "ERROR: HEC-MW-VIS-E1043: fixed_range_on only can be 0 or 1\n");
2382 "ERROR: HEC-MW-VIS-E1025: num_of_scale only can be greater "
2386 if ((stat_para[37] == 1) && (stat_para[38] == 0)) {
2388 "ERROR: HEC-MW-VIS-E1026:Please input range_value for "
2389 "fixed_range_on style\n");
2392 if (stat_para[40] == 0) vr->
mark_0_on = 0;
2395 "ERROR: HEC-MW-VIS-E1044:mark_0_on only can be 0 or 1\n");
2402 "ERROR: HEC-MW-VIS-E1045:remove_0_display_on only can be 0 or 1\n");
2408 "ERROR: HEC-MW-VIS-E1046: x_specified_level should be greater "
2415 "ERROR: HEC-MW-VIS-E1047: y_specified_level should be greater "
2422 "ERROR: HEC-MW-VIS-E1048: z_specified_level should be greater "
2430 "ERROR: HEC-MW-VIS-E1050: time_mark_on value should be 0 or 1");
2437 "ERROR: HEC-MW-VIS-E1049: fixed_scale_mark value should be 0 or 1");
2459 stat_para[0]=stat_para[1]=stat_para[2]=0;
2465 stat_para[4]=stat_para[5]=stat_para[6]=0;
2470 stat_para[8]=stat_para[9]=stat_para[10]=1;
2479 stat_para[14]=stat_para[15]=0;
2480 stat_para[16]=stat_para[17]=1;
2508 void read_lookup_table(
Parameter_vr *vr,
double *opa_table)
2513 fprintf(stderr,
"There is not such a opacity file:\n");
2517 fscanf(opa_fp,
"%lf", &(opa_table[i]));