Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove binary vtk option #928

Merged
merged 6 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/t8_cmesh/t8_cmesh_vtk_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
}
fprintf (vtufile, "<?xml version=\"1.0\"?>\n");
fprintf (vtufile, "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"");
#if defined T8_VTK_BINARY && defined T8_VTK_COMPRESSION
fprintf (vtufile, " compressor=\"vtkZLibDataCompressor\"");
#endif
#ifdef SC_IS_BIGENDIAN
fprintf (vtufile, " byte_order=\"BigEndian\">\n");
#else
Expand All @@ -122,7 +119,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
" NumberOfComponents=\"3\" format=\"%s\">\n",
T8_VTK_FLOAT_NAME, T8_VTK_FORMAT_STRING);

#ifdef T8_VTK_ASCII
for (tree = t8_cmesh_get_first_tree (cmesh); tree != NULL; tree = t8_cmesh_get_next_tree (cmesh, tree)) {
/* TODO: Use new geometry here. Need cmesh_get_reference coords function. */
vertices = t8_cmesh_get_tree_vertices (cmesh, tree->treeid);
Expand Down Expand Up @@ -163,9 +159,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
}
} /* end ghost loop */
}
#else
SC_ABORT ("Binary vtk file not implemented\n");
#endif /* T8_VTK_ASCII */
fprintf (vtufile, " </DataArray>\n");
fprintf (vtufile, " </Points>\n");
fprintf (vtufile, " <Cells>\n");
Expand All @@ -175,7 +168,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
" <DataArray type=\"%s\" Name=\"connectivity\""
" format=\"%s\">\n",
T8_VTK_LOCIDX, T8_VTK_FORMAT_STRING);
#ifdef T8_VTK_ASCII
for (tree = t8_cmesh_get_first_tree (cmesh), count_vertices = 0; tree != NULL;
tree = t8_cmesh_get_next_tree (cmesh, tree)) {
fprintf (vtufile, " ");
Expand All @@ -195,17 +187,13 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
fprintf (vtufile, "\n");
}
}
#else
SC_ABORT ("Binary vtk file not implemented\n");
#endif /* T8_VTK_ASCII */
fprintf (vtufile, " </DataArray>\n");

/* write offset data */
fprintf (vtufile,
" <DataArray type=\"%s\" Name=\"offsets\""
" format=\"%s\">\n",
T8_VTK_LOCIDX, T8_VTK_FORMAT_STRING);
#ifdef T8_VTK_ASCII
fprintf (vtufile, " ");
for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1, offset = 0; tree != NULL;
tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) {
Expand All @@ -225,16 +213,12 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
}
}
fprintf (vtufile, "\n");
#else
SC_ABORT ("Binary vtk file not implemented\n");
#endif /* T8_VTK_ASCII */
fprintf (vtufile, " </DataArray>\n");
/* write type data */
fprintf (vtufile,
" <DataArray type=\"UInt8\" Name=\"types\""
" format=\"%s\">\n",
T8_VTK_FORMAT_STRING);
#ifdef T8_VTK_ASCII
fprintf (vtufile, " ");
for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1; tree != NULL;
tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) {
Expand All @@ -252,9 +236,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
}
}
fprintf (vtufile, "\n");
#else
SC_ABORT ("Binary vtk file not implemented\n");
#endif /* T8_VTK_ASCII */
fprintf (vtufile, " </DataArray>\n");
fprintf (vtufile, " </Cells>\n");
/* write treeif data */
Expand All @@ -263,7 +244,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
" <DataArray type=\"%s\" Name=\"treeid\""
" format=\"%s\">\n",
T8_VTK_GLOIDX, T8_VTK_FORMAT_STRING);
#ifdef T8_VTK_ASCII
fprintf (vtufile, " ");
for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1, offset = 0; tree != NULL;
tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) {
Expand Down Expand Up @@ -292,16 +272,12 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
}
}
fprintf (vtufile, "\n");
#else
SC_ABORT ("Binary vtk file not implemented\n");
#endif /* T8_VTK_ASCII */
fprintf (vtufile, " </DataArray>\n");
/* write mpirank data */
fprintf (vtufile,
" <DataArray type=\"%s\" Name=\"mpirank\""
" format=\"%s\">\n",
"Int32", T8_VTK_FORMAT_STRING);
#ifdef T8_VTK_ASCII
fprintf (vtufile, " ");
for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1, offset = 0; tree != NULL;
tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) {
Expand All @@ -318,9 +294,6 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, double sc
}
}
fprintf (vtufile, "\n");
#else
SC_ABORT ("Binary vtk file not implemented\n");
#endif /* T8_VTK_ASCII */
fprintf (vtufile, " </DataArray>\n");
fprintf (vtufile, " </CellData>\n");
/* write type data */
Expand Down
3 changes: 0 additions & 3 deletions src/t8_forest/t8_forest_vtk.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1275,9 +1275,6 @@ t8_forest_vtk_write_file (t8_forest_t forest, const char *fileprefix, const int
}
T8_ASSERT (forest->ghosts != NULL || !write_ghosts);

/* Currently we only support output in ascii format, not binary */
T8_ASSERT (T8_VTK_ASCII == 1);

/* process 0 creates the .pvtu file */
if (forest->mpirank == 0) {
if (t8_write_pvtu (fileprefix, forest->mpisize, write_treeid, write_mpirank, write_level, write_element_id,
Expand Down
5 changes: 0 additions & 5 deletions src/t8_vtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@
#define T8_VTK_FLOAT_TYPE double
#endif

#ifndef T8_VTK_BINARY
#define T8_VTK_ASCII 1
#define T8_VTK_FORMAT_STRING "ascii"
#else
#define T8_VTK_FORMAT_STRING "binary"
#endif

#if T8_WITH_VTK
#define t8_vtk_locidx_array_type_t vtkTypeInt32Array
Expand Down