Input and output

Briareus.read_beam_table — Method
read_beam_table(path; columns = Dict(), scale = Dict(), defaults = (;), template = nothing)
    -> Vector{Beam}

Read beams from a CSV. Canonical column names (see write_beam_table) are recognized case-insensitively; columns maps a canonical field to the file's column name for foreign tables, e.g. Dict(:aim_x => "X (cm)", :theta => "Theta"), and scale multiplies a field after reading, e.g. Dict(:aim_x => 10, :aim_y => 10, :aim_z => 10) for cm → mm. Fields missing from the file come from defaults (a NamedTuple of canonical fields), or — when template is a beam vector — from the template beam with the same name (so a pointing table can update a facility beam set), else from the Beam defaults.

source
Briareus.read_csv — Method
read_csv(path; comment = '#') -> (header::Vector{String}, rows::Vector{Vector{String}})

Minimal CSV reader (quoted fields, "" escapes, comment and blank lines skipped). Tab- or semicolon-separated files are detected from the header line.

source
Briareus.read_stl — Method
read_stl(path; scale = 1.0) -> Mesh

Triangle mesh from an STL file (binary or ASCII), one patch per facet, with vertex coordinates multiplied by scale (STL carries no units: 1 for millimetres, 10 for centimetres, 25.4 for inches). Facet normals in the file are ignored; the winding decides the front side, as STL specifies (counterclockwise seen from outside), but exported CAD often mixes windings: pass the mesh through orient_mesh, and through coarsen_mesh before view factors.

All facets of the file go into one mesh, also when an ASCII file holds several solid … endsolid blocks (one per CAD body, as many exporters write them); read_stl_solids keeps them apart. A binary file is recognized by its size (84 + 50n bytes for the n facets its header announces), so binary files whose header begins with "solid" (as SolidWorks writes them) read as binary. ASCII keywords are read in any case, with any whitespace and line endings.

source
Briareus.read_stl_solids — Method
read_stl_solids(path; scale = 1.0) -> Vector{Pair{String,Mesh}}

The solids of an STL file as name => mesh pairs in file order, each mesh as read_stl reads it (one patch per facet, coordinates multiplied by scale). An ASCII file gives one pair per solid <name> … endsolid block, named by the rest of its solid line ("solid<k>" for the k-th solid when that is blank; repeated names are kept as they are), and an empty solid gives an empty mesh. A binary file has no solids: it gives one pair named after the file. To build a target from the parts, e.g. Target([Component(n, orient_mesh(m), gold()) for (n, m) in read_stl_solids(path)]).

source
Briareus.write_beam_table — Method
write_beam_table(path, beams) -> path

Write beams as CSV with the canonical columns name, quad, group, theta, phi, power, aim_x, aim_y, aim_z, defocus, spot_a, spot_b, spot_order, spot_angle, spot_halo, spot_halo_scale, spot_halo_order, fnumber, wavelength, dlambda (mm, TW, degrees, µm, Å). Hohlraum-cylindrical aim coordinates aim_r (toward the port azimuth), aim_phi_offset (tangential) are appended for reference.

source
Briareus.write_element_table — Method
write_element_table(path, target, fields...; elems = all) -> path

Per-element CSV: index, component, side, centroid (mm), normal, area (mm²), polar and azimuthal angle of the centroid (degrees, about TCC), then one column per name => values pair in fields (e.g. :H => sol.H, :laser => laser_flux(dep, t)).

source
Briareus.write_moments — Method
write_moments(path, moments; label = "a") -> path

Write Legendre moments aₗ and aₗ/a₀ (vector) or a time history (matrix (lmax+1) × nt with times) as CSV.

source
Briareus.write_results — Method
write_results(dir, target, dep; sol = nothing, beams = nothing, observe = nothing,
              lmax = 8) -> Vector{String}

Write a calculation's results to the folder dir as CSV files, for postprocessing or comparison with another code, and return their paths:

  • elements.csv — per element (write_element_table): absorbed laser power (TW) and intensity (W/cm²), and with a radiosity solution sol the x-ray source, radiosity and incident flux (W/cm²), albedo and transmitted fraction;
  • components.csv — per component: absorbed laser power (TW, front and the unmodeled back side), and with sol the x-ray power absorbed, escaped (apertures) and transmitted (thin foils, gaps) from energy_balance;
  • beams.csv — with beams (in the deposition's order): each beam's name, port angles, delivered and landed power (TW);
  • legendre.csv and ylm.csv — with observe (component names) and sol: the Legendre moments aₗ (write_moments) and the real spherical-harmonic coefficients c_lm of the observed incident flux, with their ratios to the mean term;
  • summary.txt — totals (delivered, landed, missed; x-ray source, lost).
source
Briareus.write_stl — Method
write_stl(path, x; binary = true, scale = 1.0, apertures = true, name = "briareus") -> path

Write x as an STL file for CAD or another code: a Mesh, a Component, a Target, or a vector of components or of name => mesh pairs. Every triangle becomes a facet whose normal is computed from its winding (the front side); vertex coordinates are divided by scale (STL carries no units: 1 writes millimetres, 10 centimetres, 25.4 inches), so read_stl(path; scale) reads the same geometry back.

binary = true writes binary STL (Float32 coordinates, so a coordinate of size L moves by up to ~6e-8 L; no names: the header lists them). binary = false writes ASCII STL with one solid <name> … endsolid <name> block per component (or pair), in order, at full Float64 precision; read_stl_solids reads them back as named parts (whitespace in a name is written as _). A mesh alone is named name.

A two-sided component is written once, wound toward its front side. Apertures (laser entrance holes and other open windows, transparent to light) are written as their own solids so a CAD user sees them; pass apertures = false to leave them out, e.g. for a code that would take every facet for a wall. A component's exact CurvedSurface is not written, only its facets, and the patch structure is lost (read_stl returns one patch per triangle).

source