Skip to content

Commit

Permalink
computes the mix/max diff of sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Jun 1, 2021
1 parent 3952abe commit e457260
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/ref_subcommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,14 @@ static REF_STATUS fixed_point_metric(
REF_INT im, node;
REF_INT fixed_point_ldim;

REF_DBL *min_scalar, *max_scalar;
REF_BOOL first = REF_TRUE;

ref_malloc_init(min_scalar, 1 * ref_node_max(ref_grid_node(ref_grid)),
REF_DBL, 0);
ref_malloc_init(max_scalar, 1 * ref_node_max(ref_grid_node(ref_grid)),
REF_DBL, 0);

ref_malloc(hess, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
total_timesteps = 0;
for (timestep = first_timestep; timestep <= last_timestep;
Expand All @@ -1771,6 +1779,18 @@ static REF_STATUS fixed_point_metric(
"unable to load scalar");
REIS(1, fixed_point_ldim, "expected one scalar");
RSS(ref_recon_hessian(ref_grid, scalar, hess, reconstruction), "hess");
if (first) {
first = REF_FALSE;
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
min_scalar[node] = scalar[node];
max_scalar[node] = scalar[node];
}
} else {
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
min_scalar[node] = MIN(min_scalar[node], scalar[node]);
max_scalar[node] = MAX(max_scalar[node], scalar[node]);
}
}
ref_free(scalar);
total_timesteps++;
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
Expand Down Expand Up @@ -1798,6 +1818,17 @@ static REF_STATUS fixed_point_metric(
complexity),
"gradation at complexity");
ref_mpi_stopwatch_stop(ref_mpi, "metric gradation and complexity");

each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
max_scalar[node] -= min_scalar[node];
}
RSS(ref_gather_scalar_by_extension(ref_grid, 1, max_scalar, NULL,
"max-scalar.plt"),
"gather recept");

ref_free(min_scalar);
ref_free(max_scalar);

return REF_SUCCESS;
}

Expand Down

0 comments on commit e457260

Please sign in to comment.