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

Last change on this file since 20500 was 20500, checked in by Mathieu Morlighem, 9 years ago

merged trunk-jpl and trunk for revision 20497

File size: 3.1 KB
Line 
1%MASSCONAXPBY class definition
2%
3% Usage:
4% massconaxpby=massconaxpby();
5% massconsumaxpby=massconaxpby('name','MassCon58+35','namex','MassCon58','alpha',.5,'namey','MassCon35','beta',.5);
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%
11% See also: MASSCON
12
13classdef massconaxpby
14 properties (SetAccess=public)
15 %masscon axpby
16 name = '';
17 definitionenum = NaN; %enum that identifies this output definition uniquely, from Outputdefinition[1-10]Enum
18 namex = '';
19 namey = '';
20 alpha = NaN;
21 beta = NaN;
22 end
23
24 methods
25 function self = massconaxpby(varargin) % {{{
26 if nargin==0,
27 self=setdefaultparameters(self);
28 else
29 %use provided options to change fields
30 options=pairoptions(varargin{:});
31
32 %get names
33 self.name=getfieldvalue(options,'name','');
34 self.definitionenum=getfieldvalue(options,'definitionenum');
35 self.namex=getfieldvalue(options,'namex');
36 self.namey=getfieldvalue(options,'namey');
37
38 %get multiplicators:
39 self.alpha=getfieldvalue(options,'alpha');
40 self.beta=getfieldvalue(options,'beta');
41
42
43 end
44 end % }}}
45 function self = setdefaultparameters(self) % {{{
46 end % }}}
47 function md = checkconsistency(self,md,solution,analyses) % {{{
48
49 if ~ischar(self.name), error('masscon error message: ''name'' field should be a string!'); end
50 if ~ischar(self.namex), error('masscon error message: ''namex'' field should be a string!'); end
51 if ~ischar(self.namey), error('masscon error message: ''namey'' field should be a string!'); end
52
53 md = checkfield(md,'fieldname','self.definitionenum','field',self.definitionenum,'values',[Outputdefinition1Enum:Outputdefinition100Enum]);
54
55 md = checkfield(md,'fieldname','self.alpha','field',self.alpha,'NaN',1,'Inf',1,'size',[1 1]);
56 md = checkfield(md,'fieldname','self.betaa','field',self.beta,'NaN',1,'Inf',1,'size',[1 1]);
57
58 end % }}}
59 function md = disp(self) % {{{
60
61 disp(sprintf(' Misfit:\n'));
62
63 fielddisplay(self,'name','name');
64 fielddisplay(self,'definitionenum','enum that identifies this output definition uniquely, from Outputdefinition[1-10]Enum');
65 fielddisplay(self,'namex','identifier for the first masscon');
66 fielddisplay(self,'alpha','first masscon multiplicator');
67 fielddisplay(self,'namey','identifier for the second masscon');
68 fielddisplay(self,'beta','second masscon multiplicator');
69
70 end % }}}
71 function md = marshall(self,md,fid) % {{{
72
73 WriteData(fid,'object',self,'fieldname','name','format','String');
74 WriteData(fid,'object',self,'fieldname','definitionenum','format','Integer');
75 WriteData(fid,'object',self,'fieldname','namex','format','String');
76 WriteData(fid,'object',self,'fieldname','namey','format','String');
77 WriteData(fid,'object',self,'fieldname','alpha','format','Double');
78 WriteData(fid,'object',self,'fieldname','beta','format','Double');
79
80 end % }}}
81 end
82end
Note: See TracBrowser for help on using the repository browser.