honeycomb_kernels::grisubal

Function grisubal

Source
pub fn grisubal<T: CoordsFloat>(
    file_path: impl AsRef<Path>,
    grid_cell_sizes: [T; 2],
    clip: Clip,
) -> Result<CMap2<T>, GrisubalError>
Expand description

Main algorithm call function.

§Arguments

  • file_path: impl AsRef<Path> – Path to a VTK file describing input geometry. See [VTK Format] for more information about the expected formatting.
  • grid_cell_sizes: [T; 2], – Desired grid cell size along the X/Y axes.
  • clip: Option<Clip> – Indicates which part of the map should be clipped, if any, in the post-processing phase. For more information on the clipping process, see Clip.

§VTK Format

At the moment, the input geometry should be specified via a file under the VTK Legacy format. Just like the io feature provided in the core crate, there are a few additional requirements for the geometry to be loaded correctly:

  • The geometry should have a consistent orientation, i.e. the order in which the points are given should form normals with a consistent direction (either pointing inward or outward the geometry).
  • The geometry should be described using in an UnstructuredGrid data set, with supported cell types (Vertex, Line). Lines will be interpreted as the boundary to match while vertices will be considered as points of interests.

§Return / Errors

This function returns a Result taking the following values:

  • Ok(CMap2) – Algorithm ran successfully.
  • Err(GrisubalError) – Algorithm encountered an issue. See GrisubalError for more information about possible errors.

§Panics

This function may panic if the specified file cannot be opened.

§Example

let cmap: CMap2<f64> = grisubal("some/path/to/geometry.vtk", [1., 1.], Clip::default())?;