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

Map C1 matrices into contiguous stacks

parent f47b2156
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,15 @@ protected:
int lm;
//! \brief NLMMT. QUESTION: definition?
int nlmmt;
//! \brief Contiguous RMI vector.
dcomplex *vec_rmi;
//! \brief Contiguous REI vector.
dcomplex *vec_rei;
//! \brief Contiguous W vector.
dcomplex *vec_w;
//! \brief Contiguous VINTS vector
dcomplex *vec_vints;
public:
//! \brief QUESTION: definition?
dcomplex **rmi;
......
......@@ -25,25 +25,29 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) {
nsph = ns;
lm = l_max;
vec_rmi = new dcomplex[nsph * lm]();
vec_rei = new dcomplex[nsph * lm]();
rmi = new dcomplex*[lm];
rei = new dcomplex*[lm];
for (int ri = 0; ri < lm; ri++) {
rmi[ri] = new dcomplex[nsph]();
rei[ri] = new dcomplex[nsph]();
rmi[ri] = &(vec_rmi[nsph * ri]);
rei[ri] = &(vec_rei[nsph * ri]);
}
vec_w = new dcomplex[4 * nlmmt]();
w = new dcomplex*[nlmmt];
for (int wi = 0; wi < nlmmt; wi++) w[wi] = new dcomplex[4]();
for (int wi = 0; wi < nlmmt; wi++) w[wi] = &(vec_w[4 * wi]);
int configurations = 0;
for (int ci = 1; ci <= nsph; ci++) {
if (_iog[ci - 1] >= ci) configurations++;
}
vec_vints = new dcomplex[nsph * 16]();
vints = new dcomplex*[nsph];
rc = new double*[configurations];
nshl = new int[configurations]();
iog = new int[nsph]();
int conf_index = 0;
for (int vi = 0; vi < nsph; vi++) {
vints[vi] = new dcomplex[16]();
vints[vi] = &(vec_vints[vi * 16]);
iog[vi] = _iog[vi];
if (iog[vi] >= vi + 1) {
nshl[conf_index] = _nshl[conf_index];
......@@ -73,9 +77,12 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) {
}
C1::~C1() {
delete[] vec_rmi;
delete[] vec_rei;
delete[] rmi;
delete[] rei;
for (int wi = nlmmt - 1; wi > -1; wi--) delete[] w[wi];
delete[] vec_w;
delete[] w;
int conf_index = 0;
for (int ci = 1; ci <= nsph; ci++) {
if (iog[ci] >= ci) {
......@@ -84,9 +91,7 @@ C1::~C1() {
}
}
delete[] rc;
for (int vi = nsph - 1; vi > - 1; vi--) {
delete[] vints[vi];
}
delete[] vec_vints;
delete[] vints;
for (int si = nsph - 1; si > -1; si--) {
delete[] sas[si][1];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment