appendPartitionDataForEmbedding

PURPOSE ^

append embedding (unified) partition data

SYNOPSIS ^

function dec = appendPartitionDataForEmbedding(dec, partitionData, zerotol)

DESCRIPTION ^

 append embedding (unified) partition data

 this function is supposed to be used whenever an appendUnifiedPartition
   was called as it adds information to the last unified partition(!)

 The following fields are added:
   .this: data that is true for vectors in the interior of the domain
   .projection: several projection matrices that apply
   .embeddingDomain: representation of partition in proper embedding
   .boundary: information on the boundaries of the partition and the
       neighbours of that partition

 THIS IS NO USER FUNCTION

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dec = appendPartitionDataForEmbedding(dec, partitionData, zerotol)
0002 % append embedding (unified) partition data
0003 %
0004 % this function is supposed to be used whenever an appendUnifiedPartition
0005 %   was called as it adds information to the last unified partition(!)
0006 %
0007 % The following fields are added:
0008 %   .this: data that is true for vectors in the interior of the domain
0009 %   .projection: several projection matrices that apply
0010 %   .embeddingDomain: representation of partition in proper embedding
0011 %   .boundary: information on the boundaries of the partition and the
0012 %       neighbours of that partition
0013 %
0014 % THIS IS NO USER FUNCTION
0015 
0016 % The elk-library: convex geometry applied to crystallization modeling.
0017 %   Copyright (C) 2013 Alexander Reinhold
0018 %
0019 % This program is free software: you can redistribute it and/or modify it
0020 %   under the terms of the GNU General Public License as published by the
0021 %   Free Software Foundation, either version 3 of the License, or (at your
0022 %   option) any later version.
0023 %
0024 % This program is distributed in the hope that it will be useful, but
0025 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0026 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0027 %   General Public License for more details.
0028 %
0029 % You should have received a copy of the GNU General Public License along
0030 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0031 
0032 %% unified partition index
0033 this.embeddingUnifiedIndex = partitionData.unifiedIndex;
0034 
0035 %% validity projection (by partition)
0036 % projection information for all facets that HAVE disappeared for
0037 %   hC-vectors in the interior of that partition.
0038 projection.invalidConstraintIndexVector = ...
0039     partitionData.debug.projectionData.violatedConstraintIndexVector;
0040 projection.invalidGroupIndexVector = ...
0041     partitionData.debug.projectionData.invalidFacetGroupVector;
0042 projection.projectionIndexVector = ...
0043     partitionData.debug.projectionData.projectionIndexVector;
0044 
0045 % the required validity projection (this does not yet map to the
0046 %    corresponding subspace in the proper embedding)
0047 projection.validity = partitionData.validityProjectionMatrix;
0048 
0049 % direct maping FROM embedding proper representation (assuming
0050 %   the hE-vector is on the proper domain in hE-space, if not we take
0051 %   the closest hE vector with that property)
0052 projection.fromProper = pinv(projection.validity*...
0053     dec.properData.mappingNewToProper);
0054 
0055 % the projection that uses validity projection (if possible) to
0056 %    reach the corresponding subspace in the proper embedding
0057 projection.validityOntoSubspace = ...
0058     projection.validity*dec.properData.mappingNewToProper*...
0059     projection.fromProper;
0060 
0061 % orthogonal projection onto the corresponding subspace (in
0062 %   embedding space)
0063 thisOrth = orth(projection.validity*...
0064     dec.properData.projectionMatrix);
0065 projection.orthogonalOntoSubspace = thisOrth*thisOrth';
0066 thisNull = null(projection.orthogonalOntoSubspace);
0067 
0068 %% representation in proper embedding
0069 % the concise representation of the domain in embedding space covered
0070 %   by the unified partition was already constructed and saved in the
0071 %   partition generation
0072 embeddingDomain.hrep.A = partitionData.debug.embeddingConstraintMatrix;
0073 %! DEV: therefore, the old code is deprecated:
0074 % thisEmbedding.hrep.A = dec.unifiedPartition{end}.A * pinv(...
0075 %     thisEmbedding.validityProjection*...
0076 %     dec.properData.mappingNewToProper);
0077 %/
0078 embeddingDomain.hrep.h = zeros(size(embeddingDomain.hrep.A, 1), 1);
0079 % also save a reduced form
0080 embeddingDomain.hrepReduced = reduceHrep(embeddingDomain.hrep);
0081 % the strict representation of the domain above:
0082 embeddingDomain.hrepStrict.A = [embeddingDomain.hrep.A; ...
0083     thisNull'; -1*thisNull'];
0084 embeddingDomain.hrepStrict.h = [embeddingDomain.hrep.h; ...
0085     zeros(2*size(thisNull, 2), 1)];
0086 
0087 %% validity projection filter (for confinement mapping)
0088 % For the confinement mapping of growth vectors, the current partition of
0089 %   the hC-vector is pivotal. If a given boundary from
0090 %   properData.confinementMapping must be considered and, hence, the
0091 %   corresponding facet validity applies depends on the confinement
0092 %   condition. To ensure the right decision, the representation of the
0093 %   boundaries in the improper space must be considered.
0094 constraintMatrix = dec.properData.confinementMappingData.A * ...
0095     dec.properData.mappingNewToProper;
0096 responsibleGroupVector = ...
0097     dec.properData.confinementMappingData.responsibleVector;
0098 projection.applyConstraintFilter = false(1, size(constraintMatrix, 1));
0099 directionMatrix = dec.properData.confinementMappingData.directionMatrix;
0100 for iCon = 1:size(constraintMatrix, 1)
0101     % Ignore the constraint when it indicates a zero-mapping (dissolution,
0102     %   disappearing shape)
0103     if responsibleGroupVector(iCon) == dec.properData.nC+1
0104         continue;
0105     end
0106     
0107     % Ignore constraints for which the facet groups have already
0108     %   disappeared by the current partition. The projection might switch
0109     %   in this case, but if it was confined beforehand, it will be
0110     %   confined thereafter.
0111     if any(projection.invalidGroupIndexVector == ...
0112            responsibleGroupVector(iCon));
0113        continue;
0114     end
0115     
0116     % We also ignore a constraint that has now a zero-vector as normal
0117     %   vector. These constraints will always be fulfilled.
0118     if all(constraintMatrix(iCon, :) < zerotol)
0119         continue;
0120     end
0121     
0122     % Now we have to check confinement. A unique list of facet groups that
0123     %   already have disappeared are:
0124     thisDisappearedGroupVector = projection.invalidGroupIndexVector;
0125     % These indices cannot contain (nC+1) since all partitions are inside
0126     %   the empty-polytope-cone. They also cannot contain the current
0127     %   direction (see above).
0128     % Usually only one group disappears but when two constraints are
0129     %   equivalent in hC-space, then the corresponding facet groups also
0130     %   disappear at the same time. Both of these constraints must then be
0131     %   considered even though none would indicate unconfinement
0132     %   separately.
0133     thisConstraintFilter = all(abs(bsxfun(@minus, ...
0134         constraintMatrix, constraintMatrix(iCon, :))) < zerotol, 2);
0135     thisGroupVector = unique([thisDisappearedGroupVector ...
0136         responsibleGroupVector(thisConstraintFilter)]);
0137     if rank([directionMatrix(:, thisGroupVector) ...
0138              dec.properData.mappingNewToProper]) == ...
0139              length(thisGroupVector) + dec.nC
0140         continue;
0141     else
0142         projection.applyConstraintFilter(iCon) = true;
0143     end
0144 end
0145 
0146 
0147 % save results
0148 dec.unifiedPartition{end}.projection = projection;
0149 dec.unifiedPartition{end}.embeddingDomain = embeddingDomain;
0150 % dec.unifiedPartition{end}.boundary = boundary;
0151 dec.unifiedPartition{end}.this = this;
0152

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