LCOV - code coverage report
Current view: top level - src - formats.jl (source / functions) Hit Total Coverage
Test: on branch nothing Lines: 5 9 55.6 %
Date: 2025-07-10 13:29:30 Functions: 0 0 -

          Line data    Source code
       1             : """
       2             : Mesh formats.
       3             : 
       4             : Subtypes include
       5             : 
       6             : - `OBJ` [Wavefront OBJ](https://paulbourke.net/dataformats/obj/) possibly with
       7             :   [vertex color](https://paulbourke.net/dataformats/obj/colour.html)
       8             : - `OFF` [OFF format](https://paulbourke.net/dataformats/off/index.html)
       9             : - `UnknownFormat` possibly delegate to [MeshIO](https://github.com/JuliaIO/MeshIO.jl
      10             : 
      11             : See also [`meshformat`](@ref)
      12             : """
      13             : abstract type AbstractMeshFormat end
      14             : 
      15           2 : struct OBJ <: AbstractMeshFormat end
      16             : 
      17             : struct OFF <: AbstractMeshFormat end
      18             : 
      19             : struct UnknownMeshFormat <: AbstractMeshFormat
      20           8 :     ext::AbstractString
      21             : end
      22             : 
      23             : const MESH_FORMATS = Dict(".obj" => OBJ(),
      24             :                           ".off" => OFF())
      25             : 
      26             : """
      27             :     format = meshformat(path)
      28             : 
      29             : Get [`AbstractMeshFormat`](@ref) from file name extension of `path`.
      30             : Ignores extensions from file compression, e.g., `.gz`.
      31             : 
      32             : See also [`AbstractMeshFormat`](@ref)
      33             : """
      34           8 : function meshformat(path)
      35          16 :     file, ext, _ = IOUtilities.splitrealext(path)
      36             : 
      37          16 :     get(MESH_FORMATS, ext, UnknownMeshFormat(ext))
      38             : end
      39             : 
      40             : """
      41             : Error if no [`AbstractMeshFormat`](@ref) is found.
      42             : """
      43           0 : function readmesh(io::IO, f::UnknownMeshFormat, template::Mesh; kargs...)
      44             :     # TODO: try delegation to MeshIO
      45           0 :     error("unknown mesh format $(f.ext)")
      46             : end
      47             : 
      48             : """
      49             : Error if no [`AbstractMeshFormat`](@ref) is found.
      50             : """
      51           0 : function writemesh(io::IO, f::UnknownMeshFormat, mesh::Mesh; kargs...)
      52             :     # TODO: try delegation to MeshIO
      53           0 :     error("unknown mesh format $(f.ext)")
      54             : end

Generated by: LCOV version 1.16