示例#1
0
        /// <summary>
        /// Override the original run method defined by the super-class because
        /// we don't want to run an actual calculation. Plots the data for
        /// every selected time-step.
        /// </summary>
        protected void Run()
        {
            ISessionInfo session   = m_Database.Controller.GetSessionInfo(m_config.SessionGuid);
            var          timesteps = session.Timesteps.Where(
                tsi => this.m_config.TimeSteps.Contains(tsi.TimeStepNumber)).ToArray();
            int TotCnt = timesteps.Count();

            int process      = this.DBDriver.MyRank + 1;
            int processCount = this.DBDriver.Size;

            this.m_info = this.m_Database.Controller.GetSessionInfo(this.m_config.SessionGuid);


            GC.Collect();
            for (int i = 0; i < timesteps.Length; i++)
            {
                var            ts         = timesteps[i];
                double         physTime   = ts.PhysicalTime;
                TimestepNumber timestepNo = ts.TimeStepNumber;

                if (this.GridDat == null || !this.GridDat.Grid.ID.Equals(ts.Grid.ID))
                {
                    WriteMessage(process, processCount, "Loading grid ...");
                    GridCommons grid = DBDriver.LoadGrid(ts.Grid.ID, m_Database);
                    this.GridDat = this.m_Database.Controller.GetInitializationContext(ts).GridData;
                    WriteMessage(process, processCount, "   Number of cells: " + this.GridDat.Grid.NoOfUpdateCells);
                    this.CreatePlotter();
                }



                WriteMessage(process, processCount, "Loading timestep ... (" + (i + 1) + " of " + TotCnt + ")");
                var fields = DBDriver.LoadFields(ts, this.GridDat, this.m_config.FieldNames).ToList();
                WriteMessage(process, processCount, "Loaded timestep " + timestepNo + ". Plotting...");

                //{
                //    Console.WriteLine("computing vorticity...");
                //    DGField velX = fields.Single(f => f.Identification == "VelocityX");
                //    DGField velY = fields.Single(f => f.Identification == "VelocityY");

                //    DGField vortZ = velX.CloneAs();
                //    vortZ.Identification = "Vorticity";
                //    vortZ.Clear();
                //    vortZ.DerivativeByFlux(1.0, velY, 0);
                //    vortZ.DerivativeByFlux(-1.0, velX, 1);
                //    Console.WriteLine("done.");

                //    fields.Add(vortZ);
                //}
                PlotCurrentState(fields, physTime, timestepNo);

                double perc = Math.Round(100.0 * (double)(i + 1) / (double)TotCnt, 1);
                WriteMessage(process, processCount, "Finished timestep (" + perc + "% of timesteps done)");

                // Free memory if possible
                timesteps[i] = null;
                GC.Collect();
            }
        }
示例#2
0
        /// <summary>
        /// Override the original run method defined by the super-class because
        /// we don't want to run an actual calculation. Plots the data for
        /// every selected time-step.
        /// </summary>
        protected void Run()
        {
            ISessionInfo session   = m_Database.Controller.GetSessionInfo(m_config.SessionGuid);
            var          timesteps = session.Timesteps.Where(
                tsi => this.m_config.TimeSteps.Contains(tsi.TimeStepNumber)).ToArray();
            int TotCnt = timesteps.Count();

            int process      = this.DBDriver.MyRank + 1;
            int processCount = this.DBDriver.Size;

            this.m_info = this.m_Database.Controller.GetSessionInfo(this.m_config.SessionGuid);


            GC.Collect();
            for (int i = 0; i < timesteps.Length; i++)
            {
                var            ts         = timesteps[i];
                double         physTime   = ts.PhysicalTime;
                TimestepNumber timestepNo = ts.TimeStepNumber;

                if (this.GridDat == null || !this.GridDat.Grid.ID.Equals(ts.Grid.ID))
                {
                    WriteMessage(process, processCount, "Loading grid ...");
                    GridCommons grid = DBDriver.LoadGrid(ts.Grid.ID, m_Database);
                    this.GridDat = this.m_Database.Controller.GetInitializationContext(ts).GridData;
                    WriteMessage(process, processCount, "   Number of cells: " + this.GridDat.Grid.NoOfUpdateCells);
                    this.CreatePlotter();
                }



                WriteMessage(process, processCount, "Loading timestep ... (" + (i + 1) + " of " + TotCnt + ")");
                var fields = DBDriver.LoadFields(ts, this.GridDat, this.m_config.FieldNames);

                WriteMessage(process, processCount, "Loaded timestep " + timestepNo + ". Plotting...");
                PlotCurrentState(fields, physTime, timestepNo);

                double perc = Math.Round(100.0 * (double)(i + 1) / (double)TotCnt, 1);
                WriteMessage(process, processCount, "Finished timestep (" + perc + "% of timesteps done)");

                // Free memory if possible
                timesteps[i] = null;
                GC.Collect();
            }
        }