|
12 | 12 | //! # Library Use
|
13 | 13 | //!
|
14 | 14 | //! ```rust
|
| 15 | +//! # fn main() -> Result<(), coupe::Error> { |
15 | 16 | //! extern crate coupe;
|
16 | 17 | //! use coupe::Partition as _;
|
17 | 18 | //! use coupe::Point2D;
|
18 | 19 | //!
|
19 |
| -//! // define coordinates, weights and graph |
20 |
| -//! # let coordinates: [Point2D; 9] = [ |
| 20 | +//! // define coordinates |
| 21 | +//! let coordinates: [Point2D; 9] = [ |
| 22 | +//! // define some points |
21 | 23 | //! # Point2D::new(0.0, 0.0),
|
22 | 24 | //! # Point2D::new(0.0, 1.0),
|
23 | 25 | //! # Point2D::new(0.0, 2.0),
|
|
27 | 29 | //! # Point2D::new(2.0, 0.0),
|
28 | 30 | //! # Point2D::new(2.0, 1.0),
|
29 | 31 | //! # 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 |
33 | 38 | //! # let mut g = sprs::CsMat::empty(sprs::CSR, 9);
|
34 | 39 | //! # g.insert(0, 1, 1);
|
35 | 40 | //! # g.insert(0, 3, 1);
|
|
56 | 61 | //! # g.insert(8, 5, 1);
|
57 | 62 | //! # g.insert(8, 7, 1);
|
58 | 63 | //! # 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 | +//! # } |
60 | 73 | //! ```
|
61 | 74 | //!
|
62 | 75 | //! ## Geometric Partitioning
|
@@ -102,10 +115,7 @@ mod work_share;
|
102 | 115 | pub use crate::algorithms::*;
|
103 | 116 | pub use crate::geometry::{BoundingBox, Point2D, Point3D, PointND};
|
104 | 117 | 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; |
109 | 119 |
|
110 | 120 | pub use nalgebra;
|
111 | 121 | pub use num_traits;
|
|
0 commit comments