[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
|
---|
| 10 | name = '';
|
---|
[18881] | 11 | definitionenum = NaN; %enum that identifies this output definition uniquely, from Outputdefinition[1-10]Enum
|
---|
[16388] | 12 | profilename = '';
|
---|
| 13 | end
|
---|
| 14 | properties (SetAccess=private)
|
---|
| 15 | segments = NaN;
|
---|
| 16 | end
|
---|
| 17 | methods
|
---|
| 18 | function obj = massfluxatgate(varargin) % {{{
|
---|
[18881] | 19 | if nargin==0,
|
---|
| 20 | obj=setdefaultparameters(obj);
|
---|
| 21 | else
|
---|
| 22 | %use provided options to change fields
|
---|
| 23 | options=pairoptions(varargin{:});
|
---|
| 24 |
|
---|
| 25 | %get name
|
---|
| 26 | obj.name=getfieldvalue(options,'name','');
|
---|
| 27 | obj.definitionenum=getfieldvalue(options,'definitionenum');
|
---|
| 28 | obj.profilename=getfieldvalue(options,'profilename');
|
---|
[16388] | 29 | end
|
---|
| 30 | end % }}}
|
---|
| 31 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 32 | end % }}}
|
---|
| 33 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
| 34 |
|
---|
| 35 | if ~ischar(obj.name),
|
---|
| 36 | error('massfluxatgate error message: ''name'' field should be a string!');
|
---|
| 37 | end
|
---|
| 38 | if ~ischar(obj.profilename),
|
---|
| 39 | error('massfluxatgate error message: ''profilename'' field should be a string!');
|
---|
| 40 | end
|
---|
[18881] | 41 |
|
---|
| 42 | md = checkfield(md,'fieldname','obj.definitionenum','field',obj.definitionenum,'values',[Outputdefinition1Enum,Outputdefinition2Enum,Outputdefinition3Enum,Outputdefinition4Enum,Outputdefinition5Enum,Outputdefinition6Enum,Outputdefinition7Enum,Outputdefinition8Enum,Outputdefinition9Enum,Outputdefinition10Enum]);
|
---|
[16388] | 43 |
|
---|
| 44 | %check the profilename points to a file!:
|
---|
| 45 | if exist(obj.profilename,'file')~=2,
|
---|
| 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 % }}}
|
---|
| 49 | function disp(obj) % {{{
|
---|
| 50 | disp(sprintf(' Massfluxatgate:\n'));
|
---|
| 51 |
|
---|
| 52 | fielddisplay(obj,'name','identifier for this massfluxatgate response');
|
---|
| 53 | fielddisplay(obj,'profilename','name of file (shapefile or argus file) defining a profile (or gate)');
|
---|
| 54 |
|
---|
| 55 | end % }}}
|
---|
| 56 | function marshall(obj,md,fid) % {{{
|
---|
| 57 |
|
---|
| 58 | %before marshalling, we need to create the segments out of the profilename:
|
---|
| 59 | obj.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,obj.profilename);
|
---|
| 60 |
|
---|
| 61 | %ok, marshall name and segments:
|
---|
| 62 | WriteData(fid,'object',obj,'fieldname','name','format','String');
|
---|
[18894] | 63 | WriteData(fid,'object',obj,'fieldname','definitionenum','format','Integer');
|
---|
[16388] | 64 | WriteData(fid,'object',obj,'fieldname','segments','format','DoubleMat','mattype',1);
|
---|
| 65 |
|
---|
| 66 | end % }}}
|
---|
| 67 | end
|
---|
| 68 | end
|
---|