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

Last change on this file was 21808, checked in by schlegel, 8 years ago

Add capability for regional output definitions

File size: 2.7 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 = extrude(self,md) % {{{
19 end % }}}
20 function self = massfluxatgate(varargin) % {{{
21 if nargin==0,
22 self=setdefaultparameters(self);
23 else
24 %use provided options to change fields
25 options=pairoptions(varargin{:});
26
27 %get name
28 self.name=getfieldvalue(options,'name','');
29 self.definitionstring=getfieldvalue(options,'definitionstring');
30 self.profilename=getfieldvalue(options,'profilename');
31 end
32 end % }}}
33 function self = setdefaultparameters(self) % {{{
34 end % }}}
35 function md = checkconsistency(self,md,solution,analyses) % {{{
36
37 if ~ischar(self.name),
38 error('massfluxatgate error message: ''name'' field should be a string!');
39 end
40 if ~ischar(self.profilename),
41 error('massfluxatgate error message: ''profilename'' field should be a string!');
42 end
43
44 OutputdefinitionStringArray={};
45 for i=1:100
46 OutputdefinitionStringArray{i}=strcat('Outputdefinition',num2str(i));
47 end
48 md = checkfield(md,'field',self.definitionstring,'values',OutputdefinitionStringArray);
49
50 %check the profilename points to a file!:
51 if exist(self.profilename,'file')~=2,
52 error('massfluxatgate error message: file name for profile corresponding to gate does not point to a legitimate file on disk!');
53 end
54 end % }}}
55 function disp(self) % {{{
56 disp(sprintf(' Massfluxatgate:\n'));
57
58 fielddisplay(self,'name','identifier for this massfluxatgate response');
59 fielddisplay(self,'profilename','name of file (shapefile or argus file) defining a profile (or gate)');
60 fielddisplay(self,'definitionstring','string that identifies this output definition uniquely, from ''Outputdefinition[1-100]''');
61
62 end % }}}
63 function marshall(self,prefix,md,fid) % {{{
64
65 %before marshalling, we need to create the segments out of the profilename:
66 self.segments=MeshProfileIntersection(md.mesh.elements,md.mesh.x,md.mesh.y,self.profilename);
67
68 %ok, marshall name and segments:
69 WriteData(fid,prefix,'data',self.name,'name','md.massfluxatgate.name','format','String');
70 WriteData(fid,prefix,'data',self.definitionstring,'name','md.massfluxatgate.definitionstring','format','String');
71 WriteData(fid,prefix,'data',self.segments,'name','md.massfluxatgate.segments','format','DoubleMat','mattype',1);
72
73 end % }}}
74 end
75end
Note: See TracBrowser for help on using the repository browser.