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 snprintf(para1,
sizeof(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);
511 const size_t para_size = 128;
516 parameters[i] = (
char *)
HECMW_calloc(para_size,
sizeof(
char));
517 if (parameters[i] ==
NULL)
520 snprintf(parameters[0], para_size,
"surface_style");
522 snprintf(parameters[1], para_size,
"group_name");
524 snprintf(parameters[2], para_size,
"defined_style");
526 snprintf(parameters[3], para_size,
"data_comp_name");
528 snprintf(parameters[4], para_size,
"data_comp");
530 snprintf(parameters[5], para_size,
"data_subcomp_name");
532 snprintf(parameters[6], para_size,
"data_subcomp");
534 snprintf(parameters[7], para_size,
"iso_value");
536 snprintf(parameters[8], para_size,
"method");
538 snprintf(parameters[9], para_size,
"point");
540 snprintf(parameters[10], para_size,
"radius");
542 snprintf(parameters[11], para_size,
"length");
544 snprintf(parameters[12], para_size,
"coef");
546 snprintf(parameters[13], para_size,
"display_method");
548 snprintf(parameters[14], para_size,
"color_comp_name");
550 snprintf(parameters[15], para_size,
"color_comp");
552 snprintf(parameters[16], para_size,
"color_subcomp_name");
554 snprintf(parameters[17], para_size,
"color_subcomp");
556 snprintf(parameters[18], para_size,
"isoline_number");
558 snprintf(parameters[19], para_size,
"specified_color");
560 snprintf(parameters[20], para_size,
"output_type");
562 snprintf(parameters[21], para_size,
"range_filename");
564 snprintf(parameters[22], para_size,
"normalize_on");
567 snprintf(parameters[23], para_size,
"x_resolution");
568 snprintf(parameters[24], para_size,
"y_resolution");
569 len_para[23] = len_para[24] = 12;
570 snprintf(parameters[25], para_size,
"num_of_lights");
572 snprintf(parameters[26], para_size,
"position_of_lights");
574 snprintf(parameters[27], para_size,
"viewpoint");
576 snprintf(parameters[28], para_size,
"look_at_point");
578 snprintf(parameters[29], para_size,
"up_direction");
580 snprintf(parameters[30], para_size,
"ambient_coef");
582 snprintf(parameters[31], para_size,
"diffuse_coef");
584 snprintf(parameters[32], para_size,
"specular_coef");
586 snprintf(parameters[33], para_size,
"color_mapping_style");
588 snprintf(parameters[34], para_size,
"interval_mapping_num");
590 snprintf(parameters[35], para_size,
"interval_mapping");
592 snprintf(parameters[36], para_size,
"rotate_style");
594 snprintf(parameters[37], para_size,
"rotate_num_of_frames");
596 snprintf(parameters[38], para_size,
"color_mapping_bar_on");
598 snprintf(parameters[39], para_size,
"scale_marking_on");
600 snprintf(parameters[40], para_size,
"background_color");
602 snprintf(parameters[41], para_size,
"font_color");
604 snprintf(parameters[42], para_size,
"color_system_type");
606 snprintf(parameters[43], para_size,
"font_size");
608 snprintf(parameters[44], para_size,
"color_bar_style");
610 snprintf(parameters[45], para_size,
"fixed_range_on");
612 snprintf(parameters[46], para_size,
"range_value");
614 snprintf(parameters[47], para_size,
"num_of_scale");
616 snprintf(parameters[48], para_size,
"mark_0_on");
618 snprintf(parameters[49], para_size,
"opacity_mapping_style");
620 snprintf(parameters[50], para_size,
"opa_value");
622 snprintf(parameters[51], para_size,
"num_of_features");
624 snprintf(parameters[52], para_size,
"fea_point");
626 snprintf(parameters[53], para_size,
"lookup_filename");
628 snprintf(parameters[54], para_size,
"histogram_on");
630 snprintf(parameters[55], para_size,
"boundary_line_on");
632 snprintf(parameters[56], para_size,
"isoline_color");
634 snprintf(parameters[57], para_size,
"time_mark_on");
636 snprintf(parameters[58], para_size,
"fixed_scale_mark");
638 snprintf(parameters[59], para_size,
"deform_display_on");
640 snprintf(parameters[60], para_size,
"deform_scale");
642 snprintf(parameters[61], para_size,
"initial_style");
644 snprintf(parameters[62], para_size,
"deform_style");
646 snprintf(parameters[63], para_size,
"deform_comp_name");
648 snprintf(parameters[64], para_size,
"deform_comp");
650 snprintf(parameters[65], para_size,
"initial_line_color");
652 snprintf(parameters[66], para_size,
"deform_line_color");
654 snprintf(parameters[67], para_size,
"deform_num_of_frames");
656 snprintf(parameters[68], para_size,
"smooth_shading_on");
658 snprintf(parameters[69], para_size,
"real_deform_scale");
660 snprintf(parameters[70], para_size,
"fixed_mesh_range");
662 snprintf(parameters[71], para_size,
"start_time");
664 snprintf(parameters[72], para_size,
"time_interval");
671 while (cont_flag == 1) {
677 for (k = 1; k < surface_num + 1; k++) {
691 for (i = 0; i < 23; i++) {
694 for (i = 59; i < 67; i++) stat_para[i] = 0;
696 if ((get_keyword_visual(buf) == 0) && (identify_surface(buf) == 1)) {
697 while (cont_flag == 1) {
705 while ((get_keyword_visual(buf) == 0) &&
706 (identify_surface(buf) == 0)) {
709 len_tmp = strlen(para);
710 for (ii = 0; ii < len_tmp; ii++) {
714 if ((strncmp(para, parameters[i], len_para[i])) == 0) {
756 for (j = 0; j < 3; j++) {
766 for (j = 0; j < 3; j++) {
771 for (j = 0; j < 10; j++) {
805 len_tmp = strlen(para1);
806 for (ii = 0; ii < len_tmp; ii++) {
807 para1[ii] =
toupper(para1[ii]);
809 if (strncmp(para1,
"AVS", 3) == 0)
811 else if (strncmp(para1,
"GPPVIEW", 7) == 0)
813 else if (strncmp(para1,
"BMP", 3) == 0)
815 else if (strncmp(para1,
"VIS_FEMAP_NEUTRAL", 17) == 0)
817 else if (strncmp(para1,
"FSTR_FEMAP_NEUTRAL", 18) == 0)
819 else if (strncmp(para1,
"COMPLETE_AVS", 12) == 0)
821 else if (strncmp(para1,
"BIN_COMPLETE_AVS", 16) == 0)
823 else if (strncmp(para1,
"COMPLETE_REORDER_AVS", 20) == 0)
825 else if (strncmp(para1,
"COMPLETE_MICROAVS", 17) == 0)
827 else if (strncmp(para1,
"SEPARATE_COMPLETE_AVS", 21) == 0)
829 else if (strncmp(para1,
"BIN_COMPLETE_REORDER_AVS", 24) ==
832 else if (strncmp(para1,
"BIN_SEPARATE_COMPLETE_AVS",
835 else if (strncmp(para1,
"COMP_COMPLETE_REORDER_AVS",
838 else if (strncmp(para1,
"COMP_SEPARATE_COMPLETE_AVS",
841 else if (strncmp(para1,
"VTK", 3) == 0)
843 else if (strncmp(para1,
"BIN_VTK", 7) == 0)
845 else if (strncmp(para1,
"COMP_VTK", 8) == 0)
847 else if (strncmp(para1,
"EXODUS", 6) == 0)
849 else if (strncmp(para1,
"STEP_EXODUS", 11) == 0)
853 "ERROR: HEC-MW-VIS-E1001: output_type is not "
856 "AVS or BMP or VIS_FEMAP_NEUTRAL or "
857 "FSTR_FEMAP_NEUTRAL or VTK or BIN_VTK or EXODUS or STEP_EXODUS");
893 for (i = 0; i < 3; i++) {
900 for (i = 0; i < 3; i++) {
906 for (i = 0; i < 3; i++) {
976 for (i = 0; i < 3; i++) {
982 for (i = 0; i < 3; i++) {
1001 for (i = 0; i < 2; i++) {
1064 for (i = 0; i < 3; i++) {
1096 for (i = 0; i < 3; i++) {
1102 for (i = 0; i < 3; i++) {
1119 for (i = 0; i < 6; i++) {
1140 if (cont_flag == 0)
break;
1146 "ERROR: HEC-MW-VIS-E1002: surface_style only can be 1, 2 or "
1156 if (stat_para[2] == 0) {
1161 if ((stat_para[3] == 0) && (stat_para[4] == 0))
1163 if ((stat_para[5] == 0) && (stat_para[6] == 0))
1165 if (stat_para[7] == 0)
1167 "ERROR: HEC-MW-VIS-E1002: iso_value should be defined for "
1172 if (stat_para[8] == 0) sf[k].
method = 5;
1174 if (stat_para[9] == 0) {
1176 sf[k].
point[2] = 0.0;
1180 "The default center point (0.0, 0.0, 0.0) is used\n");
1182 if (stat_para[10] == 0) {
1185 fprintf(stderr,
"The default radius 1.0 is used\n");
1187 }
else if ((sf[k].
method == 2) || (sf[k].
method == 3) ||
1189 if (stat_para[9] == 0) {
1190 sf[k].
point[0] = 0.0;
1191 sf[k].
point[1] = 0.0;
1192 sf[k].
point[2] = 0.0;
1196 "The default center point (0.0, 0.0, 0.0) is used\n");
1198 if (stat_para[11] == 0) {
1204 "The default length (1.0, 1.0, 1.0) is used\n");
1206 }
else if (sf[k].
method == 5) {
1207 if (stat_para[12] == 0) {
1210 "ERROR: HEC-MW-VIS-E1003:The 10 coefficients of "
1211 "the equation should be defined \n");
1221 "ERROR: HEC-MW-VIS-E1004:display_method is not in the "
1222 "reasonable range\n");
1226 if ((stat_para[14] == 0) && (stat_para[15] == 0))
1228 if ((stat_para[16] == 0) && (stat_para[17] == 0))
1233 if (stat_para[18] == 0) {
1236 "No value for the number of isolines. Now using the "
1237 "default value 10");
1242 if (stat_para[19] == 0) {
1246 "The number of specified_color has not been defined\n");
1247 fprintf(stderr,
"Now using the default value 0.5\n");
1255 fprintf(stderr,
"the output_type only can be 1 -- 19\n");
1263 "ERROR: HEC-MW-VIS-E1037: deform_display_on should be 0 "
1278 if (stat_para[60] == 0) sf[k].
disp_scale = -1.0;
1289 "ERROR: HEC-MW-VIS-E1037: initial_display_style should "
1295 "ERROR: HEC-MW-VIS-E1037: deform_display_style should be "
1299 if ((stat_para[63] == 0) && (stat_para[64] == 0))
1301 if (stat_para[65] == 0) {
1306 if (stat_para[66] == 0) {
1311 for (i = 0; i < 3; i++) {
1324 else if (get_keyword_visual(buf) > 0) {
1325 visual_method = get_keyword_visual(buf);
1338 if (stat_para[23] == 0) {
1341 fprintf(stderr,
"No value for xr. Now use the default value 512\n");
1345 sr->
xr = (int)(sr->
xr / 8) * 8;
1347 if (stat_para[24] == 0) {
1349 fprintf(stderr,
"No value for yr. Now use the default value 512\n");
1354 "ERROR: HEC-MW-VIS-E1005: The x_resolution should be greater "
1359 "ERROR: HEC-MW-VIS-E1006: The y_resolution should be greater "
1363 if (stat_para[25] == 0) {
1367 "No value for num_of_lights. Now use the default value 1\n");
1373 "ERROR: HEC-MW-VIS-E1007: The number of light sources should be "
1376 if (stat_para[29] == 0) {
1380 "No value for up_direction. The default value (0.0, 0.0, "
1386 if (stat_para[30] == 0) {
1390 if ((stat_para[30] == 1) && (sr->
k_ads[0] < 0)) {
1392 "ERROR: HEC-MW-VIS-E1008: The ambient_coef is not correct. "
1393 "Should be >=0.0\n");
1395 "Please re-input the ambient_coef in your control file");
1397 if (stat_para[31] == 0) {
1401 if ((stat_para[31] == 1) && (sr->
k_ads[1] < 0)) {
1403 "ERROR: HEC-MW-VIS-E1009: The diffuse_coef is not correct. "
1404 "Should be >=0.0\n");
1406 "Please re-input the diffuse_coef in your control file");
1408 if (stat_para[32] == 0) {
1412 if ((stat_para[32] == 1) && (sr->
k_ads[2] < 0)) {
1414 "ERROR: HEC-MW-VIS-E1010: The specular_coef is not correct. "
1415 "Should be >=0.0\n");
1417 "Please re-input the specular_coef in your control file");
1419 if (stat_para[33] == 0) {
1425 "ERROR: HEC-MW-VIS-E1011: color_mapping_style should be "
1426 "between 1 and 4\n");
1431 "ERROR: HEC-MW-VIS-E1012:For color_mapping_style 3, "
1432 "interval_mapping_num is required\n");
1434 "Please re-input the value of interval_mapping_num");
1438 "ERROR: HEC-MW-VIS-E1013: For color_mapping_style 3, the "
1439 "interval_mapping_num should be greater than 0");
1443 (stat_para[35] == 0)) {
1445 "ERROR: HEC-MW-VIS-E1014: For color_mapping_style =2 or 3, "
1446 "the interval_point should be defined\n");
1449 if (stat_para[36] == 0) {
1457 "ERROR: HEC-MW-VIS-E1015: The parameter "
1458 "rotate_num_of_frames cannot be less than 1.\n");
1467 "ERROR: HEC-MW-VIS-E1016: color_mapping_bar_on parameter "
1468 "only can be defined as 0 or 1\n");
1474 "ERROR: HEC-MW-VIS-E1017: scale_marking_on parameter only "
1475 "can be defined as 0 or 1\n");
1481 "ERROR: HEC-MW-VIS-E1018: x resolution should be larger than "
1482 "40 for adding color_mapping_bar case\n");
1487 "ERROR: HEC-MW-VIS-E1019: x resolution should be larger than "
1488 "65 for adding color_mapping and scale marking case\n");
1491 if (stat_para[40] == 0)
1494 if (stat_para[41] == 0)
1499 "ERROR: HEC-MW-VIS-E1020:color_system_type should be between "
1510 "ERROR: HEC-MW-VIS-E1021:The background color should be in "
1511 "the interval of (0.0, 1.0)\n");
1521 "ERROR: HEC-MW-VIS-E1022: The font color should be in the "
1522 "interval of (0.0, 1.0)\n");
1525 if (stat_para[43] == 0) sr->
font_size = 1.0;
1528 "ERROR: HEC-MW-VIS-E1023: font_size parameters cannot be "
1529 "between 1.0 and 4.0\n");
1537 "ERROR: HEC-MW-VIS-E1024: color_bar_style only can be 1 or 2\n");
1542 fprintf(stderr,
"fixed_range_on only can be 0 or 1\n");
1548 "ERROR: HEC-MW-VIS-E1025: num_of_scale only can be greater "
1554 "ERROR: HEC-MW-VIS-E1026: range_value is required for "
1555 "fixed_range_on style\n");
1558 if (stat_para[48] == 0) sr->
mark_0_on = 0;
1561 "ERROR: HEC-MW-VIS-E1027: mark_0_on only can be 0 or 1\n");
1565 if (stat_para[49] == 0) {
1574 "ERROR: HEC-MW-VIS-E1028: transfer_function_style should be "
1575 "between 1 and 8\n");
1578 if ((stat_para[50] == 1) && (sr->
opa_value < 0)) {
1580 "ERROR: HEC-MW-VIS-E1029: opacity_value cannot be less than "
1586 (stat_para[51] == 0)) {
1588 "ERROR: HEC-MW-VIS-E1030:When transfer_function_style =3 or "
1589 "4, num_of_features should be defined\n");
1594 "ERROR: HEC-MW-VIS-E1031: When transfer_function_style =3 or "
1595 "4, num_of_features should be greater than 0\n");
1598 if ((stat_para[51] == 1) && (stat_para[52] == 0)) {
1600 "ERROR: HEC-MW-VIS-E1032:For transfer_function_style =3 or "
1601 "4, feature_points should be defined\n");
1606 "ERROR: HEC-MW-VIS-E1033:For transfer_function_style=8, "
1607 "lookup_filename should be specified\n");
1613 "ERROR: HEC-MW-VIS-E1034: histogram_on value should be 0,1, "
1621 "ERROR: HEC-MW-VIS-E1035: histogram_on value should be 0 or 1");
1624 if (stat_para[56] == 0) {
1633 "ERROR: HEC-MW-VIS-E1036: time_mark_on value should be 0 or 1");
1639 "ERROR: HEC-MW-VIS-E1037: fixed_scale_mark value should be 0 "
1670 else if ((visual_method == 2) && (cont_flag == 1)) {
1675 const size_t para_size = 128;
1680 parameters[i] = (
char *)
HECMW_calloc(para_size,
sizeof(
char));
1681 if (parameters[i] ==
NULL)
1687 snprintf(parameters[0], para_size,
"maximum_refinement");
1689 snprintf(parameters[1], para_size,
"x_resolution");
1690 snprintf(parameters[2], para_size,
"y_resolution");
1691 len_para[1] = len_para[2] = 12;
1692 snprintf(parameters[3], para_size,
"num_of_lights");
1694 snprintf(parameters[4], para_size,
"position_of_lights");
1696 snprintf(parameters[5], para_size,
"viewpoint");
1698 snprintf(parameters[6], para_size,
"look_at_point");
1700 snprintf(parameters[7], para_size,
"up_direction");
1702 snprintf(parameters[8], para_size,
"ambient_coef");
1704 snprintf(parameters[9], para_size,
"diffuse_coef");
1706 snprintf(parameters[10], para_size,
"specular_coef");
1708 snprintf(parameters[11], para_size,
"surface_on");
1710 snprintf(parameters[12], para_size,
"surface_opacity");
1712 snprintf(parameters[13], para_size,
"color_mapping_style");
1714 snprintf(parameters[14], para_size,
"interval_mapping_num");
1716 snprintf(parameters[15], para_size,
"interval_mapping");
1718 snprintf(parameters[16], para_size,
"opacity_mapping_style");
1720 snprintf(parameters[17], para_size,
"opacity_value");
1722 snprintf(parameters[18], para_size,
"num_of_features");
1724 snprintf(parameters[19], para_size,
"feature_points");
1726 snprintf(parameters[20], para_size,
"lookup_filename");
1728 snprintf(parameters[21], para_size,
"rotate_style");
1730 snprintf(parameters[22], para_size,
"voxel_filename");
1732 snprintf(parameters[23], para_size,
"color_mapping_bar_on");
1734 snprintf(parameters[24], para_size,
"scale_marking_on");
1736 snprintf(parameters[25], para_size,
"color_comp_name");
1738 snprintf(parameters[26], para_size,
"color_subcomp_name");
1740 snprintf(parameters[27], para_size,
"n_voxel_x");
1742 snprintf(parameters[28], para_size,
"n_voxel_y");
1744 snprintf(parameters[29], para_size,
"n_voxel_z");
1746 snprintf(parameters[30], para_size,
"surface_filename");
1748 snprintf(parameters[31], para_size,
"num_of_frames");
1750 snprintf(parameters[32], para_size,
"background_color");
1752 snprintf(parameters[33], para_size,
"font_color");
1754 snprintf(parameters[34], para_size,
"color_system_type");
1756 snprintf(parameters[35], para_size,
"font_size");
1758 snprintf(parameters[36], para_size,
"color_bar_style");
1760 snprintf(parameters[37], para_size,
"fixed_range_on");
1762 snprintf(parameters[38], para_size,
"range_value");
1764 snprintf(parameters[39], para_size,
"num_of_scale");
1766 snprintf(parameters[40], para_size,
"mark_0_on");
1768 snprintf(parameters[41], para_size,
"remove_0_display_on");
1770 snprintf(parameters[42], para_size,
"x_specified_level");
1772 snprintf(parameters[43], para_size,
"y_specified_level");
1774 snprintf(parameters[44], para_size,
"z_specified_level");
1776 snprintf(parameters[45], para_size,
"histogram_on");
1778 snprintf(parameters[46], para_size,
"display_range");
1780 snprintf(parameters[47], para_size,
"time_mark_on");
1782 snprintf(parameters[48], para_size,
"fixed_scale_mark");
1784 snprintf(parameters[49], para_size,
"color_comp");
1786 snprintf(parameters[50], para_size,
"color_subcomp");
1799 while (get_keyword_visual(buf) == 0) {
1802 len_tmp = strlen(para);
1803 for (ii = 0; ii < len_tmp; ii++) {
1807 if ((strncmp(para, parameters[i], len_para[i])) == 0) {
1846 for (i = 0; i < 3; i++) {
1852 for (i = 0; i < 3; i++) {
1857 for (i = 0; i < 3; i++) {
1987 for (i = 0; i < 3; i++) {
1993 for (i = 0; i < 3; i++) {
2010 for (i = 0; i < 2; i++) {
2037 for (i = 0; i < 6; i++) {
2064 else if (get_keyword_visual(buf) > 0) {
2065 visual_method = get_keyword_visual(buf);
2070 if (stat_para[0] == 0) {
2074 if ((vr->
max_level <= 0) && (stat_para[0] == 1)) {
2076 "ERROR: HEC-MW-VIS-E1038: maximum_refinement parameter should "
2077 "be greater than 0\n");
2080 if (stat_para[1] == 0) {
2085 vr->
xr = (int)(vr->
xr / 8) * 8;
2087 if (stat_para[2] == 0) {
2092 "ERROR: HEC-MW-VIS-E1005: The x_resolution should be greater "
2098 "ERROR: HEC-MW-VIS-E1006: The y_resolution should be greater "
2102 if (stat_para[3] == 0) {
2108 "ERROR: HEC-MW-VIS-E1007: The number of light sources should be "
2111 if (stat_para[7] == 0) {
2117 if (stat_para[8] == 0) {
2121 if ((stat_para[8] == 1) && (vr->
k_ads[0] < 0)) {
2123 "ERROR: HEC-MW-VIS-E1008: The ambient_coef is not correct. "
2124 "Should be >=0.0\n");
2126 "Please re-input the ambient_coef in your control file");
2128 if (stat_para[9] == 0) {
2132 if ((stat_para[9] == 1) && (vr->
k_ads[1] < 0)) {
2134 "ERROR: HEC-MW-VIS-E1009: The diffuse_coef is not correct. "
2135 "Should be >=0.0\n");
2137 "Please re-input the diffuse_coef in your control file");
2139 if (stat_para[10] == 0) {
2143 if ((stat_para[10] == 1) && (vr->
k_ads[2] < 0)) {
2145 "ERROR: HEC-MW-VIS-E1010: The specular_coef is not correct. "
2146 "Should be >=0.0\n");
2148 "Please re-input the specular_coef in your control file");
2169 if (stat_para[13] == 0) {
2175 "ERROR: HEC-MW-VIS-E1011:color_mapping_style should be between "
2181 "ERROR: HEC-MW-VIS-E1012:For color_mapping_style 3, the "
2182 "parameter interval_mapping_num is required\n");
2184 "Please re-input the value of interval_mapping_num");
2188 "ERROR: HEC-MW-VIS-E1013:For color_mapping_style 3, the "
2189 "interval_mapping_num should be greater than 0");
2192 (stat_para[15] == 0)) {
2194 "ERROR: HEC-MW-VIS-E1014:For color_mapping_style =2 or 3, the "
2195 "interval_point should be defined\n");
2198 if (stat_para[16] == 0) {
2207 "ERROR: HEC-MW-VIS-E1028:transfer_function_style should be "
2208 "between 1 and 8\n");
2211 if ((stat_para[17] == 1) && (vr->
opa_value < 0)) {
2214 "ERROR: HEC-MW-VIS-E1029:opacity_value cannot be less than 0.0\n");
2215 fprintf(stderr,
"Please re-input and run again\n");
2220 (stat_para[18] == 0)) {
2222 "ERROR: HEC-MW-VIS-E1030:When transfer_function_style =3 or 4, "
2223 "num_of_features should be defined\n");
2228 "ERROR: HEC-MW-VIS-E1031:When transfer_function_style =3 or 4, "
2229 "num_of_features should be greater than 0\n");
2232 if ((stat_para[18] == 1) && (stat_para[19] == 0)) {
2234 "ERROR: HEC-MW-VIS-E1032:For transfer_function_style =3 or 4, "
2235 "feature_points should be defined\n");
2240 "ERROR: HEC-MW-VIS-E1033:For transfer_function_style=8, "
2241 "lookup_filename should be specified\n");
2247 "ERROR: HEC-MW-VIS-E1039:The rotate_style parameter is wrong. "
2248 "Please input one within (0, 4)");
2253 "ERROR: HEC-MW-VIS-E1016:color_mapping_bar_on parameter only "
2254 "can be defined as 0 or 1\n");
2260 "ERROR: HEC-MW-VIS-E1017:scale_marking_on parameter only can "
2261 "be defined as 0 or 1\n");
2267 "ERROR: HEC-MW-VIS-E1018:x resolution should be larger than 40 "
2268 "for adding color_mapping_bar case\n");
2273 " ERROR: HEC-MW-VIS-E1019: x resolution should be larger than "
2274 "65 for adding color_mapping and scale marking case\n");
2277 if (stat_para[25] == 0) {
2280 if (stat_para[26] == 0) {
2283 if (stat_para[22] == 1) {
2287 }
else if (stat_para[22] == 0) {
2288 if ((stat_para[27] == 0) && (stat_para[28] == 0) &&
2289 (stat_para[29] == 0)) {
2294 }
else if ((stat_para[27] == 0) || (stat_para[28] == 0) ||
2295 (stat_para[29] == 0)) {
2297 "ERROR: HEC-MW-VIS-E1040: please define all the n_voxel_x, "
2298 "n_voxel_y, n_voxel_z parameters");
2301 "ERROR: HEC-MW-VIS-E1041: n_voxel_x*n_voxel_y*n_voxel_z "
2302 "should be equal to the number of pes\n");
2304 }
else if ((vr->
nv_xyz[0] <= 0) || (vr->
nv_xyz[1] <= 0) ||
2307 "ERROR: HEC-MW-VIS-E1042: n_voxel_x,n_voxel_y, and n_voxel_z "
2308 "cannot be less or equal to 0\n");
2323 "ERROR: HEC-MW-VIS-E1015: The parameter num_of_frames cannot "
2324 "be less than 1.\n");
2329 if (stat_para[32] == 0)
2332 if (stat_para[33] == 0)
2337 "ERROR: HEC-MW-VIS-E1020: color_system_type should be between "
2348 "ERROR: HEC-MW-VIS-E1021: The background color should be in "
2349 "the interval of (0.0, 1.0)\n");
2359 "ERROR: HEC-MW-VIS-E1022: The font color should be in the "
2360 "interval of (0.0, 1.0)\n");
2363 if (stat_para[35] == 0) vr->
font_size = 1.0;
2366 "ERROR: HEC-MW-VIS-E1023: font_size parameters cannot be "
2367 "between 1.0 and 4.0\n");
2375 "ERROR: HEC-MW-VIS-E1024: color_bar_style only can be 1 or 2\n");
2381 "ERROR: HEC-MW-VIS-E1043: fixed_range_on only can be 0 or 1\n");
2387 "ERROR: HEC-MW-VIS-E1025: num_of_scale only can be greater "
2391 if ((stat_para[37] == 1) && (stat_para[38] == 0)) {
2393 "ERROR: HEC-MW-VIS-E1026:Please input range_value for "
2394 "fixed_range_on style\n");
2397 if (stat_para[40] == 0) vr->
mark_0_on = 0;
2400 "ERROR: HEC-MW-VIS-E1044:mark_0_on only can be 0 or 1\n");
2407 "ERROR: HEC-MW-VIS-E1045:remove_0_display_on only can be 0 or 1\n");
2413 "ERROR: HEC-MW-VIS-E1046: x_specified_level should be greater "
2420 "ERROR: HEC-MW-VIS-E1047: y_specified_level should be greater "
2427 "ERROR: HEC-MW-VIS-E1048: z_specified_level should be greater "
2435 "ERROR: HEC-MW-VIS-E1050: time_mark_on value should be 0 or 1");
2442 "ERROR: HEC-MW-VIS-E1049: fixed_scale_mark value should be 0 or 1");
2464 stat_para[0]=stat_para[1]=stat_para[2]=0;
2470 stat_para[4]=stat_para[5]=stat_para[6]=0;
2475 stat_para[8]=stat_para[9]=stat_para[10]=1;
2484 stat_para[14]=stat_para[15]=0;
2485 stat_para[16]=stat_para[17]=1;
2513 void read_lookup_table(
Parameter_vr *vr,
double *opa_table)
2518 fprintf(stderr,
"There is not such a opacity file:\n");
2522 fscanf(opa_fp,
"%lf", &(opa_table[i]));
#define HECMW_calloc(nmemb, size)
#define HECMW_malloc(size)
void HECMW_vis_print_exit(char *var)
void HECMW_vis_memory_exit(char *var)
int is_blank_line(char *buf)
int is_comment_line(char *buf)
double get_double_item(char *para, char *buf, int *start_location)
int get_int_item(char *para, char *buf, int *start_location)
int get_keyword_item(char *buf, char *para)
void HECMW_vis_read_control(FILE *fp, int pesize, int mynode, PSF_link *psf, PVR_link *pvr)
void get_string_item(char *para, char *buf, int *start_location, char *para2)
struct _psf_link_struct * next_psf
int stat_para[NUM_CONTROL_PSF]
struct surface_module * sf
struct _pvr_link_struct * next_pvr
int stat_para[NUM_CONTROL_PVR]
int transfer_function_style
double fixed_mesh_range[6]
double background_color[3]
char color_comp_name[100]
int transfer_function_style
char color_subcomp_name[5]
double background_color[3]
char color_subcomp_name[128]
char data_subcomp_name[128]
double deform_line_color[3]
double initial_line_color[3]
char color_comp_name[128]