Skip to main content

Crate gaia

Crate gaia 

Source
Expand description

§gaia

State-of-the-art watertight CFD mesh generation for millifluidic devices.

This crate provides the canonical indexed and half-edge mesh representations, a complete Boolean CSG pipeline, spatial-hash vertex welding, exact geometric predicates, manifold/watertight checking, and OpenFOAM-compatible I/O — all targeting millimetre-scale microfluidic channel geometries.

§Quick Start

// Illustrative — see MeshBuilder for the full builder API.
use gaia::MeshBuilder;
let mesh: gaia::IndexedMesh = MeshBuilder::new().build();
assert!(mesh.face_count() == 0);

§Architecture Diagram

┌─ gaia crate ─────────────────────────────────────────────────────────┐
│                                                                           │
│  Entry points                                                             │
│  ┌──────────────────┐    ┌───────────────────┐    ┌──────────────────┐   │
│  │  with_mesh(f)    │    │   MeshBuilder     │    │  csg_boolean_*   │   │
│  │  HalfEdgeMesh    │    │   IndexedMesh     │    │  CsgNode tree    │   │
│  └────────┬─────────┘    └────────┬──────────┘    └────────┬─────────┘   │
│           │                       │                         │             │
│  ┌────────▼─────────┐    ┌────────▼──────────┐   ┌────────▼──────────┐  │
│  │ permission/      │    │ storage/           │   │ csg/              │  │
│  │  GhostToken      │    │  VertexPool        │   │  BspTree          │  │
│  │  GhostCell       │    │  FaceStore         │   │  BvhTree          │  │
│  └────────┬─────────┘    │  EdgeStore         │   │  boolean pipeline │  │
│           │              └────────┬──────────┘   └───────────────────┘  │
│  ┌────────▼─────────┐            │                                       │
│  │ topology/        │    ┌────────▼──────────┐                           │
│  │  halfedge kernel │    │ geometry/          │                           │
│  │  BoundaryPatch   │    │  exact predicates  │                           │
│  │  ElementType     │    │  AABB, Plane, NURBS│                           │
│  └──────────────────┘    └───────────────────┘                           │
│                                                                           │
│  Cross-cutting: welding/  watertight/  quality/  io/  core/              │
└───────────────────────────────────────────────────────────────────────────┘

§Module Overview

ModuleContents
domain::meshHalfEdgeMesh, IndexedMesh, MeshBuilder
domain::topologyHalf-edge structures, boundary patches, element types
domain::geometryExact predicates, AABB, plane, NURBS, builders
application::welding26-neighbor SnappingGrid, SpatialHashGrid, MeshWelder
infrastructure::storageVertexPool, FaceStore, EdgeStore, SlotPool
application::watertightManifold check, Euler characteristic, repair
application::qualityTriangle quality metrics and validation reports
infrastructure::permissionGhostToken, GhostCell, PermissionedArena
coreScalar types, indices (VertexKey, VertexId, …), errors
infrastructure::ioSTL and VTK mesh I/O
application::csgBSP-tree + BVH boolean operations

§Invariants

The following mesh invariants are enforced at all API boundaries:

  1. Manifold half-edge: every interior edge is shared by exactly 2 faces; twin(twin(he)) == he and next(prev(he)) == he.
  2. Spatial deduplication: VertexPool and SnappingGrid guarantee that no two vertex positions are closer than TOLERANCE apart.
  3. Watertight closure: IndexedMesh::is_watertight() verifies zero boundary edges (every edge has exactly 2 adjacent faces).
  4. Generational key safety: VertexKey / FaceKey values are valid only within the mesh that created them; stale keys return None.

Re-exports§

pub use domain::core::error::Error;
pub use domain::core::error::ErrorContext;
pub use domain::core::error::NurbsKind;
pub use domain::core::error::Result;
pub use domain::mesh::IndexedMesh;
pub use domain::mesh::MeshBuilder;
pub use domain::mesh::TetrahedralMeshBuilder;
pub use domain::mesh::HalfEdgeMesh;
pub use domain::mesh::with_mesh;
pub use application::quality::analyze_normals;
pub use application::quality::NormalAnalysis;
pub use domain::topology::halfedge::BoundaryPatch;
pub use domain::topology::halfedge::PatchType;
pub use domain::geometry::Polyline;
pub use domain::geometry::PolylineError;
pub use domain::geometry::UnitSphereDirectionSet;
pub use domain::geometry::Orientation;
pub use domain::geometry::Ray;
pub use domain::geometry::RayError;
pub use domain::geometry::Aabb;
pub use domain::geometry::primitives;
pub use domain::geometry::Antiprism;
pub use domain::geometry::BiconcaveDisk;
pub use domain::geometry::Capsule;
pub use domain::geometry::Cone;
pub use domain::geometry::Cube;
pub use domain::geometry::Cuboctahedron;
pub use domain::geometry::Cylinder;
pub use domain::geometry::Disk;
pub use domain::geometry::Dodecahedron;
pub use domain::geometry::Elbow;
pub use domain::geometry::Ellipsoid;
pub use domain::geometry::FischerKochCySphere;
pub use domain::geometry::FrdSphere;
pub use domain::geometry::Frustum;
pub use domain::geometry::GeodesicSphere;
pub use domain::geometry::GyroidSphere;
pub use domain::geometry::HelixSweep;
pub use domain::geometry::Icosahedron;
pub use domain::geometry::IwpSphere;
pub use domain::geometry::LidinoidSphere;
pub use domain::geometry::LinearSweep;
pub use domain::geometry::NeoviusSphere;
pub use domain::geometry::Octahedron;
pub use domain::geometry::Pipe;
pub use domain::geometry::Pyramid;
pub use domain::geometry::RevolutionSweep;
pub use domain::geometry::RoundedCube;
pub use domain::geometry::SchwarzDSphere;
pub use domain::geometry::SchwarzPSphere;
pub use domain::geometry::SerpentineTube;
pub use domain::geometry::SphericalShell;
pub use domain::geometry::SplitPSphere;
pub use domain::geometry::StadiumPrism;
pub use domain::geometry::Tetrahedron;
pub use domain::geometry::Torus;
pub use domain::geometry::TruncatedIcosahedron;
pub use domain::geometry::UvSphere;
pub use application::channel::BranchingMeshBuilder;
pub use application::channel::ChannelPath;
pub use application::channel::ChannelPathError;
pub use application::channel::ChannelProfile;
pub use application::channel::SerpentineMeshBuilder;
pub use application::channel::SubstrateBuilder;
pub use application::channel::SweepError;
pub use application::channel::SweepMesher;
pub use application::channel::VenturiMeshBuilder;

Modules§

application
Application layer — use-case services that compose domain types with infrastructure to deliver CFD mesh operations.
domain
Domain layer — pure value objects, domain logic, no infrastructure dependencies.
infrastructure
Infrastructure layer — I/O adapters, storage backends, and cross-cutting technical concerns that have no domain semantics.