42 double *minvalue, *maxvalue, *mincolor, *maxcolor, mic, mac;
43 int sum_v, sum_t, tvertex, tpatch;
49 static int first_boundary = 1;
58 if (sf[1].output_type == 5) {
60 for (j = 0; j <
data->nn_component; j++) {
61 name_len = strlen(
data->node_label[j]);
62 if (strncmp(
"NodalSTRESS",
data->node_label[j], name_len) == 0 ||
63 strncmp(
"NodalSTRESSplus",
data->node_label[j], name_len) == 0 ||
64 strncmp(
"TEMPERATURE",
data->node_label[j], name_len) == 0) {
72 "The current library only support the FEMAP output for "
73 "structure/heat analysis result.\n");
78 while ((outfile1[ii] !=
' ') && (ii < 100) && (outfile1[ii] !=
'\0')) {
79 if (outfile1[ii] ==
'.') outfile1[ii] =
'_';
86 if ((sf[1].output_type == 6) || (sf[1].output_type == 7) ||
87 (sf[1].output_type == 8) || (sf[1].output_type == 9)) {
88 strcat(outfile1,
".inp");
89 if (sf[1].output_type == 6) {
91 }
else if (sf[1].output_type == 8) {
93 }
else if (sf[1].output_type == 7) {
95 }
else if (sf[1].output_type == 9) {
101 if (sf[1].output_type == 10) {
103 sprintf(buf,
"_%d.inp", mynode);
104 strcat(outfile1, buf);
107 }
else if(sf[1].output_type==15) {
110 }
else if(sf[1].output_type==16) {
116 conv_compname_integer(sf,
data);
125 for (ii = 0; ii <
data->nn_component; ii++) color_list[ii] = 0;
127 if (sf[ii].display_method != 4) {
128 if ((sf[ii].color_comp >= 0) && (sf[ii].color_comp < data->nn_component))
136 if ((minvalue ==
NULL) || (mincolor ==
NULL) || (maxvalue ==
NULL) ||
139 for (ii = 0; ii <
data->nn_component; ii++) {
140 minvalue[ii] = mincolor[ii] = 1.0E17;
141 maxvalue[ii] = maxcolor[ii] = -1.0E17;
148 if ((sff ==
NULL) || (result ==
NULL))
161 chk_sf_param(sf,
data, ii);
163 copy_control_para(sff, sf, ii);
174 &tvertex, &tpatch, &mic, &mac, result, ii - 1,
181 &tvertex, &tpatch, &mic, &mac, result, ii - 1,
185 if (first_boundary == 1) {
198 &mic, &mac, result, ii - 1, VIS_COMM,
206 &mic, &mac, result, ii - 1, VIS_COMM,
212 fprintf(stderr,
"iso surface parameters: %d %lf\n", sff->
data_comp,
221 &tvertex, &tpatch, &mic, &mac, result,
222 ii - 1, mynode, VIS_COMM);
228 &tvertex, &tpatch, &mic, &mac, result,
229 ii - 1, mynode, VIS_COMM);
250 &tvertex, &tpatch, &mic, &mac, result,
251 ii - 1, mynode, VIS_COMM);
257 &tvertex, &tpatch, &mic, &mac, result,
258 ii - 1, mynode, VIS_COMM);
268 fprintf(stderr,
"Finish visual computing, the time is: %lf\n", t3 - t2);
271 if (sf[1].output_type == 4) {
273 while ((outfile1[ii] !=
' ') && (ii < 100) && (outfile1[ii] !=
'\0')) {
274 if (outfile1[ii] ==
'.') outfile1[ii] =
'_';
278 if ((sf[1].output_type == 1) || (sf[1].output_type == 2) ||
279 (sf[1].output_type == 4))
281 maxvalue, result, outfile1, VIS_COMM);
282 else if (sf[1].output_type == 3)
284 minvalue, maxvalue, result, outfile1, stat_para,
285 VIS_COMM, *timestep);
288 fprintf(stderr,
"surface module finish\n");
290 fprintf(stderr,
"the rendering and output file time is %lf\n", t3 - t2);
293 if (result[ii].n_vertex > 0) {
297 if (result[ii].n_patch > 0)
HECMW_free(result[ii].patch);
324 int i, j, name_len, find;
327 if (sf[i].surface_style == 2) {
328 if (sf[i].data_comp < 0) {
330 if (strncmp(sf[i].data_comp_name,
"NULL", 4) != 0) {
331 for (j = 0; j <
data->nn_component; j++) {
332 name_len = strlen(
data->node_label[j]);
333 if (strncmp(sf[i].data_comp_name,
data->node_label[j], name_len) ==
343 "ERROR: HEC-MW-VIS-E1051:the name for data component is not "
345 sf[i].data_comp_name);
350 if (
data->nn_dof[sf[i].data_comp] > 1) {
351 if (sf[i].data_subcomp < 0) {
353 if (strncmp(sf[i].data_subcomp_name,
"norm", 4) == 0) {
356 }
else if (strncmp(sf[i].data_subcomp_name,
"x", 1) == 0) {
359 }
else if (strncmp(sf[i].data_subcomp_name,
"y", 1) == 0) {
362 }
else if (strncmp(sf[i].data_subcomp_name,
"z", 1) == 0) {
367 "ERROR: HEC-MW-VIS-E1052:The subcompnent name is not "
368 "correct, it must be norm, x, y, or z. \n");
375 if (sf[i].deform_display_on == 1) {
376 if (sf[i].disp_comp < 0) {
378 if (strncmp(sf[i].disp_comp_name,
"NULL", 4) != 0) {
379 for (j = 0; j <
data->nn_component; j++) {
380 name_len = strlen(
data->node_label[j]);
381 if (strncmp(sf[i].disp_comp_name,
data->node_label[j], name_len) ==
391 "ERROR: HEC-MW-VIS-E1051:the name for deformation component "
392 "is not correct:%s\n",
393 sf[i].disp_comp_name);
399 if (sf[i].color_comp < 0) {
401 if (strncmp(sf[i].color_comp_name,
"NULL", 4) != 0) {
402 for (j = 0; j <
data->nn_component; j++) {
403 name_len = strlen(
data->node_label[j]);
404 if (strncmp(sf[i].color_comp_name,
data->node_label[j], name_len) ==
414 "ERROR: HEC-MW-VIS-E1053:the name for color component is not "
416 sf[i].color_comp_name);
420 if (
data->nn_dof[sf[i].color_comp] > 1) {
421 if (sf[i].color_subcomp < 0) {
423 if (strncmp(sf[i].color_subcomp_name,
"norm", 4) == 0) {
426 }
else if (strncmp(sf[i].color_subcomp_name,
"x", 1) == 0) {
429 }
else if (strncmp(sf[i].color_subcomp_name,
"y", 1) == 0) {
432 }
else if (strncmp(sf[i].color_subcomp_name,
"z", 1) == 0) {
437 "ERROR: HEC-MW-VIS-E1052:The subcompnent name is not "
438 "correct, it must be norm, x, y, or z. \n");
449 if (
data->nn_component < sf[ii].color_comp) {
451 "ERROR: HEC-MW-VIS-E1054: color_comp is wrong: >nn_component");
453 if (
data->nn_dof[sf[ii].color_comp] > 1) {
454 if (sf[ii].color_subcomp >
data->nn_dof[sf[ii].color_comp]) {
456 "ERROR: HEC-MW-VIS-E1055: color_subcomp is wrong: >dof");
465 if (sf[ii].surface_style == 2) {
466 if (
data->nn_component < sf[ii].data_comp)
468 "ERROR: HEC-MW-VIS-E1056: data component number is wrong: "
470 if (
data->nn_dof[sf[ii].data_comp] > 1) {
471 if (sf[ii].data_subcomp >
data->nn_dof[sf[ii].data_comp])
473 "ERROR: HEC-MW-VIS-E1057: data_subcomp is wrong: >dof");
476 if (sf[ii].surface_style == 3) {
477 if ((sf[ii].method < 1) || (sf[ii].method > 5)) {
479 "ERROR: HEC-MW-VIS-E1058: the number of method, it must be between "
482 if ((sf[ii].display_method < 1) || (sf[ii].display_method > 5)) {
484 "ERROR: HEC-MW-VIS-E1004: the number of display_method,it should be "
487 if (sf[ii].isoline_number < 0) {
489 "ERROR: HEC-MW-VIS-E1059: the number of isolines,it should be >=0");
515 read_surface_equation(sff, sf, ii);
566 for (j = 0; j < 3; j++) {
577 double point[3], coff[10];
578 double laxis[3], radius;
579 for (i = 0; i < 10; i++) coff[i] = 0.0;
581 input_way = sf[ii].
method;
584 for (i = 0; i < 3; i++) point[i] = sf[ii].point[i];
586 coff[0] = coff[1] = coff[2] = 1;
587 coff[6] = -2 * point[0];
588 coff[7] = -2 * point[1];
589 coff[8] = -2 * point[2];
590 coff[9] = point[0] * point[0] + point[1] * point[1] +
591 point[2] * point[2] - radius * radius;
595 for (i = 0; i < 3; i++) {
596 point[i] = sf[ii].
point[i];
597 laxis[i] = sf[ii].
length[i];
599 for (i = 0; i < 3; i++) coff[i] = 1 / (laxis[i] * laxis[i]);
600 for (i = 0; i < 3; i++)
601 coff[i + 6] = -2.0 * point[i] / (laxis[i] * laxis[i]);
602 coff[9] = point[0] * point[0] / (laxis[0] * laxis[0]) +
603 (point[1] * point[1]) / (laxis[1] * laxis[1]) +
604 (point[2] * point[2]) / (laxis[2] * laxis[2]) - 1;
609 for (i = 0; i < 3; i++) {
610 point[i] = sf[ii].
point[i];
611 laxis[i] = sf[ii].
length[i];
614 for (i = 0; i < 3; i++) coff[i] = 1 / (laxis[i] * laxis[i]);
616 for (i = 0; i < 3; i++)
617 coff[i + 6] = -2.0 * point[i] / (laxis[i] * laxis[i]);
619 coff[9] = point[0] * point[0] / (laxis[0] * laxis[0]) +
620 (point[1] * point[1]) / (laxis[1] * laxis[1]) -
621 (point[2] * point[2]) / (laxis[2] * laxis[2]) - 1;
625 for (i = 0; i < 3; i++) {
626 point[i] = sf[ii].
point[i];
627 laxis[i] = sf[ii].
length[i];
629 for (i = 0; i < 2; i++) coff[i] = 1 / (laxis[i] * laxis[i]);
632 coff[6] = -2.0 * point[0] / (laxis[0] * laxis[0]);
633 coff[7] = 2.0 * point[1] / (laxis[1] * laxis[1]);
635 coff[9] = point[0] * point[0] / (laxis[0] * laxis[0]) -
636 (point[1] * point[1]) / (laxis[1] * laxis[1]) + point[2];
640 for (i = 0; i < 10; i++) coff[i] = sf[ii].coef[i];
644 for (i = 0; i < 10; i++) sff->
cont_equ[i] = coff[i];
649 double cal_matrix(
double a[3][3])
652 value=a[0][0]*a[1][1]*a[2][2]+a[0][1]*a[1][2]*a[2][0]+a[0][2]*a[1][0]*a[2][1]
653 -a[0][0]*a[1][2]*a[2][1]-a[0][1]*a[1][0]*a[2][2]-a[0][2]*a[1][1]*a[2][0];
659 int chk_gid(
struct visual_buf *vol,
int *bdflag,
int *gid,
int *over_elem_id) {
664 for (i = 0; i < vol->mesh->n_elem; i++) {
665 gid[i] = vol->mesh->global_elem_id[i];
667 over_elem_id[count] = i;
677 int judge_box(
double box[
HEX_N_NODE*3],
double cont_equ[10])
685 f[i]=x*cont_equ[0]+y*cont_equ[1]+z*cont_equ[2]+cont_equ[3];
692 if((sum==-8) || (sum==8))
708 fprintf(stderr,
"Start transforming...\n");
716 for (j = 0; j < 3; j++) coord[i * 2 * 3 + j] =
mesh->
node[i * 3 + j];
717 for (j = 0; j < 2; j++) coord[(i * 2 + 1) * 3 + j] =
mesh->
node[i * 3 + j];
718 coord[(i * 2 + 1) * 3 + 2] =
mesh->
node[i * 3 + 2] + thickness;
727 for (j = 0; j < 3; j++)
730 for (j = 0; j < 3; j++)
731 connect[i * 6 + 3 + j] =
744 for (j = 0; j < 4; j++)
747 for (j = 0; j < 4; j++)
748 connect[i * 8 + 4 + j] =
763 for (i = 0; i <
data->nn_component; i++) tn_component +=
data->nn_dof[i];
768 for (j = 0; j < tn_component; j++)
769 value[i * 2 * tn_component + j] =
770 data->node_val_item[i * tn_component + j];
771 for (j = 0; j < tn_component; j++)
772 value[(i * 2 + 1) * tn_component + j] =
773 data->node_val_item[i * tn_component + j];
776 data->node_val_item = value;
778 fprintf(stderr,
"It is ok to transform shell to solid\n");
794 int tn_component, pesize;
795 double range[6], trange[6];
796 fprintf(stderr,
"Start transforming...\n");
801 range[0] = range[2] = range[4] = 1.0E17;
802 range[1] = range[3] = range[5] = -1.0E17;
805 for (j = 0; j < 3; j++) {
806 if (
mesh->
node[i * 3 + j] < range[j * 2])
807 range[j * 2] =
mesh->
node[i * 3 + j];
808 if (
mesh->
node[i * 3 + j] > range[j * 2 + 1])
809 range[j * 2 + 1] =
mesh->
node[i * 3 + j];
826 for (i = 0; i < 6; i++) trange[i] = range[i];
828 thickness = 0.01 * sqrt((trange[1] - trange[0]) * (trange[1] - trange[0]) +
829 (trange[3] - trange[2]) * (trange[3] - trange[2]) +
830 (trange[5] - trange[4]) * (trange[5] - trange[4]));
835 for (j = 0; j < 3; j++) coord[i * 2 * 3 + j] =
mesh->
node[i * 3 + j];
836 for (j = 0; j < 2; j++) coord[(i * 2 + 1) * 3 + j] =
mesh->
node[i * 3 + j];
837 coord[(i * 2 + 1) * 3 + 2] =
mesh->
node[i * 3 + 2] + thickness;
846 for (j = 0; j < 3; j++)
849 for (j = 0; j < 3; j++)
850 connect[i * 6 + 3 + j] =
863 for (j = 0; j < 4; j++)
866 for (j = 0; j < 4; j++)
867 connect[i * 8 + 4 + j] =
882 for (i = 0; i <
data->nn_component; i++) tn_component +=
data->nn_dof[i];
887 for (j = 0; j < tn_component; j++)
888 value[i * 2 * tn_component + j] =
889 data->node_val_item[i * tn_component + j];
890 for (j = 0; j < tn_component; j++)
891 value[(i * 2 + 1) * tn_component + j] =
892 data->node_val_item[i * tn_component + j];
895 data->node_val_item = value;
897 fprintf(stderr,
"It is ok to transform shell to solid\n");