#include "rsl.h"
extern int radar_verbose_flag;
+/* Define global variable for pruning and the functions to set or unset it.
+ * Added by Bart Kelley, SSAI, August 26, 2009
+ */
+int prune_radar = 1;
+
+void RSL_prune_radar_on()
+{
+ prune_radar = 1;
+}
+
+void RSL_prune_radar_off()
+{
+ prune_radar = 0;
+}
+
Ray *RSL_prune_ray(Ray *ray)
{
if (ray == NULL) return NULL;
if (s == NULL) return NULL;
if (s->h.nrays == 0) {
- RSL_free_sweep(s);
- return NULL;
+ RSL_free_sweep(s);
+ return NULL;
}
/*
* Squash out all dataless rays. 'j' is the index for the squashed (pruned)
* rays.
*/
for (i=0,j=0; i<s->h.nrays; i++)
- if ((s->ray[i] = RSL_prune_ray(s->ray[i])))
- s->ray[j++] = s->ray[i]; /* Keep this ray. */
+ if ((s->ray[i] = RSL_prune_ray(s->ray[i])))
+ s->ray[j++] = s->ray[i]; /* Keep this ray. */
if (j==0) {
- RSL_free_sweep(s);
- return NULL; /* All rays were pruned. */
+ RSL_free_sweep(s);
+ return NULL; /* All rays were pruned. */
}
for (i=j; i<s->h.nrays; i++) s->ray[i] = NULL;
s->h.nrays = j;
if (v == NULL) return NULL;
if (v->h.nsweeps == 0) {
- RSL_free_volume(v);
- return NULL;
+ RSL_free_volume(v);
+ return NULL;
}
/*
* Squash out all dataless sweeps. 'j' is the index for sweep containing data.
*/
for (i=0,j=0; i<v->h.nsweeps; i++)
- if ((v->sweep[i] = RSL_prune_sweep(v->sweep[i])))
- v->sweep[j++] = v->sweep[i]; /* Keep this sweep. */
+ if ((v->sweep[i] = RSL_prune_sweep(v->sweep[i])))
+ v->sweep[j++] = v->sweep[i]; /* Keep this sweep. */
if (j==0) {
- RSL_free_volume(v);
- return NULL; /* All sweeps were pruned. */
+ RSL_free_volume(v);
+ return NULL; /* All sweeps were pruned. */
}
for (i=j; i<v->h.nsweeps; i++) v->sweep[i] = NULL;
v->h.nsweeps = j;
int i;
/* Volume indexes are fixed so we just prune the substructures. */
if (radar == NULL) return NULL;
- for (i=0; i<radar->h.nvolumes; i++)
- radar->v[i] = RSL_prune_volume(radar->v[i]);
+ if (prune_radar)
+ for (i=0; i<radar->h.nvolumes; i++)
+ radar->v[i] = RSL_prune_volume(radar->v[i]);
+ else if (radar_verbose_flag) fprintf(stderr,
+ "RSL_prune_radar: No pruning done. prune_radar = %d\n", prune_radar);
return radar;
}