Commit 49c8415c authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Make use of run-time options to handle refinement and dynamic orders

parent 47bc1c8c
Loading
Loading
Loading
Loading
+36 −20
Original line number Diff line number Diff line
@@ -757,9 +757,15 @@ int cluster_jxi488_cycle(
	+ ").\n";
      logger->log(message, LOG_WARN);
    } else if (recommended_li < cid->c1->li) {
      if (gconf->dyn_order_flag > 0) {
	message = "INFO: lowering internal order from " + to_string(cid->c1->li) + " to "
	  + to_string(recommended_li) + " for scale iteration " + to_string(jxi488) + ".\n";
	logger->log(message, LOG_INFO);
      } else {
	message = "WARNING: internal order " + to_string(cid->c1->li) + " too high for scale iteration "
	  + to_string(jxi488) + ".\n";
	logger->log(message, LOG_WARN);
      }
    }
    if (recommended_le > cid->c1->le) {
      message = "WARNING: external order " + to_string(cid->c1->le) + " for scale iteration "
@@ -767,11 +773,18 @@ int cluster_jxi488_cycle(
	+ ").\n";
      logger->log(message, LOG_WARN);
    } else if (recommended_le < cid->c1->le) {
      if (gconf->dyn_order_flag > 0) {
	message = "INFO: lowering external order from " + to_string(cid->c1->le) + " to "
	  + to_string(recommended_le) + " for scale iteration " + to_string(jxi488) + ".\n";
	logger->log(message, LOG_INFO);
      } else {
	message = "INFO: external order " + to_string(cid->c1->le) + " too high for scale iteration "
	  + to_string(jxi488) + ".\n";
	logger->log(message, LOG_WARN);
      }
    }
    if (recommended_li < max_li || recommended_le < max_le) {
      if (gconf->dyn_order_flag > 0) {
	int new_li = (recommended_li < max_li) ? recommended_li : max_li;
	int new_le = (recommended_le < max_le) ? recommended_le : max_le;
	cid->update_orders(sconf->_rcf, new_li, new_le);
@@ -780,6 +793,7 @@ int cluster_jxi488_cycle(
	cid->refinemode = 2;
      }
    }
  }
  int li = cid->c1->li;
  int le = cid->c1->le;
  int lm = cid->c1->lm;
@@ -883,8 +897,10 @@ int cluster_jxi488_cycle(
  double actualaccuracy = cid->accuracygoal;
  invert_matrix(cid->am, ndit, jer, cid->maxrefiters, actualaccuracy, cid->refinemode, output_path, jxi488, mxndm, cid->proc_device);
  // in principle, we should check whether the returned actualaccuracy is indeed lower than the accuracygoal, and do something about it if not
#ifdef USE_REFINEMENT
  if (gconf->refine_flag > 0) {
    if (cid->refinemode==2) {
      message = "DEBUG: iterative refinement enabled at run-time.\n";
      logger->log(message, LOG_DEBG);
      message = "INFO: calibration obtained accuracy " + to_string(actualaccuracy) + " (" + to_string(cid->accuracygoal) + " requested) in " + to_string(cid->maxrefiters) + " refinement iterations\n";
      logger->log(message);
      if (actualaccuracy > 1e-1) {
@@ -892,7 +908,7 @@ int cluster_jxi488_cycle(
	exit(1);
      }
    }
#endif
  }
  cid->refinemode = 0;
#ifdef DEBUG_AM
  VirtualAsciiFile *outam2 = new VirtualAsciiFile();
+36 −20
Original line number Diff line number Diff line
@@ -743,9 +743,15 @@ int inclusion_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryCo
	+ ").\n";
      logger->log(message, LOG_WARN);
    } else if (recommended_li < cid->c1->li) {
      if (gconf->dyn_order_flag > 0) {
	message = "INFO: lowering internal order from " + to_string(cid->c1->li) + " to "
	  + to_string(recommended_li) + " for scale iteration " + to_string(jxi488) + ".\n";
	logger->log(message, LOG_INFO);
      } else {
	message = "WARNING: internal order " + to_string(cid->c1->li) + " too high for scale iteration "
	  + to_string(jxi488) + ".\n";
	logger->log(message, LOG_WARN);
      }
    }
    if (recommended_le > cid->c1->le) {
      message = "WARNING: external order " + to_string(cid->c1->le) + " for scale iteration "
@@ -753,11 +759,18 @@ int inclusion_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryCo
	+ ").\n";
      logger->log(message, LOG_WARN);
    } else if (recommended_le < cid->c1->le) {
      if (gconf->dyn_order_flag > 0) {
	message = "INFO: lowering external order from " + to_string(cid->c1->le) + " to "
	  + to_string(recommended_le) + " for scale iteration " + to_string(jxi488) + ".\n";
	logger->log(message, LOG_INFO);
      } else {
	message = "WARNING: external order " + to_string(cid->c1->le) + " too high for scale iteration "
	  + to_string(jxi488) + ".\n";
	logger->log(message, LOG_WARN);
      }
    }
    if (recommended_li < max_li || recommended_le < max_le) {
      if (gconf->dyn_order_flag > 0) {
	int new_li = (recommended_li < max_li) ? recommended_li : max_li;
	int new_le = (recommended_le < max_le) ? recommended_le : max_le;
	cid->update_orders(sconf->_rcf, new_li, new_le);
@@ -766,6 +779,7 @@ int inclusion_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryCo
	cid->refinemode = 2;
      }
    }
  }
  int li = cid->c1->li;
  int le = cid->c1->le;
  int lm = cid->c1->lm;
@@ -873,8 +887,10 @@ int inclusion_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryCo
  double actualaccuracy = cid->accuracygoal;
  invert_matrix(cid->am, cid->c1->ndm, jer, cid->maxrefiters, actualaccuracy, cid->refinemode, output_path, jxi488, mxndm, cid->proc_device);
  // in principle, we should check whether the returned actualaccuracy is indeed lower than the accuracygoal, and do something about it if not
#ifdef USE_REFINEMENT
  if (gconf->refine_flag > 0) {
    if (cid->refinemode==2) {
      message = "DEBUG: iterative refinement enabled at run-time.\n";
      logger->log(message, LOG_DEBG);
      message = "INFO: calibration obtained accuracy " + to_string(actualaccuracy) + " (" + to_string(cid->accuracygoal) + " requested) in " + to_string(cid->maxrefiters) + " refinement iterations\n";
      logger->log(message);
      if (actualaccuracy > 1e-2) {
@@ -882,7 +898,7 @@ int inclusion_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryCo
	exit(1);
      }
    }
#endif // USE_REFINEMENT
  }
#ifdef USE_NVTX
  nvtxRangePop();
#endif
+15 −8
Original line number Diff line number Diff line
@@ -593,6 +593,7 @@ int sphere_jxi488_cycle(
	+ ").\n";
      logger->log(message, LOG_WARN);
    } else if (recommended_lm < max_lm) {
      if (gconf->dyn_order_flag > 0) {
	int new_lm = recommended_lm;
	message = "INFO: lowering internal order from " + to_string(max_lm) + " to "
	  + to_string(recommended_lm) + " for scale iteration " + to_string(jxi488) + ".\n";
@@ -601,6 +602,12 @@ int sphere_jxi488_cycle(
	is_first_scale = true;
	// jw = 1;
	l_max = new_lm;
      } else {
	message = "WARNING: internal order " + to_string(max_lm) + " for scale iteration "
	  + to_string(jxi488) + " too high (recommended order is " + to_string(recommended_lm)
	  + ").\n";
      logger->log(message, LOG_WARN);
      }
    }
  }
  // End of dynamic order check