43 double *minvalue, *maxvalue, *mincolor, *maxcolor, mic, mac;
44 int sum_v, sum_t, tvertex, tpatch;
50 static int first_boundary = 1;
59 if (sf[1].output_type == 5) {
61 for (j = 0; j <
data->nn_component; j++) {
62 name_len = strlen(
data->node_label[j]);
63 if (strncmp(
"NodalSTRESS",
data->node_label[j], name_len) == 0 ||
64 strncmp(
"NodalSTRESSplus",
data->node_label[j], name_len) == 0 ||
65 strncmp(
"TEMPERATURE",
data->node_label[j], name_len) == 0) {
73 "The current library only support the FEMAP output for "
74 "structure/heat analysis result.\n");
79 while ((outfile1[ii] !=
' ') && (ii < 100) && (outfile1[ii] !=
'\0')) {
80 if (outfile1[ii] ==
'.') outfile1[ii] =
'_';
87 if ((sf[1].output_type == 6) || (sf[1].output_type == 7) ||
88 (sf[1].output_type == 8) || (sf[1].output_type == 9)) {
89 strcat(outfile1,
".inp");
90 if (sf[1].output_type == 6) {
92 }
else if (sf[1].output_type == 8) {
94 }
else if (sf[1].output_type == 7) {
96 }
else if (sf[1].output_type == 9) {
102 if (sf[1].output_type == 10) {
104 sprintf(buf,
"_%d.inp", mynode);
105 strcat(outfile1, buf);
108 }
else if(sf[1].output_type==15) {
111 }
else if(sf[1].output_type==16) {
114 }
else if(sf[1].output_type==18) {
117 }
else if(sf[1].output_type==19) {
123 conv_compname_integer(sf,
data);
132 for (ii = 0; ii <
data->nn_component; ii++) color_list[ii] = 0;
134 if (sf[ii].display_method != 4) {
135 if ((sf[ii].color_comp >= 0) && (sf[ii].color_comp < data->nn_component))
143 if ((minvalue ==
NULL) || (mincolor ==
NULL) || (maxvalue ==
NULL) ||
146 for (ii = 0; ii <
data->nn_component; ii++) {
147 minvalue[ii] = mincolor[ii] = 1.0E17;
148 maxvalue[ii] = maxcolor[ii] = -1.0E17;
155 if ((sff ==
NULL) || (result ==
NULL))
168 chk_sf_param(sf,
data, ii);
170 copy_control_para(sff, sf, ii);
181 &tvertex, &tpatch, &mic, &mac, result, ii - 1,
188 &tvertex, &tpatch, &mic, &mac, result, ii - 1,
192 if (first_boundary == 1) {
205 &mic, &mac, result, ii - 1, VIS_COMM,
213 &mic, &mac, result, ii - 1, VIS_COMM,
219 fprintf(stderr,
"iso surface parameters: %d %lf\n", sff->
data_comp,
228 &tvertex, &tpatch, &mic, &mac, result,
229 ii - 1, mynode, VIS_COMM);
235 &tvertex, &tpatch, &mic, &mac, result,
236 ii - 1, mynode, VIS_COMM);
257 &tvertex, &tpatch, &mic, &mac, result,
258 ii - 1, mynode, VIS_COMM);
264 &tvertex, &tpatch, &mic, &mac, result,
265 ii - 1, mynode, VIS_COMM);
275 fprintf(stderr,
"Finish visual computing, the time is: %lf\n", t3 - t2);
278 if (sf[1].output_type == 4) {
280 while ((outfile1[ii] !=
' ') && (ii < 100) && (outfile1[ii] !=
'\0')) {
281 if (outfile1[ii] ==
'.') outfile1[ii] =
'_';
285 if ((sf[1].output_type == 1) || (sf[1].output_type == 2) ||
286 (sf[1].output_type == 4))
288 maxvalue, result, outfile1, VIS_COMM);
289 else if (sf[1].output_type == 3)
291 minvalue, maxvalue, result, outfile1, stat_para,
292 VIS_COMM, *timestep);
295 fprintf(stderr,
"surface module finish\n");
297 fprintf(stderr,
"the rendering and output file time is %lf\n", t3 - t2);
300 if (result[ii].n_vertex > 0) {
304 if (result[ii].n_patch > 0)
HECMW_free(result[ii].patch);
331 int i, j, name_len, find;
334 if (sf[i].surface_style == 2) {
335 if (sf[i].data_comp < 0) {
337 if (strncmp(sf[i].data_comp_name,
"NULL", 4) != 0) {
338 for (j = 0; j <
data->nn_component; j++) {
339 name_len = strlen(
data->node_label[j]);
340 if (strncmp(sf[i].data_comp_name,
data->node_label[j], name_len) ==
350 "ERROR: HEC-MW-VIS-E1051:the name for data component is not "
352 sf[i].data_comp_name);
357 if (
data->nn_dof[sf[i].data_comp] > 1) {
358 if (sf[i].data_subcomp < 0) {
360 if (strncmp(sf[i].data_subcomp_name,
"norm", 4) == 0) {
363 }
else if (strncmp(sf[i].data_subcomp_name,
"x", 1) == 0) {
366 }
else if (strncmp(sf[i].data_subcomp_name,
"y", 1) == 0) {
369 }
else if (strncmp(sf[i].data_subcomp_name,
"z", 1) == 0) {
374 "ERROR: HEC-MW-VIS-E1052:The subcompnent name is not "
375 "correct, it must be norm, x, y, or z. \n");
382 if (sf[i].deform_display_on == 1) {
383 if (sf[i].disp_comp < 0) {
385 if (strncmp(sf[i].disp_comp_name,
"NULL", 4) != 0) {
386 for (j = 0; j <
data->nn_component; j++) {
387 name_len = strlen(
data->node_label[j]);
388 if (strncmp(sf[i].disp_comp_name,
data->node_label[j], name_len) ==
398 "ERROR: HEC-MW-VIS-E1051:the name for deformation component "
399 "is not correct:%s\n",
400 sf[i].disp_comp_name);
406 if (sf[i].color_comp < 0) {
408 if (strncmp(sf[i].color_comp_name,
"NULL", 4) != 0) {
409 for (j = 0; j <
data->nn_component; j++) {
410 name_len = strlen(
data->node_label[j]);
411 if (strncmp(sf[i].color_comp_name,
data->node_label[j], name_len) ==
421 "ERROR: HEC-MW-VIS-E1053:the name for color component is not "
423 sf[i].color_comp_name);
427 if (
data->nn_dof[sf[i].color_comp] > 1) {
428 if (sf[i].color_subcomp < 0) {
430 if (strncmp(sf[i].color_subcomp_name,
"norm", 4) == 0) {
433 }
else if (strncmp(sf[i].color_subcomp_name,
"x", 1) == 0) {
436 }
else if (strncmp(sf[i].color_subcomp_name,
"y", 1) == 0) {
439 }
else if (strncmp(sf[i].color_subcomp_name,
"z", 1) == 0) {
444 "ERROR: HEC-MW-VIS-E1052:The subcompnent name is not "
445 "correct, it must be norm, x, y, or z. \n");
456 if (
data->nn_component < sf[ii].color_comp) {
458 "ERROR: HEC-MW-VIS-E1054: color_comp is wrong: >nn_component");
460 if (
data->nn_dof[sf[ii].color_comp] > 1) {
461 if (sf[ii].color_subcomp >
data->nn_dof[sf[ii].color_comp]) {
463 "ERROR: HEC-MW-VIS-E1055: color_subcomp is wrong: >dof");
472 if (sf[ii].surface_style == 2) {
473 if (
data->nn_component < sf[ii].data_comp)
475 "ERROR: HEC-MW-VIS-E1056: data component number is wrong: "
477 if (
data->nn_dof[sf[ii].data_comp] > 1) {
478 if (sf[ii].data_subcomp >
data->nn_dof[sf[ii].data_comp])
480 "ERROR: HEC-MW-VIS-E1057: data_subcomp is wrong: >dof");
483 if (sf[ii].surface_style == 3) {
484 if ((sf[ii].method < 1) || (sf[ii].method > 5)) {
486 "ERROR: HEC-MW-VIS-E1058: the number of method, it must be between "
489 if ((sf[ii].display_method < 1) || (sf[ii].display_method > 5)) {
491 "ERROR: HEC-MW-VIS-E1004: the number of display_method,it should be "
494 if (sf[ii].isoline_number < 0) {
496 "ERROR: HEC-MW-VIS-E1059: the number of isolines,it should be >=0");
522 read_surface_equation(sff, sf, ii);
573 for (j = 0; j < 3; j++) {
584 double point[3], coff[10];
585 double laxis[3], radius;
586 for (i = 0; i < 10; i++) coff[i] = 0.0;
588 input_way = sf[ii].
method;
591 for (i = 0; i < 3; i++) point[i] = sf[ii].point[i];
593 coff[0] = coff[1] = coff[2] = 1;
594 coff[6] = -2 * point[0];
595 coff[7] = -2 * point[1];
596 coff[8] = -2 * point[2];
597 coff[9] = point[0] * point[0] + point[1] * point[1] +
598 point[2] * point[2] - radius * radius;
602 for (i = 0; i < 3; i++) {
603 point[i] = sf[ii].
point[i];
604 laxis[i] = sf[ii].
length[i];
606 for (i = 0; i < 3; i++) coff[i] = 1 / (laxis[i] * laxis[i]);
607 for (i = 0; i < 3; i++)
608 coff[i + 6] = -2.0 * point[i] / (laxis[i] * laxis[i]);
609 coff[9] = point[0] * point[0] / (laxis[0] * laxis[0]) +
610 (point[1] * point[1]) / (laxis[1] * laxis[1]) +
611 (point[2] * point[2]) / (laxis[2] * laxis[2]) - 1;
616 for (i = 0; i < 3; i++) {
617 point[i] = sf[ii].
point[i];
618 laxis[i] = sf[ii].
length[i];
621 for (i = 0; i < 3; i++) coff[i] = 1 / (laxis[i] * laxis[i]);
623 for (i = 0; i < 3; i++)
624 coff[i + 6] = -2.0 * point[i] / (laxis[i] * laxis[i]);
626 coff[9] = point[0] * point[0] / (laxis[0] * laxis[0]) +
627 (point[1] * point[1]) / (laxis[1] * laxis[1]) -
628 (point[2] * point[2]) / (laxis[2] * laxis[2]) - 1;
632 for (i = 0; i < 3; i++) {
633 point[i] = sf[ii].
point[i];
634 laxis[i] = sf[ii].
length[i];
636 for (i = 0; i < 2; i++) coff[i] = 1 / (laxis[i] * laxis[i]);
639 coff[6] = -2.0 * point[0] / (laxis[0] * laxis[0]);
640 coff[7] = 2.0 * point[1] / (laxis[1] * laxis[1]);
642 coff[9] = point[0] * point[0] / (laxis[0] * laxis[0]) -
643 (point[1] * point[1]) / (laxis[1] * laxis[1]) + point[2];
647 for (i = 0; i < 10; i++) coff[i] = sf[ii].coef[i];
651 for (i = 0; i < 10; i++) sff->
cont_equ[i] = coff[i];
656 double cal_matrix(
double a[3][3])
659 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]
660 -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];
666 int chk_gid(
struct visual_buf *vol,
int *bdflag,
int *gid,
int *over_elem_id) {
671 for (i = 0; i < vol->mesh->n_elem; i++) {
672 gid[i] = vol->mesh->global_elem_id[i];
674 over_elem_id[count] = i;
684 int judge_box(
double box[
HEX_N_NODE*3],
double cont_equ[10])
692 f[i]=x*cont_equ[0]+y*cont_equ[1]+z*cont_equ[2]+cont_equ[3];
699 if((sum==-8) || (sum==8))
715 fprintf(stderr,
"Start transforming...\n");
723 for (j = 0; j < 3; j++) coord[i * 2 * 3 + j] =
mesh->
node[i * 3 + j];
724 for (j = 0; j < 2; j++) coord[(i * 2 + 1) * 3 + j] =
mesh->
node[i * 3 + j];
725 coord[(i * 2 + 1) * 3 + 2] =
mesh->
node[i * 3 + 2] + thickness;
734 for (j = 0; j < 3; j++)
737 for (j = 0; j < 3; j++)
738 connect[i * 6 + 3 + j] =
751 for (j = 0; j < 4; j++)
754 for (j = 0; j < 4; j++)
755 connect[i * 8 + 4 + j] =
770 for (i = 0; i <
data->nn_component; i++) tn_component +=
data->nn_dof[i];
775 for (j = 0; j < tn_component; j++)
776 value[i * 2 * tn_component + j] =
777 data->node_val_item[i * tn_component + j];
778 for (j = 0; j < tn_component; j++)
779 value[(i * 2 + 1) * tn_component + j] =
780 data->node_val_item[i * tn_component + j];
783 data->node_val_item = value;
785 fprintf(stderr,
"It is ok to transform shell to solid\n");
801 int tn_component, pesize;
802 double range[6], trange[6];
803 fprintf(stderr,
"Start transforming...\n");
808 range[0] = range[2] = range[4] = 1.0E17;
809 range[1] = range[3] = range[5] = -1.0E17;
812 for (j = 0; j < 3; j++) {
813 if (
mesh->
node[i * 3 + j] < range[j * 2])
814 range[j * 2] =
mesh->
node[i * 3 + j];
815 if (
mesh->
node[i * 3 + j] > range[j * 2 + 1])
816 range[j * 2 + 1] =
mesh->
node[i * 3 + j];
833 for (i = 0; i < 6; i++) trange[i] = range[i];
835 thickness = 0.01 * sqrt((trange[1] - trange[0]) * (trange[1] - trange[0]) +
836 (trange[3] - trange[2]) * (trange[3] - trange[2]) +
837 (trange[5] - trange[4]) * (trange[5] - trange[4]));
842 for (j = 0; j < 3; j++) coord[i * 2 * 3 + j] =
mesh->
node[i * 3 + j];
843 for (j = 0; j < 2; j++) coord[(i * 2 + 1) * 3 + j] =
mesh->
node[i * 3 + j];
844 coord[(i * 2 + 1) * 3 + 2] =
mesh->
node[i * 3 + 2] + thickness;
853 for (j = 0; j < 3; j++)
856 for (j = 0; j < 3; j++)
857 connect[i * 6 + 3 + j] =
870 for (j = 0; j < 4; j++)
873 for (j = 0; j < 4; j++)
874 connect[i * 8 + 4 + j] =
889 for (i = 0; i <
data->nn_component; i++) tn_component +=
data->nn_dof[i];
894 for (j = 0; j < tn_component; j++)
895 value[i * 2 * tn_component + j] =
896 data->node_val_item[i * tn_component + j];
897 for (j = 0; j < tn_component; j++)
898 value[(i * 2 + 1) * tn_component + j] =
899 data->node_val_item[i * tn_component + j];
902 data->node_val_item = value;
904 fprintf(stderr,
"It is ok to transform shell to solid\n");
int HECMW_Comm_rank(HECMW_Comm comm, int *rank)
int HECMW_Comm_size(HECMW_Comm comm, int *size)
int HECMW_Allreduce(void *sendbuf, void *recvbuf, int count, HECMW_Datatype datatype, HECMW_Op op, HECMW_Comm comm)
int HECMW_Barrier(HECMW_Comm comm)
struct hecmwST_local_mesh * mesh
void HECMW_exodus_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, char *outfile1, HECMW_Comm VIS_COMM)
void HECMW_exodus_step_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, char *outfile1, HECMW_Comm VIS_COMM)
void HECMW_fstr_output_femap(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, HECMW_Comm VIS_COMM)
void HECMW_separate_avs_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile)
void HECMW_microavs_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, HECMW_Comm VIS_COMM)
void HECMW_bin_avs_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, HECMW_Comm VIS_COMM)
void HECMW_avs_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, HECMW_Comm VIS_COMM)
void HECMW_reorder_avs_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, HECMW_Comm VIS_COMM)
void HECMW_vtk_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, char *outfile1, HECMW_Comm VIS_COMM)
void HECMW_bin_vtk_output(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, char *outfile, char *outfile1, HECMW_Comm VIS_COMM)
#define HECMW_calloc(nmemb, size)
#define HECMW_malloc(size)
void HECMW_vis_combine(struct surface_module *sf, struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, int tvertex, int tpatch, int *color_list, double *minvalue, double *maxvalue, Result *result, char *outfile, HECMW_Comm VIS_COMM)
void HECMW_vis_find_boundary_surface(Surface *sff, struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, int *tvertex, int *tpatch, double *minc, double *maxc, Result *result, int sf_i, HECMW_Comm VIS_COMM, int init_flag, Connect_inf *global_connect)
void HECMW_vis_print_exit(char *var)
void HECMW_vis_memory_exit(char *var)
void HECMW_vis_rendering_surface(struct surface_module *sf, Parameter_rendering *sr, struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, int tvertex, int tpatch, int *color_list, double *minvalue, double *maxvalue, Result *result, char *outfile, int stat_para[NUM_CONTROL_PSF], HECMW_Comm VIS_COMM, int timestep)
int HECMW_vis_surface_compute(Surface *sff, struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, int *bdflag, int *sum_v, int *sum_t, int *tvertex, int *tpatch, double *minc, double *maxc, Result *result, int sf_i, int mynode, HECMW_Comm VIS_COMM)
int HECMW_vis_chk_bounds(struct hecmwST_local_mesh *mesh, int *bdflag)
Connect_inf * global_connect
void HECMW_vis_psf_rendering(struct hecmwST_local_mesh *mesh, struct hecmwST_result_data *data, int *timestep, struct surface_module *sf, Parameter_rendering *sr, int stat_para[NUM_CONTROL_PSF], char *outfile1, char *body, HECMW_Comm VIS_COMM)
double deform_line_color[3]
double initial_line_color[3]
struct hecmwST_section * section
long long * elem_node_index
double deform_line_color[3]
double initial_line_color[3]