Exemplo n.º 1
0
 private void OutputData(int iteration, InputData inputData, double[] output)
 {
     double[] tmp;
     tmp = GridService.Find_MinmalAndMaximal_Temperarure(finalVector);
     output[(iteration)] = tmp[0];
     output[(output.Length / 2) + iteration] = tmp[1];
 }
Exemplo n.º 2
0
        public double[] Calculate(InputData inputData)
        {
            var watch = Stopwatch.StartNew();

            double[] output = new double[Convert.ToInt32(2 * (inputData.simulation_time / inputData.step))];
            iteration_finalVectors = new List <List <double> >();
            GridService.InitializeGlobal(this, inputData);
            GridGeneration(inputData);
            Write(inputData);
            progressEvent.Invoke(null, Tuple.Create(0.0, inputData.simulation_time, 0));
            AllElements_To_UniversalElement(inputData);
            Aggregation(inputData);
            GridService.Count_H_CdT(inputData, this);
            for (var i = 0d; i < inputData.simulation_time; i += inputData.step)
            {
                iteration_finalVectors.Add(new List <double>());
                GridService.Count_P_C_dT_T0(inputData, this);
                finalVector = GridService.Count_FinalVector(inputData, this);
                iteration_finalVectors[Convert.ToInt32(i / inputData.step)] = finalVector;
                OutputData(Convert.ToInt32(i / inputData.step), inputData, output);
                GridService.Write_Temperature(finalVector, (i / inputData.step), writeEvent, writeTemperatureEvent);
                GridService.UpdateNodesTemperature(this, inputData);
                progressEvent.Invoke(null, Tuple.Create(i + inputData.step, inputData.simulation_time,
                                                        Convert.ToInt32((i / inputData.step) + 1)));
            }
            watch.Stop();
            var elapsedTime = watch.Elapsed;

            Console.WriteLine(elapsedTime);
            if (writeEvent != null)
            {
                writeEvent.Invoke(null, "Calculation tiome: " + elapsedTime.ToString());
            }
            return(output);
        }
Exemplo n.º 3
0
 private void Aggregation(InputData inputData)
 {
     Console.Write("Aggregation -> ");
     for (int i = 0; i < inputData.nW - 1; i++)
     {
         for (int j = 0; j < inputData.nH - 1; j++)
         {
             GridService.AgregateToGlobal_WithElement(elements[i][j], this);
         }
     }
     Console.WriteLine("Agregation Completed.");
 }
Exemplo n.º 4
0
 public void SaveToFile(double[] outputData, InputData inputData)
 {
     GridService.SaveToFile(outputData, inputData, writeEvent);
 }