/// <summary> /// Solves equation /// </summary> protected virtual void Solve() { int k = 0; for (int i = 0; i < aggrWrappres.Length; i++) { AggregableWrapper frame = aggrWrappres[i]; IAggregableMechanicalObject agg = frame.Aggregate; double[] intacc = agg.InternalAcceleration; int l = intacc.Length; Array.Copy(intacc, 0, vector, k, l); k += l; } if (matrix.GetLength(0) != 0) { CalculateLinkAccelerations(); RealMatrixProcessor.RealMatrix.PlusEqual(vector, addAcceleration); for (int ln = 0; ln < links.Count; ln++) { 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]; Add(s, t, sc, tc, tn); Add(t, s, tc, sc, sn); } } }
/// <summary> /// Calculates residues of accelerations /// </summary> protected void CalculateResidues() { 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; double[] sa = s.GetInternalAcceleration(sc); double[] ta = t.GetInternalAcceleration(tc); for (int i = 0; i < 6; i++) { connectionResidues[i + k] = sa[i] - ta[i]; } } }
/// <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); }