private void Add(IAggregableMechanicalObject source, IAggregableMechanicalObject target, int sc, int tc, int tn)
 {
     double[] fs = source.GetConnectionForce(sc);
     double[,] mt = target.GetForcesMatrix(tc);
     double[] intt = target.InternalAcceleration;
     Add(mt, fs, intt, vector, tn);
 }
        /// <summary>
        /// Calculates matrixes
        /// </summary>
        protected void CalculateMatrixes()
        {
            int n    = vector.Length;
            int conn = connectionForces.Length;

            for (int i = 0; i < conn; i++)
            {
                for (int j = 0; j < conn; j++)
                {
                    matrix[i, j] = 0;
                }
                for (int j = 0; j < n; j++)
                {
                    forcesToAccelerations[j, i]  = 0;
                    accelerationTransition[i, j] = 0;
                }
            }
            for (int ln = 0; ln < links.Count; ln++)
            {
                int k = ln * 6;
                MechanicalAggregateLink     ml = links[ln];
                IAggregableMechanicalObject s  = ml.SourceObject;
                IAggregableMechanicalObject t  = ml.TargetObject;
                int sc = ml.SourceConnection;
                int tc = ml.TargetConnection;
                int sn = numbers[s];
                int tn = numbers[t];
                int ss = ml.SourceConnection;
                int tt = ml.TargetConnection;
                Fill(accelerationTransition, s.GetAccelerationMatrix(ss), k, sn);
                FillMinus(accelerationTransition, t.GetAccelerationMatrix(tt), k, tn);
                Fill(forcesToAccelerations, s.GetForcesMatrix(ss), sn, k);
                FillMinus(forcesToAccelerations, t.GetForcesMatrix(tt), tn, k);
            }
            RealMatrixProcessor.RealMatrix.Multiply(accelerationTransition, forcesToAccelerations, matrix);
        }