From b40f95bcf5fc5ff506f43ebd94d4958c2918e7d5 Mon Sep 17 00:00:00 2001 From: Egor Larionov Date: Sat, 1 Oct 2022 16:26:36 -0700 Subject: [PATCH] Update default header_type to UInt32 This makes the results more consistent with paraview. It also passes on one additional testcase from pygmsh. --- assets/box.vtu | 2 +- src/lib.rs | 2 +- src/xml.rs | 4 ++-- tests/pygmsh.rs | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/assets/box.vtu b/assets/box.vtu index 4d2c46c..9a25ee0 100644 --- a/assets/box.vtu +++ b/assets/box.vtu @@ -1 +1 @@ -AAAAAAAAAAS/AAAAvwAAAD8AAAA/AAAAvwAAAL8AAAA/AAAAPwAAAA==AAAAAAAAAAQ+TMzNAAAAAD+AAAA+TMzNAAAAAD+AAAAAAAAAP4AAAD3MzM0AAAAAP4AAAD3MzM0+TMzNAAAAAD+AAAA+TMzNAAAAAD+AAAAAAAAAP4AAAD3MzM0AAAAAP4AAAD3MzM0=AAAAAAAAAAQAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQ==AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=AAAAAAAAAAg/4KqqoAAAAL/gAAAAAAAAP+AAAAAAAAC/4KqqoAAAAL/gAAAAAAAAP+AAAAAAAAA/4KqqoAAAAD/gAAAAAAAAP+AAAAAAAAC/4KqqoAAAAD/gAAAAAAAAP+AAAAAAAAC/4KqqoAAAAL/gAAAAAAAAv+AAAAAAAAA/4KqqoAAAAL/gAAAAAAAAv+AAAAAAAAC/4KqqoAAAAD/gAAAAAAAAv+AAAAAAAAA/4KqqoAAAAD/gAAAAAAAAv+AAAAAAAAA=AAAAAAAAAAgAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAMAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAUAAAAAAAAABwAAAAAAAAAGAAAAAAAAAAYAAAAAAAAABwAAAAAAAAACAAAAAAAAAAMAAAAAAAAABQAAAAAAAAA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AAAAAM=AAAAAAAAADAAAAAAAAAABAAAAAAAAAAIAAAAAAAAAAwAAAAAAAAAEAAAAAAAAAAUAAAAAAAAABg=AAAAAAAAAAYHBwcHBwc= \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 9f8fff3..08152ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -351,7 +351,7 @@ impl Vtk { /// use vtkio::model::*; // import the model definition of a VTK file /// /// let input: &[u8] = b"\ - /// \ + /// \ /// \ /// \ /// \ diff --git a/src/xml.rs b/src/xml.rs index c033a71..8cad64f 100644 --- a/src/xml.rs +++ b/src/xml.rs @@ -1968,7 +1968,7 @@ impl DataArray { DataArrayFormat::Binary => { // First byte gives the bytes let bytes = base64::decode(data[0].clone().into_string())?; - //eprintln!("{:?}", &bytes[..header_bytes]); + // eprintln!("{:?}", &bytes[..header_bytes]); let buf = IOBuffer::from_bytes( &bytes[header_bytes..], scalar_type.into(), @@ -2768,7 +2768,7 @@ impl TryFrom for model::Vtk { let encoding_info = EncodingInfo { byte_order, - header_type: header_type.unwrap_or(ScalarType::UInt64), + header_type: header_type.unwrap_or(ScalarType::UInt32), compressor, compression_level: 0, // This is meaningless when decoding }; diff --git a/tests/pygmsh.rs b/tests/pygmsh.rs index 5041314..80be71b 100644 --- a/tests/pygmsh.rs +++ b/tests/pygmsh.rs @@ -160,7 +160,7 @@ fn legacy_ascii() -> Result { test_ignore_rem!(parse_be(input) => out1); let mut outtest = String::new(); outtest.write_vtk_ne(out1.clone())?; - println!("{}", outtest); + // println!("{}", outtest); test_b!(parse_ne(String::new().write_vtk_ne(out1.clone())?.as_bytes()) => ne(&out1)); test_b!(parse_ne(Vec::::new().write_vtk_ne(out1.clone())?) => ne(&out1)); test_b!(parse_le(Vec::::new().write_vtk_le(out1.clone())?) => le(&out1)); @@ -176,7 +176,7 @@ fn legacy_binary() -> Result { test_ignore_rem!(parse_be(input) => out1); let mut outtest = String::new(); outtest.write_vtk_ne(out1.clone())?; - println!("{}", outtest); + // println!("{}", outtest); test_b!(parse_ne(String::new().write_vtk_ne(out1.clone())?.as_bytes()) => ne(&out1)); test_b!(parse_ne(Vec::::new().write_vtk_ne(out1.clone())?) => ne(&out1)); test_b!(parse_le(Vec::::new().write_vtk_le(out1.clone())?) => le(&out1)); @@ -258,7 +258,6 @@ fn xml_lzma() -> Result { } #[test] -#[ignore] fn xml_no_compression() -> Result { let mut vtu = Vtk::import("./assets/pygmsh/no-compression.vtu")?; assert_and_fix_xml_vtu(&mut vtu);