예제 #1
0
        /// <summary>
        /// Same as Solve, but will relay if the solution was aborted due to incompatible dimensions.
        /// </summary>
        /// <param name="inputs"></param>
        /// <param name="successful"></param>
        /// <returns></returns>
        public double[] Solve(double[] inputs, out SolutionRemark remark)
        {
            //double[] results = (double[])inputs.Clone();

            if (HasParent)
            {
                inputs = parent.Solve(inputs, out remark);
                if (remark.Equals(SolutionRemark.UndersizedInputs))
                {
                    return(inputs);
                }
            }

            if (inputs.Length < InputDimension)
            {
                remark = SolutionRemark.UndersizedInputs;
                return(inputs);
            }

            else if (InputIsFixedSize && inputs.Length > InputDimension)
            {
                remark = SolutionRemark.OversizedInputs;
            }
            else
            {
                remark = SolutionRemark.Successful;
            }

            return(solveAlgorithm(inputs));
        }
예제 #2
0
        protected bool SolveAlgorithm(ref double[] inputs, Boa_Algorithm algorithm, string errorMessage)
        {
            SolutionRemark remark = 0;

            inputs = algorithm.Solve(inputs, out remark);

            if (remark.Equals(SolutionRemark.OversizedInputs))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Length of input list is oversized. Some values were ignored.");
            }

            else if (remark.Equals(SolutionRemark.UndersizedInputs))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, errorMessage);
                return(false);
            }

            return(true);
        }
예제 #3
0
 /// <summary>
 /// Solve but takes a Point3d, which is converted to a 3 item double array.
 /// </summary>
 /// <param name="inputs"></param>
 /// <param name="successful"></param>
 /// <returns></returns>
 public double[] Solve(Point3d point, out SolutionRemark remark)
 {
     return(Solve(new double[] { point.X, point.Y, point.Z }, out remark));
 }
예제 #4
0
        /// <summary>
        /// Solves the collection of algorithms, feeding the output of the first algorithm in the list to the input of the next one, and so on.
        /// </summary>
        /// <param name="inputs"></param>
        /// <returns></returns>
        public double[] Solve(double[] inputs)
        {
            SolutionRemark remark = 0;

            return(Solve(inputs, out remark));
        }