示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        private static void EvaluateAndWriteForwardSolverSteadyStateResults(ForwardSolverType fST,
                                                                            SpatialDomainType sDT,
                                                                            OpticalProperties op,
                                                                            IEnumerable <double> spatialVariable)
        {
            double[] reflectanceValues;

            var ReflectanceFunction = GetSteadyStateReflectanceFunction(fST, sDT);

            MakeDirectoryIfNonExistent(sDT.ToString(), "SteadyState", fST.ToString());

            reflectanceValues = ReflectanceFunction(op.AsEnumerable(), spatialVariable).ToArray();

            LocalWriteArrayToBinary(reflectanceValues, @"Output/" + sDT.ToString() +
                                    "/SteadyState/" + fST.ToString() + "/" +
                                    "musp" + op.Musp.ToString() + "mua" + op.Mua.ToString(), FileMode.Create);
        }
示例#4
0
        private static void ReportSteadyStateForwardSolver(ForwardSolverType[] fSTs,
                                                           SpatialDomainType sDT,
                                                           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}", filename, sDT.ToString());

            if (File.Exists(inputPath + sDT.ToString() + "/SteadyState/" + filename) || sDT == SpatialDomainType.SpatialFrequency)
            {
                Console.WriteLine("The file {0} has been found.", filename);
                int sDim = GetSpatialNumberOfPoints(sDT);
                IEnumerable <double> spatialVariable;
                // if R(r) not uniform locations where we evaluate, but points defined in binary files (these points are average radial positions of photons collected in each bin)
                if (sDT == SpatialDomainType.Real)
                {
                    spatialVariable = (IEnumerable <double>)FileIO.ReadArrayFromBinaryInResources <double>
                                          ("Resources/" + sDT.ToString() + "/SteadyState/" + filename, projectName, sDim);
                }
                // if R(fx) uniform evaluation, sDim used to specify number of points.
                else
                {
                    spatialVariable = new DoubleRange(0.0, 1.0, sDim).AsEnumerable();
                }
                // after providing spatial locations where we want evaluation execute and store results
                foreach (var fST in fSTs)
                {
                    EvaluateAndWriteForwardSolverSteadyStateResults(fST, sDT, op, spatialVariable);
                }
            }
            else
            {
                Console.WriteLine("The file {0} has not been found.", filename);
            }
        }