예제 #1
0
        // do the particle-fitting in another thread
        public static void Preprocess()
        {
            // deduce number of particles
            int inner_count = 150000;
            int outer_count = 600000;
            int pause_count = 250000;

            if (Settings.LowQualityRendering)
            {
                inner_count /= 5;
                outer_count /= 5;
                pause_count /= 5;
            }

            // start time
            UInt64 time = Lib.Clocks();

            // create all magnetic fields and do particle-fitting
            List <string> done = new List <string>();

            foreach (var pair in models)
            {
                // get radiation data
                RadiationModel mf = pair.Value;

                // skip if model is already done
                if (done.Contains(mf.name))
                {
                    continue;
                }

                // add to the skip list
                done.Add(mf.name);

                // if it has a field
                if (mf.Has_Field())
                {
                    // some feedback in the log
                    // note: can't use BuildString here, as it is not thread-safe
                    Lib.Verbose("particle-fitting '" + mf.name + "'...");
                }

                // particle-fitting for the inner radiation belt
                if (mf.has_inner)
                {
                    mf.inner_pmesh = new ParticleMesh(mf.Inner_Func, mf.Inner_Domain(), mf.Inner_Offset(), inner_count, mf.inner_quality);
                }

                // particle-fitting for the outer radiation belt
                if (mf.has_outer)
                {
                    mf.outer_pmesh = new ParticleMesh(mf.Outer_Func, mf.Outer_Domain(), mf.Outer_Offset(), outer_count, mf.outer_quality);
                }

                // particle-fitting for the magnetopause
                if (mf.has_pause)
                {
                    mf.pause_pmesh = new ParticleMesh(mf.Pause_Func, mf.Pause_Domain(), mf.Pause_Offset(), pause_count, mf.pause_quality);
                }
            }

            // measure time required
            // note: can't use BuildString here, as it is not thread-safe
            Lib.Verbose("particle-fitting completed in " + Lib.Seconds(Lib.Clocks() - time).ToString("F3") + " seconds");
        }