Skip to content

Commit 0c43862

Browse files
committed
Update readme
1 parent fc53a80 commit 0c43862

1 file changed

Lines changed: 33 additions & 11 deletions

File tree

pysplashsurf/README.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22

33
![splashsurf logo](https://raw.githubusercontent.com/InteractiveComputerGraphics/splashsurf/main/logos/logo_small.svg "splashsurf")
44

5-
Pysplashsurf is a Python binding for splashsurf, an open source surface reconstruction library for particle data from SPH simulations. Detailed information on how the library works can be found on the [project website (splashsurf.physics-simulation.org)](https://splashsurf.physics-simulation.org/) or the [main repository](https://github.com/InteractiveComputerGraphics/splashsurf).
5+
PySplashsurf provides Python bindings for `splashsurf`, an open source surface reconstruction library for particle data from SPH simulations.
6+
Detailed information on the surface reconstruction and library itself and its API can be found on the [project website (splashsurf.physics-simulation.org)](https://splashsurf.physics-simulation.org/) or the [main repository](https://github.com/InteractiveComputerGraphics/splashsurf).
67

78
## Installation
89
```
910
pip install pysplashsurf
1011
```
1112
Requires Python version 3.7+
1213

13-
To install pysplashsurf directly with meshio (which allows some additional functionality), do
14+
To install pysplashsurf with meshio support (which adds some additional IO functionality), use
1415
```
1516
pip install pysplashsurf[meshio]
1617
```
17-
When meshio is installed, support for the `.bgeo` extension will be added to it, so that particle data from the `BGEOV` format can be read using meshio. Meshio is also required for the `write_to_file` method to work. The rest of the package will still work even if meshio is not installed.
18+
This will add support for the `.bgeo` file extension to meshio, so that particle data in the `BGEOV` format can be read using meshio.
19+
Meshio is also required for the `write_to_file` method from the bindings to work.
20+
The rest of the package will still work even if meshio is not installed.
1821

1922
## Usage
20-
Example to reconstruct the surface from an input file, apply some post processing methods and write the data back to a file:
23+
Example to reconstruct the surface from an input file, apply some post-processing methods and write the data back to a file:
2124
```python
2225
import meshio
2326
import numpy as np
@@ -26,26 +29,45 @@ import pysplashsurf
2629
mesh = meshio.read("input.vtk")
2730
particles = np.array(mesh.points, dtype=np.float64)
2831

29-
mesh_with_data, reconstruction = pysplashsurf.reconstruction_pipeline(particles, particle_radius=0.025, rest_density=1000.0, smoothing_length=2.0, cube_size=0.5, iso_surface_threshold=0.6, mesh_smoothing_weights=True, mesh_smoothing_weights_normalization=13.0, mesh_smoothing_iters=25, normals_smoothing_iters=10, mesh_cleanup=True, decimate_barnacles=True, compute_normals=True, output_raw_normals=True, subdomain_grid=True, subdomain_num_cubes_per_dim=64, output_mesh_smoothing_weights=True)
32+
mesh_with_data, reconstruction = pysplashsurf.reconstruction_pipeline(
33+
particles,
34+
particle_radius=0.025,
35+
rest_density=1000.0,
36+
smoothing_length=2.0,
37+
cube_size=0.5,
38+
iso_surface_threshold=0.6,
39+
mesh_smoothing_weights=True,
40+
mesh_smoothing_weights_normalization=13.0,
41+
mesh_smoothing_iters=25,
42+
normals_smoothing_iters=10,
43+
mesh_cleanup=True,
44+
compute_normals=True,
45+
subdomain_grid=True,
46+
subdomain_num_cubes_per_dim=64,
47+
output_mesh_smoothing_weights=True
48+
)
3049

3150
pysplashsurf.write_to_file(mesh_with_data, "output.vtk")
3251
```
33-
It may be necessary to specify the dtype of a function input (as done for `particles` in the example) so that Rust knows what data type to use internally. The extension supports single (`np.float32`) and double precision floats (`np.float64`).
52+
The `reconstruction_pipeline` method provides (mostly) the same arguments as the splashsurf binary CLI.
53+
It may be necessary to specify the `dtype` of a function input (as done for `particles` in the example) so that the bindings know what data type to use internally.
54+
The extension supports single (`np.float32`) and double precision floats (`np.float64`).
3455

3556
## Build instructions
3657
You can also manually build the package from the source code:
3758
1. Clone the repository
38-
2. cd to the pysplashsurf directory
39-
3. Create an environment from python_environment.yaml and activate it
59+
2. cd to the `pysplashsurf` directory
60+
3. Create an environment from `python_environment.yaml` and activate it
4061
- I recommend creating it in a subfolder, e.g.
4162
```conda env create --prefix ./envs -f python_environment.yaml```
4263
- Then activate it using `conda activate ./envs`
4364
4. Now, to build the project, use maturin: `maturin develop`
4465
- Maturin automatically installs the resulting binary in your python environment
45-
- Set the release flag `-r` or `--release` to build a more performant binary, however compilation time will be slightly longer
66+
- Set the release flag `-r` or `--release` to build a more performant binary, however, compilation time will be slightly longer
4667

4768
### Documentation Build
48-
To generate the Sphinx documentation, make sure that the package is installed through e.g. maturin, and then run `make html` in the `pysplashsurf/pysplashsurf/docs` directory. The resulting html files will be in `pysplashsurf/pysplashsurf/docs/build/html`.
69+
To generate the Sphinx documentation, make sure that the package is installed through, e.g., maturin, and then run `make html` in the `pysplashsurf/pysplashsurf/docs` directory.
70+
The resulting HTML files will be in `pysplashsurf/pysplashsurf/docs/build/html`.
4971

5072
### Stub File Generation
51-
To automatically generate a stub file for the package, run `cargo run --bin stub_gen` from the root project folder (from `pysplashsurf/`).
73+
To automatically generate a stub file for the package, run `cargo run --bin stub_gen` from the root project folder (from `pysplashsurf/`).

0 commit comments

Comments
 (0)