Skip to content

Commit

Permalink
expose method to parse meshb contents
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Sep 6, 2022
1 parent 7450cd7 commit 9cd652e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/ref_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,23 @@ REF_FCN static REF_STATUS ref_import_meshb_size(FILE *file, REF_INT version,
return REF_SUCCESS;
}

REF_FCN REF_STATUS ref_import_meshb_contents(const char *filename,
REF_BOOL *has_association,
REF_BOOL *has_geometry_model) {
REF_INT version;
REF_FILEPOS key_pos[REF_IMPORT_MESHB_LAST_KEYWORD];
REF_INT node_keyword = 40;
REF_INT edge_keyword = 41;
REF_INT face_keyword = 42;
REF_INT cad_data_keyword = 126; /* GmfByteFlow */
RSS(ref_import_meshb_header(filename, &version, key_pos), "header");
*has_association = ((REF_FILEPOS)REF_EMPTY != key_pos[node_keyword]) ||
((REF_FILEPOS)REF_EMPTY != key_pos[edge_keyword]) ||
((REF_FILEPOS)REF_EMPTY != key_pos[face_keyword]);
*has_geometry_model = ((REF_FILEPOS)REF_EMPTY != key_pos[cad_data_keyword]);
return REF_SUCCESS;
}

REF_FCN static REF_STATUS ref_import_meshb(REF_GRID *ref_grid_ptr,
REF_MPI ref_mpi,
const char *filename) {
Expand Down
4 changes: 4 additions & 0 deletions src/ref_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ REF_FCN REF_STATUS ref_import_meshb_jump(FILE *file, REF_INT version,
REF_BOOL *available,
REF_FILEPOS *next_position);

REF_FCN REF_STATUS ref_import_meshb_contents(const char *filename,
REF_BOOL *has_association,
REF_BOOL *has_geometry_model);

REF_FCN REF_STATUS ref_import_examine_header(const char *filename);

END_C_DECLORATION
Expand Down

0 comments on commit 9cd652e

Please sign in to comment.