diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp index 0f6737ac7e7d90d9ae5897ef16d9c257536800a5..c8aec3d43aa0cf3d68fb9fec54ef5b49430f3341 100644 --- a/src/cluster/cluster.cpp +++ b/src/cluster/cluster.cpp @@ -638,9 +638,9 @@ void cluster(string config_file, string data_file, string output_path) { real(c1->sas[i226 - 1][1][1]), imag(c1->sas[i226 - 1][1][1]) ); for (int j225 = 0; j225 < 16; j225++) { // QUESTION: check that 16 is a fixed dimension - c1ao->vint[j225] = c1->vints[i226 - 1][j225]; + c1->vint[j225] = c1->vints[i226 - 1][j225]; } // j225 loop - mmulc(c1ao->vint, cmullr, cmul); + mmulc(c1->vint, cmullr, cmul); fprintf(output, " MULS\n"); for (int i1 = 0; i1 < 4; i1++) { fprintf( @@ -670,7 +670,7 @@ void cluster(string config_file, string data_file, string output_path) { fprintf(output, " CLUSTER\n"); pcros(vk, exri, c1, c1ao, c4); mextc(vk, exri, c1ao->fsac, cextlr, cext); - mmulc(c1ao->vint, cmullr, cmul); + mmulc(c1->vint, cmullr, cmul); if (jw != 0) { jw = 0; // Some implicit loops writing to binary. @@ -735,9 +735,9 @@ void cluster(string config_file, string data_file, string output_path) { } // label 254 for (int i = 0; i < 16; i++) { - double value = real(c1ao->vint[i]); + double value = real(c1->vint[i]); tppoan.write(reinterpret_cast<char *>(&value), sizeof(double)); - value = imag(c1ao->vint[i]); + value = imag(c1->vint[i]); tppoan.write(reinterpret_cast<char *>(&value), sizeof(double)); } for (int i = 0; i < 4; i++) { diff --git a/src/include/Commons.h b/src/include/Commons.h index bd80be4c1fe53511630754a916fe618dbc95fd21..b522ecde9fe1d966cfd96bf0c3fe6df4395be6f1 100644 --- a/src/include/Commons.h +++ b/src/include/Commons.h @@ -40,7 +40,7 @@ protected: int nsph; //! \brief Maximum order of field expansion. int lm; - //! \brief NLMMT. QUESTION: definition? + //! \brief NLMMT = 2 * LM * (LM + 2) int nlmmt; //! \brief Contiguous RMI vector. dcomplex *vec_rmi; @@ -63,6 +63,8 @@ public: //! \brief QUESTION: definition? dcomplex **vints; //! \brief QUESTION: definition? + dcomplex *vint; + //! \brief QUESTION: definition? double *sscs; //! \brief QUESTION: definition? double *sexs; @@ -233,8 +235,6 @@ public: //! \brief QUESTION: definition? dcomplex **am0m; //! \brief QUESTION: definition? - dcomplex *vint; - //! \brief QUESTION: definition? dcomplex *vintm; //! \brief QUESTION: definition? dcomplex *vintt; diff --git a/src/libnptm/Commons.cpp b/src/libnptm/Commons.cpp index 1041b0a7a7177e4ca3b654806be9cf2933abc6c0..c9d5aeb288fda94eab24cea75d5ff71096a3b001 100644 --- a/src/libnptm/Commons.cpp +++ b/src/libnptm/Commons.cpp @@ -40,6 +40,7 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) { for (int ci = 1; ci <= nsph; ci++) { if (_iog[ci - 1] >= ci) configurations++; } + vint = new dcomplex[16](); vec_vints = new dcomplex[nsph * 16](); vints = new dcomplex*[nsph]; rc = new double*[configurations]; @@ -91,6 +92,7 @@ C1::~C1() { } } delete[] rc; + delete[] vint; delete[] vec_vints; delete[] vints; for (int si = nsph - 1; si > -1; si--) { @@ -128,7 +130,6 @@ C1_AddOns::C1_AddOns(C4 *c4) { for (int ai = 0; ai < nlemt; ai++) { am0m[ai] = new dcomplex[nlemt](); } - vint = new dcomplex[16](); // QUESTION: is dimension 16 generally fixed? vintm = new dcomplex[16](); vintt = new dcomplex[16](); fsac = new dcomplex*[2]; @@ -164,7 +165,6 @@ C1_AddOns::~C1_AddOns() { delete[] am0m[ai]; } delete am0m; - delete[] vint; delete[] vintm; delete[] vintt; for (int fi = 1; fi > -1; fi--) { diff --git a/src/libnptm/clu_subs.cpp b/src/libnptm/clu_subs.cpp index b004cc11e7a65c7e6800beb863bfa856b003bcf9..ea5bd6fa53b80720b1531c04fff4c9a1f7f85100 100644 --- a/src/libnptm/clu_subs.cpp +++ b/src/libnptm/clu_subs.cpp @@ -1100,7 +1100,7 @@ void pcros(double vk, double exri, C1 *c1, C1_AddOns *c1ao, C4 *c4) { cc = dconjg(c1ao->sac[jpo1 - 1][ipo1 - 1]); for (int ipo2 = 1; ipo2 <= 2; ipo2 ++) { for (int jpo2 = 1; jpo2 <= 2; jpo2++) { - c1ao->vint[i++] = c1ao->sac[jpo2 - 1][ipo2 - 1] * cc * cfsq; + c1->vint[i++] = c1ao->sac[jpo2 - 1][ipo2 - 1] * cc * cfsq; } // jpo2 loop } // ipo2 loop } // jpo1 loop diff --git a/src/sphere/sphere.cpp b/src/sphere/sphere.cpp index b4bf9652d3e0a9401e076f750b92615073750b97..94860567344395db2182f27b1019874f1460dc23 100644 --- a/src/sphere/sphere.cpp +++ b/src/sphere/sphere.cpp @@ -102,7 +102,6 @@ void sphere(string config_file, string data_file, string output_path) { } double frx = 0.0, fry = 0.0, frz = 0.0; double cfmp, cfsp, sfmp, sfsp; - dcomplex *vint = new dcomplex[16]; int jw; int nsph = gconf->number_of_spheres; C1 *c1 = new C1(nsph, gconf->l_max, sconf->nshl_vec, sconf->iog_vec); @@ -509,8 +508,8 @@ void sphere(string config_file, string data_file, string output_path) { output, " Fx=%15.7lE, Fy=%15.7lE, Fz=%15.7lE\n", frx, fry, frz ); - for (int i225 = 0; i225 < 16; i225++) vint[i225] = c1->vints[ns226][i225]; - mmulc(vint, cmullr, cmul); + for (int i225 = 0; i225 < 16; i225++) c1->vint[i225] = c1->vints[ns226][i225]; + mmulc(c1->vint, cmullr, cmul); fprintf(output, " MULS\n "); for (int imul = 0; imul < 4; imul++) { for (int jmul = 0; jmul < 4; jmul++) { @@ -528,9 +527,9 @@ void sphere(string config_file, string data_file, string output_path) { else fprintf(output, "\n"); } for (int vi = 0; vi < 16; vi++) { - double value = real(vint[vi]); + double value = real(c1->vint[vi]); tppoan.write(reinterpret_cast<char *>(&value), sizeof(double)); - value = imag(vint[vi]); + value = imag(c1->vint[vi]); tppoan.write(reinterpret_cast<char *>(&value), sizeof(double)); } for (int imul = 0; imul < 4; imul++) { @@ -577,7 +576,6 @@ void sphere(string config_file, string data_file, string output_path) { delete[] upsmp; delete[] unmp; delete[] unsmp; - delete[] vint; delete[] argi; delete[] args; delete[] gaps;