Beispiel #1
0
        public void ReorderRemainderDofs(FetiDPDofSeparator dofSeparator, ISubdomain subdomain)
        {
            if (reordering == null)
            {
                return;                     // Use the natural ordering and do not modify any stored dof data
            }
            try
            {
                int   s             = subdomain.ID;
                int[] remainderDofs = dofSeparator.RemainderDofIndices[s];
                var   pattern       = linearSystem.Matrix.GetSubmatrixSymmetricPattern(remainderDofs);
                (int[] permutation, bool oldToNew) = reordering.FindPermutation(pattern);
                int[] newRemainderDofs = ReorderingUtilities.ReorderKeysOfDofIndicesMap(remainderDofs, permutation, oldToNew);

                // What if the dof separator gets added other state that needs to be updated?
                dofSeparator.RemainderDofIndices[s] = newRemainderDofs;
                dofSeparator.RemainderDofOrderings[s].Reorder(permutation, oldToNew);
            }
            catch (MatrixDataOverwrittenException)
            {
                throw new InvalidOperationException(
                          "The free-free stiffness matrix of this subdomain has been overwritten and cannot be used anymore."
                          + "Try calling this method before factorizing/inverting it.");
            }
        }
        public void ReorderCornerDofs(FetiDPDofSeparator dofSeparator)
        {
            if (reordering == null)
            {
                return;                     // Use the natural ordering and do not modify any stored dof data
            }
            var pattern = SparsityPatternSymmetric.CreateEmpty(dofSeparator.NumGlobalCornerDofs);

            for (int s = 0; s < subdomains.Count; ++s)
            {
                // Treat each subdomain as a superelement with only its corner nodes.
                var localCornerDofOrdering = dofSeparator.SubdomainCornerDofOrderings[s];
                int numLocalCornerDofs     = localCornerDofOrdering.EntryCount;
                var subdomainToGlobalDofs  = new int[numLocalCornerDofs];
                foreach ((INode node, IDofType dofType, int localIdx) in localCornerDofOrdering)
                {
                    int globalIdx = dofSeparator.GlobalCornerDofOrdering[node, dofType];
                    subdomainToGlobalDofs[localIdx] = globalIdx;
                }
                pattern.ConnectIndices(subdomainToGlobalDofs, false);
            }
            (int[] permutation, bool oldToNew) = reordering.FindPermutation(pattern);
            dofSeparator.GlobalCornerDofOrdering.Reorder(permutation, oldToNew);
            dofSeparator.GlobalCornerToFreeDofMap =
                ReorderingUtilities.ReorderKeysOfDofIndicesMap(dofSeparator.GlobalCornerToFreeDofMap, permutation, oldToNew);
        }
Beispiel #3
0
        public void ReorderInternalDofs(FetiDPDofSeparator dofSeparator, ISubdomain subdomain)
        {
            if (reordering == null)
            {
                return;                     // Use the natural ordering and do not modify any stored dof data
            }
            try
            {
                int[] internalDofs = dofSeparator.InternalDofIndices[subdomain.ID];
                var   pattern      = Krr.GetSubmatrixSymmetricPattern(internalDofs);
                (int[] permutation, bool oldToNew) = reordering.FindPermutation(pattern);
                int[] newInternalDofs = ReorderingUtilities.ReorderKeysOfDofIndicesMap(internalDofs, permutation, oldToNew);

                // What if the dof separator gets added other state that needs to be updated?
                dofSeparator.InternalDofIndices[subdomain.ID] = newInternalDofs;
            }
            catch (MatrixDataOverwrittenException)
            {
                throw new InvalidOperationException(
                          "The remainder-remainder stiffness submatrix of this subdomain has been already been calculated and"
                          + " then overwritten and cannot be used anymore. Try calling this method before"
                          + " factorizing/inverting it.");
            }
        }