Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Fix Bezier cell rational weights and degree attributes #132

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions test/bezier.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env julia

# Reproduce the VTK_BEZIER_TETRA_quartic_solidSphereOctant.vtu file from the VTK
# test suite.

using WriteVTK

using Test

const VTK_BASENAME = "bezier_tetra_quartic_solidSphereOctant"
const VTK_BASENAME_SPHERE = "bezier_tetra_quartic_solidSphereOctant"
const VTK_BASENAME_ANNULUS = "bezier_anisotropic_degree_quarterAnnulus"

function main()
# Reproduce the VTK_BEZIER_TETRA_quartic_solidSphereOctant.vtu file from the VTK
# test suite
function bezier_tetra_quartic_solid_sphere_octant()
cell_type = VTKCellTypes.VTK_BEZIER_TETRAHEDRON

# Copied from VTK generated file.
Expand Down Expand Up @@ -48,14 +49,44 @@ function main()

cells = [MeshCell(cell_type, connectivity)]

outfiles = vtk_grid(VTK_BASENAME, points, cells; vtkversion = v"1.0") do vtk
output = vtk_grid(VTK_BASENAME_SPHERE, points, cells; vtkversion = v"1.0") do vtk
@test vtk.version == "1.0"
vtk["RationalWeights"] = rational_weights
vtk[VTKPointData()] = "RationalWeights" => "RationalWeights"
end
end

println("Saved: ", join(outfiles, " "))
# Test Bezier quadrilateral with anisotropic degrees
function bezier_anisotropic_degree_quarter_annulus()
cell_type = VTKCellTypes.VTK_BEZIER_QUADRILATERAL
points = [1.0 0.0 0.0 2.0 1.0 2.0; 0.0 1.0 2.0 0.0 1.0 2.0]
connectivity = 1:size(points, 2)
rational_weights = [1.0, 1.0, 1.0, 1.0, sqrt(0.5), sqrt(0.5)]
cells = [MeshCell(cell_type, connectivity)]

output = vtk_grid(VTK_BASENAME_ANNULUS, points, cells; vtkversion = v"1.0") do vtk
vtk["HigherOrderDegrees", VTKCellData()] = [2.0 1.0 1.0]
vtk["RationalWeights", VTKPointData()] = rational_weights
vtk[VTKPointData()] = "RationalWeights" => "RationalWeights"
vtk[VTKCellData()] = "HigherOrderDegrees" => "HigherOrderDegrees"
end
end

function main()
files = String[]

let
@time output = bezier_tetra_quartic_solid_sphere_octant()
append!(files, output)
end

let
@time output = bezier_anisotropic_degree_quarter_annulus()
append!(files, output)
end

outfiles
println("Saved: ", join(files, " "))
files
end

main()
3 changes: 2 additions & 1 deletion test/checksums.sha1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ a96c57cd06b71ea2793883224ec08e69c401240c unstructured_3D_tuple.vtu
161a307d963f2ac42caabcc63257caeafec7cde0 empty_cells.vtp
067069b65b73675ed3249418356ac201896d4cc3 polydata_2D.vtp
30c857ba5e9e3f09650fb116aa3f3c4fb731241e polydata_3D.vtp
00b35b76151c72a86ce4d819c4ced934fab3b569 bezier_tetra_quartic_solidSphereOctant.vtu
3a63f7fa317097dd36edaac4c1eccbfb5e135d50 bezier_tetra_quartic_solidSphereOctant.vtu
f9c4503da4de4d20b55c3964d3ec91fbbb460336 bezier_anisotropic_degree_quarterAnnulus.vtu
795a82b363436a80068f7455a8f219017b3285d7 collection.pvd
e041dbdab45b518feee8a974fd93dce15cacd60c collection_00.vtr
40ffa7cef8284404ef2405096b7771607b57d476 collection_01.vtr
Expand Down
Loading