Skip to content

Safe usage of t8_forest_write_vtk_ext with data for external applications #2454

Description

@benegee

Feature request

To provide additional data when writing to VTK files, t8code defines a t8_vtk_data_field_t struct:

typedef struct
{
t8_vtk_data_type_t type; /**< Describes of which type the data array is */
char description[BUFSIZ]; /**< String that describes the data. */
double *data;
/**< An array of length n*num_local_elements doubles with
n = 1 if type = T8_VTK_SCALAR, n = 3 if type = T8_VTK_VECTOR */
} t8_vtk_data_field_t;

Its member description has fixed width BUFSIZ, which is platform dependent. I checked Windows, mac, and linux, and got 512, 1024, and 8192, respectively, but it could also vary among different compilers IIUC.

This becomes problematic when an external application linking against t8code tries to assemble such a data field and pass it to t8_forest_write_vtk_ext. One has to make sure to use a BUFSIZ which is consistent to the one used when t8code was compiled.

See DLR-AMR/T8code.jl#126

A simple solution would be to use a fixed, non platform dependent, constant. Another option might be to make the internally used BUFSIZ accessible from outside.

Estimated priority
Which of these is most applicable (remove the others):

"Priority: medium" Should be solved within half a year

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumShould be solved within half a yearworkload:lowWould take half a day or less

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions