Skip to main content

Module compile

Module compile 

Source
Expand description

Mesh compilation: run the lowered DAG through a geometry backend.

Gated behind the opt-in compile feature. ADR 0004 keeps this crate a bridge, and compilation is the one narrow exception: it selects an execution provider and a memory budget, which are application policy rather than properties of the file. Nothing here is reachable in a default build.

The bridge still implements no geometry. It calls a compiler that already exists and translates the refusal into IFC terms.

§Bringing your own kernel

Every entry point is generic over [MeshCompiler], so a caller may bring CGAL, OCCT, a GPU tessellator, or a research prototype without forking this crate. Two granularities are supported:

  • Whole-kernel. Implement [MeshCompiler] over your own engine and pass it to compile_product_mesh_with. Enable compile alone and none of the reference execution path is even linked.
  • Per-area. Keep the reference compiler’s traversal and swap only the area a kernel does well, e.g. ReferenceMeshCompiler::new(MyBoolean) to replace boolean evaluation while retaining everything else. That needs the compile-reference-backend feature for the traversal.

Selection is the application’s, never the file’s: two backends given the same model must agree on what the file means, so choosing between them is a question of speed, robustness, or licence – which is why this module refuses to pick for you beyond the documented default.

§Comparing backends

Because the backend is a parameter, comparing two kernels over one corpus is a loop. The backend_compare example (source, #31) is that loop, written as a caller would: it compiles a fixed corpus of committed fixtures through the reference backend and through a small [MeshCompiler] defined in the example itself, prints wall time and mesh size per fixture keyed by BackendId, and checks that the two agree on volume, area and bounding box, listing every divergence and every refusal. Its own backend builds under compile alone. The timings carry their method and are not a cross-kernel performance claim.

cargo run --release -p ifc-geometry --features compile-reference-backend \
    --example backend_compare

Structs§

ChordDeviation
How far the exact curve may lie from its polyline, reported the way a compiled mesh’s deviation is: the chord budget asked for, and a certified upper bound on the distance from every point of the exact curve to the nearest point of the polyline, both in world units.
CompiledMesh
A compiled mesh and whether it bounds a solid.
CompiledPolyline
One curve of a representation as a 3D polyline.
ItemMesh
One leaf item of a product’s Body, meshed on its own (#656).
LayerMesh
One layer of a split Body, meshed.
LayerMeshes
A product’s Body split by a LayerCut, one mesh per layer.
NetMesh
A product’s NET mesh and the openings removed to produce it.
ProductBounds
A product’s axis-aligned bounds in world coordinates, in metres.
ProductPolylines
The curves of one product’s representation, and the items with no curve to give that were left out.
SampledArc
Where one sampled IfcArcIndex segment sits in its ring.
SampledProfileOutline
An arbitrary profile’s boundaries, arcs sampled.
SampledRing
One boundary curve as a ring of vertices.
SkippedItem
A representation item the curves reader did not lower.
Tolerance
The tolerance every entry point takes and the mesh it returns, re-exported so a caller that names no axiolid-* crate – the openbim-ifc facade and the language bindings above it (ADR 0004, #328) – can call them and read the result. Linear and angular tolerance carried with an operation.
TriMesh
Indexed triangle mesh in local coordinates.

Enums§

BoundsSource
How a product’s bounds were obtained.
MeshClosure
Whether a compiled mesh bounds a solid (#161).
NonCurveItem
A representation item with no curve to give, which the curves reader leaves to its own reader (#512).
SeamWindowRefusal
Why the kernel refused a station’s seam-snapping window (#423), or a run’s (#429).

Traits§

PolylineCompiler
Backend that compiles a curve node of a graph to a 3D polyline.

Functions§

compile_product_curves
The curves of one product’s representation for purpose, leaving its text literals and fill areas to their readers, with default_backend.
compile_product_curves_with
The curves of one product’s representation for purpose as polylines, leaving its text literals and fill areas to their readers (#512), with a caller-supplied backend.
compile_product_item_meshes
Mesh each leaf item of a product’s Body on its own, gross (#656).
compile_product_item_meshes_with
Mesh each leaf item of a product’s Body with a caller-supplied backend.
compile_product_layer_meshes
Mesh each layer of a product’s Body, split by cut (#455).
compile_product_layer_meshes_with
Mesh each layer of a product’s Body with a caller-supplied backend.
compile_product_mesh
Compile one product’s body representation into triangles.
compile_product_mesh_for
The surfaces and solids of one product’s representation for purpose as one mesh, with default_backend.
compile_product_mesh_for_with
The surfaces and solids of one product’s representation for purpose as one mesh, reporting its closure, with a caller-supplied backend.
compile_product_mesh_net
Compile one product’s Body with every voiding opening subtracted (#44).
compile_product_mesh_net_with
Compile one product’s net Body with a caller-supplied backend.
compile_product_mesh_reported
Compile one product’s body and report whether it bounds a solid.
compile_product_mesh_reported_with
Compile one product’s body with a caller-supplied backend and report whether it bounds a solid.
compile_product_mesh_with
Compile one product’s body representation with a caller-supplied backend.
compile_product_polylines
The curves of one product’s representation for purpose as polylines, with default_backend.
compile_product_polylines_with
The curves of one product’s representation for purpose as polylines, one per curve in authored order, with a caller-supplied backend.
compile_profile_outline
compile_profile_outline_with with default_backend.
compile_profile_outline_with
Read an arbitrary profile’s outline in metres, sampling each arc with backend within tolerance.
compile_sweep_directrix
compile_sweep_directrix_with with default_backend.
compile_sweep_directrix_with
sweep’s directrix as a polyline in frame, sampled by backend within tolerance.
default_backend
The backend used when a caller expresses no preference.
product_bounds
The world-space axis-aligned bounding box of one product’s body.
product_bounds_with
The world-space axis-aligned bounding box of one product’s body.

Type Aliases§

Point3
A semantic alias used when a value is a three-dimensional position.