Changeset 22296
- Timestamp:
- 12/21/17 14:58:51 (7 years ago)
- Location:
- issm/trunk-jpl/src/m/classes
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/m/classes/model.m ¶
r22194 r22296 128 128 %2016 October 11 129 129 if isa(md.esa,'double'); md.esa=esa(); end 130 %2017 Dec 21st (needs to be here) 131 if isempty(md.settings) 132 disp('Warning: md.settings had to be reset, make sure to adjust md.settings.output_frequency and other fields'); 133 md.settings = issmsettings(); 134 end 130 135 %2017 February 10th 131 136 if md.settings.solver_residue_threshold==0, … … 1146 1151 md.debug = debug(); 1147 1152 md.verbose = verbose(); 1148 md.settings = settings();1153 md.settings = issmsettings(); 1149 1154 md.toolkits = toolkits(); 1150 1155 md.cluster = generic(); -
TabularUnified issm/trunk-jpl/src/m/classes/qmu/continuous_design.m ¶
r13646 r22296 31 31 % 32 32 classdef continuous_design 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 % create a default object48 49 50 51 % copy the object52 53 54 55 56 57 58 59 60 61 % create the object from the input62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 % display the object139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 % collect only the variables of the appropriate class219 220 221 222 % write variables223 224 225 226 33 properties 34 descriptor=''; 35 initpt = 0.; 36 lower =-Inf; 37 upper = Inf; 38 scale_type='none'; 39 scale = 1.; 40 end 41 42 methods 43 function [cdv]=continuous_design(varargin) 44 45 switch nargin 46 47 % create a default object 48 49 case 0 50 51 % copy the object 52 53 case 1 54 if isa(varargin{1},'continuous_design') 55 cdv=varargin{1}; 56 else 57 error('Object ''%s'' is a ''%s'' class object, not ''%s''.',... 58 inputname(1),class(varargin{1}),'continuous_design'); 59 end 60 61 % create the object from the input 62 63 otherwise 64 asizec=num2cell(array_size(varargin{1:min(nargin,6)})); 65 cdv(asizec{:})=continuous_design; 66 clear asizec 67 68 if ischar(varargin{1}) 69 varargin{1}=cellstr(varargin{1}); 70 end 71 for i=1:numel(cdv) 72 if (numel(varargin{1}) > 1) 73 cdv(i).descriptor=varargin{1}{i}; 74 else 75 cdv(i).descriptor=[char(varargin{1}) string_dim(cdv,i,'vector')]; 76 end 77 end 78 79 if (nargin >= 2) 80 for i=1:numel(cdv) 81 if (numel(varargin{2}) > 1) 82 cdv(i).initpt =varargin{2}(i); 83 else 84 cdv(i).initpt =varargin{2}; 85 end 86 end 87 if (nargin >= 3) 88 for i=1:numel(cdv) 89 if (numel(varargin{3}) > 1) 90 cdv(i).lower =varargin{3}(i); 91 else 92 cdv(i).lower =varargin{3}; 93 end 94 end 95 if (nargin >= 4) 96 for i=1:numel(cdv) 97 if (numel(varargin{4}) > 1) 98 cdv(i).upper =varargin{4}(i); 99 else 100 cdv(i).upper =varargin{4}; 101 end 102 end 103 if (nargin >= 5) 104 if ischar(varargin{5}) 105 varargin{5}=cellstr(varargin{5}); 106 end 107 for i=1:numel(cdv) 108 if (numel(varargin{5}) > 1) 109 cdv(i).scale_type=varargin{5}{i}; 110 else 111 cdv(i).scale_type=char(varargin{5}); 112 end 113 end 114 if (nargin >= 6) 115 for i=1:numel(cdv) 116 if (numel(varargin{6}) > 1) 117 cdv(i).scale =varargin{6}(i); 118 else 119 cdv(i).scale =varargin{6}; 120 end 121 end 122 if (nargin > 6) 123 warning('continuous_design:extra_arg',... 124 'Extra arguments for object of class ''%s''.',... 125 class(cdv)); 126 end 127 end 128 end 129 end 130 end 131 end 132 end 133 134 end 135 136 function []=disp(cdv) 137 138 % display the object 139 140 disp(sprintf('\n')); 141 for i=1:numel(cdv) 142 disp(sprintf('class ''%s'' object ''%s%s'' = \n',... 143 class(cdv),inputname(1),string_dim(cdv,i))); 144 disp(sprintf(' descriptor: ''%s''' ,cdv(i).descriptor)); 145 disp(sprintf(' initpt: %g' ,cdv(i).initpt)); 146 disp(sprintf(' lower: %g' ,cdv(i).lower)); 147 disp(sprintf(' upper: %g' ,cdv(i).upper)); 148 disp(sprintf(' scale_type: ''%s''' ,cdv(i).scale_type)); 149 disp(sprintf(' scale: %g\n' ,cdv(i).scale)); 150 end 151 152 end 153 154 function [desc] =prop_desc(cdv,dstr) 155 desc=cell(1,numel(cdv)); 156 for i=1:numel(cdv) 157 if ~isempty(cdv(i).descriptor) 158 desc(i)=cellstr(cdv(i).descriptor); 159 elseif ~isempty(inputname(1)) 160 desc(i)=cellstr([inputname(1) string_dim(cdv,i,'vector')]); 161 elseif exist('dstr','var') 162 desc(i)=cellstr([dstr string_dim(cdv,i,'vector')]); 163 else 164 desc(i)=cellstr(['cdv' string_dim(cdv,i,'vector')]); 165 end 166 end 167 desc=allempty(desc); 168 end 169 function [initpt]=prop_initpt(cdv) 170 initpt=zeros(1,numel(cdv)); 171 for i=1:numel(cdv) 172 initpt(i)=cdv(i).initpt; 173 end 174 initpt=allequal(initpt,0.); 175 end 176 function [lower] =prop_lower(cdv) 177 lower=zeros(1,numel(cdv)); 178 for i=1:numel(cdv) 179 lower(i)=cdv(i).lower; 180 end 181 lower=allequal(lower,-Inf); 182 end 183 function [upper] =prop_upper(cdv) 184 upper=zeros(1,numel(cdv)); 185 for i=1:numel(cdv) 186 upper(i)=cdv(i).upper; 187 end 188 upper=allequal(upper, Inf); 189 end 190 function [mean] =prop_mean(cdv) 191 mean=[]; 192 end 193 function [stddev]=prop_stddev(cdv) 194 stddev=[]; 195 end 196 function [initst]=prop_initst(cdv) 197 initst=[]; 198 end 199 function [stype] =prop_stype(cdv) 200 stype=cell(1,numel(cdv)); 201 for i=1:numel(cdv) 202 stype(i)=cellstr(cdv(i).scale_type); 203 end 204 stype=allequal(stype,'none'); 205 end 206 function [scale] =prop_scale(cdv) 207 scale=zeros(1,numel(cdv)); 208 for i=1:numel(cdv) 209 scale(i)=cdv(i).scale; 210 end 211 scale=allequal(scale,1.); 212 end 213 end 214 215 methods (Static) 216 function []=dakota_write(fidi,dvar) 217 218 % collect only the variables of the appropriate class 219 220 cdv=struc_class(dvar,'continuous_design'); 221 222 % write variables 223 224 vlist_write(fidi,'continuous_design','cdv',cdv); 225 end 226 end 227 227 end
Note:
See TracChangeset
for help on using the changeset viewer.