Skip to content

Commit 3b66b63

Browse files
committed
Generalize VTK.jl
1 parent 32b9de6 commit 3b66b63

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/Export/VTK.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,17 @@ end
223223
Project `vals` to the grid nodes with `proj` and save to `vtk`.
224224
"""
225225
function write_projection(vtk::VTKGridFile, proj::L2Projector, vals, name)
226-
data = _evaluate_at_grid_nodes(proj, vals, #=vtk=# Val(true))::Matrix
227-
@assert size(data, 2) == getnnodes(get_grid(proj.dh))
228-
_vtk_write_node_data(vtk.vtk, data, name; component_names = component_names(eltype(vals)))
226+
if write_discontinuous(vtk)
227+
# @assert first(vals) isa Number
228+
data = evaluate_at_discontinuous_vtkgrid_nodes(proj.dh, vals, only(getfieldnames(proj.dh)), vtk.cellnodes)
229+
comp_names = ["x", "y", "z"][1:size(data, 1)]
230+
else
231+
data = _evaluate_at_grid_nodes(proj, vals, #=vtk=# Val(true))::Matrix
232+
@assert size(data, 2) == getnnodes(get_grid(proj.dh))
233+
comp_names = component_names(eltype(vals))
234+
end
235+
236+
_vtk_write_node_data(vtk.vtk, data, name; component_names = comp_names)
229237
return vtk
230238
end
231239

0 commit comments

Comments
 (0)