[16388] | 1 | %MASSFLUXATGATE class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % massfluxatgate=massfluxatgate();
|
---|
[21049] | 5 | % massfluxatgate=massfluxatgate('name','GateName','definitionname','Outputdefinition1','profilename','PathToExpFile');
|
---|
[16388] | 6 |
|
---|
| 7 | classdef massfluxatgate
|
---|
| 8 | properties (SetAccess=public)
|
---|
| 9 | %massfluxatgate
|
---|
[18944] | 10 | name = '';
|
---|
[21049] | 11 | definitionstring = '';
|
---|
[18944] | 12 | profilename = '';
|
---|
[16388] | 13 | end
|
---|
| 14 | properties (SetAccess=private)
|
---|
[18944] | 15 | segments = NaN;
|
---|
[16388] | 16 | end
|
---|
| 17 | methods
|
---|
[19040] | 18 | function self = massfluxatgate(varargin) % {{{
|
---|
[18881] | 19 | if nargin==0,
|
---|
[19040] | 20 | self=setdefaultparameters(self);
|
---|
[18881] | 21 | else
|
---|
| 22 | %use provided options to change fields
|
---|
| 23 | options=pairoptions(varargin{:});
|
---|
| 24 |
|
---|
| 25 | %get name
|
---|
[19040] | 26 | self.name=getfieldvalue(options,'name','');
|
---|
[21049] | 27 | self.definitionstring=getfieldvalue(options,'definitionstring');
|
---|
[19040] | 28 | self.profilename=getfieldvalue(options,'profilename');
|
---|
[16388] | 29 | end
|
---|
| 30 | end % }}}
|
---|
[19040] | 31 | function self = setdefaultparameters(self) % {{{
|
---|
[16388] | 32 | end % }}}
|
---|
[19040] | 33 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
[16388] | 34 |
|
---|
[19040] | 35 | if ~ischar(self.name),
|
---|
[16388] | 36 | error('massfluxatgate error message: ''name'' field should be a string!');
|
---|
| 37 | end
|
---|
[19040] | 38 | if ~ischar(self.profilename),
|
---|
[16388] | 39 | error('massfluxatgate error message: ''profilename'' field should be a string!');
|
---|
| 40 | end
|
---|
[21049] | 41 |
|
---|
| 42 | OutputdefinitionStringArray={};
|
---|
| 43 | for i=1:100
|
---|
| 44 | OutputdefinitionStringArray{i}=strcat('Outputdefinition',num2str(i));
|
---|
| 45 | end
|
---|
| 46 | md = checkfield(md,'field',self.definitionstring,'values',OutputdefinitionStringArray);
|
---|
[16388] | 47 |
|
---|
| 48 | %check the profilename points to a file!:
|
---|
[19040] | 49 | if exist(self.profilename,'file')~=2,
|
---|
[16388] | 50 | error('massfluxatgate error message: file name for profile corresponding to gate does not point to a legitimate file on disk!');
|
---|
| 51 | end
|
---|
| 52 | end % }}}
|
---|
[19040] | 53 | function disp(self) % {{{
|
---|
[16388] | 54 | disp(sprintf(' Massfluxatgate:\n'));
|
---|
| 55 |
|
---|
[19040] | 56 | fielddisplay(self,'name','identifier for this massfluxatgate response');
|
---|
| 57 | fielddisplay(self,'profilename','name of file (shapefile or argus file) defining a profile (or gate)');
|
---|
[21049] | 58 | fielddisplay(self,'definitionstring','string that identifies this output definition uniquely, from ''Outputdefinition[1-10]''');
|
---|
[16388] | 59 |
|
---|
| 60 | end % }}}
|
---|
[20690] | 61 | function marshall(self,prefix,md,fid) % {{{
|
---|
[16388] | 62 |
|
---|
| 63 | %before marshalling, we need to create the segments out of the profilename:
|
---|
[19040] | 64 | self.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,self.profilename);
|
---|
[16388] | 65 |
|
---|
| 66 | %ok, marshall name and segments:
|
---|
[20690] | 67 | WriteData(fid,prefix,'data',self.name,'name','md.massfluxatgate.name','format','String');
|
---|
[21049] | 68 | WriteData(fid,prefix,'data',self.definitionstring,'name','md.massfluxatgate.definitionstring','format','String');
|
---|
[20690] | 69 | WriteData(fid,prefix,'data',self.segments,'name','md.massfluxatgate.segments','format','DoubleMat','mattype',1);
|
---|
[16388] | 70 |
|
---|
| 71 | end % }}}
|
---|
| 72 | end
|
---|
| 73 | end
|
---|