Changeset 1014
- Timestamp:
- 06/16/09 11:32:48 (16 years ago)
- Location:
- issm/trunk/src/m/solutions/dakota
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/solutions/dakota/dakota_in_data.m
r349 r1014 1 1 % 2 % define the data to write the dakota .in file2 % define the data to write the dakota .in and .m files. 3 3 % 4 % []=dakota_in_data(variables,responses,dmeth,dparams,filei,package,varargin) 4 % []=dakota_in_data(dmeth,variables,responses,dparams,filei,package,varargin) 5 % 6 % where the required input is: 7 % dmeth (dakota_method, method class object) 8 % variables (structure array, variable class objects) 9 % responses (structure array, response class objects) 10 % dparams (structure array, method-independent parameters) 11 % filei (character, name of .in and .m files) 12 % package (character, analysis package) 13 % 14 % params may be empty, in which case defaults will be used. 15 % 16 % the optional varargin are passed directly through to the 17 % QmuUpdateFunctions brancher to be used by the analysis 18 % package. for example, this could be model information. 19 % 20 % this function defines the data to write the dakota .in and 21 % .m files. it is necessary for multiple reasons. first, 22 % it collects the parameters and applies some defaults that 23 % are unique to the environment. second, some analysis package 24 % variables and/or responses may be treated differently by 25 % dakota. for example, an analysis package variable may be 26 % defined as an array, so the QmuSetupDesign brancher will 27 % create dakota variables for each element of the array. 28 % finally it calls the functions to write the .in and .m files. 29 % this function is independent of the particular analysis 30 % package. 31 % 32 % this data would typically be generated by a matlab script 33 % for a specific model, using the method, variable, and 34 % response class objects. 35 % 36 % "Copyright 2009, by the California Institute of Technology. 37 % ALL RIGHTS RESERVED. United States Government Sponsorship 38 % acknowledged. Any commercial use must be negotiated with 39 % the Office of Technology Transfer at the California Institute 40 % of Technology. (NTR 47078) 41 % 42 % This software may be subject to U.S. export control laws. 43 % By accepting this software, the user agrees to comply with 44 % all applicable U.S. export laws and regulations. User has the 45 % responsibility to obtain export licenses, or other export 46 % authority as may be required before exporting such information 47 % to foreign countries or providing access to foreign persons." 5 48 % 6 49 function []=dakota_in_data(dmeth,variables,responses,dparams,filei,package,varargin) … … 55 98 % for linear constraints, just copy 56 99 57 if strcmp(class(variables.(fnames{i})),'linear_inequality_constraint') || ...58 strcmp(class(variables.(fnames{i})),'linear_equality_constraint' )100 if isa(variables.(fnames{i}),'linear_inequality_constraint') || ... 101 isa(variables.(fnames{i}),'linear_equality_constraint' ) 59 102 dvar.(fnames{i})=variables.(fnames{i}); 60 103 -
issm/trunk/src/m/solutions/dakota/dakota_in_params.m
r452 r1014 3 3 % 4 4 % [params]=dakota_in_params(params) 5 % 6 % where the optional input is: 7 % params (structure array, method-independent parameters) 8 % 9 % and the output is the same. 10 % 11 % this function takes a structure of method-independent dakota 12 % parameters, which may be empty, and adds default parameters 13 % for those parameters which do not exist. 14 % 15 % the field names of the structure are identical to the dakota 16 % parameter names (and are in fact used to write them to the 17 % files). logical values are used for parameters which have 18 % no associated data and are determined only by their presence 19 % or absence. 20 % 21 % note that the method-dependent parameters are contained in 22 % the dakota_method class object. 23 % 24 % "Copyright 2009, by the California Institute of Technology. 25 % ALL RIGHTS RESERVED. United States Government Sponsorship 26 % acknowledged. Any commercial use must be negotiated with 27 % the Office of Technology Transfer at the California Institute 28 % of Technology. (NTR 47078) 29 % 30 % This software may be subject to U.S. export control laws. 31 % By accepting this software, the user agrees to comply with 32 % all applicable U.S. export laws and regulations. User has the 33 % responsibility to obtain export licenses, or other export 34 % authority as may be required before exporting such information 35 % to foreign countries or providing access to foreign persons." 5 36 % 6 37 function [params]=dakota_in_params(params) -
issm/trunk/src/m/solutions/dakota/dakota_in_parse.m
r32 r1014 1 1 % 2 % read a Dakota .in file and parse it.2 % read a Dakota .in input file and parse it. 3 3 % 4 4 % [method,dvar,dresp]=dakota_in_parse(filei) 5 % 6 % where the required input is: 7 % filei (character, name of .in file) 8 % 9 % the required output is: 10 % method (character, dakota method name) 11 % dvar (structure array, variables) 12 % dresp (structure array, responses) 13 % 14 % the filei will be prompted if empty. the fields of dvar and 15 % dresp are particular to the data contained within the file. 16 % 17 % this function reads a dakota .in input file and parses it 18 % into the matlab workspace. it operates in a content-driven 19 % fashion, where it parses whatever input data it encounters 20 % in the file, rather than searching for data based on the 21 % particular method. (this makes it independent of method.) 22 % 23 % as of now, parameters are generally not parsed. also, the 24 % variable and response classes are not used for output. 25 % 26 % this data would typically be used for modifying and submitting 27 % a subsequent dakota run. it could also be used with output 28 % data for post-processing or annotation purposes. 29 % 30 % "Copyright 2009, by the California Institute of Technology. 31 % ALL RIGHTS RESERVED. United States Government Sponsorship 32 % acknowledged. Any commercial use must be negotiated with 33 % the Office of Technology Transfer at the California Institute 34 % of Technology. (NTR 47078) 35 % 36 % This software may be subject to U.S. export control laws. 37 % By accepting this software, the user agrees to comply with 38 % all applicable U.S. export laws and regulations. User has the 39 % responsibility to obtain export licenses, or other export 40 % authority as may be required before exporting such information 41 % to foreign countries or providing access to foreign persons." 5 42 % 6 43 function [method,dvar,dresp]=dakota_in_parse(filei) … … 233 270 function [dresp]=responses_parse(fidi,tokens,itoken) 234 271 235 display('Reading Dakota response functions.');272 display('Reading Dakota responses.'); 236 273 dresp=[]; 237 274 nof =0; … … 515 552 strncmpi(tokens{1}{itoken},'responses',9) 516 553 517 % assemble the lists by response function554 % assemble the lists by response 518 555 519 556 if exist('nrespl','var') && isfield(dresp,'rf') -
issm/trunk/src/m/solutions/dakota/dakota_in_write.m
r659 r1014 1 1 % 2 % write a Dakota .in file.2 % write a Dakota .in input file. 3 3 % 4 4 % []=dakota_in_write(method,dmeth,dvar,dresp,params,filei,varargin) 5 % 6 % where the required input is: 7 % method (character, dakota method name) 8 % dmeth (dakota_method, method class object) 9 % dvar (structure array, variable class objects) 10 % dresp (structure array, response class objects) 11 % params (structure array, method-independent parameters) 12 % filei (character, name of .in file) 13 % 14 % the method, dmeth, and filei will be prompted if empty. 15 % params may be empty, in which case defaults will be used. 16 % 17 % the optional varargin are not yet used. 18 % 19 % this function writes a dakota .in input file to be used 20 % by dakota. this file is independent of the particular 21 % analysis package. 22 % 23 % this data would typically be generated by a matlab script 24 % for a specific model, using the method, variable, and 25 % response class objects. this function may be called by 26 % dakota_in_data. 27 % 28 % "Copyright 2009, by the California Institute of Technology. 29 % ALL RIGHTS RESERVED. United States Government Sponsorship 30 % acknowledged. Any commercial use must be negotiated with 31 % the Office of Technology Transfer at the California Institute 32 % of Technology. (NTR 47078) 33 % 34 % This software may be subject to U.S. export control laws. 35 % By accepting this software, the user agrees to comply with 36 % all applicable U.S. export laws and regulations. User has the 37 % responsibility to obtain export licenses, or other export 38 % authority as may be required before exporting such information 39 % to foreign countries or providing access to foreign persons." 5 40 % 6 41 function []=dakota_in_write(method,dmeth,dvar,dresp,params,filei,varargin) … … 26 61 [pathstr,name,ext,versn] = fileparts(filei); 27 62 if isempty(ext) 63 % fileparts only considers '.in' to be the extension, not '.qmu.in' 28 64 ext='.qmu.in'; 29 65 end -
issm/trunk/src/m/solutions/dakota/dakota_m_write.m
r586 r1014 1 1 % 2 % write a Dakota .m file for the Matlab direct or external 3 % driver. 4 % 5 % []=dakota_m_write(method,dmeth,dvar,dresp,params,filem,package) 2 % write a Matlab .m function file to be called by Dakota for 3 % the Matlab direct or external driver. 4 % 5 % []=dakota_m_write(method,dmeth,dvar,dresp,params,filem,package,varargin) 6 % 7 % where the required input is: 8 % method (character, dakota method name) 9 % dmeth (dakota_method, method class object) 10 % dvar (structure array, variable class objects) 11 % dresp (structure array, response class objects) 12 % params (structure array, method-independent parameters) 13 % filem (character, name of .m file) 14 % package (character, analysis package) 15 % 16 % the method, dmeth, and filem will be prompted if empty. 17 % params may be empty, in which case defaults will be used. 18 % 19 % the optional varargin are passed directly through to the 20 % QmuUpdateFunctions brancher to be used by the analysis 21 % package. for example, this could be model information. 22 % 23 % this function writes a matlab .m function file to be called 24 % by dakota for the matlab direct or external driver. for 25 % the direct driver, dakota is linked with matlab and 26 % automatically starts a matlab session, passing the variables 27 % and responses through the function; for the external driver, 28 % dakota calls a shell script to start the matlab session, 29 % passing the variables and responses through text files. 30 % this function must be tailored to the particular analysis 31 % package. 32 % 33 % this data would typically be generated by a matlab script 34 % for a specific model, using the method, variable, and 35 % response class objects. this function may be called by 36 % dakota_in_data. 37 % 38 % "Copyright 2009, by the California Institute of Technology. 39 % ALL RIGHTS RESERVED. United States Government Sponsorship 40 % acknowledged. Any commercial use must be negotiated with 41 % the Office of Technology Transfer at the California Institute 42 % of Technology. (NTR 47078) 43 % 44 % This software may be subject to U.S. export control laws. 45 % By accepting this software, the user agrees to comply with 46 % all applicable U.S. export laws and regulations. User has the 47 % responsibility to obtain export licenses, or other export 48 % authority as may be required before exporting such information 49 % to foreign countries or providing access to foreign persons." 6 50 % 7 51 function []=dakota_m_write(method,dmeth,dvar,dresp,params,filem,package,varargin) … … 99 143 end 100 144 101 %% function to write designvariables into the Matlab m-file145 %% function to write variables into the Matlab m-file 102 146 103 147 function []=variables_write(fidm,dmeth,dvar,params,varargin) … … 145 189 eval([descriptor '_lock=1;']); 146 190 147 %now, we need a string to put in the matlab file, which will update all the designvariables191 %now, we need a string to put in the matlab file, which will update all the variables 148 192 %for this descriptor. 149 193 [string,ixc]=QmuUpdateFunctions(ixc,descriptor,dvar,params,i,varargin{:}); -
issm/trunk/src/m/solutions/dakota/dakota_out_parse.m
r963 r1014 1 1 % 2 % read a Dakota .out file and parse it.2 % read a Dakota .out or .dat output file and parse it. 3 3 % 4 4 % [method,dresp,scm,pcm,srcm,prcm]=dakota_out_parse(filei) 5 % 6 % where the required input is: 7 % filei (character, name of .out file) 8 % 9 % the required output is: 10 % method (character, dakota method name) 11 % dresp (structure array, responses) 12 % 13 % and the optional output is: 14 % scm (double array, simple correlation matrix) 15 % pcm (double array, partial correlation matrix) 16 % srcm (double array, simple rank correlation matrix) 17 % prcm (double array, partial rank correlation matrix) 18 % 19 % the filei will be prompted if empty. the fields of dresp 20 % are particular to the data contained within the file. the 21 % scm, pcm, srcm, and prcm are output by dakota only for the 22 % sampling methods. 23 % 24 % this function reads a dakota .out output file and parses it 25 % into the matlab workspace. it operates in a content-driven 26 % fashion, where it skips the intermediate data and then parses 27 % whatever output data it encounters in the order in which it 28 % exists in the file, rather than searching for data based on 29 % the particular method. (this makes it independent of method.) 30 % it also can read and parse the .dat tabular_output file. 31 % 32 % this data would typically be used for plotting and other 33 % post-processing within matlab or excel. 34 % 35 % "Copyright 2009, by the California Institute of Technology. 36 % ALL RIGHTS RESERVED. United States Government Sponsorship 37 % acknowledged. Any commercial use must be negotiated with 38 % the Office of Technology Transfer at the California Institute 39 % of Technology. (NTR 47078) 40 % 41 % This software may be subject to U.S. export control laws. 42 % By accepting this software, the user agrees to comply with 43 % all applicable U.S. export laws and regulations. User has the 44 % responsibility to obtain export licenses, or other export 45 % authority as may be required before exporting such information 46 % to foreign countries or providing access to foreign persons." 5 47 % 6 48 function [method,dresp,scm,pcm,srcm,prcm]=dakota_out_parse(filei) … … 183 225 % draw box plot 184 226 185 % figure186 % subplot(2,1,1)187 % plot_boxplot(dresp);227 % figure 228 % subplot(2,1,1) 229 % plot_boxplot(dresp); 188 230 189 231 % draw normal probability plot 190 232 191 % subplot(2,1,2)192 % plot_normplot(dresp);233 % subplot(2,1,2) 234 % plot_normplot(dresp); 193 235 194 236 end … … 483 525 [ntokens,tokens]=fltokens(fline); 484 526 idvar=idvar+1; 485 dresp(end). desvar(idvar,1)=cellstr(tokens{1}{5});527 dresp(end).var (idvar,1)=cellstr(tokens{1}{5}); 486 528 dresp(end).impfac(idvar,1)= tokens{1}{7}; 487 529 … … 497 539 if ~idvar 498 540 display(' Importance Factors not available.'); 499 dresp(end). desvar={};541 dresp(end).var ={}; 500 542 dresp(end).impfac=[]; 501 543 while ~ieof && ...
Note:
See TracChangeset
for help on using the changeset viewer.