Skip to content

Commit

Permalink
chore: clean and order imports (#283)
Browse files Browse the repository at this point in the history
* update benches

* udpate core crate

* update kernel crate

* update render crate
  • Loading branch information
imrn99 authored Feb 11, 2025
1 parent f2e447a commit 99f3b5d
Show file tree
Hide file tree
Showing 62 changed files with 65 additions and 255 deletions.
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ cfg-if.workspace = true
honeycomb.workspace = true
rayon.workspace = true


[dev-dependencies]
honeycomb-core.workspace = true
criterion = { workspace = true, features = ["html_reports"] }
iai-callgrind.workspace = true
rand = { workspace = true, features = ["small_rng"] }
Expand Down
7 changes: 2 additions & 5 deletions benches/benches/builder/grid_size.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// ------ IMPORTS

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use honeycomb::prelude::CMap2;
use honeycomb::prelude::{CMap2, CMapBuilder};

use honeycomb_benches::FloatType;
use honeycomb_core::cmap::CMapBuilder;
// ------ CONTENT

pub fn criterion_benchmark(c: &mut Criterion) {
let mut group = c.benchmark_group("builder-grid-size");
Expand Down
7 changes: 2 additions & 5 deletions benches/benches/builder/time.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// ------ IMPORTS

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use honeycomb::prelude::CMap2;
use honeycomb::prelude::{CMap2, CMapBuilder};

use honeycomb_benches::FloatType;
use honeycomb_core::cmap::CMapBuilder;
// ------ CONTENT

pub fn criterion_benchmark(c: &mut Criterion) {
// passing args to cargo bench filters bench instead of actually reading args;
Expand Down
7 changes: 1 addition & 6 deletions benches/benches/core/cmap2/basic_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@
//!
//! Each benchmark is repeated on CMap2 of different sizes.
// ------ IMPORTS

use std::hint::black_box;

use honeycomb_core::cmap::{CMap2, CMapBuilder, DartIdType};
use honeycomb_core::geometry::Vertex2;
use honeycomb::prelude::{CMap2, CMapBuilder, DartIdType, Vertex2};
use iai_callgrind::{
library_benchmark, library_benchmark_group, main, FlamegraphConfig, LibraryBenchmarkConfig,
};

use honeycomb_benches::FloatType;

// ------ CONTENT

// --- common

fn get_map(n_square: usize) -> CMap2<FloatType> {
Expand Down
6 changes: 1 addition & 5 deletions benches/benches/core/cmap2/constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@
//!
//! Each benchmark is repeated on CMap2 of different sizes.
// ------ IMPORTS

use std::hint::black_box;

use honeycomb_core::cmap::{CMap2, CMapBuilder};
use honeycomb::core::cmap::{CMap2, CMapBuilder};
use iai_callgrind::{
library_benchmark, library_benchmark_group, main, FlamegraphConfig, LibraryBenchmarkConfig,
};

use honeycomb_benches::FloatType;

// ------ CONTENT

// --- common

fn get_map(n_square: usize) -> CMap2<FloatType> {
Expand Down
8 changes: 2 additions & 6 deletions benches/benches/core/cmap2/fetch_icells.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// ------ IMPORTS

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use honeycomb::prelude::CMap2;
use honeycomb_benches::FloatType;
use honeycomb_core::cmap::CMapBuilder;
use honeycomb::core::cmap::{CMap2, CMapBuilder};

// ------ CONTENT
use honeycomb_benches::FloatType;

pub fn criterion_benchmark(c: &mut Criterion) {
let n_square = 512;
Expand Down
6 changes: 1 addition & 5 deletions benches/benches/core/cmap2/link_and_sew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@
//!
//! Each benchmark is repeated on CMap2 of different sizes.
// ------ IMPORTS

use std::hint::black_box;

use honeycomb_core::cmap::{CMap2, CMapBuilder};
use honeycomb::core::cmap::{CMap2, CMapBuilder};
use iai_callgrind::{
library_benchmark, library_benchmark_group, main, FlamegraphConfig, LibraryBenchmarkConfig,
};

use honeycomb_benches::FloatType;

// ------ CONTENT

// --- common

fn get_map(n_square: usize) -> CMap2<FloatType> {
Expand Down
5 changes: 1 addition & 4 deletions benches/benches/grisubal/grid_size.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// ------ IMPORTS

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use honeycomb::prelude::{
grisubal::{grisubal, Clip},
CMap2,
};
use honeycomb_benches::FloatType;

// ------ CONTENT
use honeycomb_benches::FloatType;

pub fn criterion_benchmark(c: &mut Criterion) {
// passing args to cargo bench filters bench instead of actually reading args;
Expand Down
5 changes: 1 addition & 4 deletions benches/benches/grisubal/time.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// ------ IMPORTS

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use honeycomb::prelude::{
grisubal::{grisubal, Clip},
CMap2,
};
use honeycomb_benches::FloatType;

// ------ CONTENT
use honeycomb_benches::FloatType;

pub fn criterion_benchmark(c: &mut Criterion) {
// passing args to cargo bench filters bench instead of actually reading args;
Expand Down
5 changes: 1 addition & 4 deletions benches/benches/triangulate/quads.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// ------ IMPORTS

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use honeycomb::prelude::{
triangulation::{earclip_cell, fan_cell, TriangulateError},
CMap2, CMapBuilder, DartIdType, Orbit2, OrbitPolicy,
};
use honeycomb_benches::FloatType;

// ------ CONTENT
use honeycomb_benches::FloatType;

const PATH: &str = "../examples/quads.vtk";

Expand Down
6 changes: 1 addition & 5 deletions honeycomb-core/src/attributes/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This module contains all code used to describe custom collections used to store attributes
//! (see [`AttributeBind`], [`AttributeUpdate`]).
// ------ IMPORTS
use num_traits::ToPrimitive;

use crate::attributes::{
AttributeBind, AttributeError, AttributeStorage, AttributeUpdate, UnknownAttributeStorage,
Expand All @@ -13,10 +13,6 @@ use crate::stm::{
abort, atomically, StmClosureResult, TVar, Transaction, TransactionClosureResult,
};

use num_traits::ToPrimitive;

// ------ CONTENT

/// Custom storage structure
///
/// **This structure is not meant to be used directly** but with the [`AttributeBind`] trait.
Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/attributes/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
//! this module contains all code used to implement a manager struct, used to handle generic
//! attributes embedded in a given combinatorial map.
// ------ IMPORTS

use std::{any::TypeId, collections::HashMap};

use crate::attributes::{
Expand All @@ -13,8 +11,6 @@ use crate::attributes::{
use crate::cmap::{DartIdType, OrbitPolicy};
use crate::stm::{StmClosureResult, Transaction, TransactionClosureResult};

// ------ CONTENT

// convenience macros

macro_rules! get_storage {
Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/attributes/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ------ IMPORTS

use std::any::Any;

use loom::sync::Arc;
Expand All @@ -14,8 +12,6 @@ use crate::{
stm::{atomically, StmError, Transaction, TransactionControl},
};

// ------ CONTENT

// --- basic structure implementation

// vertex bound
Expand Down
14 changes: 5 additions & 9 deletions honeycomb-core/src/attributes/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
//! This module contains all code used to handle attribute genericity in the context of mesh
//! representation through combinatorial maps embedded data.
// ------ IMPORTS

use crate::attributes::AttributeError;
use crate::cmap::{DartIdType, OrbitPolicy};
use crate::stm::{atomically, StmClosureResult, Transaction};
use std::any::{type_name, Any};
use std::fmt::Debug;

use downcast_rs::{impl_downcast, Downcast};
use fast_stm::TransactionClosureResult;

use std::any::{type_name, Any};
use std::fmt::Debug;

// ------ CONTENT
use crate::attributes::AttributeError;
use crate::cmap::{DartIdType, OrbitPolicy};
use crate::stm::{atomically, StmClosureResult, Transaction};

/// # Generic attribute trait
///
Expand Down
7 changes: 0 additions & 7 deletions honeycomb-core/src/cmap/builder/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
//! Builder implementation for combinatorial map structures.
// ------ MODULE DECLARATIONS

pub mod grid;
pub mod io;
pub mod structure;

// ------ RE-EXPORTS

pub use grid::GridDescriptor;
pub use structure::{BuilderError, CMapBuilder};

// ------ CONTENT

// ------ TESTS
#[cfg(test)]
mod tests;
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/builder/structure.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ------ IMPORTS

use std::fs::File;
use std::io::Read;

Expand All @@ -12,8 +10,6 @@ use crate::geometry::CoordsFloat;

use super::io::CMapFile;

// ------ CONTENT

/// # Builder-level error enum
///
/// This enum is used to describe all non-panic errors that can occur when using the builder
Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/components/betas.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
// ------ IMPORTS

use std::ops::{Index, IndexMut};

use crate::cmap::{LinkError, NULL_DART_ID};
use crate::stm::{abort, TVar, Transaction, TransactionClosureResult};

use super::identifiers::DartIdType;

// ------ CONTENT

/// Beta functions storage.
///
/// `N` is the number of beta function stored, including `B0`. This means that, for example,
Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/components/unused.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ------ IMPORTS

use std::{
ops::{Index, IndexMut},
slice::Iter,
Expand All @@ -9,8 +7,6 @@ use crate::stm::TVar;

use super::identifiers::DartIdType;

// ------ CONTENT

/// Unused dart tracking structure.
pub struct UnusedDarts(Vec<TVar<bool>>);

Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/dim2/basic_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//! - Beta function interfaces
//! - i-cell computations
// ------ IMPORTS

use std::collections::{HashSet, VecDeque};

use crate::attributes::UnknownAttributeStorage;
Expand All @@ -18,8 +16,6 @@ use crate::cmap::{
use crate::geometry::CoordsFloat;
use crate::stm::{atomically, StmClosureResult, Transaction};

// ------ CONTENT

/// **Dart-related methods**
impl<T: CoordsFloat> CMap2<T> {
// --- read
Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/dim2/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
//! map. This includes operations regarding vertices as well as (in the future) user-defined
//! generic attributes
// ------ IMPORT

use crate::cmap::{CMap2, VertexIdType};
use crate::stm::{StmClosureResult, Transaction};
use crate::{
attributes::{AttributeBind, AttributeStorage, AttributeUpdate, UnknownAttributeStorage},
geometry::{CoordsFloat, Vertex2},
};

// ------ CONTENT

/// **Built-in vertex-related methods**
impl<T: CoordsFloat> CMap2<T> {
/// Return the current number of vertices.
Expand Down
6 changes: 0 additions & 6 deletions honeycomb-core/src/cmap/dim2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//! The definitions are re-exported, direct interaction with this module
//! should be minimal, if existing at all.
// ------ MODULE DECLARATIONS

pub mod basic_ops;
pub mod embed;
pub mod links;
Expand All @@ -16,13 +14,9 @@ pub mod sews;
pub mod structure;
pub mod utils;

// ------ CONTENT

/// Number of beta functions defined for [`CMap2`].
const CMAP2_BETA: usize = 3;

// ------ TESTS

#[allow(unused_mut)]
#[cfg(test)]
mod tests;
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/dim2/orbits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
//! This module contains all code used to model orbits, a notion defined
//! along the structure of combinatorial maps.
// ------ IMPORTS

use std::collections::{BTreeSet, VecDeque};

use crate::cmap::{CMap2, DartIdType, OrbitPolicy, NULL_DART_ID};
use crate::geometry::CoordsFloat;

// ------ CONTENT

/// # Generic 2D orbit implementation
///
/// This structure only contains meta-data about the orbit in its initial state. All the darts
Expand Down
4 changes: 0 additions & 4 deletions honeycomb-core/src/cmap/dim2/structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
//! This module contains the main structure definition ([`CMap2`]) as well as its constructor
//! implementation.
// ------ IMPORTS

use crate::attributes::{AttrSparseVec, AttrStorageManager, UnknownAttributeStorage};
use crate::cmap::components::{betas::BetaFunctions, unused::UnusedDarts};
use crate::geometry::{CoordsFloat, Vertex2};

use super::CMAP2_BETA;

// ------ CONTENT

/// # 2D combinatorial map implementation
///
/// Information regarding maps can be found in the [user guide][UG].
Expand Down
Loading

0 comments on commit 99f3b5d

Please sign in to comment.