23 int *sum_v,
int *sum_t,
int *tvertex,
int *tpatch,
24 double *minc,
double *maxc,
Result *result,
30 Point **CS_verts_head;
32 int alpha_index, beta_index;
35 Point **CS_verts_tail, **CS_verts_refer;
45 Polygon *CS_polys, *CS_polys_tmp;
46 Point *CS_verts, *CS_verts_tmp;
47 int sum_polys, poly_num;
48 int aplist_size, bplist_size, cplist_size;
51 int flag_hexa, flag_tetra;
60 int tn_component, c_base;
70 for (i = 0; i <
data->nn_component; i++) tn_component +=
data->nn_dof[i];
106 for (j = 0; j < sum_table; j++) {
107 if ((CS_verts_refer[j] = CS_verts_tail[j] = CS_verts_head[j] =
113 if ((*CS_polys_tail = *CS_polys_head =
127 if (alpha_index && beta_index) {
130 &beta_cube, bdflag[i], &sum_verts,
131 CS_verts_tail, CS_verts_refer, CS_verts_head,
139 alpha_index =
make_tile(
mesh, cell, 0, 0, &alpha_cube, disamb_flag);
140 beta_index =
make_tile(
mesh, cell, 0, 1, &beta_cube, disamb_flag);
141 if (alpha_index && beta_index) {
144 bdflag[i], &sum_verts, CS_verts_tail,
145 CS_verts_refer, CS_verts_head,
155 if (flag_tetra == 0) {
164 if ((vertex_hash_table ==
NULL) || (tetra ==
NULL) ||
165 (tetra_point ==
NULL) || (head_patch_tetra ==
NULL))
168 vertex_hash_table[j].
ident = 0;
171 tetra_point->
ident = 0;
177 head_patch_tetra, vertex_hash_table);
180 if (flag_tetra == 1) {
181 num_nh_verts = tetra_point->
ident;
182 num_nh_patch = head_patch_tetra->
num_patch;
186 for (i = 0; i < vertex_hash_table[j].
ident; i++) {
198 mfree(CS_verts_tail);
199 mfree(CS_verts_refer);
200 mfree(CS_polys_tail);
206 CS_polys = *CS_polys_head;
210 aplist_size = bplist_size = cplist_size = 1;
212 switch (CS_polys->
type) {
214 aplist_size += CS_polys->
plist[0] + 1;
218 bplist_size += CS_polys->
plist[0] + 1;
222 cplist_size += (CS_polys->
plist[0] - 2) * 4;
223 sum_polys += CS_polys->
plist[0] - 2;
230 if ((sum_verts + num_nh_verts) > 0) {
231 result[sf_i].
n_vertex = sum_verts + num_nh_verts;
232 result[sf_i].
n_patch = sum_polys + num_nh_patch;
234 (
double *)
HECMW_calloc(result[sf_i].n_vertex * 3,
sizeof(
double));
236 (
int *)
HECMW_calloc(result[sf_i].n_patch * 3,
sizeof(
int));
238 (
double *)
HECMW_calloc(result[sf_i].n_vertex,
sizeof(
double));
239 if ((result[sf_i].vertex ==
NULL) || (result[sf_i].
patch ==
NULL) ||
240 (result[sf_i].color ==
NULL))
246 for (i = 0; i < sum_table; i++) {
247 CS_verts_tmp = CS_verts = CS_verts_head[i];
249 while (CS_verts->
ident != 0) {
260 result[sf_i].
vertex[mm * 3 + 1] = CS_verts->
geom.
y;
261 result[sf_i].
vertex[mm * 3 + 2] = CS_verts->
geom.
z;
267 CS_verts_tmp = CS_verts;
272 mfree(CS_verts_head);
278 CS_polys_tmp = CS_polys = *CS_polys_head;
284 switch (CS_polys->
type) {
289 for (j = 1; j <= CS_polys->
plist[0]; j++) {
297 result[sf_i].
patch[(poly_num - 1) * 3 + k] =
298 *tvertex + CS_polys->
plist[j];
300 result[sf_i].
patch[(poly_num - 1) * 3 + k] = CS_polys->
plist[j];
304 tmp_data[k * 3 + 1] =
305 result[sf_i].
vertex[(CS_polys->
plist[j] - 1) * 3 + 1];
306 tmp_data[k * 3 + 2] =
307 result[sf_i].
vertex[(CS_polys->
plist[j] - 1) * 3 + 2];
309 if (((fabs(tmp_data[0] - tmp_data[3]) <
EPSILON) &&
310 (fabs(tmp_data[1] - tmp_data[4]) <
EPSILON) &&
311 (fabs(tmp_data[2] - tmp_data[5]) <
EPSILON)) ||
312 ((fabs(tmp_data[0] - tmp_data[6]) <
EPSILON) &&
313 (fabs(tmp_data[1] - tmp_data[7]) <
EPSILON) &&
314 (fabs(tmp_data[2] - tmp_data[8]) <
EPSILON)) ||
315 ((fabs(tmp_data[6] - tmp_data[3]) <
EPSILON) &&
316 (fabs(tmp_data[7] - tmp_data[4]) <
EPSILON) &&
317 (fabs(tmp_data[8] - tmp_data[5]) <
EPSILON)))
330 CS_polys_tmp = CS_polys;
338 result[sf_i].
n_patch -= minus_patch;
342 if (num_nh_verts > 0) {
344 for (i = 0; i < tetra_point->
ident; i++) {
345 for (j = 0; j < 3; j++)
346 result[sf_i].vertex[(sum_verts + p1->
ident) * 3 + j] = p1->
geom[j];
354 if (num_nh_patch > 0) {
356 for (i = 0; i < head_patch_tetra->
num_patch; i++) {
357 for (j = 0; j < 3; j++) {
359 result[sf_i].
patch[(sum_polys - minus_patch + i) * 3 + j] =
360 t1->
patch[j] + 1 + sum_verts;
362 result[sf_i].
patch[(sum_polys - minus_patch + i) * 3 + j] =
363 *tvertex + t1->
patch[j] + 1 + sum_verts;
376 if (result[sf_i].n_vertex > 0) {
377 *minc = *maxc = result[sf_i].
color[0];
378 for (i = 1; i <= result[sf_i].
n_vertex; i++) {
379 if (result[sf_i].color[i - 1] < (*minc))
380 (*minc) = result[sf_i].
color[i - 1];
381 if (result[sf_i].color[i - 1] > (*maxc))
382 (*maxc) = result[sf_i].
color[i - 1];
394 for (i = 0; i < n_elem; i++) {
405 (
int *)
HECMW_calloc(result[sf_i].n_patch * 3,
sizeof(
int));
406 if ((result[sf_i].vertex ==
NULL) || (result[sf_i].
color ==
NULL) ||
407 (result[sf_i].patch ==
NULL))
410 for (j = 0; j < 3; j++)
411 result[sf_i].vertex[i * 3 + j] =
mesh->
node[i * 3 + j];
423 result[sf_i].
color[i] = 0.0;
425 tmp =
data->node_val_item[c_base + i * tn_component + j];
426 result[sf_i].
color[i] += tmp * tmp;
428 result[sf_i].
color[i] = sqrt(result[sf_i].color[i]);
434 result[sf_i].
color[i] =
data->node_val_item[c_base + i * tn_component +
439 result[sf_i].
color[i] =
data->node_val_item[c_base + i * tn_component];
443 for (i = 0; i < n_elem; i++) {
445 for (j = 0; j < 3; j++)
446 result->
patch[poly_num * 3 + j] =
450 for (j = 0; j < 3; j++)
451 result->
patch[poly_num * 3 + j] =
454 result->
patch[poly_num * 3 + 0] =
456 result->
patch[poly_num * 3 + 1] =
458 result->
patch[poly_num * 3 + 2] =
467 if (result[sf_i].n_vertex > 0) {
468 *minc = *maxc = result[sf_i].
color[0];
469 for (i = 1; i <= result[sf_i].
n_vertex; i++) {
470 if (result[sf_i].color[i - 1] < (*minc))
471 (*minc) = result[sf_i].
color[i - 1];
472 if (result[sf_i].color[i - 1] > (*maxc))
473 (*maxc) = result[sf_i].
color[i - 1];
484 (*tvertex) += result[sf_i].
n_vertex;
485 (*tpatch) += result[sf_i].
n_patch;
506 for (i = 0; i < n_elem; i++) {
513 int chk_node_data(
struct visual_buf *v,
int s_comp,
int c_comp) {
521 int n_export_node, export_base;
522 int n_import_node, import_base;
528 for (i = 0; i < s_comp; i++) {
529 s_base += v->node.n_free[i] * v->node.n;
531 for (i = 0; i < c_comp; i++) {
532 c_base += v->node.n_free[i] * v->node.n;
537 for (i = 0; i < v->mesh->n_neighbor_pe; i++) {
538 ne = v->mesh->neighbor_pe[i];
539 n_export_node = v->mesh->export_index[i + 1] - v->mesh->export_index[i];
540 global_node_id = (
int *)
HECMW_calloc(n_export_node,
sizeof(
int));
541 shape_data = (
double *)
HECMW_calloc(n_export_node,
sizeof(
double));
542 color_data = (
double *)
HECMW_calloc(n_export_node,
sizeof(
double));
543 for (j = 0; j < n_export_node; j++) {
545 v->mesh->global_node_id[v->mesh->export_node[export_base + j] - 1];
546 shape_data[j] = (double)*(v->node.data + s_base +
547 v->mesh->export_node[export_base + j] - 1);
548 color_data[j] = (double)*(v->node.data + c_base +
549 v->mesh->export_node[export_base + j] - 1);
560 export_base = v->mesh->export_index[i + 1];
562 n_import_node = v->mesh->import_index[i + 1] - v->mesh->import_index[i];
566 if (imp_node != n_import_node) {
567 GEOFEM_abort(711,
"chk_node_data error\n");
569 global_node_id = (
int *)
HECMW_calloc(n_import_node,
sizeof(
int));
570 shape_data = (
double *)
HECMW_calloc(n_import_node,
sizeof(
double));
571 color_data = (
double *)
HECMW_calloc(n_import_node,
sizeof(
double));
573 geofem_app_comm, &stat);
575 geofem_app_comm, &stat);
577 geofem_app_comm, &stat);
578 for (k = import_base; k < import_base + n_import_node; k++) {
579 for (j = 0; j < n_import_node; j++) {
580 if (v->mesh->global_node_id[v->mesh->import_node[k] - 1] ==
582 v->node.data[s_base + v->mesh->import_node[k] - 1] = shape_data[j];
583 v->node.data[c_base + v->mesh->import_node[k] - 1] = color_data[j];
591 import_base = v->mesh->import_index[i + 1];
648 void find_isoline(
int isonum,
int sum_polys,
double mincolor,
double maxcolor,
649 double *vcoord,
int *plist,
double *vcolor,
653 double isocolor, deltac;
657 fprintf(stderr,
"isonumber input wrong\n");
660 deltac = (maxcolor - mincolor) / (isonum + 1);
661 for (k = 0; k < isonum; k++) {
662 isocolor = mincolor + (k + 1) * deltac;
663 for (i = 0; i < sum_polys; i++) {
664 for (j = 0; j < 3; j++) {
665 c[j] = vcolor[plist[i * 3 + j] - 1];
666 g[j].
x = vcoord[(plist[i * 3 + j] - 1) * 3];
667 g[j].
y = vcoord[(plist[i * 3 + j] - 1) * 3 + 1];
668 g[j].
z = vcoord[(plist[i * 3 + j] - 1) * 3 + 2];
682 for (j = 0; j < 3; j++) {
685 if ((fabs(c[j] - c[j1]) < 0.0000001) &&
686 (fabs(c[j] - isocolor) < 0.0000001)) {
690 for (m = 0; m < 3; m++) iso_p[m] = f[j][m];
691 for (m = 0; m < 3; m++) iso_p[m + 3] = f[j1][m];
693 }
else if (((c[j] >= isocolor) && (c[j1] < isocolor)) ||
694 ((c[j] < isocolor) && (c[j1] >= isocolor))) {
696 for (m = 0; m < 3; m++)
697 iso_p[pnum * 3 + m] =
698 f[j][m] + (isocolor - c[j]) / (c[j1] - c[j]) * (f[j1][m] - f[j][m]);
701 if (pnum == 1) flag = 1;
714 for (j = 0; j < 2; j++) {
715 isopoint[j].
x = isopoint[j].
y = isopoint[j].
z = 0.0;
717 for (j = 0; j < 3; j++) {
720 if ((fabs(c[j] - c[j1]) < 0.0000001) &&
721 (fabs(c[j] - isocolor) < 0.0000001)) {
739 else if (((c[j] >= isocolor) && (c[j1] < isocolor)) ||
740 ((c[j] < isocolor) && (c[j1] >= isocolor))) {
743 g[j].
x + (isocolor - c[j]) / (c[j1] - c[j]) * (g[j1].
x - g[j].
x);
745 g[j].
y + (isocolor - c[j]) / (c[j1] - c[j]) * (g[j1].
y - g[j].
y);
747 g[j].
z + (isocolor - c[j]) / (c[j1] - c[j]) * (g[j1].
z - g[j].
z);
754 for (m = 0; m < 2; m++) {
755 p2->
point[m].
x = isopoint[m].
x;
756 p2->
point[m].
y = isopoint[m].
y;
757 p2->
point[m].
z = isopoint[m].
z;
769 for (i = 0; i < isonum; i++) {