[16297] | 1 | %MASSFLUXATGATE class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % massfluxatgate=massfluxatgate();
|
---|
| 5 |
|
---|
| 6 | classdef massfluxatgate
|
---|
| 7 | properties (SetAccess=public)
|
---|
| 8 | %massfluxatgate
|
---|
| 9 | name = '';
|
---|
| 10 | profilename = '';
|
---|
| 11 | end
|
---|
| 12 | properties (SetAccess=private)
|
---|
| 13 | segments = NaN;
|
---|
| 14 | end
|
---|
| 15 | methods
|
---|
| 16 | function obj = massfluxatgate(varargin) % {{{
|
---|
| 17 | switch nargin
|
---|
| 18 | case 0
|
---|
| 19 | obj=setdefaultparameters(obj);
|
---|
| 20 | case 1
|
---|
| 21 | obj.name=varargin{1};
|
---|
| 22 | case 2
|
---|
| 23 | obj.name=varargin{1};
|
---|
| 24 | obj.profilename=varargin{2};
|
---|
| 25 | otherwise
|
---|
| 26 | error('constructor not supported');
|
---|
| 27 | end
|
---|
| 28 | end % }}}
|
---|
| 29 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 30 | end % }}}
|
---|
| 31 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
| 32 |
|
---|
[16298] | 33 | if ~ischar(obj.name),
|
---|
| 34 | error('massfluxatgate error message: ''name'' field should be a string!');
|
---|
| 35 | end
|
---|
| 36 | if ~ischar(obj.profilename),
|
---|
| 37 | error('massfluxatgate error message: ''profilename'' field should be a string!');
|
---|
| 38 | end
|
---|
[16297] | 39 |
|
---|
| 40 | %check the profilename points to a file!:
|
---|
[16298] | 41 | if exist(obj.profilename,'file')~=2,
|
---|
[16297] | 42 | error('massfluxatgate error message: file name for profile corresponding to gate does not point to a legitimate file on disk!');
|
---|
| 43 | end
|
---|
| 44 | end % }}}
|
---|
| 45 | function disp(obj) % {{{
|
---|
| 46 | disp(sprintf(' Massfluxatgate:\n'));
|
---|
| 47 |
|
---|
| 48 | fielddisplay(obj,'name','identifier for this massfluxatgate response');
|
---|
| 49 | fielddisplay(obj,'profilename','name of file (shapefile or argus file) defining a profile (or gate)');
|
---|
| 50 |
|
---|
| 51 | end % }}}
|
---|
| 52 | function marshall(obj,md,fid) % {{{
|
---|
| 53 |
|
---|
| 54 | %before marshalling, we need to create the segments out of the profilename:
|
---|
| 55 | obj.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,obj.profilename);
|
---|
| 56 |
|
---|
| 57 | %ok, marshall name and segments:
|
---|
| 58 | WriteData(fid,'object',obj,'fieldname','name','format','String');
|
---|
| 59 | WriteData(fid,'object',obj,'fieldname','segments','format','DoubleMat','mattype',1);
|
---|
| 60 |
|
---|
| 61 | end % }}}
|
---|
| 62 | end
|
---|
| 63 | end
|
---|