Skip to content

Commit

Permalink
completes Unstructured Mesh Header
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 ba01570 commit 2b80637
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/ref_gather.c
Expand Up @@ -2200,12 +2200,15 @@ static REF_STATUS ref_gather_avm(REF_GRID ref_grid, const char *filename) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_GLOB nnode;
REF_LONG ntri, ntet;
REF_INT nfaceid, min_faceid, max_faceid;

RSS(ref_node_synchronize_globals(ref_node), "sync");

nnode = ref_node_n_global(ref_node);
RSS(ref_cell_ncell(ref_grid_tri(ref_grid), ref_node, &ntri), "ntri");
RSS(ref_cell_ncell(ref_grid_tet(ref_grid), ref_node, &ntet), "ntet");
RSS(ref_grid_faceid_range(ref_grid, &min_faceid, &max_faceid), "range");
nfaceid = max_faceid - min_faceid + 1;

file = NULL;
if (ref_mpi_once(ref_mpi)) {
Expand All @@ -2225,6 +2228,7 @@ static REF_STATUS ref_gather_avm(REF_GRID ref_grid, const char *filename) {
char mesh_units[12];
int refined = 0;
int n_int;
char element_scheme[] = "uniform";
file = fopen(filename, "w");
if (NULL == (void *)file) printf("unable to open %s\n", filename);
RNS(file, "unable to open file");
Expand Down Expand Up @@ -2334,6 +2338,39 @@ static REF_STATUS ref_gather_avm(REF_GRID ref_grid, const char *filename) {
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "max nodes per cell");
n_int = 4;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "max faces per cell");
length = (int)strlen(element_scheme);
REIS(length,
fwrite(element_scheme, sizeof(char), (unsigned long)length, file),
"element_scheme");
length = 32 - length;
for (i = 0; i < length; i++) {
REIS(1, fwrite(&nul, sizeof(nul), 1, file), "nul");
}
n_int = 1;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "face polynomial order");
n_int = 1;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "cell polynomial order");
n_int = nfaceid;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "# boundary patches");
n_int = 0;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "nhex");
n_int = (int)ntet;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "ntet");
n_int = 0;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "npri");
n_int = 0;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "npyr");
n_int = (int)ntri;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "# boundary tri faces");
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "# tri faces");
n_int = 0;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "# boundary quad faces");
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "# quad faces");
length = 5;
for (i = 0; i < length; i++) {
n_int = 0;
REIS(1, fwrite(&n_int, sizeof(n_int), 1, file), "zeros");
}
}
if (ref_mpi_once(ref_mpi)) fclose(file);
return REF_SUCCESS;
Expand Down

0 comments on commit 2b80637

Please sign in to comment.