Index: /issm/trunk-jpl/src/m/mesh/augment2dmesh.m
===================================================================
--- /issm/trunk-jpl/src/m/mesh/augment2dmesh.m	(revision 20108)
+++ /issm/trunk-jpl/src/m/mesh/augment2dmesh.m	(revision 20109)
@@ -12,27 +12,26 @@
 options=pairoptions(varargin{:});
 
-%Offset the mesh2 elements: 
+%Offset the mesh band elements: 
 mhband.elements=mhband.elements+mh.numberofvertices;
 mhband.segments(:,1:2)=mhband.segments(:,1:2)+mh.numberofvertices;
 mhband.segments(:,3)=mhband.segments(:,3)+mh.numberofelements;
 
-%The innner segment of md2 and the outer segments of md1 are identical. Go into  the elements of 
-%md2 and set them to their md1 equivalent: 
-flag=0;
-if flag,
-	for i=1:length(mhband.segments),
-		node2=mhband.segments(i,1);
-		%this node2 has an equivalent on the segments  of md1: 
-		for j=1:length(mh.segments),
-			node1=mh.segments(j,1);
-			if mhband.x(node2-mh.numberofvertices) == mh.x(node1) &&  mhband.y(node2-mh.numberofvertices) == mh.y(node1),
-				%go into the mesh of md2, and replace by node1.
-				pos=find(mhband.elements==node2); mhband.elements(pos)=node1;
-				segs=mhband.segments(:,1:2); pos=find(segs==node2); segs(pos)=node1; mhband.segments(:,1:2)=segs;
-				break;
-			end
+%The innner segments of mhband and the outer segments of mh are identical. Go into  the elements of 
+%mhband and set them to their md1 equivalent: 
+tol=1; %1 meter 
+for i=1:length(mhband.segments),
+	node2=mhband.segments(i,1);
+	%this node2 has an equivalent on the segments  of mdh: 
+	for j=1:length(mh.segments),
+		node1=mh.segments(j,1);
+		%if mhband.x(node2-mh.numberofvertices) == mh.x(node1) &&  mhband.y(node2-mh.numberofvertices) == mh.y(node1),
+		if sqrt((mhband.x(node2-mh.numberofvertices) - mh.x(node1))^2 + (mhband.y(node2-mh.numberofvertices) - mh.y(node1))^2)<tol,
+			%go into the mesh of mhband, and replace by node1.
+			pos=find(mhband.elements==node2); mhband.elements(pos)=node1;
+			segs=mhband.segments(:,1:2); pos=find(segs==node2); segs(pos)=node1; mhband.segments(:,1:2)=segs;
+			break;
 		end
 	end
-end	
+end
 
 %Do the merge: 
