Skip to content

Commit

Permalink
Merge pull request #190 from autotwin/lite
Browse files Browse the repository at this point in the history
lite
  • Loading branch information
mrbuche authored Nov 6, 2024
2 parents e00d700 + 22bd150 commit c9f4139
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
21 changes: 13 additions & 8 deletions src/fem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,14 @@ fn write_finite_elements_to_exodus(
file.add_attribute::<f32>("api_version", 8.25)?;
file.add_attribute::<i32>("file_size", 1)?;
file.add_attribute::<i32>("floating_point_word_size", 8)?;
file.add_attribute::<String>(
"title",
format!(
"autotwin.automesh, version {}, autogenerated on {}",
env!("CARGO_PKG_VERSION"),
Utc::now()
),
)?;
file.add_attribute::<f32>("version", 8.25)?;
let mut element_blocks_unique = element_blocks.clone();
element_blocks_unique.sort();
Expand All @@ -678,7 +686,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
Expand All @@ -698,17 +705,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::<i32>(
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")]
Expand Down
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c9f4139

Please sign in to comment.