cleanupDecStructure

PURPOSE ^

ensure proper format fieldnames of the decomposition structure

SYNOPSIS ^

function dec = cleanupDecStructure(dec)

DESCRIPTION ^

 ensure proper format fieldnames of the decomposition structure

 We ensure that all fields are present and ordered like defined in
   templateDec. Additionally, we handle the naming of the confinementCone
   dependent on isComplete and isOrdinary. This shall ensure that
   confinementCone is used accordingly.

 THIS IS NO USER FUNCTION

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dec = cleanupDecStructure(dec)
0002 % ensure proper format fieldnames of the decomposition structure
0003 %
0004 % We ensure that all fields are present and ordered like defined in
0005 %   templateDec. Additionally, we handle the naming of the confinementCone
0006 %   dependent on isComplete and isOrdinary. This shall ensure that
0007 %   confinementCone is used accordingly.
0008 %
0009 % THIS IS NO USER FUNCTION
0010 
0011 % The elk-library: convex geometry applied to crystallization modeling.
0012 %   Copyright (C) 2013 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 dec = mergeStruct(dec, templateDec);
0028 dec = orderfields(dec, templateDec);
0029 
0030 if dec.isOrdinary && dec.isComplete
0031     dec = rmfield(dec, {'confinementConeHull', 'confinementConePart', ...
0032         'validityConePart'});
0033 elseif ~dec.isComplete
0034     dec.confinementConePart = dec.confinementCone;
0035     dec.validityConePart = dec.validityCone;
0036     dec = rmfield(dec, {'confinementCone', 'confinementConeHull', ...
0037         'validityCone', 'confinementMappingData'});
0038 elseif ~dec.isOrdinary && dec.isComplete
0039     dec.confinementConeHull = dec.confinementCone;
0040     dec = rmfield(dec, {'confinementCone', 'confinementConePart', ...
0041         'validityConePart'});
0042 else
0043     error('elk:decomposition:internalError', 'This case should not exist.');
0044 end
0045 
0046 % remove empty fields
0047 removeIndexVector = find(structfun(@isempty, dec));
0048 fieldnameList = fieldnames(dec);
0049 dec = rmfield(dec, fieldnameList(removeIndexVector));

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