addFacetValidityData

PURPOSE ^

add data to identify invalid facets

SYNOPSIS ^

function dec = addFacetValidityData(dec, validityConeData, zerotol, verbose)

DESCRIPTION ^

 add data to identify invalid facets

 THIS FUNCTION IS NO USER FUNCTION.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dec = addFacetValidityData(dec, validityConeData, zerotol, verbose)
0002 % add data to identify invalid facets
0003 %
0004 % THIS FUNCTION IS NO USER FUNCTION.
0005 
0006 % The elk-library: convex geometry applied to crystallization modeling.
0007 %   Copyright (C) 2012 Alexander Reinhold
0008 %
0009 % This program is free software: you can redistribute it and/or modify it
0010 %   under the terms of the GNU General Public License as published by the
0011 %   Free Software Foundation, either version 3 of the License, or (at your
0012 %   option) any later version.
0013 %
0014 % This program is distributed in the hope that it will be useful, but
0015 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0016 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017 %   General Public License for more details.
0018 %
0019 % You should have received a copy of the GNU General Public License along
0020 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 
0022 %% data structure
0023 %     .A       - boundary facet normals in nC-dimensional space
0024 %     .responsibleMatrix - a matrix that indicates in each row a constraint
0025 %                in A (first column) that must be fulfilled by a facet
0026 %                (second column)
0027 
0028 %% generate facet validity data
0029 % the responsibleMatrix indicates where the facet grows out; the facet
0030 %   (nH+1) corresponds to the empty-polytope condidions
0031 boundaryData.A = nan(0, dec.nC);
0032 boundaryData.responsibleMatrix = nan(0, 2);
0033 ineqFilterBase = validityConeData.responsibleFacetVector < 0;
0034 
0035 if verbose,fprintf('......');end
0036 
0037 for iFacet = 1:(dec.nH+1)
0038     if verbose
0039        fprintf('\b\b\b\b\b\b%5.1f%%', iFacet/(dec.nH+1)*100);
0040     end
0041     
0042     % filter required conditions (in case nH+1, ineqFilterBase is retained)
0043     thisIneqFilter = ineqFilterBase | ...
0044         (validityConeData.responsibleFacetVector == iFacet);
0045     
0046     % reduce conditions
0047     thisCone.A = unique(validityConeData.A(thisIneqFilter, :), 'rows');
0048     thisCone.h = zeros(size(thisCone.A, 1), 1);
0049     thisCone = reduceHrep(thisCone);
0050     
0051     % concatenate constraints
0052     theseIneqIdxVector = size(boundaryData.A, 1) + (1:size(thisCone.A, 1))';
0053     boundaryData.A = [boundaryData.A; thisCone.A];
0054     boundaryData.responsibleMatrix = [boundaryData.responsibleMatrix; ...
0055         [theseIneqIdxVector, theseIneqIdxVector*0 + iFacet]];
0056 end
0057 if verbose, fprintf('\b\b\b\b\b\b');end
0058 
0059 % make constraints unique, again
0060 [boundaryData.A dump newIndexVector] = unique(boundaryData.A, 'rows');
0061 boundaryData.responsibleMatrix(:,1) = newIndexVector(...
0062     boundaryData.responsibleMatrix(:,1));
0063 boundaryData.responsibleMatrix = unique(boundaryData.responsibleMatrix, 'rows');
0064 
0065 % assign result
0066 dec.facetValidityData = boundaryData;

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