% mesh_refine.m — Changing a mesh's resolution. % % A mesh can be modified by changing the polynomial degree per patch % ("p-refinement", via resample) or by splitting patches ("h-refinement", % via refine). mip load --install flatironinstitute/flatironinstitute/surfacefun p = 16; dom = surfacemesh.sphere(p + 1, 1); figure(1); plot(dom, surface='off') title(sprintf('Original: %d patches, order %d', length(dom), order(dom))); % p-refinement: resample each patch down to 4 nodes per dimension. dom2 = resample(dom, 4); figure(2); plot(dom2, surface='off') title(sprintf('Resampled to order %d', order(dom2))); % h-refinement: split each patch into four. dom3 = refine(dom2); figure(3); plot(dom3, surface='off') title(sprintf('Refined: %d patches', length(dom3)));