source: issm/trunk/src/m/classes/massconaxpby.m

Last change on this file was 22758, checked in by Mathieu Morlighem, 7 years ago

merged trunk-jpl and trunk for revision 22757

File size: 3.6 KB
RevLine 
[18812]1%MASSCONAXPBY class definition
2%
3% Usage:
4% massconaxpby=massconaxpby();
[22758]5% massconaxpby=massconaxpby('name','MassCon58+35','namex','MassCon58','alpha',.5,'namey','MassCon35','beta',.5,'definitionstring','Outputdefinition1');
[18812]6%
7% where name is the name of the massconaxpby object, namex is the name of the first masscon, namey the name of the second masscon and alpha,beta the
8% multiplicators. The meaning of axpby here is: resulting masscon is the linear combination (alpha *x + beta * y)
9% of two masscons.
10%
[22758]11% See also: MASSCON, REGIONALOUTPUT
[18812]12
13classdef massconaxpby
14 properties (SetAccess=public)
15 %masscon axpby
[22758]16 name = '';
[21341]17 definitionstring = ''; %String that identifies this output definition uniquely, from 'Outputdefinition[1-10]'
[18812]18 namex = '';
19 namey = '';
20 alpha = NaN;
[22758]21 beta = NaN;
[18812]22 end
23
24 methods
[22758]25 function self = extrude(self,md) % {{{
26 end % }}}
[19040]27 function self = massconaxpby(varargin) % {{{
[18812]28 if nargin==0,
[19040]29 self=setdefaultparameters(self);
[18812]30 else
31 %use provided options to change fields
32 options=pairoptions(varargin{:});
33
34 %get names
[19040]35 self.name=getfieldvalue(options,'name','');
[21341]36 self.definitionstring=getfieldvalue(options,'definitionstring');
[19040]37 self.namex=getfieldvalue(options,'namex');
38 self.namey=getfieldvalue(options,'namey');
[18812]39
40 %get multiplicators:
[19040]41 self.alpha=getfieldvalue(options,'alpha');
42 self.beta=getfieldvalue(options,'beta');
[18812]43
44
45 end
46 end % }}}
[19040]47 function self = setdefaultparameters(self) % {{{
[18812]48 end % }}}
[19040]49 function md = checkconsistency(self,md,solution,analyses) % {{{
[18812]50
[19040]51 if ~ischar(self.name), error('masscon error message: ''name'' field should be a string!'); end
52 if ~ischar(self.namex), error('masscon error message: ''namex'' field should be a string!'); end
53 if ~ischar(self.namey), error('masscon error message: ''namey'' field should be a string!'); end
[21341]54
55 % Create output definition cell array for check
56 OutputdefinitionStringArray={};
57 for i=1:100
58 OutputdefinitionStringArray{i}=strcat('Outputdefinition',num2str(i));
59 end
[18812]60
[21341]61 md = checkfield(md,'fieldname','self.definitionstring','field',self.definitionstring,'values',OutputdefinitionStringArray);
62
[20500]63 md = checkfield(md,'fieldname','self.alpha','field',self.alpha,'NaN',1,'Inf',1,'size',[1 1]);
64 md = checkfield(md,'fieldname','self.betaa','field',self.beta,'NaN',1,'Inf',1,'size',[1 1]);
[18812]65
66 end % }}}
[19040]67 function md = disp(self) % {{{
[18812]68
[22758]69 disp(sprintf(' Massconaxpby:\n'));
[18812]70
[19040]71 fielddisplay(self,'name','name');
[21341]72 fielddisplay(self,'definitionstring','string that identifies this output definition uniquely, from Outputdefinition[1-10]');
[19040]73 fielddisplay(self,'namex','identifier for the first masscon');
74 fielddisplay(self,'alpha','first masscon multiplicator');
75 fielddisplay(self,'namey','identifier for the second masscon');
76 fielddisplay(self,'beta','second masscon multiplicator');
[18812]77
78 end % }}}
[21341]79 function md = marshall(self,prefix,md,fid) % {{{
[18812]80
[22758]81 WriteData(fid,prefix,'data',self.name,'name','md.massconaxpby.name','format','String');
82 WriteData(fid,prefix,'data',self.definitionstring,'name','md.massconaxpby.definitionstring','format','String');
83 WriteData(fid,prefix,'data',self.namex,'name','md.massconaxpby.namex','format','String');
84 WriteData(fid,prefix,'data',self.namey,'name','md.massconaxpby.namey','format','String');
85 WriteData(fid,prefix,'data',self.alpha,'name','md.massconaxpby.alpha','format','Double');
86 WriteData(fid,prefix,'data',self.beta,'name','md.massconaxpby.beta','format','Double');
[18812]87
88 end % }}}
89 end
90end
Note: See TracBrowser for help on using the repository browser.