From 5227de529560fb3621558755adf2c9e510076b86 Mon Sep 17 00:00:00 2001 From: Giovanni La Mura <giovanni.lamura@inaf.it> Date: Mon, 5 Feb 2024 15:12:54 +0100 Subject: [PATCH] Implement the ScattererConfiguration comparison operator --- src/libnptm/Configuration.cpp | 51 +++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/src/libnptm/Configuration.cpp b/src/libnptm/Configuration.cpp index 765db12b..63faf394 100644 --- a/src/libnptm/Configuration.cpp +++ b/src/libnptm/Configuration.cpp @@ -1111,16 +1111,29 @@ void ScattererConfiguration::write_formatted(string file_name) { } bool ScattererConfiguration::operator ==(ScattererConfiguration &other) { - if (reference_variable_name.compare(other.reference_variable_name) != 0) return false; - if (number_of_spheres != other.number_of_spheres) return false; - if (number_of_scales != other.number_of_scales) return false; - if (idfc != other.idfc) return false; - if (exdc != other.exdc) return false; - if (wp != other.wp) return false; - if (xip != other.xip) return false; - if (use_external_sphere != other.use_external_sphere) return false; + if (number_of_spheres != other.number_of_spheres) { + return false; + } + if (number_of_scales != other.number_of_scales) { + return false; + } + if (idfc != other.idfc) { + return false; + } + if (exdc != other.exdc) { + return false; + } + if (wp != other.wp) { + return false; + } + if (xip != other.xip) { + return false; + } + //if (use_external_sphere != other.use_external_sphere) return false; for (int svi = 0; svi < number_of_scales; svi++) - if (scale_vec[svi] != other.scale_vec[svi]) return false; + if (scale_vec[svi] != other.scale_vec[svi]) { + return false; + } int dj_index = 0; for (int dj = 0; dj < number_of_spheres; dj++) { bool check_matrixes = false; @@ -1128,15 +1141,25 @@ bool ScattererConfiguration::operator ==(ScattererConfiguration &other) { dj_index = iog_vec[dj] - 1; check_matrixes = true; } - if (iog_vec[dj] != other.iog_vec[dj]) return false; - if (radii_of_spheres[dj_index] != other.radii_of_spheres[dj_index]) return false; + if (iog_vec[dj] != other.iog_vec[dj]) { + return false; + } + if (radii_of_spheres[dj_index] != other.radii_of_spheres[dj_index]) { + return false; + } int layers = nshl_vec[dj_index]; - if (layers != other.nshl_vec[dj_index]) return false; + if (layers != other.nshl_vec[dj_index]) { + return false; + } if (check_matrixes) { for (int di = 0; di < layers; di++) { - if (rcf[dj_index][di] != other.rcf[dj_index][di]) return false; + if (rcf[dj_index][di] != other.rcf[dj_index][di]) { + return false; + } for (int dk = 0; dk < number_of_scales; dk++) { - if (dc0_matrix[di][dj_index][dk] != other.dc0_matrix[di][dj_index][dk]) return false; + if (dc0_matrix[di][dj_index][dk] != other.dc0_matrix[di][dj_index][dk]) { + return false; + } } // dk loop } // di loop } -- GitLab