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