Exemplo n.º 1
0
        /// <summary>
        /// Does not mutate this object.
        /// </summary>
        internal Dictionary <int, Vector> CalcActualDisplacements(Vector lagranges, Vector cornerDisplacements,
                                                                  Dictionary <int, Vector> fr)
        {
            var freeDisplacements = new Dictionary <int, Vector>();

            foreach (int s in subdomains.Keys)
            {
                IFetiDPSubdomainMatrixManager matrices = matrixManagers[s];

                // ur[s] = inv(Krr[s]) * (fr[s] - Br[s]^T * lagranges - Krc[s] * Lc[s] * uc)
                Vector BrLambda = lagrangeEnumerator.BooleanMatrices[s].Multiply(lagranges, true);
                Vector KrcLcUc  = dofSeparator.CornerBooleanMatrices[s].Multiply(cornerDisplacements);
                KrcLcUc = matrices.MultiplyKrcTimes(KrcLcUc);
                Vector temp = fr[s].Copy();
                temp.SubtractIntoThis(BrLambda);
                temp.SubtractIntoThis(KrcLcUc);
                Vector ur = matrices.MultiplyInverseKrrTimes(temp);

                // uf[s] = union(ur[s], ubc[s])
                // Remainder dofs
                var   uf            = Vector.CreateZero(subdomains[s].FreeDofOrdering.NumFreeDofs);
                int[] remainderDofs = dofSeparator.RemainderDofIndices[s];
                uf.CopyNonContiguouslyFrom(remainderDofs, ur);

                // Corner dofs: ubc[s] = Bc[s] * uc
                Vector ubc        = dofSeparator.CornerBooleanMatrices[s].Multiply(cornerDisplacements);
                int[]  cornerDofs = dofSeparator.CornerDofIndices[s];
                uf.CopyNonContiguouslyFrom(cornerDofs, ubc);

                freeDisplacements[s] = uf;
            }
            return(freeDisplacements);
        }
Exemplo n.º 2
0
        public void MultiplyFIrr(Vector lhs, Vector rhs)
        {
            Preconditions.CheckMultiplicationDimensions(Order, lhs.Length);
            Preconditions.CheckSystemSolutionDimensions(Order, rhs.Length);

            // FIrr[s] * x = sum_over_s( Br[s] * (inv(Krr[s]) * (Br[s]^T * x)) )
            rhs.Clear();
            foreach (int s in Br.Keys)
            {
                IFetiDPSubdomainMatrixManager matrices = matrixManagers[s];
                Vector temp = Br[s].Multiply(lhs, true);
                temp = matrices.MultiplyInverseKrrTimes(temp);
                temp = Br[s].Multiply(temp);
                rhs.AddIntoThis(temp);
            }
        }
Exemplo n.º 3
0
        public Vector MultiplyTransposedFIrc(Vector vector)
        {
            Preconditions.CheckMultiplicationDimensions(Order, vector.Length);

            // FIrc[s]^T * x = sum_over_s( Lc[s]^T * (Krc[s]^T * (inv(Krr[s]) * (Br[s]^T * x))) )
            var result = Vector.CreateZero(numCornerDofs);

            foreach (int s in Br.Keys)
            {
                IFetiDPSubdomainMatrixManager matrices = matrixManagers[s];
                Vector temp = Br[s].Multiply(vector, true);
                temp = matrices.MultiplyInverseKrrTimes(temp);
                temp = matrices.MultiplyKcrTimes(temp);
                temp = Lc[s].Multiply(temp, true);
                result.AddIntoThis(temp);
            }
            return(result);
        }
        public Vector CreateCoarseProblemRhs(FetiDPDofSeparator dofSeparator,
                                             Dictionary <int, IFetiDPSubdomainMatrixManager> matrixManagers,
                                             Dictionary <int, Vector> fr, Dictionary <int, Vector> fbc)
        {
            // Static condensation for the force vectors
            var globalFcStar = Vector.CreateZero(dofSeparator.NumGlobalCornerDofs);

            for (int s = 0; s < subdomains.Count; ++s)
            {
                IFetiDPSubdomainMatrixManager matrices = matrixManagers[s];

                // fcStar[s] = fbc[s] - Krc[s]^T * inv(Krr[s]) * fr[s]
                // globalFcStar = sum_over_s(Lc[s]^T * fcStar[s])
                UnsignedBooleanMatrix Lc = dofSeparator.CornerBooleanMatrices[s];
                Vector temp = matrices.MultiplyInverseKrrTimes(fr[s]);
                temp = matrices.MultiplyKcrTimes(temp);
                Vector fcStar = fbc[s] - temp;
                globalFcStar.AddIntoThis(Lc.Multiply(fcStar, true));
            }
            return(globalFcStar);
        }