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

  1. added theissue type on Sep 29, 2026
  2. added
    priority:medium
    workload:low
    on Sep 29, 2026
  3. moved this from In-Box to ToDo in t8code's Issue Landing pageon Sep 29, 2026
  4. added
    t8code_week_maintenance_issue
    on Oct 5, 2026
  5. moved this from Needs Review to In Review in t8code's Issue Landing pageon Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority:mediumt8code_week_maintenance_issueworkload:low

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions