[22755] | 1 | Index: ../trunk-jpl/src/m/classes/settings.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/classes/settings.m (revision 22295)
|
---|
| 4 | +++ ../trunk-jpl/src/m/classes/settings.m (nonexistent)
|
---|
| 5 | @@ -1,110 +0,0 @@
|
---|
| 6 | -%SETTINGS class definition
|
---|
| 7 | -%
|
---|
| 8 | -% Usage:
|
---|
| 9 | -% settings=settings();
|
---|
| 10 | -
|
---|
| 11 | -classdef settings
|
---|
| 12 | - properties (SetAccess=public)
|
---|
| 13 | - results_on_nodes = 0;
|
---|
| 14 | - io_gather = 0;
|
---|
| 15 | - lowmem = 0;
|
---|
| 16 | - output_frequency = 0;
|
---|
| 17 | - recording_frequency = 0;
|
---|
| 18 | - waitonlock = 0;
|
---|
| 19 | - upload_server = '';
|
---|
| 20 | - upload_path = '';
|
---|
| 21 | - upload_login = '';
|
---|
| 22 | - upload_port = 0;
|
---|
| 23 | - upload_filename = '';
|
---|
| 24 | - solver_residue_threshold = 0;
|
---|
| 25 | - end
|
---|
| 26 | - methods
|
---|
| 27 | - function self = settings(varargin) % {{{
|
---|
| 28 | - switch nargin
|
---|
| 29 | - case 0
|
---|
| 30 | - self=setdefaultparameters(self);
|
---|
| 31 | - otherwise
|
---|
| 32 | - error('constructor not supported');
|
---|
| 33 | - end
|
---|
| 34 | - end % }}}
|
---|
| 35 | - function self = setdefaultparameters(self) % {{{
|
---|
| 36 | -
|
---|
| 37 | - %are we short in memory ? (0 faster but requires more memory)
|
---|
| 38 | - self.lowmem=0;
|
---|
| 39 | -
|
---|
| 40 | - %i/o:
|
---|
| 41 | - self.io_gather=1;
|
---|
| 42 | -
|
---|
| 43 | - %results frequency by default every step
|
---|
| 44 | - self.output_frequency=1;
|
---|
| 45 | -
|
---|
| 46 | - %checkpoints frequency, by default never:
|
---|
| 47 | - self.recording_frequency=0;
|
---|
| 48 | -
|
---|
| 49 | - %this option can be activated to load automatically the results
|
---|
| 50 | - %onto the model after a parallel run by waiting for the lock file
|
---|
| 51 | - %N minutes that is generated once the solution has converged
|
---|
| 52 | - %0 to deactivate
|
---|
| 53 | - self.waitonlock=Inf;
|
---|
| 54 | -
|
---|
| 55 | - %upload options:
|
---|
| 56 | - self.upload_port = 0;
|
---|
| 57 | -
|
---|
| 58 | - %throw an error if solver residue exceeds this value
|
---|
| 59 | - self.solver_residue_threshold = 1e-6;
|
---|
| 60 | -
|
---|
| 61 | - end % }}}
|
---|
| 62 | - function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 63 | -
|
---|
| 64 | - md = checkfield(md,'fieldname','settings.results_on_nodes','numel',[1],'values',[0 1]);
|
---|
| 65 | - md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0 1]);
|
---|
| 66 | - md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0 1]);
|
---|
| 67 | - md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
|
---|
| 68 | - md = checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0);
|
---|
| 69 | - md = checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
|
---|
| 70 | - md = checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
|
---|
| 71 | -
|
---|
| 72 | - end % }}}
|
---|
| 73 | - function disp(self) % {{{
|
---|
| 74 | - disp(sprintf(' general settings parameters:'));
|
---|
| 75 | -
|
---|
| 76 | - fielddisplay(self,'results_on_nodes','results are output for all the nodes of each element');
|
---|
| 77 | - fielddisplay(self,'io_gather','I/O gathering strategy for result outputs (default 1)');
|
---|
| 78 | - fielddisplay(self,'lowmem','is the memory limited ? (0 or 1)');
|
---|
| 79 | - fielddisplay(self,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
|
---|
| 80 | - fielddisplay(self,'recording_frequency','frequency at which the runs are being recorded, allowing for a restart');
|
---|
| 81 | - fielddisplay(self,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
|
---|
| 82 | - fielddisplay(self,'upload_server','server hostname where model should be uploaded');
|
---|
| 83 | - fielddisplay(self,'upload_path','path on server where model should be uploaded');
|
---|
| 84 | - fielddisplay(self,'upload_login','server login');
|
---|
| 85 | - fielddisplay(self,'upload_port','port login (default is 0)');
|
---|
| 86 | - fielddisplay(self,'upload_filename','unique id generated when uploading the file to server');
|
---|
| 87 | - fielddisplay(self,'solver_residue_threshold','throw an error if solver residue exceeds this value (NaN to deactivate)');
|
---|
| 88 | -
|
---|
| 89 | - end % }}}
|
---|
| 90 | - function marshall(self,prefix,md,fid) % {{{
|
---|
| 91 | - WriteData(fid,prefix,'object',self,'fieldname','results_on_nodes','format','Boolean');
|
---|
| 92 | - WriteData(fid,prefix,'object',self,'fieldname','io_gather','format','Boolean');
|
---|
| 93 | - WriteData(fid,prefix,'object',self,'fieldname','lowmem','format','Boolean');
|
---|
| 94 | - WriteData(fid,prefix,'object',self,'fieldname','output_frequency','format','Integer');
|
---|
| 95 | - WriteData(fid,prefix,'object',self,'fieldname','recording_frequency','format','Integer');
|
---|
| 96 | - WriteData(fid,prefix,'object',self,'fieldname','waitonlock','data',self.waitonlock>0,'format','Boolean');
|
---|
| 97 | - WriteData(fid,prefix,'object',self,'fieldname','solver_residue_threshold','format','Double');
|
---|
| 98 | - end % }}}
|
---|
| 99 | - function savemodeljs(self,fid,modelname) % {{{
|
---|
| 100 | -
|
---|
| 101 | - writejsdouble(fid,[modelname '.settings.results_on_nodes'],self.results_on_nodes);
|
---|
| 102 | - writejsdouble(fid,[modelname '.settings.io_gather'],self.io_gather);
|
---|
| 103 | - writejsdouble(fid,[modelname '.settings.lowmem'],self.lowmem);
|
---|
| 104 | - writejsdouble(fid,[modelname '.settings.output_frequency'],self.output_frequency);
|
---|
| 105 | - writejsdouble(fid,[modelname '.settings.recording_frequency'],self.recording_frequency);
|
---|
| 106 | - writejsdouble(fid,[modelname '.settings.waitonlock'],self.waitonlock);
|
---|
| 107 | - writejsstring(fid,[modelname '.settings.upload_server'],self.upload_server);
|
---|
| 108 | - writejsstring(fid,[modelname '.settings.upload_path'],self.upload_path);
|
---|
| 109 | - writejsstring(fid,[modelname '.settings.upload_login'],self.upload_login);
|
---|
| 110 | - writejsdouble(fid,[modelname '.settings.upload_port'],self.upload_port);
|
---|
| 111 | - writejsstring(fid,[modelname '.settings.upload_filename'],self.upload_filename);
|
---|
| 112 | - writejsstring(fid,[modelname '.settings.solver_residue_threshold'],self.solver_residue_threshold);
|
---|
| 113 | - end % }}}
|
---|
| 114 | - end
|
---|
| 115 | -end
|
---|
| 116 | Index: ../trunk-jpl/src/m/classes/qmu/continuous_design.m
|
---|
| 117 | ===================================================================
|
---|
| 118 | --- ../trunk-jpl/src/m/classes/qmu/continuous_design.m (revision 22295)
|
---|
| 119 | +++ ../trunk-jpl/src/m/classes/qmu/continuous_design.m (revision 22296)
|
---|
| 120 | @@ -30,198 +30,198 @@
|
---|
| 121 | % to foreign countries or providing access to foreign persons."
|
---|
| 122 | %
|
---|
| 123 | classdef continuous_design
|
---|
| 124 | - properties
|
---|
| 125 | - descriptor='';
|
---|
| 126 | - initpt = 0.;
|
---|
| 127 | - lower =-Inf;
|
---|
| 128 | - upper = Inf;
|
---|
| 129 | - scale_type='none';
|
---|
| 130 | - scale = 1.;
|
---|
| 131 | - end
|
---|
| 132 | + properties
|
---|
| 133 | + descriptor='';
|
---|
| 134 | + initpt = 0.;
|
---|
| 135 | + lower =-Inf;
|
---|
| 136 | + upper = Inf;
|
---|
| 137 | + scale_type='none';
|
---|
| 138 | + scale = 1.;
|
---|
| 139 | + end
|
---|
| 140 |
|
---|
| 141 | - methods
|
---|
| 142 | - function [cdv]=continuous_design(varargin)
|
---|
| 143 | + methods
|
---|
| 144 | + function [cdv]=continuous_design(varargin)
|
---|
| 145 |
|
---|
| 146 | - switch nargin
|
---|
| 147 | + switch nargin
|
---|
| 148 |
|
---|
| 149 | -% create a default object
|
---|
| 150 | + % create a default object
|
---|
| 151 |
|
---|
| 152 | - case 0
|
---|
| 153 | + case 0
|
---|
| 154 |
|
---|
| 155 | -% copy the object
|
---|
| 156 | + % copy the object
|
---|
| 157 |
|
---|
| 158 | - case 1
|
---|
| 159 | - if isa(varargin{1},'continuous_design')
|
---|
| 160 | - cdv=varargin{1};
|
---|
| 161 | - else
|
---|
| 162 | - error('Object ''%s'' is a ''%s'' class object, not ''%s''.',...
|
---|
| 163 | - inputname(1),class(varargin{1}),'continuous_design');
|
---|
| 164 | - end
|
---|
| 165 | + case 1
|
---|
| 166 | + if isa(varargin{1},'continuous_design')
|
---|
| 167 | + cdv=varargin{1};
|
---|
| 168 | + else
|
---|
| 169 | + error('Object ''%s'' is a ''%s'' class object, not ''%s''.',...
|
---|
| 170 | + inputname(1),class(varargin{1}),'continuous_design');
|
---|
| 171 | + end
|
---|
| 172 |
|
---|
| 173 | -% create the object from the input
|
---|
| 174 | + % create the object from the input
|
---|
| 175 |
|
---|
| 176 | - otherwise
|
---|
| 177 | - asizec=num2cell(array_size(varargin{1:min(nargin,6)}));
|
---|
| 178 | - cdv(asizec{:})=continuous_design;
|
---|
| 179 | - clear asizec
|
---|
| 180 | + otherwise
|
---|
| 181 | + asizec=num2cell(array_size(varargin{1:min(nargin,6)}));
|
---|
| 182 | + cdv(asizec{:})=continuous_design;
|
---|
| 183 | + clear asizec
|
---|
| 184 |
|
---|
| 185 | - if ischar(varargin{1})
|
---|
| 186 | - varargin{1}=cellstr(varargin{1});
|
---|
| 187 | - end
|
---|
| 188 | - for i=1:numel(cdv)
|
---|
| 189 | - if (numel(varargin{1}) > 1)
|
---|
| 190 | - cdv(i).descriptor=varargin{1}{i};
|
---|
| 191 | - else
|
---|
| 192 | - cdv(i).descriptor=[char(varargin{1}) string_dim(cdv,i,'vector')];
|
---|
| 193 | - end
|
---|
| 194 | - end
|
---|
| 195 | + if ischar(varargin{1})
|
---|
| 196 | + varargin{1}=cellstr(varargin{1});
|
---|
| 197 | + end
|
---|
| 198 | + for i=1:numel(cdv)
|
---|
| 199 | + if (numel(varargin{1}) > 1)
|
---|
| 200 | + cdv(i).descriptor=varargin{1}{i};
|
---|
| 201 | + else
|
---|
| 202 | + cdv(i).descriptor=[char(varargin{1}) string_dim(cdv,i,'vector')];
|
---|
| 203 | + end
|
---|
| 204 | + end
|
---|
| 205 |
|
---|
| 206 | - if (nargin >= 2)
|
---|
| 207 | - for i=1:numel(cdv)
|
---|
| 208 | - if (numel(varargin{2}) > 1)
|
---|
| 209 | - cdv(i).initpt =varargin{2}(i);
|
---|
| 210 | - else
|
---|
| 211 | - cdv(i).initpt =varargin{2};
|
---|
| 212 | - end
|
---|
| 213 | - end
|
---|
| 214 | - if (nargin >= 3)
|
---|
| 215 | - for i=1:numel(cdv)
|
---|
| 216 | - if (numel(varargin{3}) > 1)
|
---|
| 217 | - cdv(i).lower =varargin{3}(i);
|
---|
| 218 | - else
|
---|
| 219 | - cdv(i).lower =varargin{3};
|
---|
| 220 | - end
|
---|
| 221 | - end
|
---|
| 222 | - if (nargin >= 4)
|
---|
| 223 | - for i=1:numel(cdv)
|
---|
| 224 | - if (numel(varargin{4}) > 1)
|
---|
| 225 | - cdv(i).upper =varargin{4}(i);
|
---|
| 226 | - else
|
---|
| 227 | - cdv(i).upper =varargin{4};
|
---|
| 228 | - end
|
---|
| 229 | - end
|
---|
| 230 | - if (nargin >= 5)
|
---|
| 231 | - if ischar(varargin{5})
|
---|
| 232 | - varargin{5}=cellstr(varargin{5});
|
---|
| 233 | - end
|
---|
| 234 | - for i=1:numel(cdv)
|
---|
| 235 | - if (numel(varargin{5}) > 1)
|
---|
| 236 | - cdv(i).scale_type=varargin{5}{i};
|
---|
| 237 | - else
|
---|
| 238 | - cdv(i).scale_type=char(varargin{5});
|
---|
| 239 | - end
|
---|
| 240 | - end
|
---|
| 241 | - if (nargin >= 6)
|
---|
| 242 | - for i=1:numel(cdv)
|
---|
| 243 | - if (numel(varargin{6}) > 1)
|
---|
| 244 | - cdv(i).scale =varargin{6}(i);
|
---|
| 245 | - else
|
---|
| 246 | - cdv(i).scale =varargin{6};
|
---|
| 247 | - end
|
---|
| 248 | - end
|
---|
| 249 | - if (nargin > 6)
|
---|
| 250 | - warning('continuous_design:extra_arg',...
|
---|
| 251 | - 'Extra arguments for object of class ''%s''.',...
|
---|
| 252 | - class(cdv));
|
---|
| 253 | - end
|
---|
| 254 | - end
|
---|
| 255 | - end
|
---|
| 256 | - end
|
---|
| 257 | - end
|
---|
| 258 | - end
|
---|
| 259 | - end
|
---|
| 260 | + if (nargin >= 2)
|
---|
| 261 | + for i=1:numel(cdv)
|
---|
| 262 | + if (numel(varargin{2}) > 1)
|
---|
| 263 | + cdv(i).initpt =varargin{2}(i);
|
---|
| 264 | + else
|
---|
| 265 | + cdv(i).initpt =varargin{2};
|
---|
| 266 | + end
|
---|
| 267 | + end
|
---|
| 268 | + if (nargin >= 3)
|
---|
| 269 | + for i=1:numel(cdv)
|
---|
| 270 | + if (numel(varargin{3}) > 1)
|
---|
| 271 | + cdv(i).lower =varargin{3}(i);
|
---|
| 272 | + else
|
---|
| 273 | + cdv(i).lower =varargin{3};
|
---|
| 274 | + end
|
---|
| 275 | + end
|
---|
| 276 | + if (nargin >= 4)
|
---|
| 277 | + for i=1:numel(cdv)
|
---|
| 278 | + if (numel(varargin{4}) > 1)
|
---|
| 279 | + cdv(i).upper =varargin{4}(i);
|
---|
| 280 | + else
|
---|
| 281 | + cdv(i).upper =varargin{4};
|
---|
| 282 | + end
|
---|
| 283 | + end
|
---|
| 284 | + if (nargin >= 5)
|
---|
| 285 | + if ischar(varargin{5})
|
---|
| 286 | + varargin{5}=cellstr(varargin{5});
|
---|
| 287 | + end
|
---|
| 288 | + for i=1:numel(cdv)
|
---|
| 289 | + if (numel(varargin{5}) > 1)
|
---|
| 290 | + cdv(i).scale_type=varargin{5}{i};
|
---|
| 291 | + else
|
---|
| 292 | + cdv(i).scale_type=char(varargin{5});
|
---|
| 293 | + end
|
---|
| 294 | + end
|
---|
| 295 | + if (nargin >= 6)
|
---|
| 296 | + for i=1:numel(cdv)
|
---|
| 297 | + if (numel(varargin{6}) > 1)
|
---|
| 298 | + cdv(i).scale =varargin{6}(i);
|
---|
| 299 | + else
|
---|
| 300 | + cdv(i).scale =varargin{6};
|
---|
| 301 | + end
|
---|
| 302 | + end
|
---|
| 303 | + if (nargin > 6)
|
---|
| 304 | + warning('continuous_design:extra_arg',...
|
---|
| 305 | + 'Extra arguments for object of class ''%s''.',...
|
---|
| 306 | + class(cdv));
|
---|
| 307 | + end
|
---|
| 308 | + end
|
---|
| 309 | + end
|
---|
| 310 | + end
|
---|
| 311 | + end
|
---|
| 312 | + end
|
---|
| 313 | + end
|
---|
| 314 |
|
---|
| 315 | - end
|
---|
| 316 | + end
|
---|
| 317 |
|
---|
| 318 | - function []=disp(cdv)
|
---|
| 319 | + function []=disp(cdv)
|
---|
| 320 |
|
---|
| 321 | -% display the object
|
---|
| 322 | + % display the object
|
---|
| 323 |
|
---|
| 324 | - disp(sprintf('\n'));
|
---|
| 325 | - for i=1:numel(cdv)
|
---|
| 326 | - disp(sprintf('class ''%s'' object ''%s%s'' = \n',...
|
---|
| 327 | - class(cdv),inputname(1),string_dim(cdv,i)));
|
---|
| 328 | - disp(sprintf(' descriptor: ''%s''' ,cdv(i).descriptor));
|
---|
| 329 | - disp(sprintf(' initpt: %g' ,cdv(i).initpt));
|
---|
| 330 | - disp(sprintf(' lower: %g' ,cdv(i).lower));
|
---|
| 331 | - disp(sprintf(' upper: %g' ,cdv(i).upper));
|
---|
| 332 | - disp(sprintf(' scale_type: ''%s''' ,cdv(i).scale_type));
|
---|
| 333 | - disp(sprintf(' scale: %g\n' ,cdv(i).scale));
|
---|
| 334 | - end
|
---|
| 335 | + disp(sprintf('\n'));
|
---|
| 336 | + for i=1:numel(cdv)
|
---|
| 337 | + disp(sprintf('class ''%s'' object ''%s%s'' = \n',...
|
---|
| 338 | + class(cdv),inputname(1),string_dim(cdv,i)));
|
---|
| 339 | + disp(sprintf(' descriptor: ''%s''' ,cdv(i).descriptor));
|
---|
| 340 | + disp(sprintf(' initpt: %g' ,cdv(i).initpt));
|
---|
| 341 | + disp(sprintf(' lower: %g' ,cdv(i).lower));
|
---|
| 342 | + disp(sprintf(' upper: %g' ,cdv(i).upper));
|
---|
| 343 | + disp(sprintf(' scale_type: ''%s''' ,cdv(i).scale_type));
|
---|
| 344 | + disp(sprintf(' scale: %g\n' ,cdv(i).scale));
|
---|
| 345 | + end
|
---|
| 346 |
|
---|
| 347 | - end
|
---|
| 348 | + end
|
---|
| 349 |
|
---|
| 350 | - function [desc] =prop_desc(cdv,dstr)
|
---|
| 351 | - desc=cell(1,numel(cdv));
|
---|
| 352 | - for i=1:numel(cdv)
|
---|
| 353 | - if ~isempty(cdv(i).descriptor)
|
---|
| 354 | - desc(i)=cellstr(cdv(i).descriptor);
|
---|
| 355 | - elseif ~isempty(inputname(1))
|
---|
| 356 | - desc(i)=cellstr([inputname(1) string_dim(cdv,i,'vector')]);
|
---|
| 357 | - elseif exist('dstr','var')
|
---|
| 358 | - desc(i)=cellstr([dstr string_dim(cdv,i,'vector')]);
|
---|
| 359 | - else
|
---|
| 360 | - desc(i)=cellstr(['cdv' string_dim(cdv,i,'vector')]);
|
---|
| 361 | - end
|
---|
| 362 | - end
|
---|
| 363 | - desc=allempty(desc);
|
---|
| 364 | - end
|
---|
| 365 | - function [initpt]=prop_initpt(cdv)
|
---|
| 366 | - initpt=zeros(1,numel(cdv));
|
---|
| 367 | - for i=1:numel(cdv)
|
---|
| 368 | - initpt(i)=cdv(i).initpt;
|
---|
| 369 | - end
|
---|
| 370 | - initpt=allequal(initpt,0.);
|
---|
| 371 | - end
|
---|
| 372 | - function [lower] =prop_lower(cdv)
|
---|
| 373 | - lower=zeros(1,numel(cdv));
|
---|
| 374 | - for i=1:numel(cdv)
|
---|
| 375 | - lower(i)=cdv(i).lower;
|
---|
| 376 | - end
|
---|
| 377 | - lower=allequal(lower,-Inf);
|
---|
| 378 | - end
|
---|
| 379 | - function [upper] =prop_upper(cdv)
|
---|
| 380 | - upper=zeros(1,numel(cdv));
|
---|
| 381 | - for i=1:numel(cdv)
|
---|
| 382 | - upper(i)=cdv(i).upper;
|
---|
| 383 | - end
|
---|
| 384 | - upper=allequal(upper, Inf);
|
---|
| 385 | - end
|
---|
| 386 | - function [mean] =prop_mean(cdv)
|
---|
| 387 | - mean=[];
|
---|
| 388 | - end
|
---|
| 389 | - function [stddev]=prop_stddev(cdv)
|
---|
| 390 | - stddev=[];
|
---|
| 391 | - end
|
---|
| 392 | - function [initst]=prop_initst(cdv)
|
---|
| 393 | - initst=[];
|
---|
| 394 | - end
|
---|
| 395 | - function [stype] =prop_stype(cdv)
|
---|
| 396 | - stype=cell(1,numel(cdv));
|
---|
| 397 | - for i=1:numel(cdv)
|
---|
| 398 | - stype(i)=cellstr(cdv(i).scale_type);
|
---|
| 399 | - end
|
---|
| 400 | - stype=allequal(stype,'none');
|
---|
| 401 | - end
|
---|
| 402 | - function [scale] =prop_scale(cdv)
|
---|
| 403 | - scale=zeros(1,numel(cdv));
|
---|
| 404 | - for i=1:numel(cdv)
|
---|
| 405 | - scale(i)=cdv(i).scale;
|
---|
| 406 | - end
|
---|
| 407 | - scale=allequal(scale,1.);
|
---|
| 408 | - end
|
---|
| 409 | - end
|
---|
| 410 | + function [desc] =prop_desc(cdv,dstr)
|
---|
| 411 | + desc=cell(1,numel(cdv));
|
---|
| 412 | + for i=1:numel(cdv)
|
---|
| 413 | + if ~isempty(cdv(i).descriptor)
|
---|
| 414 | + desc(i)=cellstr(cdv(i).descriptor);
|
---|
| 415 | + elseif ~isempty(inputname(1))
|
---|
| 416 | + desc(i)=cellstr([inputname(1) string_dim(cdv,i,'vector')]);
|
---|
| 417 | + elseif exist('dstr','var')
|
---|
| 418 | + desc(i)=cellstr([dstr string_dim(cdv,i,'vector')]);
|
---|
| 419 | + else
|
---|
| 420 | + desc(i)=cellstr(['cdv' string_dim(cdv,i,'vector')]);
|
---|
| 421 | + end
|
---|
| 422 | + end
|
---|
| 423 | + desc=allempty(desc);
|
---|
| 424 | + end
|
---|
| 425 | + function [initpt]=prop_initpt(cdv)
|
---|
| 426 | + initpt=zeros(1,numel(cdv));
|
---|
| 427 | + for i=1:numel(cdv)
|
---|
| 428 | + initpt(i)=cdv(i).initpt;
|
---|
| 429 | + end
|
---|
| 430 | + initpt=allequal(initpt,0.);
|
---|
| 431 | + end
|
---|
| 432 | + function [lower] =prop_lower(cdv)
|
---|
| 433 | + lower=zeros(1,numel(cdv));
|
---|
| 434 | + for i=1:numel(cdv)
|
---|
| 435 | + lower(i)=cdv(i).lower;
|
---|
| 436 | + end
|
---|
| 437 | + lower=allequal(lower,-Inf);
|
---|
| 438 | + end
|
---|
| 439 | + function [upper] =prop_upper(cdv)
|
---|
| 440 | + upper=zeros(1,numel(cdv));
|
---|
| 441 | + for i=1:numel(cdv)
|
---|
| 442 | + upper(i)=cdv(i).upper;
|
---|
| 443 | + end
|
---|
| 444 | + upper=allequal(upper, Inf);
|
---|
| 445 | + end
|
---|
| 446 | + function [mean] =prop_mean(cdv)
|
---|
| 447 | + mean=[];
|
---|
| 448 | + end
|
---|
| 449 | + function [stddev]=prop_stddev(cdv)
|
---|
| 450 | + stddev=[];
|
---|
| 451 | + end
|
---|
| 452 | + function [initst]=prop_initst(cdv)
|
---|
| 453 | + initst=[];
|
---|
| 454 | + end
|
---|
| 455 | + function [stype] =prop_stype(cdv)
|
---|
| 456 | + stype=cell(1,numel(cdv));
|
---|
| 457 | + for i=1:numel(cdv)
|
---|
| 458 | + stype(i)=cellstr(cdv(i).scale_type);
|
---|
| 459 | + end
|
---|
| 460 | + stype=allequal(stype,'none');
|
---|
| 461 | + end
|
---|
| 462 | + function [scale] =prop_scale(cdv)
|
---|
| 463 | + scale=zeros(1,numel(cdv));
|
---|
| 464 | + for i=1:numel(cdv)
|
---|
| 465 | + scale(i)=cdv(i).scale;
|
---|
| 466 | + end
|
---|
| 467 | + scale=allequal(scale,1.);
|
---|
| 468 | + end
|
---|
| 469 | + end
|
---|
| 470 |
|
---|
| 471 | - methods (Static)
|
---|
| 472 | - function []=dakota_write(fidi,dvar)
|
---|
| 473 | + methods (Static)
|
---|
| 474 | + function []=dakota_write(fidi,dvar)
|
---|
| 475 |
|
---|
| 476 | -% collect only the variables of the appropriate class
|
---|
| 477 | + % collect only the variables of the appropriate class
|
---|
| 478 |
|
---|
| 479 | - cdv=struc_class(dvar,'continuous_design');
|
---|
| 480 | + cdv=struc_class(dvar,'continuous_design');
|
---|
| 481 |
|
---|
| 482 | -% write variables
|
---|
| 483 | + % write variables
|
---|
| 484 |
|
---|
| 485 | - vlist_write(fidi,'continuous_design','cdv',cdv);
|
---|
| 486 | - end
|
---|
| 487 | - end
|
---|
| 488 | + vlist_write(fidi,'continuous_design','cdv',cdv);
|
---|
| 489 | + end
|
---|
| 490 | + end
|
---|
| 491 | end
|
---|
| 492 | Index: ../trunk-jpl/src/m/classes/model.m
|
---|
| 493 | ===================================================================
|
---|
| 494 | --- ../trunk-jpl/src/m/classes/model.m (revision 22295)
|
---|
| 495 | +++ ../trunk-jpl/src/m/classes/model.m (revision 22296)
|
---|
| 496 | @@ -127,6 +127,11 @@
|
---|
| 497 | if isa(md.slr,'double'); md.slr=slr(); end
|
---|
| 498 | %2016 October 11
|
---|
| 499 | if isa(md.esa,'double'); md.esa=esa(); end
|
---|
| 500 | + %2017 Dec 21st (needs to be here)
|
---|
| 501 | + if isempty(md.settings)
|
---|
| 502 | + disp('Warning: md.settings had to be reset, make sure to adjust md.settings.output_frequency and other fields');
|
---|
| 503 | + md.settings = issmsettings();
|
---|
| 504 | + end
|
---|
| 505 | %2017 February 10th
|
---|
| 506 | if md.settings.solver_residue_threshold==0,
|
---|
| 507 | md.settings.solver_residue_threshold = 1e-6;
|
---|
| 508 | @@ -1145,7 +1150,7 @@
|
---|
| 509 | md.flowequation = flowequation();
|
---|
| 510 | md.debug = debug();
|
---|
| 511 | md.verbose = verbose();
|
---|
| 512 | - md.settings = settings();
|
---|
| 513 | + md.settings = issmsettings();
|
---|
| 514 | md.toolkits = toolkits();
|
---|
| 515 | md.cluster = generic();
|
---|
| 516 | md.balancethickness = balancethickness();
|
---|
| 517 | Index: ../trunk-jpl/src/m/classes/issmsettings.m
|
---|
| 518 | ===================================================================
|
---|
| 519 | --- ../trunk-jpl/src/m/classes/issmsettings.m (nonexistent)
|
---|
| 520 | +++ ../trunk-jpl/src/m/classes/issmsettings.m (revision 22296)
|
---|
| 521 | @@ -0,0 +1,110 @@
|
---|
| 522 | +%ISSMSETTINGS class definition
|
---|
| 523 | +%
|
---|
| 524 | +% Usage:
|
---|
| 525 | +% issmsettings=issmsettings();
|
---|
| 526 | +
|
---|
| 527 | +classdef issmsettings
|
---|
| 528 | + properties (SetAccess=public)
|
---|
| 529 | + results_on_nodes = 0;
|
---|
| 530 | + io_gather = 0;
|
---|
| 531 | + lowmem = 0;
|
---|
| 532 | + output_frequency = 0;
|
---|
| 533 | + recording_frequency = 0;
|
---|
| 534 | + waitonlock = 0;
|
---|
| 535 | + upload_server = '';
|
---|
| 536 | + upload_path = '';
|
---|
| 537 | + upload_login = '';
|
---|
| 538 | + upload_port = 0;
|
---|
| 539 | + upload_filename = '';
|
---|
| 540 | + solver_residue_threshold = 0;
|
---|
| 541 | + end
|
---|
| 542 | + methods
|
---|
| 543 | + function self = issmsettings(varargin) % {{{
|
---|
| 544 | + switch nargin
|
---|
| 545 | + case 0
|
---|
| 546 | + self=setdefaultparameters(self);
|
---|
| 547 | + otherwise
|
---|
| 548 | + error('constructor not supported');
|
---|
| 549 | + end
|
---|
| 550 | + end % }}}
|
---|
| 551 | + function self = setdefaultparameters(self) % {{{
|
---|
| 552 | +
|
---|
| 553 | + %are we short in memory ? (0 faster but requires more memory)
|
---|
| 554 | + self.lowmem=0;
|
---|
| 555 | +
|
---|
| 556 | + %i/o:
|
---|
| 557 | + self.io_gather=1;
|
---|
| 558 | +
|
---|
| 559 | + %results frequency by default every step
|
---|
| 560 | + self.output_frequency=1;
|
---|
| 561 | +
|
---|
| 562 | + %checkpoints frequency, by default never:
|
---|
| 563 | + self.recording_frequency=0;
|
---|
| 564 | +
|
---|
| 565 | + %this option can be activated to load automatically the results
|
---|
| 566 | + %onto the model after a parallel run by waiting for the lock file
|
---|
| 567 | + %N minutes that is generated once the solution has converged
|
---|
| 568 | + %0 to deactivate
|
---|
| 569 | + self.waitonlock=Inf;
|
---|
| 570 | +
|
---|
| 571 | + %upload options:
|
---|
| 572 | + self.upload_port = 0;
|
---|
| 573 | +
|
---|
| 574 | + %throw an error if solver residue exceeds this value
|
---|
| 575 | + self.solver_residue_threshold = 1e-6;
|
---|
| 576 | +
|
---|
| 577 | + end % }}}
|
---|
| 578 | + function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 579 | +
|
---|
| 580 | + md = checkfield(md,'fieldname','issmsettings.results_on_nodes','numel',[1],'values',[0 1]);
|
---|
| 581 | + md = checkfield(md,'fieldname','issmsettings.io_gather','numel',[1],'values',[0 1]);
|
---|
| 582 | + md = checkfield(md,'fieldname','issmsettings.lowmem','numel',[1],'values',[0 1]);
|
---|
| 583 | + md = checkfield(md,'fieldname','issmsettings.output_frequency','numel',[1],'>=',1);
|
---|
| 584 | + md = checkfield(md,'fieldname','issmsettings.recording_frequency','numel',[1],'>=',0);
|
---|
| 585 | + md = checkfield(md,'fieldname','issmsettings.waitonlock','numel',[1]);
|
---|
| 586 | + md = checkfield(md,'fieldname','issmsettings.solver_residue_threshold','numel',[1],'>',0);
|
---|
| 587 | +
|
---|
| 588 | + end % }}}
|
---|
| 589 | + function disp(self) % {{{
|
---|
| 590 | + disp(sprintf(' general issmsettings parameters:'));
|
---|
| 591 | +
|
---|
| 592 | + fielddisplay(self,'results_on_nodes','results are output for all the nodes of each element');
|
---|
| 593 | + fielddisplay(self,'io_gather','I/O gathering strategy for result outputs (default 1)');
|
---|
| 594 | + fielddisplay(self,'lowmem','is the memory limited ? (0 or 1)');
|
---|
| 595 | + fielddisplay(self,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
|
---|
| 596 | + fielddisplay(self,'recording_frequency','frequency at which the runs are being recorded, allowing for a restart');
|
---|
| 597 | + fielddisplay(self,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
|
---|
| 598 | + fielddisplay(self,'upload_server','server hostname where model should be uploaded');
|
---|
| 599 | + fielddisplay(self,'upload_path','path on server where model should be uploaded');
|
---|
| 600 | + fielddisplay(self,'upload_login','server login');
|
---|
| 601 | + fielddisplay(self,'upload_port','port login (default is 0)');
|
---|
| 602 | + fielddisplay(self,'upload_filename','unique id generated when uploading the file to server');
|
---|
| 603 | + fielddisplay(self,'solver_residue_threshold','throw an error if solver residue exceeds this value (NaN to deactivate)');
|
---|
| 604 | +
|
---|
| 605 | + end % }}}
|
---|
| 606 | + function marshall(self,prefix,md,fid) % {{{
|
---|
| 607 | + WriteData(fid,prefix,'object',self,'fieldname','results_on_nodes','format','Boolean');
|
---|
| 608 | + WriteData(fid,prefix,'object',self,'fieldname','io_gather','format','Boolean');
|
---|
| 609 | + WriteData(fid,prefix,'object',self,'fieldname','lowmem','format','Boolean');
|
---|
| 610 | + WriteData(fid,prefix,'object',self,'fieldname','output_frequency','format','Integer');
|
---|
| 611 | + WriteData(fid,prefix,'object',self,'fieldname','recording_frequency','format','Integer');
|
---|
| 612 | + WriteData(fid,prefix,'object',self,'fieldname','waitonlock','data',self.waitonlock>0,'format','Boolean');
|
---|
| 613 | + WriteData(fid,prefix,'object',self,'fieldname','solver_residue_threshold','format','Double');
|
---|
| 614 | + end % }}}
|
---|
| 615 | + function savemodeljs(self,fid,modelname) % {{{
|
---|
| 616 | +
|
---|
| 617 | + writejsdouble(fid,[modelname '.issmsettings.results_on_nodes'],self.results_on_nodes);
|
---|
| 618 | + writejsdouble(fid,[modelname '.issmsettings.io_gather'],self.io_gather);
|
---|
| 619 | + writejsdouble(fid,[modelname '.issmsettings.lowmem'],self.lowmem);
|
---|
| 620 | + writejsdouble(fid,[modelname '.issmsettings.output_frequency'],self.output_frequency);
|
---|
| 621 | + writejsdouble(fid,[modelname '.issmsettings.recording_frequency'],self.recording_frequency);
|
---|
| 622 | + writejsdouble(fid,[modelname '.issmsettings.waitonlock'],self.waitonlock);
|
---|
| 623 | + writejsstring(fid,[modelname '.issmsettings.upload_server'],self.upload_server);
|
---|
| 624 | + writejsstring(fid,[modelname '.issmsettings.upload_path'],self.upload_path);
|
---|
| 625 | + writejsstring(fid,[modelname '.issmsettings.upload_login'],self.upload_login);
|
---|
| 626 | + writejsdouble(fid,[modelname '.issmsettings.upload_port'],self.upload_port);
|
---|
| 627 | + writejsstring(fid,[modelname '.issmsettings.upload_filename'],self.upload_filename);
|
---|
| 628 | + writejsstring(fid,[modelname '.issmsettings.solver_residue_threshold'],self.solver_residue_threshold);
|
---|
| 629 | + end % }}}
|
---|
| 630 | + end
|
---|
| 631 | +end
|
---|