-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
2,024 additions
and
2,122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
use bempp::grid::flat_triangle_grid::FlatTriangleGridBuilder; | ||
use bempp::traits::grid::{Builder, Cell, Geometry, Grid, Point}; | ||
// use bempp::grid::flat_triangle_grid::FlatTriangleGridBuilder; | ||
// use bempp::traits::grid::{Builder, Cell, Geometry, Grid, Point}; | ||
|
||
extern crate blas_src; | ||
extern crate lapack_src; | ||
|
||
/// Creating a flat triangle grid | ||
/// | ||
/// In a flat triangle grid, all the cells are flat triangles in 3D space. | ||
fn main() { | ||
// The grid will be created using the grid builder | ||
let mut b = FlatTriangleGridBuilder::<f64>::new(); | ||
// Add four points, giving them the ids 1 to 4 | ||
b.add_point(1, [0.0, 0.0, 0.0]); | ||
b.add_point(2, [1.0, 0.0, 1.0]); | ||
b.add_point(3, [1.0, 1.0, 0.0]); | ||
b.add_point(4, [0.0, 1.0, 0.0]); | ||
// Add two cells. The vertex ids used above are used to define the cells | ||
b.add_cell(0, [1, 2, 3]); | ||
b.add_cell(1, [2, 3, 4]); | ||
// Create the grid | ||
let grid = b.create_grid(); | ||
// fn main() { | ||
// // The grid will be created using the grid builder | ||
// let mut b = FlatTriangleGridBuilder::<f64>::new(); | ||
// // Add four points, giving them the ids 1 to 4 | ||
// b.add_point(1, [0.0, 0.0, 0.0]); | ||
// b.add_point(2, [1.0, 0.0, 1.0]); | ||
// b.add_point(3, [1.0, 1.0, 0.0]); | ||
// b.add_point(4, [0.0, 1.0, 0.0]); | ||
// // Add two cells. The vertex ids used above are used to define the cells | ||
// b.add_cell(0, [1, 2, 3]); | ||
// b.add_cell(1, [2, 3, 4]); | ||
// // Create the grid | ||
// let grid = b.create_grid(); | ||
|
||
// Print the coordinates or each point in the mesh. Note that that point indices | ||
// start from 0 and are not equal to the ids used when inputting the points | ||
let mut coords = vec![0.0; grid.physical_dimension()]; | ||
for point in grid.iter_all_points() { | ||
point.coords(coords.as_mut_slice()); | ||
println!("point {} (id {}): {:#?}", point.index(), point.id(), coords); | ||
} | ||
// // Print the coordinates or each point in the mesh. Note that that point indices | ||
// // start from 0 and are not equal to the ids used when inputting the points | ||
// let mut coords = vec![0.0; grid.physical_dimension()]; | ||
// for point in grid.iter_all_points() { | ||
// point.coords(coords.as_mut_slice()); | ||
// println!("point {} (id {}): {:#?}", point.index(), point.id(), coords); | ||
// } | ||
|
||
// Print the vertices of each cell | ||
for cell in grid.iter_all_cells() { | ||
println!( | ||
"cell {}: {:?} ", | ||
cell.index(), | ||
cell.geometry() | ||
.vertices() | ||
.map(|v| v.index()) | ||
.collect::<Vec<_>>() | ||
); | ||
} | ||
} | ||
// // Print the vertices of each cell | ||
// for cell in grid.iter_all_cells() { | ||
// println!( | ||
// "cell {}: {:?} ", | ||
// cell.index(), | ||
// cell.geometry() | ||
// .vertices() | ||
// .map(|v| v.index()) | ||
// .collect::<Vec<_>>() | ||
// ); | ||
// } | ||
// } | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.