You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: icosahedron.m
    path of file: ./repos/jigsaw-matlab/tools/ellipsoid
    
    the code of the file until where you have to start completion: function [mesh] = icosahedron(opts,nlev)
%ICOSAHEDRON an Nth-level icosahedral mesh of the ellipsoid
    
function [mesh] = refine (opts,nlev)

%---------------------------- call JIGSAW via inc. bisection

    opts.mesh_iter = +0;
    opts.optm_div_ = false;
    opts.optm_zip_ = false;

    for ilev = nlev : -1 : +0

        if (isfield(opts,'optm_dual'))

%---------------------------- create/write current DUAL flag
        opts.optm_dual = (ilev == +0) ;

        end