Loading src/trapping/clffft.cpp +14 −15 Original line number Original line Diff line number Diff line Loading @@ -121,7 +121,6 @@ void lffft(string data_file, string output_path) { if (is >= 2222) { // label 120 if (is >= 2222) { // label 120 tms = new dcomplex*[le]; tms = new dcomplex*[le]; for (int ti = 0; ti < le; ti++) tms[ti] = new dcomplex[3](); for (int ti = 0; ti < le; ti++) tms[ti] = new dcomplex[3](); // QUESTION|WARNING: original code uses LM without defining it. Where does it come from? int lm = le; int lm = le; for (int i = 0; i < lm; i++) { for (int i = 0; i < lm; i++) { double vreal, vimag; double vreal, vimag; Loading Loading @@ -323,10 +322,10 @@ void lffft(string data_file, string output_path) { if (lm > le) wsl = new dcomplex[nlmmt](); if (lm > le) wsl = new dcomplex[nlmmt](); // FORTRAN writes two output formatted files without opening them // FORTRAN writes two output formatted files without opening them // explicitly. It is assumed thay can be opened here. // explicitly. It is assumed thay can be opened here. string out66_name = output_path + "/c_out66.txt"; string force_cs_name = output_path + "/c_force_cs.txt"; string out67_name = output_path + "/c_out67.txt"; string torque_cs_name = output_path + "/c_torque_cs.txt"; FILE *output66 = fopen(out66_name.c_str(), "w"); FILE *output_frc = fopen(force_cs_name.c_str(), "w"); FILE *output67 = fopen(out67_name.c_str(), "w"); FILE *output_trq = fopen(torque_cs_name.c_str(), "w"); for (int iz475 = 0; iz475 < nzv; iz475++) { for (int iz475 = 0; iz475 < nzv; iz475++) { for (int iy475 = 0; iy475 < nyv; iy475++) { for (int iy475 = 0; iy475 < nyv; iy475++) { for (int ix475 = 0; ix475 < nxv; ix475++) { for (int ix475 = 0; ix475 < nxv; ix475++) { Loading Loading @@ -383,15 +382,15 @@ void lffft(string data_file, string output_path) { if (jss == 1) { if (jss == 1) { // Writes to 66 // Writes to 66 fprintf( fprintf( output66, " %18.16lE%18.16lE%18.16lE\n", output_frc, " %18.16lE%18.16lE%18.16lE\n", fffe[0], fffs[0], fffe[0] - fffs[0] fffe[0], fffs[0], fffe[0] - fffs[0] ); ); fprintf( fprintf( output66, " %18.16lE%18.16lE%18.16lE\n", output_frc, " %18.16lE%18.16lE%18.16lE\n", fffe[1], fffs[1], fffe[1] - fffs[1] fffe[1], fffs[1], fffe[1] - fffs[1] ); ); fprintf( fprintf( output66, " %18.16lE%18.16lE%18.16lE\n", output_frc, " %18.16lE%18.16lE%18.16lE\n", fffe[2], fffs[2], fffe[2] - fffs[2] fffe[2], fffs[2], fffe[2] - fffs[2] ); ); } else { // label 450 } else { // label 450 Loading @@ -402,7 +401,7 @@ void lffft(string data_file, string output_path) { if (jtw == 1) { if (jtw == 1) { // Writes to 66 // Writes to 66 fprintf( fprintf( output66, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", output_frc, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", ix475 + 1, iy475 + 1, iz475 + 1, ix475 + 1, iy475 + 1, iz475 + 1, fffe[0] - fffs[0], fffe[1] - fffs[1], fffe[2] - fffs[2] fffe[0] - fffs[0], fffe[1] - fffs[1], fffe[2] - fffs[2] ); ); Loading @@ -420,15 +419,15 @@ void lffft(string data_file, string output_path) { if (jss == 1) { if (jss == 1) { // Writes to 67 // Writes to 67 fprintf( fprintf( output67, " %18.16lE%18.16lE%18.16lE\n", output_trq, " %18.16lE%18.16lE%18.16lE\n", ffte[0], ffts[0], ffte[0] - ffts[0] ffte[0], ffts[0], ffte[0] - ffts[0] ); ); fprintf( fprintf( output67, " %18.16lE%18.16lE%18.16lE\n", output_trq, " %18.16lE%18.16lE%18.16lE\n", ffte[1], ffts[1], ffte[1] - ffts[1] ffte[1], ffts[1], ffte[1] - ffts[1] ); ); fprintf( fprintf( output67, " %18.16lE%18.16lE%18.16lE\n", output_trq, " %18.16lE%18.16lE%18.16lE\n", ffte[2], ffts[2], ffte[2] - ffts[2] ffte[2], ffts[2], ffte[2] - ffts[2] ); ); } else { // label 470 } else { // label 470 Loading @@ -439,7 +438,7 @@ void lffft(string data_file, string output_path) { if (jtw == 1) { if (jtw == 1) { // Writes to 67 // Writes to 67 fprintf( fprintf( output67, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", output_trq, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", ix475 + 1, iy475 + 1, iz475 + 1, ix475 + 1, iy475 + 1, iz475 + 1, ffte[0] - ffts[0], ffte[1] - ffts[1], ffte[2] - ffts[2] ffte[0] - ffts[0], ffte[1] - ffts[1], ffte[2] - ffts[2] ); ); Loading @@ -455,8 +454,8 @@ void lffft(string data_file, string output_path) { if (jft <= 0) tlfff.close(); if (jft <= 0) tlfff.close(); if (jft >= 0) tlfft.close(); if (jft >= 0) tlfft.close(); } } fclose(output66); fclose(output_frc); fclose(output67); fclose(output_trq); } } } } delete tfrfme; delete tfrfme; Loading Loading
src/trapping/clffft.cpp +14 −15 Original line number Original line Diff line number Diff line Loading @@ -121,7 +121,6 @@ void lffft(string data_file, string output_path) { if (is >= 2222) { // label 120 if (is >= 2222) { // label 120 tms = new dcomplex*[le]; tms = new dcomplex*[le]; for (int ti = 0; ti < le; ti++) tms[ti] = new dcomplex[3](); for (int ti = 0; ti < le; ti++) tms[ti] = new dcomplex[3](); // QUESTION|WARNING: original code uses LM without defining it. Where does it come from? int lm = le; int lm = le; for (int i = 0; i < lm; i++) { for (int i = 0; i < lm; i++) { double vreal, vimag; double vreal, vimag; Loading Loading @@ -323,10 +322,10 @@ void lffft(string data_file, string output_path) { if (lm > le) wsl = new dcomplex[nlmmt](); if (lm > le) wsl = new dcomplex[nlmmt](); // FORTRAN writes two output formatted files without opening them // FORTRAN writes two output formatted files without opening them // explicitly. It is assumed thay can be opened here. // explicitly. It is assumed thay can be opened here. string out66_name = output_path + "/c_out66.txt"; string force_cs_name = output_path + "/c_force_cs.txt"; string out67_name = output_path + "/c_out67.txt"; string torque_cs_name = output_path + "/c_torque_cs.txt"; FILE *output66 = fopen(out66_name.c_str(), "w"); FILE *output_frc = fopen(force_cs_name.c_str(), "w"); FILE *output67 = fopen(out67_name.c_str(), "w"); FILE *output_trq = fopen(torque_cs_name.c_str(), "w"); for (int iz475 = 0; iz475 < nzv; iz475++) { for (int iz475 = 0; iz475 < nzv; iz475++) { for (int iy475 = 0; iy475 < nyv; iy475++) { for (int iy475 = 0; iy475 < nyv; iy475++) { for (int ix475 = 0; ix475 < nxv; ix475++) { for (int ix475 = 0; ix475 < nxv; ix475++) { Loading Loading @@ -383,15 +382,15 @@ void lffft(string data_file, string output_path) { if (jss == 1) { if (jss == 1) { // Writes to 66 // Writes to 66 fprintf( fprintf( output66, " %18.16lE%18.16lE%18.16lE\n", output_frc, " %18.16lE%18.16lE%18.16lE\n", fffe[0], fffs[0], fffe[0] - fffs[0] fffe[0], fffs[0], fffe[0] - fffs[0] ); ); fprintf( fprintf( output66, " %18.16lE%18.16lE%18.16lE\n", output_frc, " %18.16lE%18.16lE%18.16lE\n", fffe[1], fffs[1], fffe[1] - fffs[1] fffe[1], fffs[1], fffe[1] - fffs[1] ); ); fprintf( fprintf( output66, " %18.16lE%18.16lE%18.16lE\n", output_frc, " %18.16lE%18.16lE%18.16lE\n", fffe[2], fffs[2], fffe[2] - fffs[2] fffe[2], fffs[2], fffe[2] - fffs[2] ); ); } else { // label 450 } else { // label 450 Loading @@ -402,7 +401,7 @@ void lffft(string data_file, string output_path) { if (jtw == 1) { if (jtw == 1) { // Writes to 66 // Writes to 66 fprintf( fprintf( output66, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", output_frc, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", ix475 + 1, iy475 + 1, iz475 + 1, ix475 + 1, iy475 + 1, iz475 + 1, fffe[0] - fffs[0], fffe[1] - fffs[1], fffe[2] - fffs[2] fffe[0] - fffs[0], fffe[1] - fffs[1], fffe[2] - fffs[2] ); ); Loading @@ -420,15 +419,15 @@ void lffft(string data_file, string output_path) { if (jss == 1) { if (jss == 1) { // Writes to 67 // Writes to 67 fprintf( fprintf( output67, " %18.16lE%18.16lE%18.16lE\n", output_trq, " %18.16lE%18.16lE%18.16lE\n", ffte[0], ffts[0], ffte[0] - ffts[0] ffte[0], ffts[0], ffte[0] - ffts[0] ); ); fprintf( fprintf( output67, " %18.16lE%18.16lE%18.16lE\n", output_trq, " %18.16lE%18.16lE%18.16lE\n", ffte[1], ffts[1], ffte[1] - ffts[1] ffte[1], ffts[1], ffte[1] - ffts[1] ); ); fprintf( fprintf( output67, " %18.16lE%18.16lE%18.16lE\n", output_trq, " %18.16lE%18.16lE%18.16lE\n", ffte[2], ffts[2], ffte[2] - ffts[2] ffte[2], ffts[2], ffte[2] - ffts[2] ); ); } else { // label 470 } else { // label 470 Loading @@ -439,7 +438,7 @@ void lffft(string data_file, string output_path) { if (jtw == 1) { if (jtw == 1) { // Writes to 67 // Writes to 67 fprintf( fprintf( output67, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", output_trq, " %5d%4d%4d%15.4lE%15.4lE%15.4lE\n", ix475 + 1, iy475 + 1, iz475 + 1, ix475 + 1, iy475 + 1, iz475 + 1, ffte[0] - ffts[0], ffte[1] - ffts[1], ffte[2] - ffts[2] ffte[0] - ffts[0], ffte[1] - ffts[1], ffte[2] - ffts[2] ); ); Loading @@ -455,8 +454,8 @@ void lffft(string data_file, string output_path) { if (jft <= 0) tlfff.close(); if (jft <= 0) tlfff.close(); if (jft >= 0) tlfft.close(); if (jft >= 0) tlfft.close(); } } fclose(output66); fclose(output_frc); fclose(output67); fclose(output_trq); } } } } delete tfrfme; delete tfrfme; Loading