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