Example #1
0
        public void PlotTrend(bool ErrorOrResidual, bool SepPoly, bool SepLev)
        {
            using (var gp = new BoSSS.Solution.Gnuplot.Gnuplot()) {
                gp.Cmd("set logscale y");
                gp.Cmd("set title " + (ErrorOrResidual ? "\"Error trend\"" : "\"Residual trend\""));

                string[] Titels;
                MultidimensionalArray ConvTrendData;
                WriteTrendToTable(ErrorOrResidual, SepPoly, SepLev, out Titels, out ConvTrendData);
                double[] IterNo = ConvTrendData.GetLength(0).ForLoop(i => ((double)i));

                for (int iCol = 0; iCol < Titels.Length; iCol++)
                {
                    gp.PlotXY(IterNo, ConvTrendData.GetColumn(iCol), Titels[iCol],
                              new PlotFormat(lineColor: ((LineColors)(iCol + 1)), Style: Styles.Lines));
                }

                gp.Execute();

                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                Console.WriteLine("killing gnuplot...");
            }
            Console.WriteLine("done.");
        }
Example #2
0
        public void WriteTrendToCSV(bool ErrorOrResidual, bool SepPoly, bool SepLev, string name)
        {
            string[] Titels;
            MultidimensionalArray ConvTrendData;

            WriteTrendToTable(ErrorOrResidual, SepPoly, SepLev, out Titels, out ConvTrendData);


            using (StreamWriter stw = new StreamWriter(name)) {
                stw.WriteLine(Titels.CatStrings(" "));
                stw.Flush();
                ConvTrendData.SaveToStream(stw);
                stw.Flush();
            }
        }
        /// <summary>
        /// Visualization of data from <see cref="WriteTrendToTable"/> in gnuplot
        /// </summary>
        public Plot2Ddata PlotIterationTrend(bool ErrorOrResidual, bool SepVars, bool SepPoly, bool SepLev)
        {
            var Ret = new Plot2Ddata();

            Ret.Title = ErrorOrResidual ? "\"Error trend\"" : "\"Residual trend\"";
            Ret.LogY  = true;

            string[] Titels;
            MultidimensionalArray ConvTrendData;

            WriteTrendToTable(ErrorOrResidual, SepVars, SepPoly, SepLev, out Titels, out ConvTrendData);
            double[] IterNo = ConvTrendData.GetLength(0).ForLoop(i => ((double)i));

            for (int iCol = 0; iCol < Titels.Length; iCol++)
            {
                var g = new Plot2Ddata.XYvalues(Titels[iCol], IterNo, ConvTrendData.GetColumn(iCol));
                g.Format = new PlotFormat(lineColor: ((LineColors)(iCol + 1)), Style: Styles.Lines);
            }

            return(Ret);
        }