function pbeDef = convertFunctionToStringPbe(pbeDef)
% convert function handles in string variables
%
% THIS IS NO USER FUNCTION

% The elk-library: convex geometry applied to crystallization modeling.
%   Copyright (C) 2012 Alexander Reinhold
%
% This program is free software: you can redistribute it and/or modify it 
%   under the terms of the GNU General Public License as published by the 
%   Free Software Foundation, either version 3 of the License, or (at your 
%   option) any later version.
%
% This program is distributed in the hope that it will be useful, but 
%   WITHOUT ANY WARRANTY; without even the implied warranty of 
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
%   General Public License for more details.
%
% You should have received a copy of the GNU General Public License along 
%   with this program.  If not, see <http://www.gnu.org/licenses/>.

%% Info
% Saved in a mat-file, anonymous functions cannot be restored so that they
%   have to be saved as string variables. This should works as long as they
%   do not contain anonymous functions themselves.

%% growth rate
if isfield(pbeDef,'growthRate')
    pbeDef.growthRate = func2str(pbeDef.growthRate);
end
if isfield(pbeDef,'growthGrad')
    pbeDef.growthGrad = func2str(pbeDef.growthGrad);
end

%% nucleation
if isfield(pbeDef, 'nucleationRate')
    pbeDef.nucleationRate = func2str(pbeDef.nucleationRate);
end

%% bulk
if isfield(pbeDef, 'bulkRate')
    pbeDef.bulkRate = func2str(pbeDef.bulkRate);
end

%% pivot property
if isfield(pbeDef, 'pivotProperty')
    pbeDef.pivotProperty = func2str(pbeDef.pivotProperty);
end

%% bulk property
if isfield(pbeDef, 'bulkProperty')
    pbeDef.bulkProperty = func2str(pbeDef.bulkProperty);
end
