Skip to content
Snippets Groups Projects
Commit 1aaea3d6 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Merge branch 'link_with_lapacke' into 'master'

BUG FIX: reshape C1 common rc field to configuration number

See merge request giacomo.mulas/np_tmcode!23
parents 4d4a311d a5ff64a7
No related branches found
No related tags found
No related merge requests found
......@@ -31,15 +31,23 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) {
}
w = new complex<double>*[nlmmt];
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];
rc = new double*[nsph];
nshl = new int[nsph]();
rc = new double*[configurations];
nshl = new int[configurations]();
iog = new int[nsph]();
int conf_index = 0;
for (int vi = 0; vi < nsph; vi++) {
rc[vi] = new double[_nshl[vi]]();
vints[vi] = new complex<double>[16]();
nshl[vi] = _nshl[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]();
sscs = new double[nsph]();
......@@ -66,11 +74,17 @@ C1::~C1() {
delete[] rmi;
delete[] rei;
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--) {
delete[] rc[vi];
delete[] vints[vi];
}
delete[] rc;
delete[] vints;
for (int si = nsph - 1; si > -1; si--) {
delete[] sas[si][1];
......
......@@ -1067,6 +1067,12 @@ void ScattererConfiguration::write_formatted(string file_name) {
);
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
double pu, wn;
xi_vec = scale_vec;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment