Skip to content

Commit 75c080a

Browse files
top example
1 parent a781182 commit 75c080a

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/lib.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
//! # Library Use
1313
//!
1414
//! ```rust
15+
//! # fn main() -> Result<(), coupe::Error> {
1516
//! extern crate coupe;
1617
//! use coupe::Partition as _;
1718
//! use coupe::Point2D;
1819
//!
19-
//! // define coordinates, weights and graph
20-
//! # let coordinates: [Point2D; 9] = [
20+
//! // define coordinates
21+
//! let coordinates: [Point2D; 9] = [
22+
//! // define some points
2123
//! # Point2D::new(0.0, 0.0),
2224
//! # Point2D::new(0.0, 1.0),
2325
//! # Point2D::new(0.0, 2.0),
@@ -27,9 +29,12 @@
2729
//! # Point2D::new(2.0, 0.0),
2830
//! # Point2D::new(2.0, 1.0),
2931
//! # Point2D::new(2.0, 2.0),
30-
//! # ];
31-
//! # let weights: [f64; 9] = [1.0, 2.0, 3.0, 2.0, 3.0, 4.0, 3.0, 4.0, 5.0];
32-
//! # let graph: sprs::CsMat<i64> = {
32+
//! ];
33+
//! // Define weights
34+
//! let weights: [f64; 9] = [1.0, 2.0, 3.0, 2.0, 3.0, 4.0, 3.0, 4.0, 5.0];
35+
//! // define graph
36+
//! let graph: sprs::CsMat<i64> = {
37+
//! // define topology
3338
//! # let mut g = sprs::CsMat::empty(sprs::CSR, 9);
3439
//! # g.insert(0, 1, 1);
3540
//! # g.insert(0, 3, 1);
@@ -56,7 +61,15 @@
5661
//! # g.insert(8, 5, 1);
5762
//! # g.insert(8, 7, 1);
5863
//! # g
59-
//! # };
64+
//! };
65+
//!
66+
//! let mut partition = [0; 9];
67+
//!
68+
//! // generate a partition of 4 parts
69+
//! coupe::Rcb { iter_count: 2, ..Default::default() }
70+
//! .partition(&mut partition, (coordinates, weights))?;
71+
//! # Ok(())
72+
//! # }
6073
//! ```
6174
//!
6275
//! ## Geometric Partitioning
@@ -102,10 +115,7 @@ mod work_share;
102115
pub use crate::algorithms::*;
103116
pub use crate::geometry::{BoundingBox, Point2D, Point3D, PointND};
104117
pub use crate::real::Real;
105-
106-
// Internal use
107-
use crate::nextafter::nextafter;
108-
use crate::work_share::work_share;
118+
pub use crate::nextafter::nextafter;
109119

110120
pub use nalgebra;
111121
pub use num_traits;

0 commit comments

Comments
 (0)