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

Last change on this file since 21049 was 21049, checked in by agscott1, 9 years ago

CHG: Replaced Enums with Strings in matlab and python. Updated corresponding cpp code.

File size: 2.6 KB
Line 
1%MASSFLUXATGATE class definition
2%
3% Usage:
4% massfluxatgate=massfluxatgate();
5% massfluxatgate=massfluxatgate('name','GateName','definitionname','Outputdefinition1','profilename','PathToExpFile');
6
7classdef massfluxatgate
8 properties (SetAccess=public)
9 %massfluxatgate
10 name = '';
11 definitionstring = '';
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.definitionstring=getfieldvalue(options,'definitionstring');
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 OutputdefinitionStringArray={};
43 for i=1:100
44 OutputdefinitionStringArray{i}=strcat('Outputdefinition',num2str(i));
45 end
46 md = checkfield(md,'field',self.definitionstring,'values',OutputdefinitionStringArray);
47
48 %check the profilename points to a file!:
49 if exist(self.profilename,'file')~=2,
50 error('massfluxatgate error message: file name for profile corresponding to gate does not point to a legitimate file on disk!');
51 end
52 end % }}}
53 function disp(self) % {{{
54 disp(sprintf(' Massfluxatgate:\n'));
55
56 fielddisplay(self,'name','identifier for this massfluxatgate response');
57 fielddisplay(self,'profilename','name of file (shapefile or argus file) defining a profile (or gate)');
58 fielddisplay(self,'definitionstring','string that identifies this output definition uniquely, from ''Outputdefinition[1-10]''');
59
60 end % }}}
61 function marshall(self,prefix,md,fid) % {{{
62
63 %before marshalling, we need to create the segments out of the profilename:
64 self.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,self.profilename);
65
66 %ok, marshall name and segments:
67 WriteData(fid,prefix,'data',self.name,'name','md.massfluxatgate.name','format','String');
68 WriteData(fid,prefix,'data',self.definitionstring,'name','md.massfluxatgate.definitionstring','format','String');
69 WriteData(fid,prefix,'data',self.segments,'name','md.massfluxatgate.segments','format','DoubleMat','mattype',1);
70
71 end % }}}
72 end
73end
Note: See TracBrowser for help on using the repository browser.