public UnifiedPhillipsSpectrumCondition(int size, float windSpeed, float windDir, float waveAge, int numGrids) : base(size, numGrids) { if (numGrids < 1 || numGrids > 4) { throw new ArgumentException("UnifiedPhillipsSpectrumCondition must have 1 to 4 grids not " + numGrids); } Key = new UnifiedSpectrumConditionKey(windSpeed, waveAge, size, windDir, SPECTRUM_TYPE.UNIFIED_PHILLIPS, numGrids); if (numGrids == 1) { GridSizes = new Vector4(772, 1, 1, 1); Choppyness = new Vector4(2.3f, 1.0f, 1.0f, 1.0f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } else if (numGrids == 2) { GridSizes = new Vector4(772, 97, 1, 1); Choppyness = new Vector4(2.3f, 1.2f, 1.0f, 1.0f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } else if (numGrids == 3) { GridSizes = new Vector4(1372, 392, 31, 1); Choppyness = new Vector4(2.3f, 2.1f, 1.0f, 1.0f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } else if (numGrids == 4) { GridSizes = new Vector4(1372, 392, 31, 4); Choppyness = new Vector4(2.3f, 2.1f, 1.0f, 0.9f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } }
public UnifiedSpectrumCondition(int size, float windSpeed, float windDir, float waveAge, int numGrids) : base(size, numGrids) { if (numGrids < 1 || numGrids > 4) throw new ArgumentException("UnifiedSpectrumCondition must have 1 to 4 grids not " + numGrids); Key = new UnifiedSpectrumConditionKey(windSpeed, waveAge, size, windDir, SPECTRUM_TYPE.UNIFIED, numGrids); if (numGrids == 1) { GridSizes = new Vector4(772, 1, 1, 1); Choppyness = new Vector4(2.3f, 1.0f, 1.0f, 1.0f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } else if (numGrids == 2) { GridSizes = new Vector4(772, 57, 1, 1); Choppyness = new Vector4(2.3f, 2.1f, 1.0f, 1.0f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } else if (numGrids == 3) { GridSizes = new Vector4(1372, 392, 28, 1); Choppyness = new Vector4(2.3f, 2.1f, 1.6f, 1.0f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } else if (numGrids == 4) { GridSizes = new Vector4(1372, 392, 28, 4); Choppyness = new Vector4(2.3f, 2.1f, 1.6f, 0.9f); WaveAmps = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); } }
public override SpectrumTask GetCreateSpectrumConditionTask() { UnifiedSpectrumConditionKey key = Key as UnifiedSpectrumConditionKey; UnifiedSpectrum uspectrum = new UnifiedSpectrum(key.WindSpeed, key.WindDir, key.WaveAge); PhillipsSpectrum pspectrum = new PhillipsSpectrum(key.WindSpeed, key.WindDir); if (Key.NumGrids == 1) { return(new SpectrumTask(this, true, new ISpectrum[] { uspectrum, null, null, null })); } else if (Key.NumGrids == 2) { return(new SpectrumTask(this, true, new ISpectrum[] { uspectrum, pspectrum, null, null })); } else if (Key.NumGrids == 3) { return(new SpectrumTask(this, true, new ISpectrum[] { uspectrum, uspectrum, pspectrum, null })); } else //numGrids == 4 { return(new SpectrumTask(this, true, new ISpectrum[] { uspectrum, uspectrum, pspectrum, uspectrum })); } }
public override SpectrumTask GetCreateSpectrumConditionTask() { UnifiedSpectrumConditionKey key = Key as UnifiedSpectrumConditionKey; UnifiedSpectrum uspectrum = new UnifiedSpectrum(key.WindSpeed, key.WindDir, key.WaveAge); return(new SpectrumTask(this, true, new ISpectrum[] { uspectrum, uspectrum, uspectrum, uspectrum })); }
protected override bool Matches(WaveSpectrumConditionKey k) { UnifiedSpectrumConditionKey key = k as UnifiedSpectrumConditionKey; if (key == null) { return(false); } if (WindSpeed != key.WindSpeed) { return(false); } if (WaveAge != key.WaveAge) { return(false); } return(true); }
public override SpectrumTask GetCreateSpectrumConditionTask() { UnifiedSpectrumConditionKey unifiedSpectrumConditionKey = base.Key as UnifiedSpectrumConditionKey; UnifiedSpectrum unifiedSpectrum = new UnifiedSpectrum(unifiedSpectrumConditionKey.WindSpeed, unifiedSpectrumConditionKey.WindDir, unifiedSpectrumConditionKey.WaveAge); PhillipsSpectrum phillipsSpectrum = new PhillipsSpectrum(unifiedSpectrumConditionKey.WindSpeed, unifiedSpectrumConditionKey.WindDir); if (base.Key.NumGrids == 1) { bool arg_53_1 = true; ISpectrum[] expr_4F = new ISpectrum[4]; expr_4F[0] = unifiedSpectrum; return(new SpectrumTask(this, arg_53_1, expr_4F)); } if (base.Key.NumGrids == 2) { bool arg_7A_1 = true; ISpectrum[] expr_72 = new ISpectrum[4]; expr_72[0] = unifiedSpectrum; expr_72[1] = phillipsSpectrum; return(new SpectrumTask(this, arg_7A_1, expr_72)); } if (base.Key.NumGrids == 3) { bool arg_A5_1 = true; ISpectrum[] expr_99 = new ISpectrum[4]; expr_99[0] = unifiedSpectrum; expr_99[1] = unifiedSpectrum; expr_99[2] = phillipsSpectrum; return(new SpectrumTask(this, arg_A5_1, expr_99)); } return(new SpectrumTask(this, true, new ISpectrum[] { unifiedSpectrum, unifiedSpectrum, phillipsSpectrum, unifiedSpectrum })); }
public override SpectrumTask GetCreateSpectrumConditionTask() { UnifiedSpectrumConditionKey unifiedSpectrumConditionKey = base.Key as UnifiedSpectrumConditionKey; UnifiedSpectrum unifiedSpectrum = new UnifiedSpectrum(unifiedSpectrumConditionKey.WindSpeed, unifiedSpectrumConditionKey.WindDir, unifiedSpectrumConditionKey.WaveAge); PhillipsSpectrum phillipsSpectrum = new PhillipsSpectrum(unifiedSpectrumConditionKey.WindSpeed, unifiedSpectrumConditionKey.WindDir); if (base.Key.NumGrids == 1) { bool multiThreadTask = true; ISpectrum[] array = new ISpectrum[4]; array[0] = unifiedSpectrum; return(new SpectrumTask(this, multiThreadTask, array)); } if (base.Key.NumGrids == 2) { bool multiThreadTask2 = true; ISpectrum[] array2 = new ISpectrum[4]; array2[0] = unifiedSpectrum; array2[1] = phillipsSpectrum; return(new SpectrumTask(this, multiThreadTask2, array2)); } if (base.Key.NumGrids == 3) { bool multiThreadTask3 = true; ISpectrum[] array3 = new ISpectrum[4]; array3[0] = unifiedSpectrum; array3[1] = unifiedSpectrum; array3[2] = phillipsSpectrum; return(new SpectrumTask(this, multiThreadTask3, array3)); } return(new SpectrumTask(this, true, new ISpectrum[] { unifiedSpectrum, unifiedSpectrum, phillipsSpectrum, unifiedSpectrum })); }
private WaveSpectrumConditionKey NewSpectrumConditionKey(int fourierSize, float windSpeed, float windDir, float waveAge) { WaveSpectrumConditionKey result; switch (this.spectrumType) { case SPECTRUM_TYPE.UNIFIED: result = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, this.spectrumType, this.numberOfGrids); break; case SPECTRUM_TYPE.PHILLIPS: result = new PhillipsSpectrumConditionKey(windSpeed, fourierSize, windDir, this.spectrumType, this.numberOfGrids); break; case SPECTRUM_TYPE.UNIFIED_PHILLIPS: result = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, this.spectrumType, 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 UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, this.spectrumType, this.numberOfGrids); } else { result = base.CustomWaveSpectrum.CreateKey(fourierSize, windDir, this.spectrumType, this.numberOfGrids); } break; default: throw new InvalidOperationException("Invalid spectrum type = " + this.spectrumType); } return(result); }
protected override bool Matches(WaveSpectrumConditionKey k) { UnifiedSpectrumConditionKey unifiedSpectrumConditionKey = k as UnifiedSpectrumConditionKey; return(!(unifiedSpectrumConditionKey == null) && this.WindSpeed == unifiedSpectrumConditionKey.WindSpeed && this.WaveAge == unifiedSpectrumConditionKey.WaveAge); }
/// <summary> /// Create a new wave condition key depending on the spectrum type used. /// </summary> WaveSpectrumConditionKey NewSpectrumConditionKey(int fourierSize, float windSpeed, float windDir, float waveAge) { WaveSpectrumConditionKey key = null; switch (spectrumType) { case SPECTRUM_TYPE.UNIFIED: key = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, spectrumType, numberOfGrids); break; case SPECTRUM_TYPE.UNIFIED_PHILLIPS: key = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, spectrumType, numberOfGrids); break; case SPECTRUM_TYPE.PHILLIPS:; key = new PhillipsSpectrumConditionKey(windSpeed, fourierSize, windDir, spectrumType, 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; key = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, spectrumType, numberOfGrids); } else { key = CustomWaveSpectrum.CreateKey(fourierSize, windDir, spectrumType, numberOfGrids); } } break; default: throw new InvalidOperationException("Invalid spectrum type = " + spectrumType); } return key; }
private WaveSpectrumConditionKey NewSpectrumConditionKey(int fourierSize, float windSpeed, float windDir, float waveAge) { WaveSpectrumConditionKey result; switch (this.spectrumType) { case SPECTRUM_TYPE.UNIFIED: result = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, this.spectrumType, this.numberOfGrids); break; case SPECTRUM_TYPE.PHILLIPS: result = new PhillipsSpectrumConditionKey(windSpeed, fourierSize, windDir, this.spectrumType, this.numberOfGrids); break; case SPECTRUM_TYPE.UNIFIED_PHILLIPS: result = new UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, this.spectrumType, 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 UnifiedSpectrumConditionKey(windSpeed, waveAge, fourierSize, windDir, this.spectrumType, this.numberOfGrids); } else { result = base.CustomWaveSpectrum.CreateKey(fourierSize, windDir, this.spectrumType, this.numberOfGrids); } break; default: throw new InvalidOperationException("Invalid spectrum type = " + this.spectrumType); } return result; }