Exemplo n.º 1
0
 public static void UpdateMassReduced(this IList <Mode> modes, IList <double> masses, HOptions options = null)
 {
     if (options == null)
     {
         options = "";
     }
     if (options.Contains("parallel"))
     {
         HDebug.Exception(new NotImplementedException("check"));
         int[] iter = new int[1] {
             0
         };
         System.Threading.Tasks.Parallel.For(0, modes.Count, delegate(int i)
         {
             Mode modei = modes[i];
             modes[i]   = null;
             modes[i]   = modei.GetMassReduced(masses);
             lock (iter)
             {
                 iter[0]++;
                 if (iter[0] % 1000 == 0)
                 {
                     System.GC.Collect(0);
                 }
             }
         });
         System.GC.Collect();
     }
     else
     {
         for (int i = 0; i < modes.Count; i++)
         {
             Mode modei = modes[i];
             modes[i] = null;
             modes[i] = modei.GetMassReduced(masses);
             if (i % 1000 == 0)
             {
                 System.GC.Collect(0);
             }
         }
         System.GC.Collect();
     }
 }