|
Last change
on this file since 10969 was 10969, checked in by Mathieu Morlighem, 14 years ago |
|
Improvement: marshall is now a method of all model fields, removed unnecessary model fields (numcontrols... etc)
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | function marshall(md)
|
|---|
| 2 | %MARSHALL - output compatible binary file from @model md, for certain solution type.
|
|---|
| 3 | %
|
|---|
| 4 | % The routine creates a compatible binary file from @model md
|
|---|
| 5 | % This binary file will be used for parallel runs in JPL-package
|
|---|
| 6 | %
|
|---|
| 7 | % Usage:
|
|---|
| 8 | % marshall(md)
|
|---|
| 9 |
|
|---|
| 10 | disp(['marshalling file ' md.miscellaneous.name '.bin']);
|
|---|
| 11 |
|
|---|
| 12 | %open file for binary writing
|
|---|
| 13 | fid=fopen([ md.miscellaneous.name '.bin'],'wb');
|
|---|
| 14 | if fid==-1,
|
|---|
| 15 | error(['marshall error message: could not open ' [md.miscellaneous.name '.bin'],' file for binary writing']);
|
|---|
| 16 | end
|
|---|
| 17 |
|
|---|
| 18 | %Go through al model field check that it is a class and call checkconsistency
|
|---|
| 19 | fields=properties(md);
|
|---|
| 20 | for i=1:length(fields),
|
|---|
| 21 | field=fields{i};
|
|---|
| 22 |
|
|---|
| 23 | %Some properties do not need to be marshalled
|
|---|
| 24 | if ismember(field,{'results' 'debug' 'radaroverlay' 'solver' 'cluster' 'flaim' 'private'}),
|
|---|
| 25 | continue;
|
|---|
| 26 | end
|
|---|
| 27 |
|
|---|
| 28 | %Check that current field is an object
|
|---|
| 29 | if ~isobject(md.(field))
|
|---|
| 30 | checkmessage(['field ''' char(field) ''' is not an object']);
|
|---|
| 31 | end
|
|---|
| 32 |
|
|---|
| 33 | %Marshall current object
|
|---|
| 34 | %disp(['marshalling ' field '...']);
|
|---|
| 35 | md.(field).marshall(fid);
|
|---|
| 36 | end
|
|---|
| 37 |
|
|---|
| 38 | %close file
|
|---|
| 39 | st=fclose(fid);
|
|---|
| 40 | if st==-1,
|
|---|
| 41 | error(['marshall error message: could not close file ' [md.miscellaneous.name '.bin']]);
|
|---|
| 42 | end
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.