[22296] | 1 | %ISSMSETTINGS class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % issmsettings=issmsettings();
|
---|
| 5 |
|
---|
| 6 | classdef issmsettings
|
---|
| 7 | properties (SetAccess=public)
|
---|
| 8 | results_on_nodes = 0;
|
---|
| 9 | io_gather = 0;
|
---|
| 10 | lowmem = 0;
|
---|
| 11 | output_frequency = 0;
|
---|
| 12 | recording_frequency = 0;
|
---|
| 13 | waitonlock = 0;
|
---|
| 14 | upload_server = '';
|
---|
| 15 | upload_path = '';
|
---|
| 16 | upload_login = '';
|
---|
| 17 | upload_port = 0;
|
---|
| 18 | upload_filename = '';
|
---|
| 19 | solver_residue_threshold = 0;
|
---|
| 20 | end
|
---|
| 21 | methods
|
---|
| 22 | function self = issmsettings(varargin) % {{{
|
---|
| 23 | switch nargin
|
---|
| 24 | case 0
|
---|
| 25 | self=setdefaultparameters(self);
|
---|
| 26 | otherwise
|
---|
| 27 | error('constructor not supported');
|
---|
| 28 | end
|
---|
| 29 | end % }}}
|
---|
| 30 | function self = setdefaultparameters(self) % {{{
|
---|
| 31 |
|
---|
| 32 | %are we short in memory ? (0 faster but requires more memory)
|
---|
| 33 | self.lowmem=0;
|
---|
| 34 |
|
---|
| 35 | %i/o:
|
---|
| 36 | self.io_gather=1;
|
---|
| 37 |
|
---|
| 38 | %results frequency by default every step
|
---|
| 39 | self.output_frequency=1;
|
---|
| 40 |
|
---|
| 41 | %checkpoints frequency, by default never:
|
---|
| 42 | self.recording_frequency=0;
|
---|
| 43 |
|
---|
| 44 | %this option can be activated to load automatically the results
|
---|
| 45 | %onto the model after a parallel run by waiting for the lock file
|
---|
| 46 | %N minutes that is generated once the solution has converged
|
---|
| 47 | %0 to deactivate
|
---|
| 48 | self.waitonlock=Inf;
|
---|
| 49 |
|
---|
| 50 | %upload options:
|
---|
| 51 | self.upload_port = 0;
|
---|
| 52 |
|
---|
| 53 | %throw an error if solver residue exceeds this value
|
---|
| 54 | self.solver_residue_threshold = 1e-6;
|
---|
| 55 |
|
---|
| 56 | end % }}}
|
---|
| 57 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 58 |
|
---|
[22297] | 59 | md = checkfield(md,'fieldname','settings.results_on_nodes','numel',[1],'values',[0 1]);
|
---|
| 60 | md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0 1]);
|
---|
| 61 | md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0 1]);
|
---|
| 62 | md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
|
---|
| 63 | md = checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0);
|
---|
| 64 | md = checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
|
---|
| 65 | md = checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
|
---|
[22296] | 66 |
|
---|
| 67 | end % }}}
|
---|
| 68 | function disp(self) % {{{
|
---|
| 69 | disp(sprintf(' general issmsettings parameters:'));
|
---|
| 70 |
|
---|
| 71 | fielddisplay(self,'results_on_nodes','results are output for all the nodes of each element');
|
---|
| 72 | fielddisplay(self,'io_gather','I/O gathering strategy for result outputs (default 1)');
|
---|
| 73 | fielddisplay(self,'lowmem','is the memory limited ? (0 or 1)');
|
---|
| 74 | fielddisplay(self,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
|
---|
| 75 | fielddisplay(self,'recording_frequency','frequency at which the runs are being recorded, allowing for a restart');
|
---|
| 76 | fielddisplay(self,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
|
---|
| 77 | fielddisplay(self,'upload_server','server hostname where model should be uploaded');
|
---|
| 78 | fielddisplay(self,'upload_path','path on server where model should be uploaded');
|
---|
| 79 | fielddisplay(self,'upload_login','server login');
|
---|
| 80 | fielddisplay(self,'upload_port','port login (default is 0)');
|
---|
| 81 | fielddisplay(self,'upload_filename','unique id generated when uploading the file to server');
|
---|
| 82 | fielddisplay(self,'solver_residue_threshold','throw an error if solver residue exceeds this value (NaN to deactivate)');
|
---|
| 83 |
|
---|
| 84 | end % }}}
|
---|
| 85 | function marshall(self,prefix,md,fid) % {{{
|
---|
[22297] | 86 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','results_on_nodes','format','Boolean');
|
---|
| 87 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','io_gather','format','Boolean');
|
---|
| 88 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','lowmem','format','Boolean');
|
---|
| 89 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','output_frequency','format','Integer');
|
---|
| 90 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','recording_frequency','format','Integer');
|
---|
| 91 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','waitonlock','data',self.waitonlock>0,'format','Boolean');
|
---|
| 92 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','solver_residue_threshold','format','Double');
|
---|
[22296] | 93 | end % }}}
|
---|
| 94 | function savemodeljs(self,fid,modelname) % {{{
|
---|
| 95 |
|
---|
[22297] | 96 | writejsdouble(fid,[modelname '.settings.results_on_nodes'],self.results_on_nodes);
|
---|
| 97 | writejsdouble(fid,[modelname '.settings.io_gather'],self.io_gather);
|
---|
| 98 | writejsdouble(fid,[modelname '.settings.lowmem'],self.lowmem);
|
---|
| 99 | writejsdouble(fid,[modelname '.settings.output_frequency'],self.output_frequency);
|
---|
| 100 | writejsdouble(fid,[modelname '.settings.recording_frequency'],self.recording_frequency);
|
---|
| 101 | writejsdouble(fid,[modelname '.settings.waitonlock'],self.waitonlock);
|
---|
| 102 | writejsstring(fid,[modelname '.settings.upload_server'],self.upload_server);
|
---|
| 103 | writejsstring(fid,[modelname '.settings.upload_path'],self.upload_path);
|
---|
| 104 | writejsstring(fid,[modelname '.settings.upload_login'],self.upload_login);
|
---|
| 105 | writejsdouble(fid,[modelname '.settings.upload_port'],self.upload_port);
|
---|
| 106 | writejsstring(fid,[modelname '.settings.upload_filename'],self.upload_filename);
|
---|
| 107 | writejsstring(fid,[modelname '.settings.solver_residue_threshold'],self.solver_residue_threshold);
|
---|
[22296] | 108 | end % }}}
|
---|
| 109 | end
|
---|
| 110 | end
|
---|