Skip to content

Commit

Permalink
bcast sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Apr 27, 2021
1 parent 7c69c8a commit 5d1a37b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/ref_part.c
Original file line number Diff line number Diff line change
Expand Up @@ -2109,15 +2109,17 @@ static REF_STATUS ref_part_scalar_cell_restart_sol(REF_GRID ref_grid,

static REF_STATUS ref_part_scalar_rst(REF_NODE ref_node, REF_INT *ldim,
REF_DBL **scalar, const char *filename) {
REF_MPI ref_mpi = ref_node_mpi(ref_node);
FILE *file;
REF_BOOL verbose = REF_TRUE;
int dim, variables, steps, dof;

*ldim = 0;
*scalar = NULL;

file = NULL;
if (ref_mpi_once(ref_node_mpi(ref_node))) {
int i, length, version, dim, variables, steps, dof, doubles;
if (ref_mpi_once(ref_mpi)) {
int i, length, version, doubles;
char letter;
file = fopen(filename, "r");
if (NULL == (void *)file) printf("unable to open %s\n", filename);
Expand Down Expand Up @@ -2146,9 +2148,23 @@ static REF_STATUS ref_part_scalar_rst(REF_NODE ref_node, REF_INT *ldim,
if (verbose) printf("%d doubles\n", doubles);
REIS(0, doubles, "expected zero doubles");
/* assert zero doubles, skip misc metadata (timestep) */
fclose(file);
}
RSS(ref_mpi_bcast(ref_mpi, &dim, 1, REF_INT_TYPE), "bcast dim");
RSS(ref_mpi_bcast(ref_mpi, &variables, 1, REF_INT_TYPE), "bcast dim");
RSS(ref_mpi_bcast(ref_mpi, &steps, 1, REF_INT_TYPE), "bcast dim");
RSS(ref_mpi_bcast(ref_mpi, &dof, 1, REF_INT_TYPE), "bcast dim");

if (ref_node_n_global(ref_node) != dof) {
if (ref_mpi_once(ref_mpi)) {
printf("file %d ref_node " REF_GLOB_FMT " %s\n", dof,
ref_node_n_global(ref_node), filename);
}
THROW("ERROR: global count mismatch");
}

if (ref_mpi_once(ref_mpi)) {
fclose(file);
}
return REF_SUCCESS;
}

Expand Down

0 comments on commit 5d1a37b

Please sign in to comment.