Index: /issm/trunk/src/m/classes/public/mesh/meshadaptation.m
===================================================================
--- /issm/trunk/src/m/classes/public/mesh/meshadaptation.m	(revision 1265)
+++ /issm/trunk/src/m/classes/public/mesh/meshadaptation.m	(revision 1266)
@@ -1,3 +1,3 @@
-function md2=meshadaptation(md,field,scale,epsilon)
+function md2=meshadaptation(md,field,scale,epsilon,threshold)
 %MESHADAPTATION - remesh a model for a given field
 %
@@ -5,7 +5,8 @@
 %   scale: 1.2 large scale leads to higher refining.
 %   epsilon: .5  large epsilon will refine fewer elements
+%   threshold: value under which no refinement is done.
 %
 %   Usage:
-%      md2=meshadaptation(md,field,scale,epsilon)
+%      md2=meshadaptation(md,field,scale,epsilon,threshold)
 %
 %   Example:
@@ -29,4 +30,7 @@
 grady=zeros(numberofgrids,1);
 metric=zeros(numberofelements,1);
+
+%take the threshold, a characteristic length, and get the area equivalent threshold:
+threshold=threshold^2/2;
 
 %build some usefull variables
@@ -83,5 +87,5 @@
 
 %ok, metric can't go under 1km resolution.
-metric(find(metric<10^6))=10^6;
+metric(find(metric<threshold))=threshold;
 
 %Remesh with this new metric
