How important is performance accessing the vectors of “mixed” data?
Do the different types have common fields?
If the performance of accessing the “blocks” field (which will have to essentially hold pointers to boxed VTKData types) isn’t so important, then the following (using the new syntax) should work:
abstract type AbstractVTK end
mutable struct VTKUnstructuredData <: AbstractVTK
end
mutable struct VTKStructuredData <: AbstractVTK
end
mutable struct VTKMultiblockData <: AbstractVTK
blocks::Vector{AbstractVTK}
end
mutable struct VTKTimeSeriesData{T<:AbstractVTK} <: AbstractVTK
data::Vector{T}
end
The VTKTimeSeriesData is parameterized so the “data” field will be a homogenous vector of a single subtype.