From 5383000fcaf5cc800e42f29b1ae88b80ffd21bef Mon Sep 17 00:00:00 2001 From: mrbuche Date: Wed, 6 Nov 2024 14:27:17 -0700 Subject: [PATCH 1/2] fixes lite issue --- src/fem/mod.rs | 13 +++++-------- src/main.rs | 9 ++++++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/fem/mod.rs b/src/fem/mod.rs index 843293c..a90ca83 100644 --- a/src/fem/mod.rs +++ b/src/fem/mod.rs @@ -678,7 +678,6 @@ fn write_finite_elements_to_exodus( &element_blocks_unique, element_node_connectivity, ); - let mut block_num_nodes = "block_num_nodes0".to_string(); let mut current_block = 0; let mut number_of_elements = 0; element_blocks_unique @@ -698,17 +697,15 @@ fn write_finite_elements_to_exodus( format!("num_nod_per_el{}", current_block).as_str(), ELEMENT_NUM_NODES, )?; - block_num_nodes = format!("block_num_nodes{}", current_block); - file.add_dimension( - block_num_nodes.as_str(), - number_of_elements * ELEMENT_NUM_NODES, - )?; let mut connectivities = file.add_variable::( format!("connect{}", current_block).as_str(), - &[block_num_nodes.as_str()], + &[ + format!("num_el_in_blk{}", current_block).as_str(), + format!("num_nod_per_el{}", current_block).as_str(), + ], )?; connectivities.put_attribute("elem_type", "HEX8")?; - connectivities.put_values(&block_connectivity, 0)?; + connectivities.put_values(&block_connectivity, (.., ..))?; Ok::<_, ErrorNetCDF>(()) })?; #[cfg(feature = "profile")] diff --git a/src/main.rs b/src/main.rs index de07f5b..f97a423 100644 --- a/src/main.rs +++ b/src/main.rs @@ -388,7 +388,14 @@ fn mesh( let input_type = match read_input(&input, nelx, nely, nelz, quiet)? { InputTypes::Npy(voxels) => voxels, InputTypes::Spn(voxels) => voxels, - _ => panic!(), + _ => { + let input_extension = Path::new(&input).extension().and_then(|ext| ext.to_str()); + Err(format!( + "Invalid extension .{} from input file {}", + input_extension.unwrap(), + input + ))? + } }; if !quiet { let entirely_default = xscale == 1.0 From 22bd1501f4f9e84b51556ee97785e7d0a44a227e Mon Sep 17 00:00:00 2001 From: mrbuche Date: Wed, 6 Nov 2024 14:32:12 -0700 Subject: [PATCH 2/2] fixes lite issue --- src/fem/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fem/mod.rs b/src/fem/mod.rs index a90ca83..f2b5d6c 100644 --- a/src/fem/mod.rs +++ b/src/fem/mod.rs @@ -659,6 +659,14 @@ fn write_finite_elements_to_exodus( file.add_attribute::("api_version", 8.25)?; file.add_attribute::("file_size", 1)?; file.add_attribute::("floating_point_word_size", 8)?; + file.add_attribute::( + "title", + format!( + "autotwin.automesh, version {}, autogenerated on {}", + env!("CARGO_PKG_VERSION"), + Utc::now() + ), + )?; file.add_attribute::("version", 8.25)?; let mut element_blocks_unique = element_blocks.clone(); element_blocks_unique.sort();