API reference
InterfaceReconstructionLibrary.LVIRANeighborhoodInterfaceReconstructionLibrary.RegionInterfaceReconstructionLibrary.Vec3Base.append!Base.collectBase.resize!InterfaceReconstructionLibrary.addmember!InterfaceReconstructionLibrary.addpath!InterfaceReconstructionLibrary.addplane!InterfaceReconstructionLibrary.adjust_cap_to_match_volume!InterfaceReconstructionLibrary.at_tagInterfaceReconstructionLibrary.calculate_plane_of_existence!InterfaceReconstructionLibrary.calculate_signInterfaceReconstructionLibrary.clear!InterfaceReconstructionLibrary.connect!InterfaceReconstructionLibrary.connect!InterfaceReconstructionLibrary.connect_null!InterfaceReconstructionLibrary.crefInterfaceReconstructionLibrary.cut_volumeInterfaceReconstructionLibrary.deserializeInterfaceReconstructionLibrary.getdataInterfaceReconstructionLibrary.getidInterfaceReconstructionLibrary.getplaneInterfaceReconstructionLibrary.getptInterfaceReconstructionLibrary.getsimplexInterfaceReconstructionLibrary.importancesInterfaceReconstructionLibrary.interface_areaInterfaceReconstructionLibrary.interface_divided_polygonInterfaceReconstructionLibrary.interface_polygonInterfaceReconstructionLibrary.internal_volumeInterfaceReconstructionLibrary.is_point_internalInterfaceReconstructionLibrary.localizerInterfaceReconstructionLibrary.localizer_from_cuboidInterfaceReconstructionLibrary.locate_pointInterfaceReconstructionLibrary.match_group_volume_fraction!InterfaceReconstructionLibrary.match_volume_fraction!InterfaceReconstructionLibrary.moments!InterfaceReconstructionLibrary.moments_at_tagInterfaceReconstructionLibrary.nearest_point_on_surfaceInterfaceReconstructionLibrary.norm_moments!InterfaceReconstructionLibrary.nsimplicesInterfaceReconstructionLibrary.parametersInterfaceReconstructionLibrary.plane_of_existenceInterfaceReconstructionLibrary.print_to_screenInterfaceReconstructionLibrary.priority_orderInterfaceReconstructionLibrary.reconstruct_advected_normalsInterfaceReconstructionLibrary.reconstruct_elviraInterfaceReconstructionLibrary.reconstruct_lviraInterfaceReconstructionLibrary.reconstruct_lvira!InterfaceReconstructionLibrary.reconstruct_mofInterfaceReconstructionLibrary.reconstruct_r2pInterfaceReconstructionLibrary.reconstruct_r2p!InterfaceReconstructionLibrary.register_handle!InterfaceReconstructionLibrary.reverse_pt_ordering!InterfaceReconstructionLibrary.separated_momentsInterfaceReconstructionLibrary.serializeInterfaceReconstructionLibrary.set_center_of_stencil!InterfaceReconstructionLibrary.set_cutting_method!InterfaceReconstructionLibrary.set_importances!InterfaceReconstructionLibrary.set_minimum_surface_area_to_track!InterfaceReconstructionLibrary.set_minimum_volume_to_track!InterfaceReconstructionLibrary.set_nplanes!InterfaceReconstructionLibrary.set_plane_of_existence!InterfaceReconstructionLibrary.set_priority_order!InterfaceReconstructionLibrary.set_vf_bounds!InterfaceReconstructionLibrary.set_vf_tolerance!InterfaceReconstructionLibrary.setdata!InterfaceReconstructionLibrary.setid!InterfaceReconstructionLibrary.setmember!InterfaceReconstructionLibrary.setplane!InterfaceReconstructionLibrary.setpt!InterfaceReconstructionLibrary.verticesInterfaceReconstructionLibrary.zero_normal_component!InterfaceReconstructionLibrary.zero_polygon!InterfaceReconstructionLibrary.@wrap
InterfaceReconstructionLibrary.LVIRANeighborhood — Type
Shared supertype of the vfrac-stencil neighborhoods (enables a generic auto-guess).
InterfaceReconstructionLibrary.Region — Type
RegionWhich side of a separator a moment refers to: Internal (normal·x ≤ d) or External.
InterfaceReconstructionLibrary.Vec3 — Type
3-vector type used throughout the API for points, normals, and centroids.
Base.append! — Method
Append every moment of other to l (IRL takes other non-const).
Base.collect — Method
Copy the buffer's current contents out as a Vector{UInt8}.
Base.resize! — Method
resize!(b::ByteBuffer, n) -> bSet the buffer's size to n bytes. Use before unpacking into b from an external source (e.g. after an MPI receive tells you the incoming length).
InterfaceReconstructionLibrary.addmember! — Function
addmember!(neigh, cell, value) -> neighAppend a stencil member (assigned the next 0-based index in insertion order).
InterfaceReconstructionLibrary.addpath! — Method
addpath!(g::PlanarSeparatorPathGroup, p::PlanarSeparatorPath[, id]) -> gAdd p to the group. With id, the path is registered under that phase id (IRL's addPlanarSeparatorPath overload taking an explicit tag).
InterfaceReconstructionLibrary.addplane! — Function
addplane!(sep_or_loc, normal, distance) -> sep_or_locAppend the plane {x : normal·x = distance} (length-3 normal).
InterfaceReconstructionLibrary.adjust_cap_to_match_volume! — Function
adjust_cap_to_match_volume!(p, signed_volume) -> pMove the "cap" vertex of a capped polytope so volume(p) equals signed_volume.
This is what makes a semi-Lagrangian flux volume conservative: build the flux polyhedron from back-projected face vertices, then pin its volume to the exact face flux u·n A Δt. Available on the capped/symmetric polytopes (CappedDodecahedron*, CappedOctahedron_*, Polyhedron24*, SymmetricHexahedron, SymmetricTriangularPrism).
InterfaceReconstructionLibrary.at_tag — Method
at_tag(c::TaggedAccumulatedVolume2, tag) -> TaggedAccumulatedVolumeThe inner tag→volume map stored under region tag. Aliases into c.
InterfaceReconstructionLibrary.calculate_plane_of_existence! — Function
calculate_plane_of_existence!(p) -> pRecompute the plane of existence from the polygon's current points.
InterfaceReconstructionLibrary.calculate_sign — Function
calculate_sign(p) -> Float64Sign of the polygon's area relative to its plane of existence.
InterfaceReconstructionLibrary.clear! — Function
clear!(c) -> cDrop all entries, leaving an empty collection ready to be refilled.
InterfaceReconstructionLibrary.connect! — Function
connect!(link, edge, other) -> linkWire link's edge-th neighbour to other (0-based edge index).
InterfaceReconstructionLibrary.connect! — Method
connect!(p::PlanarSeparatorPath, other) -> pPoint p at its downstream path in the separator chain.
InterfaceReconstructionLibrary.connect_null! — Method
connect_null!(p::PlanarSeparatorPath) -> pTerminate the chain at p.
InterfaceReconstructionLibrary.cref — Method
Return the Ref{c_*} that a high-level wrapper forwards to ccall.
InterfaceReconstructionLibrary.cut_volume — Function
cut_volume(poly, sep) -> Float64Volume of poly internal to sep (the scalar getNormMoments … Vol cutters).
InterfaceReconstructionLibrary.deserialize — Method
deserialize(::Type{PlanarSeparator}, b::ByteBuffer) -> PlanarSeparatorReconstruct a PlanarSeparator from a packed buffer.
InterfaceReconstructionLibrary.getdata — Function
getdata(p, i) -> Vec3Per-vertex data 3-vector at vertex i (1-based) of a doubles3 polytope.
InterfaceReconstructionLibrary.getid — Function
getid(link) -> IntThe link's mesh id.
InterfaceReconstructionLibrary.getplane — Method
getplane(s::PlanarSeparator, i) -> (normal::Vec3, distance)The i-th plane. 1-based (Julia convention).
InterfaceReconstructionLibrary.getpt — Function
getpt(p, i) -> Vec3The i-th defining point of a polytope. 1-based (Julia convention).
InterfaceReconstructionLibrary.getsimplex — Function
getsimplex(p, i) -> TriangleThe i-th triangle (1-based) of the simplex decomposition.
InterfaceReconstructionLibrary.importances — Method
importances(w::R2PWeighting) -> NamedTupleRead back the configured R2P objective weights.
InterfaceReconstructionLibrary.interface_area — Method
interface_area(cell::RectangularCuboid, sep::PlanarSeparator) -> Float64Total interfacial area inside cell — summed over all of sep's planes, so unlike interface_divided_polygon this handles a two-plane (R2P) separator in one call. Zero when the cell holds no interface.
InterfaceReconstructionLibrary.interface_divided_polygon — Method
interface_divided_polygon(cell::RectangularCuboid, sep; plane = 1) -> DividedPolygonAs interface_polygon, but returns the triangulated form — the one that carries surface_area.
InterfaceReconstructionLibrary.interface_polygon — Function
interface_polygon(cell, sep::PlanarSeparator; plane = 1) -> PolygonThe polygon where sep's plane-th interface plane (1-based) cuts cell.
Cells: RectangularCuboid, Tet, Hexahedron. Returns an empty polygon (npts == 0) when the plane misses the cell — a cell that is entirely liquid or entirely gas has no interface. The result's plane of existence is set, so volume (signed area), centroid, and normal are immediately valid.
InterfaceReconstructionLibrary.internal_volume — Function
internal_volume(poly, sep) -> Float64Alias of cut_volume: the volume of poly on the internal side of sep.
InterfaceReconstructionLibrary.is_point_internal — Function
is_point_internal(pt, sep::PlanarSeparator) -> Bool
is_point_internal(pt, loc::PlanarLocalizer) -> BoolWhether pt lies on the internal side of every plane — inside the separator's liquid region, or inside the localizer's cell.
InterfaceReconstructionLibrary.localizer — Function
localizer(p) -> PlanarLocalizerA localizer bounding the polygon (its plane plus its edge planes).
InterfaceReconstructionLibrary.localizer_from_cuboid — Method
localizer_from_cuboid(lower, upper) -> PlanarLocalizerA localizer whose six planes bound the axis-aligned box [lower, upper].
InterfaceReconstructionLibrary.locate_point — Function
locate_point(pt, link) -> IntWalk the link graph from link and return the id of the node whose localizer contains pt (the id set with setid!).
This is the lookup a semi-Lagrangian scheme needs after back-projecting a point: given a departure point, which cell did it come from? Works on LocalizedSeparatorLink and LocalizedSeparatorGroupLink. The walk starts at link, so pass a node near pt to keep it short.
At each node IRL steps to neighbour(n) for the first plane n that pt lies outside of. If that neighbour was never connected, IRL dereferences a null pointer — its only guard is an assert, which a Release build of libirl_c compiles out, so the result is a segfault, not an exception. Every link on the path from link to pt's cell must be wired with connect!, and pt must lie inside the connected region.
For a localizer built by localizer_from_cuboid the edge index is the plane index, ordered -x, +x, -y, +y, -z, +z — so a cell's +x neighbour is edge 1, not 0.
InterfaceReconstructionLibrary.match_group_volume_fraction! — Function
match_group_volume_fraction!(group::PlanarSeparatorPathGroup, cell, vfracs;
tolerance = nothing) -> groupMulti-phase volume-fraction matching: set every separator in group so that cell's phase fractions equal vfracs (one entry per phase, in the group's priority order). Cells: Tet, Hexahedron, Pyramid, TriangularPrism.
InterfaceReconstructionLibrary.match_volume_fraction! — Function
match_volume_fraction!(sep::PlanarSeparator, cell, vfrac; tolerance = nothing) -> sepAdjust sep's plane distance so cell's internal fraction equals vfrac. With tolerance, IRL's iterative distance search stops at that volume-fraction error instead of the library default.
InterfaceReconstructionLibrary.moments! — Function
moments!(out, poly, sep) -> outFill out with the un-normalized moments of poly cut by sep.
InterfaceReconstructionLibrary.moments_at_tag — Method
moments_at_tag(c, tag) -> SeparatedMomentsThe moments accumulated against region tag — for a flux-volume cut, the liquid and gas contributed by the donor cell with that id. Unlike c[i], the lookup is by IRL's raw tag, so you can ask for a specific donor without scanning tags(c). The result aliases into c, which it retains.
InterfaceReconstructionLibrary.nearest_point_on_surface — Method
nearest_point_on_surface(p::Polygon, pt) -> Vec3The point of p closest to pt.
InterfaceReconstructionLibrary.norm_moments! — Function
norm_moments!(out, poly, sep) -> outFill out with the normalized moments of poly cut by sep.
InterfaceReconstructionLibrary.nsimplices — Function
nsimplices(p) -> IntNumber of triangles in the polygon's simplex decomposition.
InterfaceReconstructionLibrary.parameters — Method
parameters(o::OptimizationBehavior) -> NamedTupleRead back every configured optimizer parameter.
InterfaceReconstructionLibrary.plane_of_existence — Function
plane_of_existence(p) -> (normal::Vec3, distance)The plane the polygon's points are taken to lie in.
InterfaceReconstructionLibrary.print_to_screen — Function
print_to_screen(x) -> xDump x using IRL's internal C++ printer. Output goes to the process's stdout directly, bypassing Julia's IO — it will not appear in a redirected IOBuffer. Defined for the types whose C interface provides printToScreen.
InterfaceReconstructionLibrary.priority_order — Method
priority_order(g::PlanarSeparatorPathGroup) -> Vector{Int}The group's current phase priority order, as tags.
InterfaceReconstructionLibrary.reconstruct_advected_normals — Method
reconstruct_advected_normals(moments::ListedVolumeMoments, n::R2PNeighborhood,
two_plane_threshold; debug = false) -> PlanarSeparatorReconstruct from transported interface normals rather than from volume fractions alone. moments holds the advected VolumeMomentsAndNormal entries (typically the output of a doubles3 / VMAN flux-volume cut); two_plane_threshold decides when the result becomes a two-plane (R2P) separator instead of a single plane.
InterfaceReconstructionLibrary.reconstruct_elvira — Method
reconstruct_elvira(n::ELVIRANeighborhood; dims=3) -> PlanarSeparatorELVIRA reconstruction from a stencil of liquid volume fractions.
InterfaceReconstructionLibrary.reconstruct_lvira — Function
reconstruct_lvira(neigh, guess_or_center_moments; dims=3) -> PlanarSeparatorNon-mutating LVIRA. Pass either an explicit PlanarSeparator guess, or the centre cell's SeparatedMoments — in which case IRL's barycentre initial guess (normalize(gas_centroid − liquid_centroid), then match VF) is built, exactly as IRL's own driver does. Requires set_center_of_stencil! for the latter.
InterfaceReconstructionLibrary.reconstruct_lvira! — Function
reconstruct_lvira!(guess::PlanarSeparator, neigh; dims=3) -> guessRefine guess in place via LVIRA against the neighborhood's volume fractions.
InterfaceReconstructionLibrary.reconstruct_mof — Function
reconstruct_mof(cell, moments::SeparatedMoments; dims = 3) -> PlanarSeparator
reconstruct_mof(cell, moments, w_internal, w_external; dims = 3) -> PlanarSeparatorMoment-of-Fluid reconstruction: the single-plane separator for cell whose internal region reproduces moments. The 4-arg form is the geometrically- weighted (GW) variant.
Cells depend on dims: 3D takes Tet, Hexahedron, RectangularCuboid; 2D takes RectangularCuboid and Triangle (IRL's planar MOF, which constrains the interface normal to the x–y plane).
InterfaceReconstructionLibrary.reconstruct_r2p! — Method
reconstruct_r2p!(guess::PlanarSeparator, n::R2PNeighborhood; dims=3,
weighting=nothing, behavior=nothing) -> guessR2P reconstruction — like LVIRA, an optimizer that refines an initial-guess separator in place against the neighborhood's separated moments. With a weighting::R2PWeighting (and optionally a behavior::OptimizationBehavior) the weighted 3D solver is used.
InterfaceReconstructionLibrary.reconstruct_r2p — Method
reconstruct_r2p(n::R2PNeighborhood[, guess]; dims=3, kwargs...) -> PlanarSeparatorNon-mutating R2P. With no guess, IRL's barycentre initial guess is built from the centre cell's stored moments (requires set_center_of_stencil!).
InterfaceReconstructionLibrary.register_handle! — Method
Register jl as the wrapper for C handle symbol csym (e.g. :c_Tet).
InterfaceReconstructionLibrary.reverse_pt_ordering! — Function
reverse_pt_ordering!(p) -> pReverse the vertex winding, flipping the sign of the area/normal.
InterfaceReconstructionLibrary.separated_moments — Method
separated_moments(poly, sep::PlanarSeparator) -> SeparatedMomentsCut poly by sep and return internal & external volume + centroid. Available for shapes with a *_PlanarSep_SepVM cutter (RectangularCuboid, Hexahedron, Dodecahedron).
InterfaceReconstructionLibrary.serialize — Method
serialize(sep::PlanarSeparator) -> ByteBufferPack sep into a fresh ByteBuffer (rewound and ready to read).
InterfaceReconstructionLibrary.set_center_of_stencil! — Function
set_center_of_stencil!(neigh, index) -> neighMark the centre cell by its 0-based stencil index (e.g. 13 for a 3×3×3 stencil), matching IRL.
InterfaceReconstructionLibrary.set_cutting_method! — Method
set_cutting_method!(m::CuttingMethod)Select the algorithm used by subsequent cutting calls.
InterfaceReconstructionLibrary.set_importances! — Method
set_importances!(w::R2PWeighting; liquidvolumefraction, liquidcentroidrelativetogas,
centroid, surfacearea) -> wSet all four R2P objective weights at once. Any omitted keyword keeps its current value.
InterfaceReconstructionLibrary.set_minimum_surface_area_to_track! — Method
set_minimum_surface_area_to_track!(area) -> areaAs set_minimum_volume_to_track!, for interface surface area.
InterfaceReconstructionLibrary.set_minimum_volume_to_track! — Method
set_minimum_volume_to_track!(vol) -> volCut regions smaller than vol are discarded rather than accumulated. Guards the tagged-accumulation collections against filling with numerical dust.
InterfaceReconstructionLibrary.set_nplanes! — Function
set_nplanes!(sep_or_loc, n) -> sep_or_locResize the plane list to n. Newly exposed planes are uninitialised — set each with setplane! before use.
InterfaceReconstructionLibrary.set_plane_of_existence! — Function
set_plane_of_existence!(p, normal, distance) -> pAssert the polygon's plane of existence instead of deriving it from the points.
InterfaceReconstructionLibrary.set_priority_order! — Method
set_priority_order!(g::PlanarSeparatorPathGroup, tags) -> gSet the order in which the group's phases are resolved, as a vector of phase tags (IRL's raw tag values, not 1-based positions).
InterfaceReconstructionLibrary.set_vf_bounds! — Method
set_vf_bounds!(low) -> lowVolume fractions below low (or above 1 - low) are snapped to pure gas / pure liquid, so a cell never carries a sliver of the other phase.
InterfaceReconstructionLibrary.set_vf_tolerance! — Method
set_vf_tolerance!(tol) -> tolConvergence tolerance for IRL's iterative distance finding — how exactly match_volume_fraction! must hit its target fraction.
InterfaceReconstructionLibrary.setdata! — Function
setdata!(p, i, d) -> pSet the per-vertex data 3-vector at vertex i (1-based).
InterfaceReconstructionLibrary.setid! — Function
setid!(link, id) -> linkAssign the link's mesh id.
InterfaceReconstructionLibrary.setmember! — Function
setmember!(neigh, index_or_ijk..., cell, value) -> neighPlace a stencil member. Stencil indices are 0-based (IRL convention): a linear index in 0:N-1 for LVIRA/R2P, or (i, j, k) ∈ {-1,0,1} for ELVIRA.
InterfaceReconstructionLibrary.setplane! — Function
setplane!(sep_or_loc, i, normal, distance) -> sep_or_locOverwrite the i-th plane (1-based) in place, rather than appending as addplane! does. The plane count must already cover i — grow it first with set_nplanes!. Reusing a separator this way avoids reallocating one per cell per timestep.
InterfaceReconstructionLibrary.setpt! — Function
setpt!(p, i, pt) -> pOverwrite vertex i (1-based) in place. Defined for the polytopes whose C interface exposes a point setter (Polyhedron24, and the doubles3 types) — useful to avoid reallocating a flux volume every timestep.
InterfaceReconstructionLibrary.vertices — Function
vertices(p) -> Matrix{Float64}All defining points as a 3×N matrix (columns = vertices). Uses IRL's bulk getVertices where available; falls back to repeated getpt.
InterfaceReconstructionLibrary.zero_normal_component! — Method
zero_normal_component!(l::ListedVolumeMoments, i) -> lZero the i-th entry's normal (1-based) — used to drop a spurious plane before feeding the list to reconstruct_advected_normals.
InterfaceReconstructionLibrary.zero_polygon! — Function
zero_polygon!(p) -> pDrop all points, leaving an empty polygon.
InterfaceReconstructionLibrary.@wrap — Macro
@wrap JuliaName c_prefixDefine mutable struct JuliaName wrapping Ref{c_prefix} with a zero-argument constructor that calls c_prefix_new, a finalizer calling c_prefix_delete, and registration in _JLTYPE. Zero-arg construction fits the many IRL objects that are created empty and then filled by a cutter.