From c4b45821b78a947a8daf3f8b8118327df67ba207 Mon Sep 17 00:00:00 2001 From: mika <54282857+m1ka05@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:29:00 +0100 Subject: [PATCH] Fix: Bezier cell rational weights and degree attributes (#132) --- test/bezier.jl | 45 ++++++++++++++++++++++++++++++++++++++------- test/checksums.sha1 | 3 ++- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/test/bezier.jl b/test/bezier.jl index c3135ea1..ace30a6d 100644 --- a/test/bezier.jl +++ b/test/bezier.jl @@ -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. @@ -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() diff --git a/test/checksums.sha1 b/test/checksums.sha1 index c0862816..9024db1c 100644 --- a/test/checksums.sha1 +++ b/test/checksums.sha1 @@ -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