source: issm/trunk-jpl/src/m/classes/massfluxatgate.m@ 19000

Last change on this file since 19000 was 19000, checked in by schlegel, 10 years ago

CHG: add more output def options

File size: 2.4 KB
Line 
1%MASSFLUXATGATE class definition
2%
3% Usage:
4% massfluxatgate=massfluxatgate();
5% massfluxatgate=massfluxatgate('name','GateName','definitionname',Outputdefinition1Enum,'profilename','PathToExpFile');
6
7classdef 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 obj = massfluxatgate(varargin) % {{{
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');
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
41
42 md = checkfield(md,'field',obj.definitionenum,'values',[Outputdefinition1Enum():Outputdefinition100Enum()]);
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 fielddisplay(obj,'definitionenum','enum that identifies this output definition uniquely, from Outputdefinition[1-10]Enum');
55
56 end % }}}
57 function marshall(obj,md,fid) % {{{
58
59 %before marshalling, we need to create the segments out of the profilename:
60 obj.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,obj.profilename);
61
62 %ok, marshall name and segments:
63 WriteData(fid,'object',obj,'fieldname','name','format','String');
64 WriteData(fid,'object',obj,'fieldname','definitionenum','format','Integer');
65 WriteData(fid,'object',obj,'fieldname','segments','format','DoubleMat','mattype',1);
66
67 end % }}}
68 end
69end
Note: See TracBrowser for help on using the repository browser.