VTK
Bcube._build_fname_with_iterations
— MethodAppend the number of iteration (if positive) to the basename
Bcube._point_index_from_IJK
— MethodReturn the node numbering of the node designated by its position in the x and y direction.
See https://www.kitware.com/modeling-arbitrary-order-lagrange-finite-elements-in-the-visualization-toolkit/.
Bcube._vtk_coords_from_lagrange
— MethodCoordinates of the nodes in the VTK cell, ordered as expected by VTK.
Bcube._vtk_lagrange_node_index_bcube_to_vtk
— MethodBcube node numbering -> VTK node numbering (in a cell)
Bcube._vtk_lagrange_node_index_vtk_to_bcube
— MethodVTK node numbering (in a cell) -> Bcube node numbering
Bcube.vtk_entity
— Methodvtk_entity(t::AbstractEntityType)
Convert an AbstractEntityType
into a VTKCellType
. To find the correspondance, browse the WriteVTK
package AND check the Doxygen (for numbering) : https://vtk.org/doc/nightly/html/classvtkTriQuadraticHexahedron.html
Bcube.write_vtk
— Methodwrite_vtk(basename::String, it::Int,time::Real, mesh::AbstractMesh{topoDim,spaceDim}, vars::Dict{String,Tuple{V,L}}; append=false) where{topoDim,spaceDim,V,L<:WriteVTK.AbstractFieldData}
Write a set of variables on the mesh nodes or cell centers to a VTK file.
Example
mesh = basic_mesh()
u = rand(ncells(mesh))
v = rand(nnodes(mesh))
dict_vars = Dict( "u" => (u, VTKCellData()), "v" => (v, VTKPointData()) )
write_vtk("output", 0, 0.0, mesh, dict_vars)
Bcube.write_vtk
— Methodwrite_vtk(basename::String, mesh::AbstractMesh{topoDim,spaceDim}) where{topoDim,spaceDim}
Write the mesh to a VTK file.
Example
write_vtk("output", basic_mesh())
Bcube.write_vtk_discontinuous
— MethodVTK writer for a set of discontinuous functions. vars
is a dictionnary of variable name => (values, values_location)
where values is an array of numbers.
Bcube.write_vtk_lagrange
— Methodwrite_vtk_lagrange(
basename::String,
vars::Dict{String, F},
mesh::AbstractMesh,
U_export::AbstractFESpace,
it::Integer = -1,
time::Real = 0.0;
collection_append = false,
vtk_kwargs...,
) where {F <: AbstractLazy}
Write the provided FEFunction/MeshCellData/CellFunction on the mesh with the precision of the Lagrange FESpace provided.
vars
is a dictionnary of variable name => Union{FEFunction,MeshCellData,CellFunction} to write.
Example
mesh = rectangle_mesh(6, 7; xmin = -1, xmax = 1.0, ymin = -1, ymax = 1.0)
f_u = PhysicalFunction(x -> x[1]^2 + x[2]^2)
u = FEFunction(TrialFESpace(FunctionSpace(:Lagrange, 4), mesh))
projection_l2!(u, f_u, mesh)
vars = Dict("f_u" => f_u, "u" => u, "grad_u" => ∇(u))
for degree_export in 1:5
U_export = TrialFESpace(FunctionSpace(:Lagrange, degree_export), mesh)
Bcube.write_vtk_lagrange(
joinpath(@__DIR__, "output"),
vars,
mesh,
U_export,
)
end
Dev notes
- in order to write an ASCII file, you must pass both
ascii = true
andappend = false
collection_append
is not namedappend
to enable passing correctkwargs
tovtk_grid
- remove (once fully validated) :
write_vtk_discontinuous