コード例 #1
0
        public void ReadOutputLine(string Line)
        {
            switch (_status)
            {
            case BlockPointer.Prelude:
                if (Line.StartsWith(" ********** VOLUME- AND MASS-BALANCES"))
                {
                    _status = BlockPointer.MassBalance;
                }
                break;

            case BlockPointer.MassBalance:
                _status = BlockPointer.Iterating;
                break;

            case BlockPointer.Iterating:

                if (Line.Length > 25 && Line.Substring(17, 4).Equals("ST ="))
                {
                    TimeStepInfo tsi = new TimeStepInfo();
                    tsi.TimeStep           = TimeSpan.FromSeconds(double.Parse(Line.Substring(40, 12)));
                    tsi.TotalTime          = TimeSpan.FromSeconds(Double.Parse(Line.Substring(22, 12)));
                    tsi.TimeStepNumber     = TimeSteps.Count() + 1;
                    tsi.MaxResidualElement = Line.Substring(1, 5);
                    tsi.NumberOfIterations = int.Parse(Line.Substring(13, 2));
                    TimeSteps.Add(tsi);


                    if (NewTimeStep != null)
                    {
                        NewTimeStep(this, tsi);
                    }
                }
                //Switch to output reading
                else if (Line.StartsWith("          OUTPUT DATA AFTER"))
                {
                    _status      = BlockPointer.FirstMatrixOutput;
                    _outputLines = 0;
                }
                else if (Line.StartsWith(" ELEM.  INDEX"))
                {
                    _status = BlockPointer.SecondMatrixOutput;
                    CurrentResults.Pointer = BlockPointer.SecondMatrixOutput;
                    CurrentResults.ReadLine(Line);
                }
                else if (Line.StartsWith(" ********** VOLUME- AND MASS-BALANCES"))
                {
                    _status = BlockPointer.MassBalance;
                }
                break;

            case BlockPointer.FirstMatrixOutput:
            {
                if (Line.Trim() != "")     //Skip empty lines
                {
                    if (_outputLines == 2) //appears to be code specific
                    {
                        CurrentResults         = new TimesOutput(TimeSpan.FromSeconds(double.Parse(Line.Substring(1, 12))), _model.Elements);
                        CurrentResults.Pointer = BlockPointer.FirstMatrixOutput;
                        Vectors.Add(CurrentResults);
                    }
                    if (_outputLines > 3)
                    {
                        if (!CurrentResults.ReadLine(Line)) //Send the line to the results reader until it does not ask for more
                        {
                            _status = BlockPointer.Iterating;
                        }
                    }
                    _outputLines++;
                }
            }
            break;

            case BlockPointer.SecondMatrixOutput:
            {
                if (!CurrentResults.ReadLine(Line))
                {
                    _status = BlockPointer.Iterating;
                }
                break;
            }

            default:
                break;
            }
        }
コード例 #2
0
 protected virtual void OnNewTimeStep(TimeStepInfo TimeStep)
 {
     NewTimeStep(this, TimeStep);
 }
コード例 #3
0
 protected virtual void OnNewTimeStep(TimeStepInfo TimeStep)
 {
   NewTimeStep(this, TimeStep);
 }
コード例 #4
0
    public void ReadOutputLine(string Line)
    {
      switch (_status)
      {
        case BlockPointer.Prelude:
          if (Line.StartsWith(" ********** VOLUME- AND MASS-BALANCES"))
            _status = BlockPointer.MassBalance;
          break;
        case BlockPointer.MassBalance:
          _status = BlockPointer.Iterating;
          break;
        case BlockPointer.Iterating:

          if (Line.Length > 25 && Line.Substring(17, 4).Equals("ST ="))
          {
            TimeStepInfo tsi = new TimeStepInfo();
            tsi.TimeStep =TimeSpan.FromSeconds(double.Parse(Line.Substring(40, 12)));
            tsi.TotalTime = TimeSpan.FromSeconds(Double.Parse(Line.Substring(22, 12)));
            tsi.TimeStepNumber = TimeSteps.Count()+1;
            tsi.MaxResidualElement = Line.Substring(1, 5);
            tsi.NumberOfIterations = int.Parse(Line.Substring(13, 2));
            TimeSteps.Add(tsi);


            if (NewTimeStep!=null)
              NewTimeStep(this, tsi);
          }
          //Switch to output reading
          else if (Line.StartsWith("          OUTPUT DATA AFTER"))
          {
            _status = BlockPointer.FirstMatrixOutput;
            _outputLines = 0;
          }
          else if (Line.StartsWith(" ELEM.  INDEX"))
          {
            _status = BlockPointer.SecondMatrixOutput;
            CurrentResults.Pointer = BlockPointer.SecondMatrixOutput;
            CurrentResults.ReadLine(Line);
          }
          else if (Line.StartsWith(" ********** VOLUME- AND MASS-BALANCES"))
            _status = BlockPointer.MassBalance;
          break;
        case BlockPointer.FirstMatrixOutput:
          {
            if (Line.Trim() != "") //Skip empty lines
            {
              if (_outputLines == 2) //appears to be code specific
              {
                CurrentResults = new TimesOutput(TimeSpan.FromSeconds(double.Parse(Line.Substring(1, 12))), _model.Elements);
                CurrentResults.Pointer = BlockPointer.FirstMatrixOutput;
                Vectors.Add(CurrentResults);
              }
              if (_outputLines > 3)
              {
                if (!CurrentResults.ReadLine(Line)) //Send the line to the results reader until it does not ask for more
                  _status = BlockPointer.Iterating;
              }
              _outputLines++;
            }
          }
          break;
        case BlockPointer.SecondMatrixOutput:
          {
            if (!CurrentResults.ReadLine(Line))
              _status = BlockPointer.Iterating;
            break;

          }
        default:
          break;
      }
    }
コード例 #5
0
 void Results_NewTimeStep(object sender, TimeStepInfo TimeStep)
 {
   dscr.AppendAsync(Dispatcher, TimeStep);
 }