Skip to content

Commit f340830

Browse files
committed
Add documentation of feature flags
1 parent f2a7c03 commit f340830

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

splashsurf_lib/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
//! Library for surface reconstruction of SPH particle data using marching cubes.
33
//!
44
//! Entry points are the [`reconstruct_surface`] or [`reconstruct_surface_inplace`] functions.
5+
//!
6+
//! ## Feature flags
7+
//! The following features are all non-default features to reduces the amount of additional dependencies.
8+
//!
9+
//! #### vtk_extras
10+
//! Enables helper functions and trait implementations to export meshes using [`vtkio`](https://github.com/elrnv/vtkio).
11+
//! In particular it adds `From` impls for the [mesh](crate::mesh) types used by this crate to convert them to
12+
//! [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) and [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html)
13+
//! types. The crate exposes its `vtkio` dependency as `splashsurflib::vtkio` if the feature is enabled.
14+
//!
15+
//! #### profiling
16+
//! Enables profiling of internal functions. The resulting data can be displayed using the functions
17+
//! from the [`profiling`] module. Furthermore, it exposes the [`profile`] macro that can be used e.g.
18+
//! by binary crates calling into this library to add their own profiling scopes to the measurements.
19+
//! If this features is not enabled, the macro will just expend to a no-op and remove the (small)
20+
//! performance overhead of the profiling.
21+
//!
522
623
use log::info;
724
/// Re-export the version of `nalgebra` used by this crate

splashsurf_lib/src/mesh.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use crate::{new_map, Real};
44
use nalgebra::{Unit, Vector3};
55
use std::fmt::Debug;
66

7+
// TODO: Rename/restructure VTK helper implementations
8+
79
/// A triangle (surface) mesh in 3D
810
#[derive(Clone, Debug, Default)]
911
pub struct TriMesh3d<R: Real> {
@@ -274,6 +276,7 @@ where
274276
&'a MeshT: Into<UnstructuredGridPiece>,
275277
PointDataT: Real,
276278
{
279+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this mesh
277280
pub fn to_dataset(&'a self) -> UnstructuredGridPiece {
278281
let mut grid_piece: UnstructuredGridPiece = (&self.mesh).into();
279282
grid_piece
@@ -289,6 +292,7 @@ impl<'a, MeshT: 'a> MeshWithData<MeshT, (), u64>
289292
where
290293
&'a MeshT: Into<UnstructuredGridPiece>,
291294
{
295+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this mesh
292296
pub fn to_dataset(&'a self) -> UnstructuredGridPiece {
293297
let mut grid_piece: UnstructuredGridPiece = (&self.mesh).into();
294298
grid_piece
@@ -300,6 +304,7 @@ where
300304
}
301305

302306
#[cfg(feature = "vtk_extras")]
307+
/// Trait implementations to convert meshes into types supported by [`vtkio`](https://github.com/elrnv/vtkio)
303308
pub mod vtk_helper {
304309
use vtkio::model::{
305310
Attributes, CellType, Cells, DataSet, UnstructuredGridPiece, VertexNumbers,
@@ -308,6 +313,7 @@ pub mod vtk_helper {
308313

309314
use super::{HexMesh3d, PointCloud3d, Real, TriMesh3d};
310315

316+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this mesh
311317
impl<R> From<&TriMesh3d<R>> for UnstructuredGridPiece
312318
where
313319
R: Real,
@@ -336,6 +342,7 @@ pub mod vtk_helper {
336342
}
337343
}
338344

345+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this mesh
339346
impl<'a, R> From<&'a HexMesh3d<R>> for UnstructuredGridPiece
340347
where
341348
R: Real,
@@ -364,6 +371,7 @@ pub mod vtk_helper {
364371
}
365372
}
366373

374+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this point cloud
367375
impl<'a, R> From<&'a PointCloud3d<R>> for UnstructuredGridPiece
368376
where
369377
R: Real,
@@ -392,18 +400,21 @@ pub mod vtk_helper {
392400
}
393401
}
394402

403+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this mesh and wraps it into a [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html)
395404
impl<R: Real> Into<DataSet> for &TriMesh3d<R> {
396405
fn into(self) -> DataSet {
397406
DataSet::inline(UnstructuredGridPiece::from(self))
398407
}
399408
}
400409

410+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this mesh and wraps it into a [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html)
401411
impl<R: Real> Into<DataSet> for &HexMesh3d<R> {
402412
fn into(self) -> DataSet {
403413
DataSet::inline(UnstructuredGridPiece::from(self))
404414
}
405415
}
406416

417+
/// Creates a [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) representing this point cloud and wraps it into a [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html)
407418
impl<R: Real> Into<DataSet> for &PointCloud3d<R> {
408419
fn into(self) -> DataSet {
409420
DataSet::inline(UnstructuredGridPiece::from(self))

0 commit comments

Comments
 (0)