1 | %MASSFLUXATGATE class definition
|
---|
2 | %
|
---|
3 | % Usage:
|
---|
4 | % massfluxatgate=massfluxatgate();
|
---|
5 | % massfluxatgate=massfluxatgate('name','GateName','definitionname',Outputdefinition1Enum,'profilename','PathToExpFile');
|
---|
6 |
|
---|
7 | classdef massfluxatgate
|
---|
8 | properties (SetAccess=public)
|
---|
9 | %massfluxatgate
|
---|
10 | name = '';
|
---|
11 | definitionenum = 0;
|
---|
12 | profilename = '';
|
---|
13 | end
|
---|
14 | properties (SetAccess=private)
|
---|
15 | segments = NaN;
|
---|
16 | end
|
---|
17 | methods
|
---|
18 | function self = massfluxatgate(varargin) % {{{
|
---|
19 | if nargin==0,
|
---|
20 | self=setdefaultparameters(self);
|
---|
21 | else
|
---|
22 | %use provided options to change fields
|
---|
23 | options=pairoptions(varargin{:});
|
---|
24 |
|
---|
25 | %get name
|
---|
26 | self.name=getfieldvalue(options,'name','');
|
---|
27 | self.definitionenum=getfieldvalue(options,'definitionenum');
|
---|
28 | self.profilename=getfieldvalue(options,'profilename');
|
---|
29 | end
|
---|
30 | end % }}}
|
---|
31 | function self = setdefaultparameters(self) % {{{
|
---|
32 | end % }}}
|
---|
33 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
34 |
|
---|
35 | if ~ischar(self.name),
|
---|
36 | error('massfluxatgate error message: ''name'' field should be a string!');
|
---|
37 | end
|
---|
38 | if ~ischar(self.profilename),
|
---|
39 | error('massfluxatgate error message: ''profilename'' field should be a string!');
|
---|
40 | end
|
---|
41 |
|
---|
42 | md = checkfield(md,'field',self.definitionenum,'values',[Outputdefinition1Enum():Outputdefinition100Enum()]);
|
---|
43 |
|
---|
44 | %check the profilename points to a file!:
|
---|
45 | if exist(self.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(self) % {{{
|
---|
50 | disp(sprintf(' Massfluxatgate:\n'));
|
---|
51 |
|
---|
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');
|
---|
55 |
|
---|
56 | end % }}}
|
---|
57 | function marshall(self,prefix,md,fid) % {{{
|
---|
58 |
|
---|
59 | %before marshalling, we need to create the segments out of the profilename:
|
---|
60 | self.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,self.profilename);
|
---|
61 |
|
---|
62 | %ok, marshall name and segments:
|
---|
63 | WriteData(fid,prefix,'data',self.name,'name','md.massfluxatgate.name','format','String');
|
---|
64 | WriteData(fid,prefix,'data',self.definitionenum,'name','md.massfluxatgate.definitionenum','format','Integer');
|
---|
65 | WriteData(fid,prefix,'data',self.segments,'name','md.massfluxatgate.segments','format','DoubleMat','mattype',1);
|
---|
66 |
|
---|
67 | end % }}}
|
---|
68 | end
|
---|
69 | end
|
---|