STL I/O
Load and save ASCII or binary STL files. Format is auto-detected; bad input (NaN/Inf coordinates) is rejected via a status code.
A pure Fortran 2003+ OOP library for reading, writing, and manipulating STL mesh files.
FOSSIL ships a focused subset of the libigl / CGAL geometry-processing toolkit, drawn directly from the standard references in the field:
H n = (1/2) M⁻¹ L V. Meyer et al. 2003.Each algorithm has a dedicated page with a CFD-relevant motivation, a worked Fortran example, and an honest list of known limitations.
Load an STL file, print its statistics, and translate it:
use fossil
use penf, only: R8P
use vecfor, only: ex_R8P
type(surface_stl_object) :: surface
real(R8P) :: d
! Load (ASCII or binary, auto-detected) and run the full repair pipeline.
call surface%load_from_file(file_name='cube.stl', guess_format=.true.)
call surface%sanitize
print '(A)', surface%statistics()
! Signed distance — SAH BVH + pseudo-normal sign by default.
d = surface%distance(point=2.0_R8P * ex_R8P, is_signed=.true., is_square_root=.true.)
print '(A,ES12.5)', 'signed distance = ', d
! Translate and save.
call surface%translate(x=1.0_R8P, y=2.0_R8P, z=0.5_R8P)
call surface%save_into_file(file_name='cube-moved.stl')Stefano Zaghi · stefano.zaghi@cnr.it
Chief Yak Shaver, Accidental Research Scientist, and HPC Farmer — CFD researcher who decided that one more day debugging Fortran build systems was one day too many, opened a Python REPL "just to prototype," and now finds himself maintaining a meshing library, a chimera assembler, an MPI load balancer, and the seven blog tabs he keeps meaning to read.
Claude (Anthropic)
Omniscient Code Oracle & Tireless Rubber Duck — AI pair programmer, responsible for writing the boring parts so humans don't have to.
Contributions are welcome — see the Contributing page.
FOSSIL is distributed under a multi-licensing system:
| Use case | License |
|---|---|
| FOSS projects | GPL v3 |
| Closed source / commercial | BSD 2-Clause |
| Closed source / commercial | BSD 3-Clause |
| Closed source / commercial | MIT |
Anyone interested in using, developing, or contributing to FOSSIL is welcome — pick the license that best fits your needs.