/// <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)); }
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); }
/// <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)); }
/// <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)); }