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

Use configuration count in comparison operator

parent b4659d20
No related branches found
No related tags found
No related merge requests found
...@@ -1113,36 +1113,34 @@ bool ScattererConfiguration::operator ==(ScattererConfiguration &other) { ...@@ -1113,36 +1113,34 @@ bool ScattererConfiguration::operator ==(ScattererConfiguration &other) {
if (scale_vec[svi] != other.scale_vec[svi]) { if (scale_vec[svi] != other.scale_vec[svi]) {
return false; return false;
} }
int dj_index = 0; int configurations = 0;
int dim3 = (idfc == 0) ? number_of_scales : 1; int dim3 = (idfc == 0) ? number_of_scales : 1;
for (int dj = 0; dj < number_of_spheres; dj++) { for (int ci = 1; ci <= number_of_spheres; ci++) {
bool check_matrixes = false; if (iog_vec[ci - 1] != other.iog_vec[ci - 1]) {
if (iog_vec[dj] >= dj + 1) {
dj_index = iog_vec[dj] - 1;
check_matrixes = true;
}
if (iog_vec[dj] != other.iog_vec[dj]) {
return false; return false;
} }
if (radii_of_spheres[dj_index] != other.radii_of_spheres[dj_index]) { if (iog_vec[ci - 1] < ci) continue;
configurations++;
}
for (int ri = 0; ri < configurations; ri++) {
if (radii_of_spheres[ri] != other.radii_of_spheres[ri]) {
return false; return false;
} }
int layers = nshl_vec[dj_index]; if (nshl_vec[ri] != other.nshl_vec[ri]) {
if (layers != other.nshl_vec[dj_index]) {
return false; return false;
} }
if (check_matrixes) { for (int rj = 0; rj < nshl_vec[ri]; rj++) {
for (int di = 0; di < layers; di++) { if (rcf[ri][rj] != other.rcf[ri][rj]) {
if (rcf[dj_index][di] != other.rcf[dj_index][di]) { return false;
}
} // rj loop
for (int dj = 0; dj < number_of_spheres; dj++) {
for (int dk = 0; dk < dim3; dk++) {
if (dc0_matrix[ri][dj][dk] != other.dc0_matrix[ri][dj][dk]) {
return false; return false;
} }
for (int dk = 0; dk < dim3; dk++) { } // dk loop
if (dc0_matrix[di][dj_index][dk] != other.dc0_matrix[di][dj_index][dk]) { } // dj loop
return false; } // ri loop
}
} // dk loop
} // di loop
}
} // dj loop
return true; return true;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment