Пример #1
0
        private WaveSpectrumCondition NewSpectrumCondition(int fourierSize, float windSpeed, float windDir, float waveAge)
        {
            WaveSpectrumCondition result;

            switch (this.spectrumType)
            {
            case SPECTRUM_TYPE.UNIFIED:
                result = new UnifiedSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
                break;

            case SPECTRUM_TYPE.PHILLIPS:
                result = new PhillipsSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
                break;

            case SPECTRUM_TYPE.UNIFIED_PHILLIPS:
                result = new UnifiedPhillipsSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
                break;

            case SPECTRUM_TYPE.CUSTOM:
                if (base.CustomWaveSpectrum == null)
                {
                    Ocean.LogWarning("Custom spectrum type selected but no custom spectrum interface has been added to the wave spectrum. Defaulting to Unified Spectrum");
                    this.spectrumType = SPECTRUM_TYPE.UNIFIED;
                    result            = new UnifiedSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
                }
                else
                {
                    result = new CustomWaveSpectrumCondition(base.CustomWaveSpectrum, fourierSize, windDir, this.numberOfGrids);
                }
                break;

            default:
                throw new InvalidOperationException("Invalid spectrum type = " + this.spectrumType);
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// Create a new wave condition depending on the spectrum type used.
        /// </summary>
        WaveSpectrumCondition NewSpectrumCondition(int fourierSize, float windSpeed, float windDir, float waveAge)
        {

      
            WaveSpectrumCondition condition = null;

            switch(spectrumType)
            {
                case SPECTRUM_TYPE.UNIFIED:
                    condition = new UnifiedSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, numberOfGrids);
                    break;

                case SPECTRUM_TYPE.UNIFIED_PHILLIPS:
                    condition = new UnifiedPhillipsSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, numberOfGrids);
                    break;

                case SPECTRUM_TYPE.PHILLIPS:
                    condition = new PhillipsSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, numberOfGrids);
                    break;

                case SPECTRUM_TYPE.CUSTOM:
                    {
                        if (CustomWaveSpectrum == null)
                        {
                            Ocean.LogWarning("Custom spectrum type selected but no custom spectrum interface has been added to the wave spectrum. Defaulting to Unified Spectrum");
                            spectrumType = SPECTRUM_TYPE.UNIFIED;
                            condition = new UnifiedSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, numberOfGrids);
                        }
                        else
                        {
                            condition = new CustomWaveSpectrumCondition(CustomWaveSpectrum, fourierSize, windDir, numberOfGrids);
                        }
                    }
                    break;

                default:
                    throw new InvalidOperationException("Invalid spectrum type = " + spectrumType);
            }

            return condition;

        }
Пример #3
0
 private WaveSpectrumCondition NewSpectrumCondition(int fourierSize, float windSpeed, float windDir, float waveAge)
 {
     WaveSpectrumCondition result;
     switch (this.spectrumType)
     {
     case SPECTRUM_TYPE.UNIFIED:
         result = new UnifiedSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
         break;
     case SPECTRUM_TYPE.PHILLIPS:
         result = new PhillipsSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
         break;
     case SPECTRUM_TYPE.UNIFIED_PHILLIPS:
         result = new UnifiedPhillipsSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
         break;
     case SPECTRUM_TYPE.CUSTOM:
         if (base.CustomWaveSpectrum == null)
         {
             Ocean.LogWarning("Custom spectrum type selected but no custom spectrum interface has been added to the wave spectrum. Defaulting to Unified Spectrum");
             this.spectrumType = SPECTRUM_TYPE.UNIFIED;
             result = new UnifiedSpectrumCondition(fourierSize, windSpeed, windDir, waveAge, this.numberOfGrids);
         }
         else
         {
             result = new CustomWaveSpectrumCondition(base.CustomWaveSpectrum, fourierSize, windDir, this.numberOfGrids);
         }
         break;
     default:
         throw new InvalidOperationException("Invalid spectrum type = " + this.spectrumType);
     }
     return result;
 }