Ignore:
Timestamp:
06/08/20 22:58:53 (5 years ago)
Author:
Eric.Larour
Message:

CHG: more integration of partition vectors into variables. Slowly stepping
away from the qmu.vpartition vector paradigm, not yet fully though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/qmu/setupdesign/QmuSetupVariables.m

    r24870 r24988  
    99%ok, key off according to type of descriptor:
    1010if strncmp(descriptor,'scaled_',7),
    11         %we have a scaled variable, expand it over the partition.
     11        %we have a scaled variable, expand it over the partition. First recover the partition:
     12        partition=variables.partition;
     13        %figure out number of partitions:
     14        npart=qmupart2npart(partition)
    1215
    1316        if isa(variables,'uniform_uncertain'),
    14                 if (length(variables.lower)>md.qmu.numberofpartitions || length(variables.upper)>md.qmu.numberofpartitions)
    15                         error('QmuSetupDesign error message: stddev should be either a scalar or a ''npart'' length vector');
     17                nlower=length(variables.lower); nupper=length(variables.upper);
     18                if (nlower ~= npart || nupper ~=npart),
     19                        error('QmuSetupVariables error message: upper and lower fields should be same size as the number of partitions');
    1620                end
    1721        elseif isa(variables,'normal_uncertain'),
    18                 if length(variables.stddev)>md.qmu.numberofpartitions,
    19                         error('QmuSetupDesign error message: stddev should be either a scalar or a ''npart'' length vector');
     22                nstddev=length(variables.stddev);
     23                nmean=length(variables.mean);
     24                if (nstddev ~= npart || nmean ~=npart),
     25                        error('QmuSetupVariables error message: stddev and mean fields should be same size as the number of partitions');
    2026                end
    2127        end
     
    2329        %ok, dealing with semi-discrete distributed variable. Distribute according to how many
    2430        %partitions we want
    25         for j=1:md.qmu.numberofpartitions
     31        for j=1:npart,
    2632                dvar(end+1)           =variables;
    2733                dvar(end  ).descriptor=sprintf('%s_%d',variables.descriptor,j);
    2834                if isa(variables,'uniform_uncertain'),
    29                         if length(variables.lower)>1,
    30                                 dvar(end  ).lower=variables.lower(j);
    31                         end
    32                         if length(variables.upper)>1,
    33                                 dvar(end  ).upper=variables.upper(j);
    34                         end
     35                        dvar(end  ).lower=variables.lower(j);
     36                        dvar(end  ).upper=variables.upper(j);
    3537                elseif isa(variables,'normal_uncertain'),
    36                         if length(variables.stddev)>1,
    37                                 dvar(end  ).stddev=variables.stddev(j);
    38                         end
    39                         if length(variables.mean)>1,
    40                                 dvar(end  ).mean=variables.mean(j);
    41                         end
    42 
     38                        dvar(end  ).stddev=variables.stddev(j);
     39                        dvar(end  ).mean=variables.mean(j);
    4340                end
    4441        end
Note: See TracChangeset for help on using the changeset viewer.