private static void EvaluateAndWriteForwardSolver2DResults(ForwardSolverType fST, SpatialDomainType sDT, TimeDomainType tDT, OpticalProperties op, IEnumerable <double> spatialVariable, double[,] temporalVariable) { double[] reflectanceValues; var ReflectanceFunction = Get2DReflectanceFunction(fST, sDT, tDT); MakeDirectoryIfNonExistent(sDT.ToString(), tDT.ToString(), fST.ToString()); var sV = spatialVariable.First(); var tV = temporalVariable.Row(0); reflectanceValues = ReflectanceFunction(op.AsEnumerable(), sV.AsEnumerable(), tV).ToArray(); LocalWriteArrayToBinary(reflectanceValues, @"Output/" + sDT.ToString() + "/" + tDT.ToString() + "/" + fST.ToString() + "/" + "musp" + op.Musp.ToString() + "mua" + op.Mua.ToString(), FileMode.Create); for (int spaceInd = 1; spaceInd < spatialVariable.Count(); spaceInd++) { sV = spatialVariable.ElementAt(spaceInd); tV = temporalVariable.Row(spaceInd); reflectanceValues = ReflectanceFunction(op.AsEnumerable(), sV.AsEnumerable(), tV).ToArray(); LocalWriteArrayToBinary(reflectanceValues, @"Output/" + sDT.ToString() + "/" + tDT.ToString() + "/" + fST.ToString() + "/" + "musp" + op.Musp.ToString() + "mua" + op.Mua.ToString(), FileMode.Append); } }
private static void Report2DForwardSolver(ForwardSolverType[] fSTs, SpatialDomainType sDT, TimeDomainType tDT, OpticalProperties op, string inputPath, string projectName) { var filename = "musp" + op.Musp.ToString() + "mua" + op.Mua.ToString(); filename = filename.Replace(".", "p"); Console.WriteLine("Looking for file {0} in spatial domain type {1} and temporal domain type{2}", filename, sDT.ToString(), tDT.ToString()); if (File.Exists(inputPath + sDT.ToString() + "/SteadyState/" + filename) || File.Exists(inputPath + sDT.ToString() + "/" + tDT.ToString() + "/" + filename)) { Console.WriteLine("The file {0} has been found.", filename); int sDim = GetSpatialNumberOfPoints(sDT); int tDim = GetTemporalNumberOfPoints(sDT, tDT); int[] dims = { sDim, tDim }; var spatialVariable = (IEnumerable <double>)FileIO.ReadArrayFromBinaryInResources <double> ("Resources/" + sDT.ToString() + "/" + "SteadyState/" + filename, projectName, sDim); var temporalVariable = (double[, ])FileIO.ReadArrayFromBinaryInResources <double> ("Resources/" + sDT.ToString() + "/" + tDT.ToString() + "/" + filename, projectName, dims); foreach (var fST in fSTs) { EvaluateAndWriteForwardSolver2DResults(fST, sDT, tDT, op, spatialVariable, temporalVariable); } } else { Console.WriteLine("The file {0} has not been found", filename); } }