STL in, STL out
ASCII or binary, format detected, NaN and Inf rejected with a status; analyze gives the box, volume, centroid, connectivity, shells and bodies.
I/O and analysis
The geometry of complex bodies for simulation codes, in pure Fortran: triangulated surfaces and 2-D curves read and repaired, signed distances and level sets, immersed-boundary queries, AMR tagging, exact cut cells and moving bodies, on the CPU or bit-exact on the GPU.
Load a body, read what FOSSIL computed about it, save it (the first chapter of the tutorial):
!< Tutorial 1: load an STL surface, read what analyze computed, save it.
program tut01_first_surface
use fossil, only : surface_stl_object
use penf, only : I4P, R8P
use vecfor, only : vector_R8P
implicit none
type(surface_stl_object) :: surface
type(vector_R8P) :: bmin, bmax
call surface%load_from_file(file_name='dragon.stl', guess_format=.true.) ! analyze runs inside
bmin = surface%get_bmin() ; bmax = surface%get_bmax()
print '(A,I0)', 'facets ', surface%get_facets_number()
print '(A,3F10.4)', 'box min ', bmin%x, bmin%y, bmin%z
print '(A,3F10.4)', 'box max ', bmax%x, bmax%y, bmax%z
print '(A,F12.4)', 'volume ', surface%get_volume()
print '(A,L1,A,L1)', 'watertight ', surface%is_watertight(), ' manifold ', surface%is_manifold()
call surface%save_into_file(file_name='dragon-ascii.stl', is_ascii=.true.)
print '(A)', 'saved dragon-ascii.stl'
endprogram tut01_first_surface$ tut01_first_surface
facets 6588
box min -10.8287 -4.1883 5.2821
box max 9.6461 4.9512 19.7413
volume 465.9287
watertight F manifold F
saved dragon-ascii.stlThe dragon is neither watertight nor manifold as loaded: chapter 2 repairs it. Start with the tutorial, or look up a task in the cookbook.
A NACA 0012 section pitching and translating through a Cartesian grid, every frame computed by FOSSIL: its exact cut cells and the level sets of its signed distance, with the pose passed to the query instead of rebuilding the tree.
Every figure and every program of the tutorial and of the cookbook is computed and run by scripts/docs_examples.sh: the outputs above are captured, not typed.
FOSSIL is distributed under a multi-licensing system: GPL v3 for FOSS projects, BSD 2-Clause, BSD 3-Clause or MIT for closed-source or commercial ones.