Loading src/include/tra_subs.h +3 −4 Original line number Diff line number Diff line Loading @@ -107,7 +107,6 @@ void ffrt( * * \param nkv: `int` QUESTION: definition? * \param vkm: `double` QUESTION: definition? * \param vkv: `double *` QUESTION: definition? * \param vknmx: `double` QUESTION: definition? * \param apfafa: `double` QUESTION: definition? * \param tra: `double` QUESTION: definition? Loading @@ -118,12 +117,12 @@ void ffrt( * \param lmode: `int` QUESTION: definition? * \param pmf: `double` QUESTION: definition? * \param tt1: `Swap1 *` Pointer to first swap object. * \param tt2: `fstream &` Handle to second temporary binary file. * \param tt2: `Swap2 *` Pointer to second swap object. */ void frfmer( int nkv, double vkm, double *vkv, double vknmx, double apfafa, double tra, int nkv, double vkm, double vknmx, double apfafa, double tra, double spd, double rir, double ftcn, int le, int lmode, double pmf, Swap1 *tt1, std::fstream &tt2 Swap1 *tt1, Swap2 *tt2 ); /*! C++ porting of PWMALP Loading src/libnptm/tfrfme.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -263,10 +263,10 @@ Swap2* Swap2::from_legacy(string file_name) { input.read(reinterpret_cast<char *>(&value), sizeof(double)); instance->set_vector_element(vj, value); } for (int mi = 0; mi < _nkv; ,i++) { for (int mi = 0; mi < _nkv; mi++) { for (int mj = 0; mj < _nkv; mj++) { input.read(reinterpret_cast<char *>(&value), sizeof(double)); instance->set_matrix_element(vi, vj, value); instance->set_matrix_element(mi, mj, value); } } input.read(reinterpret_cast<char *>(&value), sizeof(double)); Loading Loading @@ -432,7 +432,7 @@ void Swap2::write_hdf5(string file_name) { void Swap2::write_legacy(string file_name) { fstream output; double value double value; output.open(file_name.c_str(), ios::out | ios::binary); if (output.is_open()) { output.write(reinterpret_cast<char *>(&nkv), sizeof(int)); Loading src/libnptm/tra_subs.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -245,18 +245,18 @@ void ffrt( } void frfmer( int nkv, double vkm, double *vkv, double vknmx, double apfafa, double tra, int nkv, double vkm, double vknmx, double apfafa, double tra, double spd, double rir, double ftcn, int le, int lmode, double pmf, Swap1 *tt1, std::fstream &tt2 Swap1 *tt1, Swap2 *tt2 ) { const int nlemt = le * (le + 2) * 2; const complex<double> cc0(0.0, 0.0); double sq = vkm * vkm; for (int jy90 = 0; jy90 < nkv; jy90++) { double vky = vkv[jy90]; double vky = tt2->get_vector_element(jy90); double sqy = vky * vky; for (int jx80 = 0; jx80 < nkv; jx80++) { double vkx = vkv[jx80]; double vkx = tt2->get_vector_element(jx80); double sqx = vkx * vkx; double sqn = sqx + sqy; double vkn = sqrt(sqn); Loading @@ -269,7 +269,8 @@ void frfmer( tt1.write(reinterpret_cast<char *>(&vreal), sizeof(double)); tt1.write(reinterpret_cast<char *>(&vimag), sizeof(double)); }*/ tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); //tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); tt2->set_matrix_element(jx80, jy90, vkz); } else { // label 50 for (int j = 0; j < nlemt; j++) { //double vreal = 0.0; Loading @@ -278,8 +279,9 @@ void frfmer( //tt1.write(reinterpret_cast<char *>(&vimag), sizeof(double)); tt1->set_element(j, cc0); } double vkz = 0.0; tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); //double vkz = 0.0; //tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); tt2->set_matrix_element(jx80, jy90, 0.0); } } // jx80 loop } // jy90 loop Loading src/trapping/cfrfme.cpp +60 −64 Original line number Diff line number Diff line Loading @@ -44,9 +44,9 @@ void frfme(string data_file, string output_path) { string tfrfme_name = output_path + "/c_TFRFME.hd5"; TFRFME *tfrfme = NULL; Swap1 *tt1 = NULL; Swap2 *tt2 = NULL; char namef[7]; char more; double *vkv = NULL, **vkzm = NULL; complex<double> **w = NULL; const complex<double> cc0(0.0, 0.0); const complex<double> uim(0.0, 1.0); Loading Loading @@ -78,9 +78,9 @@ void frfme(string data_file, string output_path) { lmode = (int)tfrfme->get_param("lmode"); lm = (int)tfrfme->get_param("lm"); nkv = (int)tfrfme->get_param("nkv"); nxv = (int)tfrfme->get_param("nkv"); nyv = (int)tfrfme->get_param("nkv"); nzv = (int)tfrfme->get_param("nkv"); nxv = (int)tfrfme->get_param("nxv"); nyv = (int)tfrfme->get_param("nyv"); nzv = (int)tfrfme->get_param("nzv"); vk = tfrfme->get_param("vk"); exri = tfrfme->get_param("exri"); an = tfrfme->get_param("an"); Loading @@ -89,33 +89,32 @@ void frfme(string data_file, string output_path) { spd = tfrfme->get_param("spd"); frsh = tfrfme->get_param("frsh"); exril = tfrfme->get_param("exril"); vkv = new double[nkv](); fstream temptape2; string tempname2 = output_path + "/c_TEMPTAPE2"; temptape2.open(tempname2.c_str(), ios::in | ios::binary); if (temptape2.is_open()) { for (int jx = 0; jx < nkv; jx++) temptape2.read(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double)); //fstream temptape2; string tempname2 = output_path + "/c_TEMPTAPE2.hd5"; //temptape2.open(tempname2.c_str(), ios::in | ios::binary); if (tt2 == NULL) tt2 = Swap2::from_binary(tempname2, "HDF5"); if (tt2 != NULL) { /*for (int jx = 0; jx < nkv; jx++) temptape2.read(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double)); vkzm = new double*[nkv]; for (int vki = 0; vki < nkv; vki++) vkzm[vki] = new double[nkv](); for (int jy10 = 0; jy10 < nkv; jy10++) { for (int jx10 = 0; jx10 < nkv; jx10++) { temptape2.read(reinterpret_cast<char *>(&(vkzm[jx10][jy10])), sizeof(double)); } //jx10 loop } // jy10 loop temptape2.read(reinterpret_cast<char *>(&apfafa), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&pmf), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&spd), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&rir), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&ftcn), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&fshmx), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&vxyzmx), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&delxyz), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&vknmx), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&delk), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&delks), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&nlmmt), sizeof(int)); temptape2.read(reinterpret_cast<char *>(&nrvc), sizeof(int)); temptape2.close(); } // jy10 loop*/ apfafa = tt2->get_param("apfafa"); pmf = tt2->get_param("pmf"); spd = tt2->get_param("spd"); rir = tt2->get_param("rir"); ftcn = tt2->get_param("ftcn"); fshmx = tt2->get_param("fshmx"); vxyzmx = tt2->get_param("vxyzmx"); delxyz = tt2->get_param("delxyz"); vknmx = tt2->get_param("vknmx"); delk = tt2->get_param("delk"); delks = tt2->get_param("delks"); nlmmt = (int)tt2->get_param("nlmmt"); nrvc = (int)tt2->get_param("nrvc"); } else { printf("ERROR: could not open TEMPTAPE2 file.\n"); } Loading Loading @@ -223,9 +222,10 @@ void frfme(string data_file, string output_path) { nks = nksh * 2; nkv = nks + 1; // Array initialization vkv = new double[nkv](); /*vkv = new double[nkv](); vkzm = new double*[nkv]; for (int vi = 0; vi < nkv; vi++) vkzm[vi] = new double[nkv]; for (int vi = 0; vi < nkv; vi++) vkzm[vi] = new double[nkv];*/ tt2 = new Swap2(nkv); // End of array initialization double vkm = vk * exri; vknmx = vk * an; Loading Loading @@ -259,8 +259,8 @@ void frfme(string data_file, string output_path) { int nrvc = nxv * nyv * nzv; int nkshpo = nksh + 1; for (int i28 = nkshpo; i28 <= nks; i28++) { vkv[i28] = vkv[i28 - 1] + delk; vkv[nkv - i28 - 1] = -vkv[i28]; tt2->set_vector_element(i28, tt2->get_vector_element(i28 - 1) + delk); tt2->set_vector_element(nkv - i28 - 1, -tt2->get_vector_element(i28)); } // i28 loop if (tfrfme != NULL) { tfrfme->set_param("vk", vk); Loading @@ -271,33 +271,33 @@ void frfme(string data_file, string output_path) { tfrfme->set_param("spd", spd); tfrfme->set_param("frsh", frsh); tfrfme->set_param("exril", exril); fstream temptape1, temptape2; //fstream temptape1, temptape2; string temp_name1 = output_path + "/c_TEMPTAPE1.hd5"; string temp_name2 = output_path + "/c_TEMPTAPE2"; string temp_name2 = output_path + "/c_TEMPTAPE2.hd5"; //temptape1.open(temp_name1.c_str(), ios::out | ios::binary); tt1 = new Swap1(lm); temptape2.open(temp_name2.c_str(), ios::out | ios::binary); /*temptape2.open(temp_name2.c_str(), ios::out | ios::binary); for (int jx = 0; jx < nkv; jx++) temptape2.write(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double)); frfmer(nkv, vkm, vkv, vknmx, apfafa, tra, spd, rir, ftcn, lm, lmode, pmf, tt1, temptape2); temptape2.write(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double));*/ frfmer(nkv, vkm, vknmx, apfafa, tra, spd, rir, ftcn, lm, lmode, pmf, tt1, tt2); //temptape1.close(); tt1->write_binary(temp_name1, "HDF5"); temptape2.write(reinterpret_cast<char *>(&apfafa), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&pmf), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&spd), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&rir), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&ftcn), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&fshmx), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&vxyzmx), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&delxyz), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&vknmx), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&delk), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&delks), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&nlmmt), sizeof(int)); temptape2.write(reinterpret_cast<char *>(&nrvc), sizeof(int)); temptape2.close(); temptape2.open("c_TEMPTAPE2", ios::in | ios::binary); for (int jx = 0; jx < nkv; jx++) { tt2->set_param("apfafa", apfafa); tt2->set_param("pmf", pmf); tt2->set_param("spd", spd); tt2->set_param("rir", rir); tt2->set_param("ftcn", ftcn); tt2->set_param("fshmx", fshmx); tt2->set_param("vxyzmx", vxyzmx); tt2->set_param("delxyz", delxyz); tt2->set_param("vknmx", vknmx); tt2->set_param("delk", delk); tt2->set_param("delks", delks); tt2->set_param("nlmmt", 1.0 * nlmmt); tt2->set_param("nrvc", 1.0 * nrvc); tt2->write_binary(temp_name2, "HDF5"); //temptape2.open("c_TEMPTAPE2", ios::in | ios::binary); /*for (int jx = 0; jx < nkv; jx++) { double value = 0.0; temptape2.read(reinterpret_cast<char *>(&value), sizeof(double)); vkv[jx] = value; Loading @@ -309,7 +309,7 @@ void frfme(string data_file, string output_path) { vkzm[jx40][jy40] = value; } } // jy40 loop temptape2.close(); temptape2.close();*/ for (int j80 = jlmf - 1; j80 < jlml; j80++) { // w matrix if (w != NULL) { Loading Loading @@ -344,16 +344,16 @@ void frfme(string data_file, string output_path) { ixyz++; complex<double> sumy = cc0; for (int jy60 = 0; jy60 < nkv; jy60++) { double vky = vkv[jy60]; double vkx = vkv[nkv - 1]; double vkzf = vkzm[0][jy60]; double vky = tt2->get_vector_element(jy60); double vkx = tt2->get_vector_element(nkv - 1); double vkzf = tt2->get_matrix_element(0, jy60); complex<double> phasf = exp(uim * (-vkx * x + vky * y + vkzf * z)); double vkzl = vkzm[nkv - 1][jy60]; double vkzl = tt2->get_matrix_element(nkv - 1, jy60); complex<double> phasl = exp(uim * (vkx * x + vky * y + vkzl * z)); complex<double> sumx = 0.5 * (w[0][jy60] * phasf + w[nkv - 1][jy60] * phasl); for (int jx55 = 2; jx55 <= nks; jx55++) { vkx = vkv[jx55 - 1]; double vkz = vkzm[jx55 - 1][jy60]; vkx = tt2->get_vector_element(jx55 - 1); double vkz = tt2->get_matrix_element(jx55 - 1, jy60); complex<double> phas = exp(uim * (vkx * x + vky * y + vkz * z)); sumx += (w[jx55 - 1][jy60] * phas); } // jx55 loop Loading Loading @@ -406,16 +406,12 @@ void frfme(string data_file, string output_path) { // label 45 if (tfrfme != NULL) delete tfrfme; delete[] file_lines; if (vkv != NULL) delete[] vkv; if (vkzm != NULL) { for (int vki = nkv - 1; vki > -1; vki--) delete[] vkzm[vki]; delete[] vkzm; } if (tt2 != NULL) delete tt2; if (w != NULL) { for (int wi = nkv - 1; wi > -1; wi--) delete[] w[wi]; delete[] w; } //if (wk != NULL) delete[] wk; if (tt1 != NULL) delete tt1; printf("Done.\n"); printf("FRFME: Done.\n"); } src/trapping/clffft.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -442,5 +442,5 @@ void lffft(string data_file, string output_path) { delete cil; delete ccr; delete[] file_lines; printf("Done.\n"); printf("LFFT: Done.\n"); } Loading
src/include/tra_subs.h +3 −4 Original line number Diff line number Diff line Loading @@ -107,7 +107,6 @@ void ffrt( * * \param nkv: `int` QUESTION: definition? * \param vkm: `double` QUESTION: definition? * \param vkv: `double *` QUESTION: definition? * \param vknmx: `double` QUESTION: definition? * \param apfafa: `double` QUESTION: definition? * \param tra: `double` QUESTION: definition? Loading @@ -118,12 +117,12 @@ void ffrt( * \param lmode: `int` QUESTION: definition? * \param pmf: `double` QUESTION: definition? * \param tt1: `Swap1 *` Pointer to first swap object. * \param tt2: `fstream &` Handle to second temporary binary file. * \param tt2: `Swap2 *` Pointer to second swap object. */ void frfmer( int nkv, double vkm, double *vkv, double vknmx, double apfafa, double tra, int nkv, double vkm, double vknmx, double apfafa, double tra, double spd, double rir, double ftcn, int le, int lmode, double pmf, Swap1 *tt1, std::fstream &tt2 Swap1 *tt1, Swap2 *tt2 ); /*! C++ porting of PWMALP Loading
src/libnptm/tfrfme.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -263,10 +263,10 @@ Swap2* Swap2::from_legacy(string file_name) { input.read(reinterpret_cast<char *>(&value), sizeof(double)); instance->set_vector_element(vj, value); } for (int mi = 0; mi < _nkv; ,i++) { for (int mi = 0; mi < _nkv; mi++) { for (int mj = 0; mj < _nkv; mj++) { input.read(reinterpret_cast<char *>(&value), sizeof(double)); instance->set_matrix_element(vi, vj, value); instance->set_matrix_element(mi, mj, value); } } input.read(reinterpret_cast<char *>(&value), sizeof(double)); Loading Loading @@ -432,7 +432,7 @@ void Swap2::write_hdf5(string file_name) { void Swap2::write_legacy(string file_name) { fstream output; double value double value; output.open(file_name.c_str(), ios::out | ios::binary); if (output.is_open()) { output.write(reinterpret_cast<char *>(&nkv), sizeof(int)); Loading
src/libnptm/tra_subs.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -245,18 +245,18 @@ void ffrt( } void frfmer( int nkv, double vkm, double *vkv, double vknmx, double apfafa, double tra, int nkv, double vkm, double vknmx, double apfafa, double tra, double spd, double rir, double ftcn, int le, int lmode, double pmf, Swap1 *tt1, std::fstream &tt2 Swap1 *tt1, Swap2 *tt2 ) { const int nlemt = le * (le + 2) * 2; const complex<double> cc0(0.0, 0.0); double sq = vkm * vkm; for (int jy90 = 0; jy90 < nkv; jy90++) { double vky = vkv[jy90]; double vky = tt2->get_vector_element(jy90); double sqy = vky * vky; for (int jx80 = 0; jx80 < nkv; jx80++) { double vkx = vkv[jx80]; double vkx = tt2->get_vector_element(jx80); double sqx = vkx * vkx; double sqn = sqx + sqy; double vkn = sqrt(sqn); Loading @@ -269,7 +269,8 @@ void frfmer( tt1.write(reinterpret_cast<char *>(&vreal), sizeof(double)); tt1.write(reinterpret_cast<char *>(&vimag), sizeof(double)); }*/ tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); //tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); tt2->set_matrix_element(jx80, jy90, vkz); } else { // label 50 for (int j = 0; j < nlemt; j++) { //double vreal = 0.0; Loading @@ -278,8 +279,9 @@ void frfmer( //tt1.write(reinterpret_cast<char *>(&vimag), sizeof(double)); tt1->set_element(j, cc0); } double vkz = 0.0; tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); //double vkz = 0.0; //tt2.write(reinterpret_cast<char *>(&vkz), sizeof(double)); tt2->set_matrix_element(jx80, jy90, 0.0); } } // jx80 loop } // jy90 loop Loading
src/trapping/cfrfme.cpp +60 −64 Original line number Diff line number Diff line Loading @@ -44,9 +44,9 @@ void frfme(string data_file, string output_path) { string tfrfme_name = output_path + "/c_TFRFME.hd5"; TFRFME *tfrfme = NULL; Swap1 *tt1 = NULL; Swap2 *tt2 = NULL; char namef[7]; char more; double *vkv = NULL, **vkzm = NULL; complex<double> **w = NULL; const complex<double> cc0(0.0, 0.0); const complex<double> uim(0.0, 1.0); Loading Loading @@ -78,9 +78,9 @@ void frfme(string data_file, string output_path) { lmode = (int)tfrfme->get_param("lmode"); lm = (int)tfrfme->get_param("lm"); nkv = (int)tfrfme->get_param("nkv"); nxv = (int)tfrfme->get_param("nkv"); nyv = (int)tfrfme->get_param("nkv"); nzv = (int)tfrfme->get_param("nkv"); nxv = (int)tfrfme->get_param("nxv"); nyv = (int)tfrfme->get_param("nyv"); nzv = (int)tfrfme->get_param("nzv"); vk = tfrfme->get_param("vk"); exri = tfrfme->get_param("exri"); an = tfrfme->get_param("an"); Loading @@ -89,33 +89,32 @@ void frfme(string data_file, string output_path) { spd = tfrfme->get_param("spd"); frsh = tfrfme->get_param("frsh"); exril = tfrfme->get_param("exril"); vkv = new double[nkv](); fstream temptape2; string tempname2 = output_path + "/c_TEMPTAPE2"; temptape2.open(tempname2.c_str(), ios::in | ios::binary); if (temptape2.is_open()) { for (int jx = 0; jx < nkv; jx++) temptape2.read(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double)); //fstream temptape2; string tempname2 = output_path + "/c_TEMPTAPE2.hd5"; //temptape2.open(tempname2.c_str(), ios::in | ios::binary); if (tt2 == NULL) tt2 = Swap2::from_binary(tempname2, "HDF5"); if (tt2 != NULL) { /*for (int jx = 0; jx < nkv; jx++) temptape2.read(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double)); vkzm = new double*[nkv]; for (int vki = 0; vki < nkv; vki++) vkzm[vki] = new double[nkv](); for (int jy10 = 0; jy10 < nkv; jy10++) { for (int jx10 = 0; jx10 < nkv; jx10++) { temptape2.read(reinterpret_cast<char *>(&(vkzm[jx10][jy10])), sizeof(double)); } //jx10 loop } // jy10 loop temptape2.read(reinterpret_cast<char *>(&apfafa), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&pmf), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&spd), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&rir), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&ftcn), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&fshmx), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&vxyzmx), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&delxyz), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&vknmx), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&delk), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&delks), sizeof(double)); temptape2.read(reinterpret_cast<char *>(&nlmmt), sizeof(int)); temptape2.read(reinterpret_cast<char *>(&nrvc), sizeof(int)); temptape2.close(); } // jy10 loop*/ apfafa = tt2->get_param("apfafa"); pmf = tt2->get_param("pmf"); spd = tt2->get_param("spd"); rir = tt2->get_param("rir"); ftcn = tt2->get_param("ftcn"); fshmx = tt2->get_param("fshmx"); vxyzmx = tt2->get_param("vxyzmx"); delxyz = tt2->get_param("delxyz"); vknmx = tt2->get_param("vknmx"); delk = tt2->get_param("delk"); delks = tt2->get_param("delks"); nlmmt = (int)tt2->get_param("nlmmt"); nrvc = (int)tt2->get_param("nrvc"); } else { printf("ERROR: could not open TEMPTAPE2 file.\n"); } Loading Loading @@ -223,9 +222,10 @@ void frfme(string data_file, string output_path) { nks = nksh * 2; nkv = nks + 1; // Array initialization vkv = new double[nkv](); /*vkv = new double[nkv](); vkzm = new double*[nkv]; for (int vi = 0; vi < nkv; vi++) vkzm[vi] = new double[nkv]; for (int vi = 0; vi < nkv; vi++) vkzm[vi] = new double[nkv];*/ tt2 = new Swap2(nkv); // End of array initialization double vkm = vk * exri; vknmx = vk * an; Loading Loading @@ -259,8 +259,8 @@ void frfme(string data_file, string output_path) { int nrvc = nxv * nyv * nzv; int nkshpo = nksh + 1; for (int i28 = nkshpo; i28 <= nks; i28++) { vkv[i28] = vkv[i28 - 1] + delk; vkv[nkv - i28 - 1] = -vkv[i28]; tt2->set_vector_element(i28, tt2->get_vector_element(i28 - 1) + delk); tt2->set_vector_element(nkv - i28 - 1, -tt2->get_vector_element(i28)); } // i28 loop if (tfrfme != NULL) { tfrfme->set_param("vk", vk); Loading @@ -271,33 +271,33 @@ void frfme(string data_file, string output_path) { tfrfme->set_param("spd", spd); tfrfme->set_param("frsh", frsh); tfrfme->set_param("exril", exril); fstream temptape1, temptape2; //fstream temptape1, temptape2; string temp_name1 = output_path + "/c_TEMPTAPE1.hd5"; string temp_name2 = output_path + "/c_TEMPTAPE2"; string temp_name2 = output_path + "/c_TEMPTAPE2.hd5"; //temptape1.open(temp_name1.c_str(), ios::out | ios::binary); tt1 = new Swap1(lm); temptape2.open(temp_name2.c_str(), ios::out | ios::binary); /*temptape2.open(temp_name2.c_str(), ios::out | ios::binary); for (int jx = 0; jx < nkv; jx++) temptape2.write(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double)); frfmer(nkv, vkm, vkv, vknmx, apfafa, tra, spd, rir, ftcn, lm, lmode, pmf, tt1, temptape2); temptape2.write(reinterpret_cast<char *>(&(vkv[jx])), sizeof(double));*/ frfmer(nkv, vkm, vknmx, apfafa, tra, spd, rir, ftcn, lm, lmode, pmf, tt1, tt2); //temptape1.close(); tt1->write_binary(temp_name1, "HDF5"); temptape2.write(reinterpret_cast<char *>(&apfafa), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&pmf), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&spd), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&rir), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&ftcn), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&fshmx), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&vxyzmx), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&delxyz), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&vknmx), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&delk), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&delks), sizeof(double)); temptape2.write(reinterpret_cast<char *>(&nlmmt), sizeof(int)); temptape2.write(reinterpret_cast<char *>(&nrvc), sizeof(int)); temptape2.close(); temptape2.open("c_TEMPTAPE2", ios::in | ios::binary); for (int jx = 0; jx < nkv; jx++) { tt2->set_param("apfafa", apfafa); tt2->set_param("pmf", pmf); tt2->set_param("spd", spd); tt2->set_param("rir", rir); tt2->set_param("ftcn", ftcn); tt2->set_param("fshmx", fshmx); tt2->set_param("vxyzmx", vxyzmx); tt2->set_param("delxyz", delxyz); tt2->set_param("vknmx", vknmx); tt2->set_param("delk", delk); tt2->set_param("delks", delks); tt2->set_param("nlmmt", 1.0 * nlmmt); tt2->set_param("nrvc", 1.0 * nrvc); tt2->write_binary(temp_name2, "HDF5"); //temptape2.open("c_TEMPTAPE2", ios::in | ios::binary); /*for (int jx = 0; jx < nkv; jx++) { double value = 0.0; temptape2.read(reinterpret_cast<char *>(&value), sizeof(double)); vkv[jx] = value; Loading @@ -309,7 +309,7 @@ void frfme(string data_file, string output_path) { vkzm[jx40][jy40] = value; } } // jy40 loop temptape2.close(); temptape2.close();*/ for (int j80 = jlmf - 1; j80 < jlml; j80++) { // w matrix if (w != NULL) { Loading Loading @@ -344,16 +344,16 @@ void frfme(string data_file, string output_path) { ixyz++; complex<double> sumy = cc0; for (int jy60 = 0; jy60 < nkv; jy60++) { double vky = vkv[jy60]; double vkx = vkv[nkv - 1]; double vkzf = vkzm[0][jy60]; double vky = tt2->get_vector_element(jy60); double vkx = tt2->get_vector_element(nkv - 1); double vkzf = tt2->get_matrix_element(0, jy60); complex<double> phasf = exp(uim * (-vkx * x + vky * y + vkzf * z)); double vkzl = vkzm[nkv - 1][jy60]; double vkzl = tt2->get_matrix_element(nkv - 1, jy60); complex<double> phasl = exp(uim * (vkx * x + vky * y + vkzl * z)); complex<double> sumx = 0.5 * (w[0][jy60] * phasf + w[nkv - 1][jy60] * phasl); for (int jx55 = 2; jx55 <= nks; jx55++) { vkx = vkv[jx55 - 1]; double vkz = vkzm[jx55 - 1][jy60]; vkx = tt2->get_vector_element(jx55 - 1); double vkz = tt2->get_matrix_element(jx55 - 1, jy60); complex<double> phas = exp(uim * (vkx * x + vky * y + vkz * z)); sumx += (w[jx55 - 1][jy60] * phas); } // jx55 loop Loading Loading @@ -406,16 +406,12 @@ void frfme(string data_file, string output_path) { // label 45 if (tfrfme != NULL) delete tfrfme; delete[] file_lines; if (vkv != NULL) delete[] vkv; if (vkzm != NULL) { for (int vki = nkv - 1; vki > -1; vki--) delete[] vkzm[vki]; delete[] vkzm; } if (tt2 != NULL) delete tt2; if (w != NULL) { for (int wi = nkv - 1; wi > -1; wi--) delete[] w[wi]; delete[] w; } //if (wk != NULL) delete[] wk; if (tt1 != NULL) delete tt1; printf("Done.\n"); printf("FRFME: Done.\n"); }
src/trapping/clffft.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -442,5 +442,5 @@ void lffft(string data_file, string output_path) { delete cil; delete ccr; delete[] file_lines; printf("Done.\n"); printf("LFFT: Done.\n"); }