Changeset 9509
- Timestamp:
- 08/31/11 10:41:14 (14 years ago)
- Location:
- issm/trunk/src/m
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/model.m
r9505 r9509 22 22 numberofelements = modelfield('default',0,'marshall',true,'format','Integer'); 23 23 numberofnodes = modelfield('default',0,'marshall',true,'format','Integer'); 24 elements = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);25 elements_type = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);26 vertices_type = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);27 x = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);28 y = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);29 z = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);24 elements = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 25 elements_type = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 26 vertices_type = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 27 x = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 28 y = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 29 z = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 30 30 nodeconnectivity = modelfield('default',NaN,'marshall',false); 31 elementconnectivity = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);32 edges = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);31 elementconnectivity = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 32 edges = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 33 33 34 34 %I/O … … 38 38 numberofelements2d = modelfield('default',0,'marshall',true,'format','Integer'); 39 39 numberofnodes2d = modelfield('default',0,'marshall',true,'format','Integer'); 40 elements2d = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);40 elements2d = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 41 41 elements_type2d = modelfield('default',NaN,'marshall',false); 42 42 vertices_type2d = modelfield('default',NaN,'marshall',false); … … 61 61 62 62 %Nodes 63 nodeonhutter = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);64 nodeonmacayeal = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);65 nodeonpattyn = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);66 nodeonstokes = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);67 borderstokes = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);63 nodeonhutter = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 64 nodeonmacayeal = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 65 nodeonpattyn = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 66 nodeonstokes = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 67 borderstokes = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 68 68 69 69 %Stokes … … 72 72 73 73 %Penalties 74 penalties = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);74 penalties = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 75 75 penalty_offset = modelfield('default',0,'marshall',true,'format','Double'); 76 76 penalty_lock = modelfield('default',0,'marshall',true,'format','Integer'); … … 78 78 segmentmarkers = modelfield('default',NaN,'marshall',false); 79 79 rifts = modelfield('default',NaN,'marshall',false); 80 riftinfo = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);80 riftinfo = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 81 81 riftproperties = modelfield('default',NaN,'marshall',false); 82 82 numrifts = modelfield('default',0,'marshall',true,'format','Integer'); … … 84 84 %Projections 85 85 uppernodes = modelfield('default',NaN,'marshall',false); 86 upperelements = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);87 lowerelements = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);86 upperelements = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 87 lowerelements = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 88 88 lowernodes = modelfield('default',NaN,'marshall',false); 89 89 90 90 %Extrusion 91 91 numlayers = modelfield('default',0,'marshall',true,'format','Integer'); 92 elementonbed = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',2);93 elementonsurface = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',2);94 nodeonbed = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',1);95 nodeonsurface = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',1);92 elementonbed = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2); 93 elementonsurface = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2); 94 nodeonbed = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',1); 95 nodeonsurface = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',1); 96 96 minh = modelfield('default',0,'marshall',false); 97 97 … … 118 118 g = modelfield('default',0,'marshall',true,'format','Double'); 119 119 yts = modelfield('default',0,'marshall',true,'format','Double'); 120 drag_coefficient = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);121 drag_p = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);122 drag_q = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);123 rheology_B = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);124 rheology_n = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);120 drag_coefficient = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 121 drag_p = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 122 drag_q = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 123 rheology_B = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 124 rheology_n = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 125 125 rheology_law = modelfield('default','','marshall',true,'format','String'); 126 126 127 127 %Geometrical parameters 128 elementoniceshelf = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',2);129 elementonicesheet = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',2);130 elementonwater = modelfield('default',NaN,'marshall',true,'format','BooleanMat',' sizetype',2);131 nodeoniceshelf = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);132 nodeonicesheet = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);133 nodeonwater = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);134 surface = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);135 thickness = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);136 thickness_coeff = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);137 bed = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);138 bathymetry = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);128 elementoniceshelf = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2); 129 elementonicesheet = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2); 130 elementonwater = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2); 131 nodeoniceshelf = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 132 nodeonicesheet = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 133 nodeonwater = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 134 surface = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 135 thickness = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 136 thickness_coeff = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 137 bed = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 138 bathymetry = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 139 139 140 140 %Boundary conditions 141 141 nodeonboundary = modelfield('default',NaN,'marshall',false); 142 pressureload = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);143 spcvx = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);144 spcvy = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);145 spcvz = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);146 spctemperature = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);147 spcthickness = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);148 spcwatercolumn = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);149 diagnostic_ref = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);142 pressureload = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 143 spcvx = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 144 spcvy = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 145 spcvz = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 146 spctemperature = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 147 spcthickness = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 148 spcwatercolumn = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 149 diagnostic_ref = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 150 150 151 151 %Observations 152 vx_obs = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);153 vy_obs = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);152 vx_obs = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 153 vy_obs = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 154 154 vel_obs = modelfield('default',NaN,'marshall',false); 155 surface_accumulation_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);156 surface_ablation_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);157 surface_mass_balance = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);158 dhdt = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);159 geothermalflux = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);160 thickness_obs = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);155 surface_accumulation_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 156 surface_ablation_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 157 surface_mass_balance = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 158 dhdt = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 159 geothermalflux = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 160 thickness_obs = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 161 161 162 162 %Statics parameters … … 183 183 %Control 184 184 control_analysis = modelfield('default',0,'marshall',true,'format','Boolean'); 185 control_type = modelfield('default',0,'marshall',true,'format','DoubleMat',' sizetype',3);186 weights = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);185 control_type = modelfield('default',0,'marshall',true,'format','DoubleMat','mattype',3); 186 weights = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 187 187 nsteps = modelfield('default',0,'marshall',true,'format','Integer'); 188 maxiter = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);189 cm_responses = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);188 maxiter = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 189 cm_responses = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 190 190 tolx = modelfield('default',0,'marshall',true,'format','Double'); 191 optscal = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);191 optscal = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 192 192 eps_cm = modelfield('default',0,'marshall',true,'format','Double'); 193 cm_min = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);194 cm_max = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);195 cm_jump = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);193 cm_min = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 194 cm_max = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 195 cm_jump = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 196 196 cm_gradient = modelfield('default',0,'marshall',true,'format','Boolean'); 197 197 epsvel = modelfield('default',0,'marshall',true,'format','Double'); … … 200 200 num_cm_responses = modelfield('default',0,'marshall',true,'format','Integer'); 201 201 %Output 202 requested_outputs = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',3);202 requested_outputs = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3); 203 203 %Debugging 204 verbose = modelfield('default',0,'marshall',true,' format','Integer');204 verbose = modelfield('default',0,'marshall',true,'preprocess','marshallverbose','format','Integer'); 205 205 mem_debug = modelfield('default',0,'marshall',false); 206 206 gprof = modelfield('default',0,'marshall',false); … … 211 211 outputfilename = modelfield('default','','marshall',true,'format','String'); 212 212 results = modelfield('default',struct(),'marshall',false); 213 vx = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);214 vy = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);215 vz = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);213 vx = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 214 vy = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 215 vz = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 216 216 vel = modelfield('default',NaN,'marshall',false); 217 temperature = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1); %temperature solution vector218 waterfraction = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);217 temperature = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); %temperature solution vector 218 waterfraction = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 219 219 groundingline_melting_rate = modelfield('default',NaN,'marshall',true,'format','Double'); 220 basal_melting_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);221 basal_melting_rate_correction = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);222 pressure = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);220 basal_melting_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 221 basal_melting_rate_correction = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 222 pressure = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 223 223 %Hydrology 224 watercolumn = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',1);224 watercolumn = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); 225 225 226 226 %Hydrology … … 261 261 dakotadat = modelfield('default','','marshall',false); 262 262 qmu_analysis = modelfield('default',0,'marshall',true,'format','Boolean'); 263 part = modelfield('default',NaN,'marshall',true,'format','DoubleMat',' sizetype',2);263 part = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2); 264 264 npart = modelfield('default',0,'marshall',true,'format','Integer'); 265 265 numberofvariables = modelfield('default',0,'marshall',true,'format','Integer'); -
issm/trunk/src/m/classes/modelfield.m
r9505 r9509 10 10 preprocess=''; 11 11 format='Int'; 12 sizetype=0;12 mattype=0; 13 13 end 14 14 methods -
issm/trunk/src/m/model/marshall.m
r9476 r9509 20 20 fields=fieldnames(template); 21 21 for i=1:length(fields), 22 field=fields{i}; 23 marshall=template.(field){2}; 24 if marshall, 25 if strcmpi(field,'verbose'), 26 WriteData(fid,field,VerboseToBinary(md.verbose),{'Integer'}); 22 fieldname=fields{i}; 23 if template.(fieldname).marshall, 24 if ~isempty(template.(fieldname).preprocess), 25 eval(['fieldvalue=' template.(fieldname).preprocess '(md.(fieldname));']); 27 26 else 28 WriteData(fid,field,md.(field),template.(field)(3:end));27 fieldvalue=md.(fieldname); 29 28 end 29 WriteData(fid,fieldname,fieldvalue,template.(fieldname)); 30 30 end 31 31 end 32 32 33 33 %Quick fix: add some fields needed by parameters 34 WriteData(fid,'numberofvertices',md.numberofnodes, {'Integer'});35 WriteData(fid,'numberofedges',size(md.edges,1), {'Integer'});34 WriteData(fid,'numberofvertices',md.numberofnodes,modelfield('format','Integer')); 35 WriteData(fid,'numberofedges',size(md.edges,1),modelfield('format','Integer')); 36 36 37 37 %close file … … 41 41 end 42 42 43 function WriteData(fid,fieldname,fieldvalue,field type) % {{{43 function WriteData(fid,fieldname,fieldvalue,fieldprop) % {{{ 44 44 %WRITEDATA - write model field in binary file 45 45 % 46 46 % Usage: 47 % WriteData(fid,fieldname,fieldvalue,fieldtype) 48 % 49 % Example: 50 % WriteData(fid,'thickness',md.thickness,{'DoubleMat',1}) 47 % WriteData(fid,fieldname,fieldvalue,fieldprop) 48 % 51 49 52 50 %first recover data, enum of the data and type of data 53 51 data=fieldvalue; 54 52 enum=BuildEnum(fieldname); 55 data_type=field type{1};53 data_type=fieldprop.format; 56 54 57 55 if issparse(data), … … 113 111 114 112 %matrix type: 115 mattype=field type{2};113 mattype=fieldprop.mattype; 116 114 117 115 %Get size … … 165 163 166 164 %matrix type: 167 mattype=field type{2};165 mattype=fieldprop.mattype; 168 166 169 167 %Get size … … 338 336 error('TypeToCode error message: data type not supported yet!'); 339 337 end% }}} 338 339 %Some processing, should be moved to the corresponding classes in the future 340 function out=marshallverbose(in) 341 out = VerboseToBinary(in);
Note:
See TracChangeset
for help on using the changeset viewer.