Index: /issm/trunk/src/m/classes/public/BasinConstrain.m
===================================================================
--- /issm/trunk/src/m/classes/public/BasinConstrain.m	(revision 1238)
+++ /issm/trunk/src/m/classes/public/BasinConstrain.m	(revision 1239)
@@ -12,7 +12,36 @@
 %   Example:
 %      md=BasinConstrain(md,'DomainOutline.exp');
+%      md=BasinConstrain(md,'~Iceshelves.exp');
 
 %now, flag grids and elements outside the domain outline.
-[gridondomain elementondomain]=ContourToMesh(md.elements,md.x,md.y,expread(domain,1),'element and node',2);
+if ischar(domain),
+	if isempty(domain),
+		elementondomain=zeros(md.numberofelements,1);
+		gridondomain=zeros(md.numberofgrids,1);
+		invert=0;
+	elseif strcmpi(domain,'all')
+		elementondomain=ones(md.numberofelements,1);
+		gridondomain=ones(md.numberofgrids,1);
+		invert=0;
+	else
+		%make sure that we actually don't want the elements outside the domain outline!
+		if strcmpi(domain(1),'~'),
+			domain=domain(2:length(domain));
+			invert=1;
+		else
+			invert=0;
+		end
+		%ok, flag elements and nodes
+		[gridondomain elementondomain]=ContourToMesh(md.elements,md.x,md.y,expread(domain,1),'element and node',2);
+	end
+	if invert,
+		gridondomain=~gridondomain;
+		elementondomain=~elementondomain;
+	end
+else
+	error('BasinConstrain error message: domain type not supported yet');
+end
+
+%list of elements and nodes not on domain
 gridnotondomain=find(~gridondomain);
 elementnotondomain=find(~elementondomain);
