Ejemplo n.º 1
0
        internal (Vector <double> loadJoints, Matrix <double> loadMagnitude) BuildLoadStructures(IEnumerable <Point3d> joints)
        {
            // TODO : It is assumed one load per joint, correct this
            Vector <double> loadJoints = Vector <double> .Build.Dense(Loads.Count);

            Matrix <double> loadMagnitude = Matrix <double> .Build.Dense(Loads.Count, 2);

            for (int i = 0; i < Loads.Count; i++)
            {
                PointLoad load = Loads.ElementAt(i);

                int?loadNode = GetJoint(load.Location, joints);
                if (!loadNode.HasValue)
                {
                    throw new InvalidOperationException("Load is not at a joint node");
                }

                loadJoints[i]       = loadNode.Value;
                loadMagnitude[i, 0] = load.XForce;
                loadMagnitude[i, 1] = load.YForce;
            }

            return(loadJoints, loadMagnitude);
        }