Esempio n. 1
0
        private void AnalyzeFort7File(string sFort7Content)
        {
            _Fort7 = sFort7Content;

            CurrentRun = AllRuns[AllRuns.Count - 1];

            string[] sLines        = UtilLib.Split(sFort7Content, '\n');
            int      nCount        = 0;
            bool     readSomething = false;

            foreach (string line in sLines)
            {
                try
                {
                    //if (line.Contains("0    PT  TY LAB"))
                    //{
                    //    AllRuns.Add(new AutoResultRun());
                    //    CurrentRun = AllRuns[AllRuns.Count - 1];
                    //    nCount = 0;
                    //}

                    string[] sColumns = UtilLib.Split(line, ' ');
                    if (sColumns[0].Trim() == "0" || sColumns.Length < 7)
                    {
                        //if (readSomething) break;
                        continue; // skip over comments
                    }


                    int nPoint = UtilLib.ConvertToInt(sColumns[1], 0);
                    if (Data.Count > 1 && Math.Sign(Data[nCount - 1].Point) != Math.Sign(nPoint))
                    {
                        Positions.Add(new IntPair(nCount, nPoint));
                        //System.Diagnostics.Debug.WriteLine("Stability change: " + nCount + " point: " + nPoint);
                    }

                    int nType  = UtilLib.ConvertToInt(sColumns[2], 0);
                    int nLabel = UtilLib.ConvertToInt(sColumns[3], 0);



                    if (nType == -9 && !readSomething)
                    {
                        _ErrorOccured = true;
                    }

                    double dPar    = UtilLib.ConvertToDouble(sColumns[4], double.NaN);
                    double dL2Norm = UtilLib.ConvertToDouble(sColumns[5], double.NaN);

                    NumVariables = sColumns.Length - 6;
                    var dVariables = new double[NumVariables];
                    for (int i = 0; i < NumVariables; i++)
                    {
                        dVariables[i] = UtilLib.ConvertToDouble(sColumns[6 + i], double.NaN);
                    }

                    Data.Add(new DataPoint(nPoint, nType, nLabel, dPar, dVariables));

                    if (nLabel != 0 && nType != 4 && nType != 9 && nType != -9)
                    {
                        Labels.Add(new IntTripple(Math.Abs(nPoint) - 1, nLabel, nType));
                    }


                    readSomething = true;
                    nCount++;
                }
                catch
                {
                    continue;
                }
            }
        }