Index: /issm/trunk-jpl/src/m/classes/qmu/histogram_bin_uncertain.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/qmu/histogram_bin_uncertain.m	(revision 25221)
+++ /issm/trunk-jpl/src/m/classes/qmu/histogram_bin_uncertain.m	(revision 25222)
@@ -1,62 +1,72 @@
 %HISTOGRAM BIN UNCERTAIN class definition
 %
-%	[hbu]=histogram_bin_uncertain(varargin)
+%	Usage: 
+%   hbu=histogram_bin_uncertain('descriptor',descriptor,'pairs_per_variable',pairs_per_variable,...
+%           'abscissas',abscissas,'counts',counts,'partition',partition)
+%      
+%      where hbu is the histogram_bin_uncertain object returned by the constructor, pairs_per_variable the 
+%      size of the histogram, 'abscissas' and 'counts' describe the histogram itself. 
+%      If the variable is distributed, then a partition vector can be supplied, which can be a 
+%      partition vector over elements or vertices. In which case counts, 
 %
-%	where the required varargin are:
-%		descriptor			(char, description, '')
-%		pairs_per_variable	(double vector, [])
-%		abscissas			(double vector, [])
-%		counts				(int vector, [])
-%
-%	NOTE: A call to the constructor with zero arguments will return a default 
-%	instance; one argument of the class copies the instance; three or more 
-%	arguments constructs a new instance from the arguments.
-%
+%   Example:
+%      md.qmu.variables.giaid=histogram_bin_uncertain('descriptor','GiammeModelId','pairs_per_variable',3,...
+%           'count',[.6 .4 0],''abscissas',[1 2 3]);
+%      md.qmu.variables.surfaceloadid=histogram_bin_uncertain(...
+%           'descriptor','distributed_SurfaceloadModelId','pairs_per_variable',[2 3 4],...
+%           'counts',{[1 0],[.6 .4 0],[.4 .4 .2 0]},...
+%           'abscissas',{[1 2],[1 2 3],[1 2 3 4]},...
+%           'partition',partition_vector);
+
 classdef histogram_bin_uncertain
 	properties
 		descriptor='';
-		pairs_per_variable=[];
-		abscissas = [];
+		pairs_per_variable={};
+		abscissas = {};
 		counts = [];
+		partition=[];
 	end
 	methods
-		function [hbu]=histogram_bin_uncertain(varargin) % {{{
-			switch nargin
-				case 0 % create a default object
-				case 1 % copy the object
-					if isa(varargin{1},'histogram_bin_uncertain')
-						hbu=varargin{1};
-					else
-						error('Object ''%s'' is a ''%s'' class object, not ''%s''.',...
-							inputname(1),class(varargin{1}),'histogram_bin_uncertain');
-					end
-				case {2,3} %  not enough arguments
-					error('Construction of ''histogram_bin_uncertain'' class object requires at least %d inputs.',4)
-				case 4 % 
-					%  create the object from the input
-					hbu = histogram_bin_uncertain; 
-					hbu.descriptor=varargin{1};
-					hbu.pairs_per_variable=varargin{2};
-					hbu.abscissas=varargin{3};
-					hbu.counts=varargin{4};
+		function self=histogram_bin_uncertain(varargin) % {{{
+		
+			%recover options:
+			options=pairoptions(varargin{:});
 
-				otherwise
-					error('Construction of histogram_bin_uncertain class object requires either (1) no arguments, (2) a histogram_bin_uncertain instance to copy from, or (3) a descriptor and pairs per variable, abscissas, and counts lists');
+			%initialize fields:
+			self.descriptor=getfieldvalue(options,'descriptor');
+			self.pairs_per_variable=getfieldvalue(options,'pairs_per_variable');
+			self.abscissas=getfieldvalue(options,'abscissas');
+			self.counts=getfieldvalue(options,'counts');
+
+			%if the variable is distributed,  a partition vector should have been 
+			%supplied, and that partition vector should have as many partitions 
+			%as the pairs_per_variable, abscissas and counts arrays: 
+			if self.isdistributed(),
+				self.partition=getfieldvalue(options,'partition');
+				npart=qmupart2npart(self.partition);
+				if npart~=length(self.pairs_per_variable),
+					error(sprintf('histogram_bin_uncertain constructor: for the distributed variable  %s the number of pairs_per_variable arrays (%i) should be equal to the number of partitions (%i)',self.descriptor,length(self.pairs_per_variable),npart));
+				end
+				if npart~=length(self.abscissas),
+					error(sprintf('histogram_bin_uncertain constructor: for the distributed variable  %s the number of abscissas arrays (%i) should be equal to the number of partitions (%i)',self.descriptor,length(self.abscissas),npart));
+				end
+				if npart~=length(self.counts),
+					error(sprintf('histogram_bin_uncertain constructor: for the distributed variable  %s the size of counts (%i) should be equal to the number of partitions (%i)',self.descriptor,length(self.counts),npart));
+				end
 			end
 		end % }}}
 		function md=checkconsistency(self,md,solution,analyses) % {{{
 		end % }}}
-		function []=disp(hbu) % {{{
-			% display the object
-			disp(sprintf('\n'));
-			for i=1:numel(hbu)
-                disp(sprintf('class ''%s'' object ''%s%s'' = \n',...
-                    class(hbu),inputname(1),string_dim(hbu,i)));
-                disp(sprintf('    descriptor: ''%s'''  ,hbu(i).descriptor));
-                disp(sprintf('          pairs_per_variable: %g'      ,hbu(i).pairs_per_variable));
-                disp(sprintf('          abscissas: %g'      ,hbu(i).abscissas));
-                disp(sprintf('        counts: %g'      ,hbu(i).counts));
-            end
-        end % }}}
+			function disp(self) % {{{
+			disp(sprintf('   histogram_bin uncertain variable: '));
+			fielddisplay(self,'descriptor','name tag');
+			fielddisplay(self,'pairs_per_variable','number of bins in histogram');
+			fielddisplay(self,'abscissas','abscissas for histogram');
+			fielddisplay(self,'counts','probabilities for histogram');
+			if ~isempty(self.partition),
+				fielddisplay(self,'partition','partition vector defining where sampling will occur');
+			end
+		end
+		%}}}
 		%virtual functions needed by qmu processing algorithms:
 		%implemented:
@@ -88,22 +98,21 @@
             upper=[];
         end % }}}
+		function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{
+			pairs_per_variable=[];
+            for i=1:numel(hbu)
+                pairs_per_variable=[pairs_per_variable hbu(i).pairs_per_variable];
+            end
+        end % }}}
 		function [abscissas]=prop_abscissas(hbu) % {{{
 			abscissas=[]; 
 			for i=1:numel(hbu)
-				abscissas=[abscissas hbu(i).abscissas];
+				abscissas=[abscissas hbu(i).abscissas'];
 			end
 			abscissas=allequal(abscissas,-Inf);
 		end % }}}
-		function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{
-			pairs_per_variable=zeros(1,numel(hbu));
-            for i=1:numel(hbu)
-                pairs_per_variable(i)=hbu(i).pairs_per_variable;
-            end
-            pairs_per_variable=allequal(pairs_per_variable,-Inf);
-        end % }}}
    		function [counts] =prop_counts(hbu) % {{{
 			counts=[]; 
 			for i=1:numel(hbu)
-				counts=[counts hbu(i).counts];
+				counts=[counts hbu(i).counts'];
 			end
 			counts=allequal(counts,-Inf);
@@ -128,4 +137,11 @@
 			end
 		end % }}}
+		function distributed=isdistributed(self) % {{{
+			if strncmp(self.descriptor,'distributed_',12),
+				distributed=1;
+			else
+				distributed=0;
+			end
+		end % }}}
 	end
     methods (Static)
Index: /issm/trunk-jpl/src/m/classes/qmu/normal_uncertain.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/qmu/normal_uncertain.m	(revision 25221)
+++ /issm/trunk-jpl/src/m/classes/qmu/normal_uncertain.m	(revision 25222)
@@ -161,5 +161,12 @@
 		end % }}}
 		%new methods:
-		function scaled=isscaled(self) % {{{
+			function distributed=isdistributed(self) % {{{
+			if strncmp(self.descriptor,'distributed_',12),
+				distributed=1;
+			else
+				distributed=0;
+			end
+		end % }}}
+	function scaled=isscaled(self) % {{{
 			if strncmp(self.descriptor,'scaled_',7),
 				scaled=1;
Index: /issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.m	(revision 25221)
+++ /issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.m	(revision 25222)
@@ -164,5 +164,12 @@
 		end % }}}
 		%new methods: 
-		function scaled=isscaled(self) % {{{
+			function distributed=isdistributed(self) % {{{
+			if strncmp(self.descriptor,'distributed_',12),
+				distributed=1;
+			else
+				distributed=0;
+			end
+		end % }}}
+	function scaled=isscaled(self) % {{{
 			if strncmp(self.descriptor,'scaled_',7),
 				scaled=1;
