回答編集履歴
2
バグの修正
    
        answer	
    CHANGED
    
    | @@ -51,7 +51,7 @@ | |
| 51 51 | 
             
            	for (i = 1; i <= np2; i++) {
         | 
| 52 52 | 
             
            		for (j = 1; j <= np1; j++)
         | 
| 53 53 | 
             
            			if (epoint1[j][0] == epoint2[i][0] &&
         | 
| 54 | 
            -
            				epoint1[j][ | 
| 54 | 
            +
            				epoint1[j][1] == epoint2[i][1] &&
         | 
| 55 55 | 
             
            				epoint1[j][2] == epoint2[i][2]) break;
         | 
| 56 56 | 
             
            		if (j > np1) {    // 重複しなかったので
         | 
| 57 57 | 
             
            			conv[i] = ++k;    // 新規節点番号を登録
         | 
1
コードの改善
    
        answer	
    CHANGED
    
    | @@ -39,7 +39,6 @@ | |
| 39 39 | 
             
            	int point2[1024][4];
         | 
| 40 40 | 
             
            	double epoint1[1024][3];
         | 
| 41 41 | 
             
            	double epoint2[1024][3];
         | 
| 42 | 
            -
            	double ecomb2[1024][3];
         | 
| 43 42 | 
             
            	int conv[1024];
         | 
| 44 43 |  | 
| 45 44 | 
             
            	read_data("in.dat1", point1, epoint1);
         | 
| @@ -49,8 +48,6 @@ | |
| 49 48 | 
             
            	int np2 = point2[0][0], ne2 = point2[0][1];
         | 
| 50 49 |  | 
| 51 50 | 
             
            	int i, j, k = np1;
         | 
| 52 | 
            -
            	for (i = 1; i <= np1; i++)
         | 
| 53 | 
            -
            		for (j = 0; j < 3; j++) ecomb2[i][j] = epoint1[i][j];
         | 
| 54 51 | 
             
            	for (i = 1; i <= np2; i++) {
         | 
| 55 52 | 
             
            		for (j = 1; j <= np1; j++)
         | 
| 56 53 | 
             
            			if (epoint1[j][0] == epoint2[i][0] &&
         | 
| @@ -58,7 +55,7 @@ | |
| 58 55 | 
             
            				epoint1[j][2] == epoint2[i][2]) break;
         | 
| 59 56 | 
             
            		if (j > np1) {    // 重複しなかったので
         | 
| 60 57 | 
             
            			conv[i] = ++k;    // 新規節点番号を登録
         | 
| 61 | 
            -
            			for (j = 0; j < 3; j++)  | 
| 58 | 
            +
            			for (j = 0; j < 3; j++) epoint1[k][j] = epoint2[i][j];
         | 
| 62 59 | 
             
            		}
         | 
| 63 60 | 
             
            		else conv[i] = j; // 重複したので、登録済み節点番号 j を使う
         | 
| 64 61 | 
             
            	}
         | 
| @@ -67,7 +64,8 @@ | |
| 67 64 |  | 
| 68 65 | 
             
            	point1[0][0] = k;
         | 
| 69 66 | 
             
            	point1[0][1] = ne1 + ne2;
         | 
| 70 | 
            -
            	write_data("in.dat", point1,  | 
| 67 | 
            +
            	write_data("in.dat", point1, epoint1);
         | 
| 71 68 | 
             
            }
         | 
| 69 | 
            +
             | 
| 72 70 | 
             
            ```
         | 
| 73 71 | 
             
            理解できたかどうかのコメントをお願いします。
         | 
