Last change
on this file since 19787 was 19787, checked in by Eric.Larour, 9 years ago |
CHG: implemented ismodelselfconsistent routine and all corresponding checkconsistency
routines in the main model classes. Implemented embryo of i/o routines to start marshalling
model. Implemented issm.js and compilation of main issm module to run ISSM in javascript.
|
File size:
1.3 KB
|
Line | |
---|
1 | function marshall(md){
|
---|
2 | //MARSHALL - outputs a typed array buffer to be send to the issm module.
|
---|
3 | //
|
---|
4 | // The routine creates a compatible binary stream from @model md
|
---|
5 | // This binary stream will be used for single cpu runs using the issm module.
|
---|
6 | //
|
---|
7 | // Usage:
|
---|
8 | // fid=marshall(md)
|
---|
9 |
|
---|
10 | if (md.verbose.solution){
|
---|
11 | console.log('marshalling file ' + md.miscellaneous.name + '.bin');
|
---|
12 | }
|
---|
13 |
|
---|
14 | //open file for binary writing
|
---|
15 | fid=new fileptr();
|
---|
16 |
|
---|
17 | //First, write MaximumNumberOfEnum to make sure that the Enums are synchronized
|
---|
18 | WriteData(fid,'enum',MaximumNumberOfDefinitionsEnum(),'data',true,'format','Boolean');
|
---|
19 |
|
---|
20 | //Go through all model fields: check that it is a class and call checkconsistency
|
---|
21 | for (field in md){
|
---|
22 |
|
---|
23 | //Some properties do not need to be marshalled
|
---|
24 | if (field == 'results' | field =='radaroverlay' | field == 'toolkits' | field =='cluster' | field == 'flaim' | field == 'private') continue;
|
---|
25 |
|
---|
26 | //Check that current field is a class
|
---|
27 | if(typeof md[field] == 'function'){
|
---|
28 | continue;
|
---|
29 | }
|
---|
30 | console.log(field);
|
---|
31 |
|
---|
32 | //Marshall current object
|
---|
33 | md[field].marshall(md,fid);
|
---|
34 | }
|
---|
35 |
|
---|
36 | //Last, write MaximumNumberOfEnum+1 to make sure that the binary file is not corrupt
|
---|
37 | WriteData(fid,'enum',MaximumNumberOfDefinitionsEnum()+1,'data',true,'format','Boolean');
|
---|
38 |
|
---|
39 | return fid;
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.