[18812] | 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 |
|
---|
| 13 | classdef massconaxpby
|
---|
| 14 | properties (SetAccess=public)
|
---|
| 15 | %masscon axpby
|
---|
| 16 | name = '';
|
---|
[18881] | 17 | definitionenum = NaN; %enum that identifies this output definition uniquely, from Outputdefinition[1-10]Enum
|
---|
[18812] | 18 | namex = '';
|
---|
| 19 | namey = '';
|
---|
| 20 | alpha = NaN;
|
---|
| 21 | beta = NaN;
|
---|
| 22 | end
|
---|
| 23 |
|
---|
| 24 | methods
|
---|
[19040] | 25 | function self = massconaxpby(varargin) % {{{
|
---|
[18812] | 26 | if nargin==0,
|
---|
[19040] | 27 | self=setdefaultparameters(self);
|
---|
[18812] | 28 | else
|
---|
| 29 | %use provided options to change fields
|
---|
| 30 | options=pairoptions(varargin{:});
|
---|
| 31 |
|
---|
| 32 | %get names
|
---|
[19040] | 33 | self.name=getfieldvalue(options,'name','');
|
---|
| 34 | self.definitionenum=getfieldvalue(options,'definitionenum');
|
---|
| 35 | self.namex=getfieldvalue(options,'namex');
|
---|
| 36 | self.namey=getfieldvalue(options,'namey');
|
---|
[18812] | 37 |
|
---|
| 38 | %get multiplicators:
|
---|
[19040] | 39 | self.alpha=getfieldvalue(options,'alpha');
|
---|
| 40 | self.beta=getfieldvalue(options,'beta');
|
---|
[18812] | 41 |
|
---|
| 42 |
|
---|
| 43 | end
|
---|
| 44 | end % }}}
|
---|
[19040] | 45 | function self = setdefaultparameters(self) % {{{
|
---|
[18812] | 46 | end % }}}
|
---|
[19040] | 47 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
[18812] | 48 |
|
---|
[19040] | 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
|
---|
[18881] | 52 |
|
---|
[19071] | 53 | md = checkfield(md,'fieldname','self.definitionenum','field',self.definitionenum,'values',[Outputdefinition1Enum:Outputdefinition100Enum]);
|
---|
[18812] | 54 |
|
---|
[20500] | 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]);
|
---|
[18812] | 57 |
|
---|
| 58 | end % }}}
|
---|
[19040] | 59 | function md = disp(self) % {{{
|
---|
[18812] | 60 |
|
---|
| 61 | disp(sprintf(' Misfit:\n'));
|
---|
| 62 |
|
---|
[19040] | 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');
|
---|
[18812] | 69 |
|
---|
| 70 | end % }}}
|
---|
[19040] | 71 | function md = marshall(self,md,fid) % {{{
|
---|
[18812] | 72 |
|
---|
[19040] | 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');
|
---|
[18812] | 79 |
|
---|
| 80 | end % }}}
|
---|
| 81 | end
|
---|
| 82 | end
|
---|