LCOV - code coverage report
Current view: top level - src - addvertex.jl (source / functions) Hit Total Coverage
Test: on branch nothing Lines: 24 24 100.0 %
Date: 2025-07-10 13:12:25 Functions: 0 0 -

          Line data    Source code
       1        5296 : addvertex!(mesh::Mesh) = addvertex!(mesh, nothing)
       2             : 
       3        5299 : function addvertex!(mesh::Mesh, ::Nothing)
       4        5299 :     v = pushattr!(vattr(mesh); use = true)
       5        5299 :     VHnd(v)
       6             : end
       7             : 
       8           4 : function addvertex!(mesh::Mesh, v::VHnd)
       9           7 :     isunusedindex(vattr(mesh), v) || return addvertex!(mesh, nothing)
      10             : 
      11           1 :     setused!(vattr(mesh), v)
      12           1 :     _sethalfedge!(mesh, v, NoH)
      13           1 :     v
      14             : end
      15             : 
      16             : """
      17             :     v = addvertex!(mesh[, v0])
      18             : 
      19             : Add new vertex and return its handle `v`.
      20             : 
      21             : If the optional hint `v0::VHnd` specifies an unused vertex,
      22             : reinitialize its attributes and "reuse" it, i.e., return `v0`.
      23             : 
      24             : See also [`addvertices!`](@ref)
      25             : """ addvertex!
      26             : 
      27          41 : function addvertices!(mesh::Mesh, n)
      28          41 :     @massert n >= 1
      29          41 :     v0 = addvertex!(mesh)
      30          41 :     for _ in 2:n
      31        5111 :         addvertex!(mesh)
      32       10181 :     end
      33          41 :     Int(v0):(Int(v0)+n-1)
      34             : end
      35             : 
      36          89 : function addvertices!(mesh::Mesh, x::Vector; attr=Val(:x))
      37          24 :     n = length(x)
      38          24 :     v = addvertices!(mesh, n)
      39             : 
      40          24 :     ax = vattr(mesh, attr)
      41          48 :     for i in v
      42         104 :         ax[VHnd(i)] = x[i]
      43         184 :     end
      44             : 
      45          24 :     v
      46             : end
      47             : 
      48             : """
      49             :     rv = addvertices!(mesh, n)
      50             :     rv = addvertices!(mesh, values[; attr=Val(:x))
      51             : 
      52             :     vs = collect(VHnd, rv)      # create Vector{VHnd}
      53             :     vs = (VHnd(v) for f in rv)  # generate VHnd from Int range
      54             : 
      55             : Add `n` or `length(values)` vertices and return range of handles to
      56             : new vertices. Given `values` are set for vertex attribute `attr`.
      57             : 
      58             : !!! note
      59             :     For convenience, `addvertices!` returns a `UnitRange{Int}` and *not*
      60             :     a generator of `VHnd`, see conversion above.
      61             : 
      62             : See also [`addvertex!`](@ref)
      63             : """ addvertices!

Generated by: LCOV version 1.16