


project a complete proper representation Initial data is already present (facet normals, mapping, properData). THIS IS NO USER FUNCTION


0001 function dec = projectCompleteDec(dec, par) 0002 % project a complete proper representation 0003 % 0004 % Initial data is already present (facet normals, mapping, properData). 0005 % 0006 % THIS IS NO USER FUNCTION 0007 0008 % The elk-library: convex geometry applied to crystallization modeling. 0009 % Copyright (C) 2013 Alexander Reinhold 0010 % 0011 % This program is free software: you can redistribute it and/or modify it 0012 % under the terms of the GNU General Public License as published by the 0013 % Free Software Foundation, either version 3 of the License, or (at your 0014 % option) any later version. 0015 % 0016 % This program is distributed in the hope that it will be useful, but 0017 % WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0019 % General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU General Public License along 0022 % with this program. If not, see <http://www.gnu.org/licenses/>. 0023 0024 %% Things, we already know 0025 %! DEV: In principle, the projection might be proper (in case of identity 0026 % as projection matrix). But this is rarely the case and ignored, here, 0027 % with no loss of functionality. 0028 dec.isProper = 0; 0029 dec.isComplete = 1; 0030 0031 %% Validity cone 0032 if par.verbose, disp('Project validity cone .. ');end 0033 % This is a simple transformation 0034 validityConeData.A = dec.properData.validityCone.A * ... 0035 dec.properData.mappingNewToProper; 0036 % remove zero rows and trim 0037 validityConeData.A = trimConstraintMatrix(validityConeData.A, par.zerotol, 1); 0038 % remove duplicate rows 0039 validityConeData.A = unique(validityConeData.A, 'rows'); 0040 0041 % add validity cone information, which adds the fields: validityCone, se 0042 % seScaledToClose, nS, centerRay. The following fiels are final: 0043 % validityCone, centerRay - all other fields will be extended. 0044 dec = addValidityCone(dec, validityConeData.A, par.zerotol); 0045 %! DEV: what happens when the validity cone is empty?? 0046 if par.verbose 0047 if dec.validityCone.volume == 0 0048 disp('.. empty validity cone, there will be no valid hC-vectors.'); 0049 else 0050 disp(['.. validity cone has volume: ' num2str(dec.validityCone.volume)]); 0051 end 0052 disp('done.'); 0053 end 0054 0055 %% Facet validity data 0056 if par.verbose, disp('Project facet validity data .. ');end 0057 dec = projectFacetValidityData(dec, dec.properData.facetValidityData, ... 0058 dec.properData.mappingNewToProper, ... 0059 par.zerotol); 0060 if par.verbose, disp('done.');end 0061 0062 %% Correct centerRay 0063 if par.verbose, disp('Construct center ray .. ');end 0064 % the valditity cone might be empty, resulting in an empty center ray. To 0065 % compensate this, we construct a meaningful closure from the 0066 % nonempty-polytope cone. 0067 nonemptyCone = obtainFacetValidityCone(dec, dec.nH + 1); 0068 dec.centerRay = mean(computeExtremeRaysFromCone(nonemptyCone.A, ... 0069 par.zerotol), 1)'; 0070 % correct SEs that are scaled to close 0071 % dec.seScaledToClose = scaleToClose(dec.seScaledToClose, dec); 0072 if par.verbose, disp('done.');end 0073 0074 %% Confinement cone 0075 if par.verbose, disp('Decompose non-empty polytope cone .. ');end 0076 % I need the scaledToClose extreme rays of the non-empty polytope cone 0077 nonemptyCone = obtainFacetValidityCone(dec, dec.nH + 1); 0078 % rayMatrix = computeExtremeRaysFromCone(nonemptyCone.A, zerotol); 0079 0080 % then, find all confined partitions 0081 partitionData = decomposeCone(dec, nonemptyCone.A, ... 0082 @generateConfinementPartition, par.zerotol, par.verbose); 0083 if par.verbose, disp('done.');end 0084 0085 if par.verbose, disp('Add confinement partitions and structuring elements.. ');end 0086 dec = addConfinementPartitionData(dec, partitionData, par.zerotol); 0087 dec = addConfinementMappingData(dec); 0088 if par.verbose, disp('done.');end 0089 0090 %% Validity (orthogonal) mapping 0091 if par.verbose, disp('Add validity mapping data.. ');end 0092 % if dec.validityCone.volume == 0 0093 % % the validity cone is empty, every mapping goes to zero 0094 % dec.validityMappingData.A = zeros(0, dec.nC); 0095 % dec.validityMappingData.responsibleMatrix = zeros(0, 3); 0096 % dec.validityMappingData.projectionList = zeros(dec.nC); 0097 % dec.validityMappingData.targetDimensionVector = 0; 0098 % else 0099 dec.validityMappingData = generateOrthogonalProjectionDataForCone(... 0100 dec.validityCone.A, ... 0101 dec.seScaledToClose(dec.validityCone.seIndexVector, :), ... 0102 par.zerotol); 0103 % end 0104 if par.verbose, disp('done.');end