Пример #1
0
        /// <summary>
        /// This method combines the passed base airfoil with the passed coefficients as aparallel processing.
        /// If finish the processing, it fires the event combinatedAirfoilUpdated.
        /// </summary>
        /// <param name="basisAirfoils"></param>
        /// <param name="coefficients"></param>
        public void CombineAirfoils(General.BasisAirfoils basisAirfoils, Double[,] coefficients)
        {
            List <Task> tasks = new List <Task>();

            for (int i = 0; i < _numberOfAirfoils; i++)
            {
                // Null Check
                if (_combinedAirfoils[i] == null)
                {
                    _combinedAirfoils[i] = new Representation.AirfoilCombiner();
                }

                var x     = i;
                var basis = basisAirfoils.AirfoilGroup.ToArray();
                var coef  = GetRowArray(coefficients, i);

                // Update Source and Re-Combinate Airfoil.
                tasks.Add(Task.Run(() => _combinedAirfoils[x].UpdateBaseSource(coef, basis)));
            }
            Task.WaitAll(tasks.ToArray());

            // Fire the event combinedAirfoilsUpdated
            CombinedAirfoilsUpdated?.Invoke(this, new CombinedAirfoilsUpdatedEventArgs()
            {
                combinedAirfoils = this._combinedAirfoils
            });
        }
Пример #2
0
        public void AddElement(Representation.AirfoilCombiner element)
        {
            List <Representation.AirfoilCombiner> tempAirfoils = new List <Representation.AirfoilCombiner>(_combinedAirfoils);

            tempAirfoils.Add(element);
            _combinedAirfoils = tempAirfoils.ToArray();

            // Increment number of airfoils
            ++this._numberOfAirfoils;

            // Fire the event combinedAirfoilsUpdated
            CombinedAirfoilsUpdated?.Invoke(this, new CombinedAirfoilsUpdatedEventArgs()
            {
                combinedAirfoils = this._combinedAirfoils
            });
        }