From 97f9b42560cde0093145bebd9340880e1ccbeba6 Mon Sep 17 00:00:00 2001
From: "Mulas, Giacomo" <gmulas@oa-cagliari.inaf.it>
Date: Mon, 18 Mar 2024 20:26:28 +0100
Subject: [PATCH] finish replacing fresh local variables instead of global ones
 in scales loop

---
 src/cluster/cluster.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp
index cc3cd05d..c7a43b35 100644
--- a/src/cluster/cluster.cpp
+++ b/src/cluster/cluster.cpp
@@ -500,8 +500,15 @@ void cluster(string config_file, string data_file, string output_path) {
 	double wn_2 = wn;
 	double vk_2 = vk;
 	np_int ndit_2 = ndit;
-    
-	jer = cluster_jxi488_cycle(jxi488, sconf_2, gconf_2, c1_2, c1ao_2, c2_2, c3_2, c4_2, c6_2, c9_2, output, output_path, gaps_2, tqse_2, tqspe_2, tqss_2, tqsps_2, zpv_2, gapm_2, gappm_2, nth, nths, nph, nphs, nk, nks, nkks, argi_2, args_2, gap_2, gapp_2, tqce_2, tqcpe_2, tqcs_2, tqcps_2, duk_2, tppoan, cextlr_2, cext_2, cmullr_2, cmul_2, gapv_2, tqev_2, tqsv_2, nxi_2, nsph_2, mxndm_2, inpol_2, iavm_2, npnt_2, npntts_2, isam_2, lm_2, th_2, thstp_2, thlst_2, ths_2, thsstp_2, thslst_2, ph_2, phstp_2, phlst_2, phs_2, phsstp_2, phslst_2, th1_2, ph1_2, ths1_2, phs1_2, thsca_2, u_2, us_2, un_2, uns_2, up_2, ups_2, unmp_2, unsmp_2, upmp_2, upsmp_2, scan_2, cfmp_2, sfmp_2, cfsp_2, sfsp_2, sqsfi_2, exri_2, lcalc_2, arg_2, wn_2, vk_2, ndit_2, am, isq, ibf);
+	dcomplex **am_2 = new dcomplex*[ndit];
+	dcomplex am_2[0] = new dcomplex[ndit * ndit]();
+	for (int ai = 1; ai < ndit; ai++) {
+	  am_2[ai] = (am_2[0] + ai * ndit);
+	}
+	int isq_2 = isq;
+	int ibf_2 = ibf;
+	
+	jer = cluster_jxi488_cycle(jxi488, sconf_2, gconf_2, c1_2, c1ao_2, c2_2, c3_2, c4_2, c6_2, c9_2, output, output_path, gaps_2, tqse_2, tqspe_2, tqss_2, tqsps_2, zpv_2, gapm_2, gappm_2, nth, nths, nph, nphs, nk, nks, nkks, argi_2, args_2, gap_2, gapp_2, tqce_2, tqcpe_2, tqcs_2, tqcps_2, duk_2, tppoan, cextlr_2, cext_2, cmullr_2, cmul_2, gapv_2, tqev_2, tqsv_2, nxi_2, nsph_2, mxndm_2, inpol_2, iavm_2, npnt_2, npntts_2, isam_2, lm_2, th_2, thstp_2, thlst_2, ths_2, thsstp_2, thslst_2, ph_2, phstp_2, phlst_2, phs_2, phsstp_2, phslst_2, th1_2, ph1_2, ths1_2, phs1_2, thsca_2, u_2, us_2, un_2, uns_2, up_2, ups_2, unmp_2, unsmp_2, upmp_2, upsmp_2, scan_2, cfmp_2, sfmp_2, cfsp_2, sfsp_2, sqsfi_2, exri_2, lcalc_2, arg_2, wn_2, vk_2, ndit_2, am_2, isq_2, ibf_2);
 
 	delete sconf_2;
 	delete gconf_2;
@@ -579,6 +586,8 @@ void cluster(string config_file, string data_file, string output_path) {
 	delete[] unsmp_2;
 	delete[] upmp_2;
 	delete[] upsmp_2;
+	delete[] am_2[0];
+	delete[] am_2;
 	
       } // jxi488 loop
       tppoan.close();
-- 
GitLab