Commit 52f3a3d0 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Use configuration counter instead of max_ici

parent dccab326
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -114,13 +114,11 @@ void cluster(string config_file, string data_file, string output_path) {
    FILE *output = fopen((output_path + "/c_OCLU").c_str(), "w");
    int jer = 0, lcalc = 0;
    complex<double> arg(0.0, 0.0), ccsam(0.0, 0.0);
    int max_ici = 0;
    for (int insh = 0; insh < nsph; insh++) {
      int nsh = sconf->nshl_vec[insh];
      int ici = (nsh + 1) / 2;
      if (ici > max_ici) max_ici = ici;
    int configurations = 0;
    for (int ci = 1; ci <= nsph; ci++) {
      if (sconf->iog_vec[ci -1] >= ci) configurations++;
    }
    C2 *c2 = new C2(nsph, max_ici, npnt, npntts);
    C2 *c2 = new C2(nsph, configurations, npnt, npntts);
    complex<double> **am = new complex<double>*[mxndm];
    for (int ai = 0; ai < mxndm; ai++) am[ai] = new complex<double>[mxndm]();
    const int ndi = c4->nsph * c4->nlim;
@@ -278,7 +276,7 @@ void cluster(string config_file, string data_file, string output_path) {
	fprintf(output, " \n");
      }
      for (int jxi488 = 1; jxi488 <= nxi; jxi488++) {
	printf("INFO: running scale iteration %d...", jxi488);
	printf("INFO: running scale iteration %d of %d...", jxi488, nxi);
	int jaw = 1;
	fprintf(output, "========== JXI =%3d ====================\n", jxi488);
	double xi = sconf->scale_vec[jxi488 - 1];
+13 −12
Original line number Diff line number Diff line
@@ -281,7 +281,6 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
    throw ex;
  }
  int nsph, ies;
  int max_ici = 0;
  re = regex("[0-9]+");
  string str_target = file_lines[last_read_line];
  for (int ri = 0; ri < 2; ri++) {
@@ -708,23 +707,25 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(string file_name) {

void ScattererConfiguration::print() {
  int ies = (use_external_sphere)? 1 : 0;
  int max_ici = 0;
  int configurations = 0;
  for (int ci = 1; ci <= number_of_spheres; ci++) {
    if (iog_vec[ci - 1] >= ci) configurations++;
  }
  printf("### CONFIGURATION DATA ###\n");
  printf("NSPH  = %d\n", number_of_spheres);
  printf("ROS   = [");
  for (int i = 0; i < number_of_spheres; i++) printf("\t%lg", radii_of_spheres[i]);
  for (int i = 0; i < configurations; i++) printf("\t%lg", radii_of_spheres[i]);
  printf("\t]\n");
  printf("IOG   = [");
  for (int i = 0; i < number_of_spheres; i++) printf("\t%d", iog_vec[i]);
  printf("\t]\n");
  printf("NSHL  = [");
  for (int i = 0; i < number_of_spheres; i++) printf("\t%d", nshl_vec[i]);
  for (int i = 0; i < configurations; i++) printf("\t%d", nshl_vec[i]);
  printf("\t]\n");
  printf("RCF   = [\n");
  for (int i = 1; i <= number_of_spheres; i++) {
  for (int i = 1; i <= configurations; i++) {
    int nsh = nshl_vec[i - 1];
    if (i == 1) nsh += ies;
    if (max_ici < (nsh + 1) / 2) max_ici = (nsh + 1) / 2;
    printf("         [");
    for (int ns = 0; ns < nsh; ns++) {
      printf("\t%lg", rcf[i - 1][ns]);
@@ -738,7 +739,7 @@ void ScattererConfiguration::print() {
  for (int i = 0; i < number_of_scales; i++) printf("\t%lg", scale_vec[i]);
  printf("\t]\n");
  printf("DC0M  = [\n");
  for (int i = 0; i < max_ici; i++) {
  for (int i = 0; i < configurations; i++) {
    printf("         [\n");
    for (int j = 0; j < number_of_spheres; j++) {
      printf("          [");
@@ -765,14 +766,15 @@ void ScattererConfiguration::write_binary(string file_name, string mode) {
}

void ScattererConfiguration::write_hdf5(string file_name) {
  const double two_pi = acos(0.0) * 4.0;
  const double evc = 6.5821188e-16;
  int ies = (use_external_sphere)? 1 : 0;
  int max_ici = 0;
  List<string> rec_name_list(1);
  List<string> rec_type_list(1);
  List<void *> rec_ptr_list(1);
  string str_type, str_name;
  int configurations = 0;
  for (int ci = 1; ci <= number_of_spheres; ci++) {
    if(iog_vec[ci - 1] >= ci) configurations++;
  }
  rec_name_list.set(0, "NSPH");
  rec_type_list.set(0, "INT32_(1)");
  rec_ptr_list.set(0, &number_of_spheres);
@@ -811,7 +813,6 @@ void ScattererConfiguration::write_hdf5(string file_name) {
    rec_ptr_list.append(&(radii_of_spheres[i115 - 1])); // was not from IOG
    int nsh = nshl_vec[i115 - 1]; // was not from IOG
    if (i115 == 1) nsh += ies;
    if (max_ici < (nsh + 1) / 2) max_ici = nsh + 1 / 2;
    str_name = "RCF_" + to_string(i115); // was not from IOG
    str_type = "FLOAT64_(" + to_string(nsh) + ")";
    rec_name_list.append(str_name);
@@ -820,7 +821,7 @@ void ScattererConfiguration::write_hdf5(string file_name) {
  }

  int dim3 = (idfc == 0) ? number_of_scales : 1;
  int dc0m_size = 2 * dim3 * number_of_spheres * max_ici;
  int dc0m_size = 2 * dim3 * number_of_spheres * configurations;
  double *dc0m = new double[dc0m_size];
  int dc0_index = 0;
  for (int jxi468 = 1; jxi468 <= number_of_scales; jxi468++) {