Esempio n. 1
0
        /// <summary>
        /// Plot all reconstructed level set fields
        /// </summary>
        /// <param name="superSampling">Output resolution</param>
        public void PlotFields(uint superSampling = 2)
        {
            Console.WriteLine("PlotFields: START");

            Tecplot.Tecplot plotDriver = new Tecplot.Tecplot(gridData, showJumps: true, ghostZone: false, superSampling: superSampling);
            plotDriver.PlotFields(SessionPath + "lsrFields", 0.0, _levelSetFields);

            Console.WriteLine("PlotFields: END");
        }
Esempio n. 2
0
        /// <summary>
        /// Plot or save all data
        /// </summary>
        /// <param name="plotDGFields">PLT-File for several DG fields</param>
        /// <param name="plotSeedingsPoints">Plot all seeding points</param>
        /// <param name="plotInflectionsPoints">Plot all inflection points</param>
        /// <param name="plotCurves">Plot the 'search path' (seeding point to inflection point)</param>
        /// <param name="plotStartEndPairs">Plot seeding point and corresponding inflection point</param>
        public void Plot(bool plotDGFields, bool plotSeedingsPoints, bool plotInflectionsPoints, bool plotCurves, bool plotStartEndPairs)
        {
            Console.WriteLine("PLOTTING: START");

            if (plotDGFields)
            {
                Tecplot.Tecplot plotDriver = new Tecplot.Tecplot(gridData, showJumps: true, ghostZone: false, superSampling: 2);

                List <DGField> fields = new List <DGField>();
                fields.AddRange(densityField, levelSetField);
                if (avField != null)
                {
                    fields.Add(avField);
                }
                plotDriver.PlotFields(SessionPath + "Fields", 0.0, fields.ToArray());
            }

            if (plotSeedingsPoints)
            {
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(SessionPath + "seedingPoints.txt")) {
                    string resultLine;
                    for (int j = 0; j < Results.Lengths[0]; j++)
                    {
                        resultLine = Results[j, 0, 0] + "\t"
                                     + Results[j, 0, 1] + "\t"
                                     + Results[j, 0, 2];
                        sw.WriteLine(resultLine);
                    }
                    sw.Flush();
                }
            }

            if (plotInflectionsPoints)
            {
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(SessionPath + "inflectionPoints.txt")) {
                    string resultLine;
                    for (int j = 0; j < Results.Lengths[0]; j++)
                    {
                        int pointFound = (int)ResultsExtended[j, 1];
                        resultLine = Results[j, (int)ResultsExtended[j, 0] - 1, 0] + "\t"
                                     + Results[j, (int)ResultsExtended[j, 0] - 1, 1] + "\t"
                                     + Results[j, (int)ResultsExtended[j, 0] - 1, 2] + "\t"
                                     + pointFound;
                        sw.WriteLine(resultLine);
                    }

                    sw.Flush();
                }
            }

            if (plotCurves)
            {
                for (int i = 0; i < Results.Lengths[0]; i++)
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(SessionPath + "curve_" + i + ".txt")) {
                        string resultLine;
                        for (int j = 0; j < (int)ResultsExtended[i, 0]; j++)
                        {
                            resultLine = Results[i, j, 0] + "\t" + Results[i, j, 1] + "\t" + Results[i, j, 2];
                            sw.WriteLine(resultLine);
                        }
                        sw.Flush();
                    }
                }
            }

            if (plotStartEndPairs)
            {
                for (int j = 0; j < Results.Lengths[0]; j++)
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(SessionPath + "startEndPairs_" + j + ".txt")) {
                        string resultLine;
                        int    pointFound = (int)ResultsExtended[j, 1];

                        // Starting point
                        resultLine = Results[j, 0, 0] + "\t"
                                     + Results[j, 0, 1] + "\t"
                                     + Results[j, 0, 2] + "\t"
                                     + pointFound;
                        sw.WriteLine(resultLine);

                        // End point
                        resultLine = Results[j, (int)ResultsExtended[j, 0] - 1, 0] + "\t"
                                     + Results[j, (int)ResultsExtended[j, 0] - 1, 1] + "\t"
                                     + Results[j, (int)ResultsExtended[j, 0] - 1, 2] + "\t"
                                     + pointFound;
                        sw.WriteLine(resultLine);

                        sw.Flush();
                    }
                }
            }

            Console.WriteLine("PLOTTING: END");
        }