executePbeCase

PURPOSE ^

execute a case from the database

SYNOPSIS ^

function [result pbeDefinition] = executePbeCase(caseName)

DESCRIPTION ^

 execute a case from the database

 Syntax: result = executeCase(caseName)

 The case from the database folder is executed and the results are stored 
   in the data folder for further analysis.

 See also: loadCasePbe, solvePbe

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [result pbeDefinition] = executePbeCase(caseName)
0002 % execute a case from the database
0003 %
0004 % Syntax: result = executeCase(caseName)
0005 %
0006 % The case from the database folder is executed and the results are stored
0007 %   in the data folder for further analysis.
0008 %
0009 % See also: loadCasePbe, solvePbe
0010 
0011 % The elk-library: convex geometry applied to crystallization modeling.
0012 %   Copyright (C) 2012 Alexander Reinhold
0013 %
0014 % This program is free software: you can redistribute it and/or modify it
0015 %   under the terms of the GNU General Public License as published by the
0016 %   Free Software Foundation, either version 3 of the License, or (at your
0017 %   option) any later version.
0018 %
0019 % This program is distributed in the hope that it will be useful, but
0020 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0021 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0022 %   General Public License for more details.
0023 %
0024 % You should have received a copy of the GNU General Public License along
0025 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0026 
0027 %% input handling
0028 if ~exist('caseName', 'var')
0029     caseName = [];
0030 end
0031 % thats my path:
0032 myPath = fileparts(which(mfilename));
0033 
0034 %% database handling
0035 if isempty(caseName) || strcmpi(caseName, 'init')
0036     if nargout == 0
0037         obtainData(caseName)
0038     else
0039         result = obtainData(caseName);
0040     end
0041     return
0042 else
0043     pbeDefinition = obtainData(caseName);
0044 end
0045 
0046 %% execute solver
0047 [result pbeDefinition] = solvePbe(pbeDefinition);
0048 
0049 %% save data
0050 % make pbeDefinition available by saving the whole file to string
0051 pbeDefinitionString = fileread([myPath filesep 'database' filesep caseName '.m']);
0052 % make functions storable by conversion to strings
0053 pbeDefinition = convertFunctionToStringPbe(pbeDefinition);
0054 
0055 % save file
0056 save([myPath filesep 'data' filesep caseName '.mat'], 'result', ...
0057     'pbeDefinition', 'pbeDefinitionString', '-v7.3');
0058 % update index file
0059 dump = obtainData('init', 'database', [myPath filesep 'data'], 'type', 'mat');
0060 
0061 %% output
0062 if nargout == 0
0063     clear result
0064 end

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005