Index: ../trunk-jpl/src/m/parameterization/killberg.m =================================================================== --- ../trunk-jpl/src/m/parameterization/killberg.m (revision 24110) +++ ../trunk-jpl/src/m/parameterization/killberg.m (revision 24111) @@ -16,9 +16,14 @@ mask = zeros(md.mesh.numberofvertices,1); element_flag = zeros(md.mesh.numberofelements,1); -%Step 1, go through all elements and put 1 in local_mask if the element is grounded disp('Looking for isolated patches of floating ice (icebergs)'); -isice = min(md.mask.ice_levelset(md.mesh.elements),[],2)<0; + +%do not go through elements that don't have ice, mark flag as 1 (done) +isice = min(md.mask.ice_levelset(md.mesh.elements),[],2)<0; +element_flag(find(~isice)) = 1; + +%do not go through elements that are grounded, mark flag as 1 (done) +%and initialize mask as 1 for all vertices of these elements isgrounded = max(md.mask.groundedice_levelset(md.mesh.elements),[],2)>0; pos = find(isgrounded); element_flag(pos) = 1; @@ -30,12 +35,7 @@ disp([' -- iteration ' num2str(iter)]); more = false; - pos = find(~element_flag & isice); - if numel(pos)==0 - break; - end - - for i=pos' + for i=find(~element_flag)' indices = md.mesh.elements(i,:); MAX=max(mask(indices)); if(MAX==0)