[16388] | 1 | %MASSFLUXATGATE class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % massfluxatgate=massfluxatgate();
|
---|
[18881] | 5 | % massfluxatgate=massfluxatgate('name','GateName','definitionname',Outputdefinition1Enum,'profilename','PathToExpFile');
|
---|
[16388] | 6 |
|
---|
| 7 | classdef massfluxatgate
|
---|
| 8 | properties (SetAccess=public)
|
---|
| 9 | %massfluxatgate
|
---|
[18944] | 10 | name = '';
|
---|
| 11 | definitionenum = 0;
|
---|
| 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','');
|
---|
| 27 | self.definitionenum=getfieldvalue(options,'definitionenum');
|
---|
| 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
|
---|
[18881] | 41 |
|
---|
[19040] | 42 | md = checkfield(md,'field',self.definitionenum,'values',[Outputdefinition1Enum():Outputdefinition100Enum()]);
|
---|
[16388] | 43 |
|
---|
| 44 | %check the profilename points to a file!:
|
---|
[19040] | 45 | if exist(self.profilename,'file')~=2,
|
---|
[16388] | 46 | error('massfluxatgate error message: file name for profile corresponding to gate does not point to a legitimate file on disk!');
|
---|
| 47 | end
|
---|
| 48 | end % }}}
|
---|
[19040] | 49 | function disp(self) % {{{
|
---|
[16388] | 50 | disp(sprintf(' Massfluxatgate:\n'));
|
---|
| 51 |
|
---|
[19040] | 52 | fielddisplay(self,'name','identifier for this massfluxatgate response');
|
---|
| 53 | fielddisplay(self,'profilename','name of file (shapefile or argus file) defining a profile (or gate)');
|
---|
| 54 | fielddisplay(self,'definitionenum','enum that identifies this output definition uniquely, from Outputdefinition[1-10]Enum');
|
---|
[16388] | 55 |
|
---|
| 56 | end % }}}
|
---|
[19040] | 57 | function marshall(self,md,fid) % {{{
|
---|
[16388] | 58 |
|
---|
| 59 | %before marshalling, we need to create the segments out of the profilename:
|
---|
[19040] | 60 | self.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,self.profilename);
|
---|
[16388] | 61 |
|
---|
| 62 | %ok, marshall name and segments:
|
---|
[19040] | 63 | WriteData(fid,'object',self,'fieldname','name','format','String');
|
---|
| 64 | WriteData(fid,'object',self,'fieldname','definitionenum','format','Integer');
|
---|
| 65 | WriteData(fid,'object',self,'fieldname','segments','format','DoubleMat','mattype',1);
|
---|
[16388] | 66 |
|
---|
| 67 | end % }}}
|
---|
| 68 | end
|
---|
| 69 | end
|
---|