Loading src/libnptm/Commons.cpp +208 −194 Original line number Original line Diff line number Diff line Loading @@ -31,15 +31,23 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) { } } w = new complex<double>*[nlmmt]; w = new complex<double>*[nlmmt]; for (int wi = 0; wi < nlmmt; wi++) w[wi] = new complex<double>[4](); for (int wi = 0; wi < nlmmt; wi++) w[wi] = new complex<double>[4](); int configurations = 0; for (int ci = 1; ci <= nsph; ci++) { if (_iog[ci - 1] >= ci) configurations++; } vints = new complex<double>*[nsph]; vints = new complex<double>*[nsph]; rc = new double*[nsph]; rc = new double*[configurations]; nshl = new int[nsph](); nshl = new int[configurations](); iog = new int[nsph](); iog = new int[nsph](); int conf_index = 0; for (int vi = 0; vi < nsph; vi++) { for (int vi = 0; vi < nsph; vi++) { rc[vi] = new double[_nshl[vi]](); vints[vi] = new complex<double>[16](); vints[vi] = new complex<double>[16](); nshl[vi] = _nshl[vi]; iog[vi] = _iog[vi]; iog[vi] = _iog[vi]; if (iog[vi] >= vi + 1) { nshl[conf_index] = _nshl[conf_index]; rc[conf_index] = new double[_nshl[conf_index]](); conf_index++; } } } fsas = new complex<double>[nsph](); fsas = new complex<double>[nsph](); sscs = new double[nsph](); sscs = new double[nsph](); Loading @@ -66,11 +74,17 @@ C1::~C1() { delete[] rmi; delete[] rmi; delete[] rei; delete[] rei; for (int wi = nlmmt - 1; wi > -1; wi--) delete[] w[wi]; for (int wi = nlmmt - 1; wi > -1; wi--) delete[] w[wi]; int conf_index = 0; for (int ci = 1; ci <= nsph; ci++) { if (iog[ci] >= ci) { delete[] rc[conf_index]; conf_index++; } } delete[] rc; for (int vi = nsph - 1; vi > - 1; vi--) { for (int vi = nsph - 1; vi > - 1; vi--) { delete[] rc[vi]; delete[] vints[vi]; delete[] vints[vi]; } } delete[] rc; delete[] vints; delete[] vints; for (int si = nsph - 1; si > -1; si--) { for (int si = nsph - 1; si > -1; si--) { delete[] sas[si][1]; delete[] sas[si][1]; Loading src/libnptm/Configuration.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1067,6 +1067,12 @@ void ScattererConfiguration::write_formatted(string file_name) { ); ); break; break; } } // Clean memory delete[] xi_vec; delete[] pu_vec; delete[] ev_vec; delete[] wn_vec; delete[] wl_vec; } else { // idfc < 0, Dielectric functions are at XIP and XI is scale for dimensions } else { // idfc < 0, Dielectric functions are at XIP and XI is scale for dimensions double pu, wn; double pu, wn; xi_vec = scale_vec; xi_vec = scale_vec; Loading Loading
src/libnptm/Commons.cpp +208 −194 Original line number Original line Diff line number Diff line Loading @@ -31,15 +31,23 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) { } } w = new complex<double>*[nlmmt]; w = new complex<double>*[nlmmt]; for (int wi = 0; wi < nlmmt; wi++) w[wi] = new complex<double>[4](); for (int wi = 0; wi < nlmmt; wi++) w[wi] = new complex<double>[4](); int configurations = 0; for (int ci = 1; ci <= nsph; ci++) { if (_iog[ci - 1] >= ci) configurations++; } vints = new complex<double>*[nsph]; vints = new complex<double>*[nsph]; rc = new double*[nsph]; rc = new double*[configurations]; nshl = new int[nsph](); nshl = new int[configurations](); iog = new int[nsph](); iog = new int[nsph](); int conf_index = 0; for (int vi = 0; vi < nsph; vi++) { for (int vi = 0; vi < nsph; vi++) { rc[vi] = new double[_nshl[vi]](); vints[vi] = new complex<double>[16](); vints[vi] = new complex<double>[16](); nshl[vi] = _nshl[vi]; iog[vi] = _iog[vi]; iog[vi] = _iog[vi]; if (iog[vi] >= vi + 1) { nshl[conf_index] = _nshl[conf_index]; rc[conf_index] = new double[_nshl[conf_index]](); conf_index++; } } } fsas = new complex<double>[nsph](); fsas = new complex<double>[nsph](); sscs = new double[nsph](); sscs = new double[nsph](); Loading @@ -66,11 +74,17 @@ C1::~C1() { delete[] rmi; delete[] rmi; delete[] rei; delete[] rei; for (int wi = nlmmt - 1; wi > -1; wi--) delete[] w[wi]; for (int wi = nlmmt - 1; wi > -1; wi--) delete[] w[wi]; int conf_index = 0; for (int ci = 1; ci <= nsph; ci++) { if (iog[ci] >= ci) { delete[] rc[conf_index]; conf_index++; } } delete[] rc; for (int vi = nsph - 1; vi > - 1; vi--) { for (int vi = nsph - 1; vi > - 1; vi--) { delete[] rc[vi]; delete[] vints[vi]; delete[] vints[vi]; } } delete[] rc; delete[] vints; delete[] vints; for (int si = nsph - 1; si > -1; si--) { for (int si = nsph - 1; si > -1; si--) { delete[] sas[si][1]; delete[] sas[si][1]; Loading
src/libnptm/Configuration.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1067,6 +1067,12 @@ void ScattererConfiguration::write_formatted(string file_name) { ); ); break; break; } } // Clean memory delete[] xi_vec; delete[] pu_vec; delete[] ev_vec; delete[] wn_vec; delete[] wl_vec; } else { // idfc < 0, Dielectric functions are at XIP and XI is scale for dimensions } else { // idfc < 0, Dielectric functions are at XIP and XI is scale for dimensions double pu, wn; double pu, wn; xi_vec = scale_vec; xi_vec = scale_vec; Loading