149 fprintf ( stderr,
"\n" );
150 fprintf ( stderr,
"I4_MODP - Fatal error!\n" );
151 fprintf ( stderr,
" I4_MODP ( I, J ) called with J = %d\n",
j );
159 value = value + abs (
j );
235 wide = jhi + 1 - jlo;
243 value = jlo +
i4_modp ( ival - jlo, wide );
341 value = s * (
int ) ( fabs ( x ) + 0.5 );
410 for (
i = 0;
i < 2;
i++ )
412 for (
j = 0;
j <
n;
j++ )
414 phy[
i+
j*2] =
t[
i+0*2] * ( 1.0 - ref[0+
j*2] - ref[1+
j*2] )
415 +
t[
i+1*2] * + ref[0+
j*2]
416 +
t[
i+2*2] * + ref[1+
j*2];
515 t[0+0*2] * (
t[1+1*2] -
t[1+2*2] ) +
516 t[0+1*2] * (
t[1+2*2] -
t[1+0*2] ) +
517 t[0+2*2] * (
t[1+0*2] -
t[1+1*2] ) );
560 if ( 1 <= rule && rule <= 9 )
567 fprintf ( stderr,
"\n" );
568 fprintf ( stderr,
"TRIANGLE_NCC_DEGREE - Fatal error!\n" );
569 fprintf ( stderr,
" Illegal RULE = %d\n", rule );
624 order_num = order_num + suborder[
order];
677 double *suborder_xyz;
683 suborder_xyz = (
double * ) malloc ( 3 * suborder_num *
sizeof (
double ) );
684 suborder_w = (
double * ) malloc ( suborder_num *
sizeof (
double ) );
694 for ( s = 0; s < suborder_num; s++ )
696 if ( suborder[s] == 1 )
698 xy[0+o*2] = suborder_xyz[0+s*3];
699 xy[1+o*2] = suborder_xyz[1+s*3];
700 w[o] = suborder_w[s];
703 else if ( suborder[s] == 3 )
705 for (
k = 0;
k < 3;
k++ )
707 xy[0+o*2] = suborder_xyz [
i4_wrap(
k, 0,2) + s*3 ];
708 xy[1+o*2] = suborder_xyz [
i4_wrap(
k+1,0,2) + s*3 ];
709 w[o] = suborder_w[s];
713 else if ( suborder[s] == 6 )
715 for (
k = 0;
k < 3;
k++ )
717 xy[0+o*2] = suborder_xyz [
i4_wrap(
k, 0,2) + s*3 ];
718 xy[1+o*2] = suborder_xyz [
i4_wrap(
k+1,0,2) + s*3 ];
719 w[o] = suborder_w[s];
723 for (
k = 0;
k < 3;
k++ )
725 xy[0+o*2] = suborder_xyz [
i4_wrap(
k+1,0,2) + s*3 ];
726 xy[1+o*2] = suborder_xyz [
i4_wrap(
k, 0,2) + s*3 ];
727 w[o] = suborder_w[s];
733 fprintf ( stderr,
"\n" );
734 fprintf ( stderr,
"TRIANGLE_NCC_RULE - Fatal error!\n" );
735 fprintf ( stderr,
" Illegal SUBORDER(%d) = %d\n", s, suborder[s] );
741 free ( suborder_xyz );
827 suborder = (
int * ) malloc ( suborder_num *
sizeof (
int ) );
833 else if ( rule == 2 )
837 else if ( rule == 3 )
841 else if ( rule == 4 )
847 else if ( rule == 5 )
853 else if ( rule == 6 )
861 else if ( rule == 7 )
870 else if ( rule == 8 )
881 else if ( rule == 9 )
895 fprintf ( stderr,
"\n" );
896 fprintf ( stderr,
"TRIANGLE_NCC_SUBORDER - Fatal error!\n" );
897 fprintf ( stderr,
" Illegal RULE = %d\n", rule );
946 else if ( rule == 2 )
950 else if ( rule == 3 )
954 else if ( rule == 4 )
958 else if ( rule == 5 )
962 else if ( rule == 6 )
966 else if ( rule == 7 )
970 else if ( rule == 8 )
974 else if ( rule == 9 )
981 fprintf ( stderr,
"\n" );
982 fprintf ( stderr,
"TRIANGLE_NCC_SUBORDER_NUM - Fatal error!\n" );
983 fprintf ( stderr,
" Illegal RULE = %d\n", rule );
992 double suborder_w[] )
1036 int *suborder_xyz_n;
1038 suborder_xyz_n = (
int * ) malloc ( 3 * suborder_num *
sizeof (
int ) );
1039 suborder_w_n = (
int * ) malloc ( suborder_num *
sizeof (
int ) );
1044 suborder_w_n, &suborder_w_d );
1046 else if ( rule == 2 )
1049 suborder_w_n, &suborder_w_d );
1051 else if ( rule == 3 )
1054 suborder_w_n, &suborder_w_d );
1056 else if ( rule == 4 )
1059 suborder_w_n, &suborder_w_d );
1061 else if ( rule == 5 )
1064 suborder_w_n, &suborder_w_d );
1066 else if ( rule == 6 )
1069 suborder_w_n, &suborder_w_d );
1071 else if ( rule == 7 )
1074 suborder_w_n, &suborder_w_d );
1076 else if ( rule == 8 )
1079 suborder_w_n, &suborder_w_d );
1081 else if ( rule == 9 )
1084 suborder_w_n, &suborder_w_d );
1088 fprintf ( stderr,
"\n" );
1089 fprintf ( stderr,
"TRIANGLE_NCC_SUBRULE - Fatal error!\n" );
1090 fprintf ( stderr,
" Illegal RULE = %d\n", rule );
1094 for ( s = 0; s < suborder_num; s++ )
1096 for (
i = 0;
i < 3;
i++ )
1098 suborder_xyz[
i+s*3] =
1099 (
double ) ( suborder_xyz_n[
i+s*3] )
1100 / (
double ) ( suborder_xyz_d );
1103 for ( s = 0; s < suborder_num; s++ )
1105 suborder_w[s] = (
double ) suborder_w_n[s] / (
double ) suborder_w_d;
1108 free ( suborder_w_n );
1109 free ( suborder_xyz_n );
1116 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1162 int suborder_xyz_n_01[3*1] = {
1165 int suborder_xyz_d_01 = 3;
1166 int suborder_w_n_01[1] = { 1 };
1167 int suborder_w_d_01 = 1;
1169 for ( s = 0; s < suborder_num; s++ )
1171 for (
i = 0;
i < 3;
i++ )
1173 suborder_xyz_n[
i+s*3] = suborder_xyz_n_01[
i+s*3];
1176 *suborder_xyz_d = suborder_xyz_d_01;
1178 for ( s = 0; s < suborder_num; s++ )
1180 suborder_w_n[s] = suborder_w_n_01[s];
1182 *suborder_w_d = suborder_w_d_01;
1189 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1235 int suborder_xyz_n_02[3*1] = {
1238 int suborder_xyz_d_02 = 1;
1239 int suborder_w_n_02[1] = { 1 };
1240 int suborder_w_d_02 = 3;
1242 for ( s = 0; s < suborder_num; s++ )
1244 for (
i = 0;
i < 3;
i++ )
1246 suborder_xyz_n[
i+s*3] = suborder_xyz_n_02[
i+s*3];
1249 *suborder_xyz_d = suborder_xyz_d_02;
1251 for ( s = 0; s < suborder_num; s++ )
1253 suborder_w_n[s] = suborder_w_n_02[s];
1255 *suborder_w_d = suborder_w_d_02;
1262 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1308 int suborder_xyz_n_03[3*1] = {
1311 int suborder_xyz_d_03 = 2;
1312 int suborder_w_n_03[1] = { 1 };
1313 int suborder_w_d_03 = 3;
1315 for ( s = 0; s < suborder_num; s++ )
1317 for (
i = 0;
i < 3;
i++ )
1319 suborder_xyz_n[
i+s*3] = suborder_xyz_n_03[
i+s*3];
1322 *suborder_xyz_d = suborder_xyz_d_03;
1324 for ( s = 0; s < suborder_num; s++ )
1326 suborder_w_n[s] = suborder_w_n_03[s];
1328 *suborder_w_d = suborder_w_d_03;
1335 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1381 int suborder_xyz_n_04[3*3] = {
1386 int suborder_xyz_d_04 = 3;
1387 int suborder_w_n_04[3] = { 4, 9, 54 };
1388 int suborder_w_d_04 = 120;
1390 for ( s = 0; s < suborder_num; s++ )
1392 for (
i = 0;
i < 3;
i++ )
1394 suborder_xyz_n[
i+s*3] = suborder_xyz_n_04[
i+s*3];
1397 *suborder_xyz_d = suborder_xyz_d_04;
1399 for ( s = 0; s < suborder_num; s++ )
1401 suborder_w_n[s] = suborder_w_n_04[s];
1403 *suborder_w_d = suborder_w_d_04;
1410 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1456 int suborder_xyz_n_05[3*3] = {
1461 int suborder_xyz_d_05 = 4;
1462 int suborder_w_n_05[3] = { 4, -1, 8 };
1463 int suborder_w_d_05 = 45;
1465 for ( s = 0; s < suborder_num; s++ )
1467 for (
i = 0;
i < 3;
i++ )
1469 suborder_xyz_n[
i+s*3] = suborder_xyz_n_05[
i+s*3];
1472 *suborder_xyz_d = suborder_xyz_d_05;
1474 for ( s = 0; s < suborder_num; s++ )
1476 suborder_w_n[s] = suborder_w_n_05[s];
1478 *suborder_w_d = suborder_w_d_05;
1485 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1531 int suborder_xyz_n_06[3*5] = {
1538 int suborder_xyz_d_06 = 5;
1539 int suborder_w_n_06[5] = { 11, 25, 25, 200, 25 };
1540 int suborder_w_d_06 = 1008;
1542 for ( s = 0; s < suborder_num; s++ )
1544 for (
i = 0;
i < 3;
i++ )
1546 suborder_xyz_n[
i+s*3] = suborder_xyz_n_06[
i+s*3];
1549 *suborder_xyz_d = suborder_xyz_d_06;
1551 for ( s = 0; s < suborder_num; s++ )
1553 suborder_w_n[s] = suborder_w_n_06[s];
1555 *suborder_w_d = suborder_w_d_06;
1562 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1608 int suborder_xyz_n_07[3*6] = {
1616 int suborder_xyz_d_07 = 6;
1617 int suborder_w_n_07[6] = { 36, -27, 72, 64, 72, -54 };
1618 int suborder_w_d_07 = 840;
1620 for ( s = 0; s < suborder_num; s++ )
1622 for (
i = 0;
i < 3;
i++ )
1624 suborder_xyz_n[
i+s*3] = suborder_xyz_n_07[
i+s*3];
1627 *suborder_xyz_d = suborder_xyz_d_07;
1629 for ( s = 0; s < suborder_num; s++ )
1631 suborder_w_n[s] = suborder_w_n_07[s];
1633 *suborder_w_d = suborder_w_d_07;
1640 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1686 int suborder_xyz_n_08[3*8] = {
1696 int suborder_xyz_d_08 = 7;
1697 int suborder_w_n_08[8] = { 1336, 2989, 3577, 32242, 2695, -6860, 44590, 3430 };
1698 int suborder_w_d_08 = 259200;
1700 for ( s = 0; s < suborder_num; s++ )
1702 for (
i = 0;
i < 3;
i++ )
1704 suborder_xyz_n[
i+s*3] = suborder_xyz_n_08[
i+s*3];
1707 *suborder_xyz_d = suborder_xyz_d_08;
1709 for ( s = 0; s < suborder_num; s++ )
1711 suborder_w_n[s] = suborder_w_n_08[s];
1713 *suborder_w_d = suborder_w_d_08;
1720 int *suborder_xyz_d,
int suborder_w_n[],
int *suborder_w_d )
1766 int suborder_xyz_n_09[3*9] = {
1777 int suborder_xyz_d_09 = 8;
1778 int suborder_w_n_09[9] = {
1779 368, -468, 704, 1136, 832, -1083, 672, -1448, 1472 };
1780 int suborder_w_d_09 = 14175;
1782 for ( s = 0; s < suborder_num; s++ )
1784 for (
i = 0;
i < 3;
i++ )
1786 suborder_xyz_n[
i+s*3] = suborder_xyz_n_09[
i+s*3];
1789 *suborder_xyz_d = suborder_xyz_d_09;
1791 for ( s = 0; s < suborder_num; s++ )
1793 suborder_w_n[s] = suborder_w_n_09[s];
1795 *suborder_w_d = suborder_w_d_09;