private static InterpolationScheme NewInterpolationScheme(string[] y) { const string isValue = @"[-|\d|\.]+"; const string ShortLimit = @"(limitedLinear|vanLeer|Gamma|limitedCubic|MUSCL)+(\d)(\d)"; const string RangeLimit = @"(limited(vanLeer|Gamma|MUSCL))"; InterpolationScheme x = null; if (y.Length > 1) { x = new InterpolationScheme(); x.SetHeader( ref y[0]); var shortLimMatch = Regex.Match(y[1], ShortLimit); if (shortLimMatch.Length == 0) { var rangeLimMatch = Regex.Match(y[1], RangeLimit); if ( rangeLimMatch.Length == 0) { x.interpolation = y[1].ToEnum<InterpolationType>(); } else { x.interpolation = rangeLimMatch.Groups[2].Value.ToEnum<InterpolationType>(); //x.view = BoundView.Range; } } else { x.view = BoundView.Name; x.interpolation = shortLimMatch.Groups[1].Value.ToEnum<InterpolationType>(); x.lower_limit = Convert.ToDecimal(shortLimMatch.Groups[2].Value); x.upper_limit = Convert.ToDecimal(shortLimMatch.Groups[3].Value); } switch (y.Length) { case 5: x.lower_limit = Convert.ToDecimal(y[2]); x.upper_limit = Convert.ToDecimal(y[3]); x.flux = String.Copy(y[4]); x.view = BoundView.Range; break; case 4: if (Regex.IsMatch(isValue,y[3])) { x.lower_limit = Convert.ToDecimal(y[2]); x.upper_limit = Convert.ToDecimal(y[3]); x.view = BoundView.Range; } else { x.psi = Convert.ToDecimal(y[2]); x.flux = String.Copy(y[3]); } break; case 3: if (Regex.IsMatch(isValue, y[2])) { x.psi = Convert.ToDecimal(y[2]); } else { x.flux = String.Copy(y[3]); } break; } } return x; }
private static InterpolationScheme NewInterpolationScheme(string[] y) { const string isValue = @"[-|\d|\.]+"; const string ShortLimit = @"(limitedLinear|vanLeer|Gamma|limitedCubic|MUSCL)+(\d)(\d)"; const string RangeLimit = @"(limited(vanLeer|Gamma|MUSCL))"; InterpolationScheme x = null; if (y.Length > 1) { x = new InterpolationScheme(); x.SetHeader(ref y[0]); var shortLimMatch = Regex.Match(y[1], ShortLimit); if (shortLimMatch.Length == 0) { var rangeLimMatch = Regex.Match(y[1], RangeLimit); if (rangeLimMatch.Length == 0) { x.interpolation = y[1].ToEnum <InterpolationType>(); } else { x.interpolation = rangeLimMatch.Groups[2].Value.ToEnum <InterpolationType>(); //x.view = BoundView.Range; } } else { x.view = BoundView.Name; x.interpolation = shortLimMatch.Groups[1].Value.ToEnum <InterpolationType>(); x.lower_limit = Convert.ToDecimal(shortLimMatch.Groups[2].Value); x.upper_limit = Convert.ToDecimal(shortLimMatch.Groups[3].Value); } switch (y.Length) { case 5: x.lower_limit = Convert.ToDecimal(y[2]); x.upper_limit = Convert.ToDecimal(y[3]); x.flux = String.Copy(y[4]); x.view = BoundView.Range; break; case 4: if (Regex.IsMatch(isValue, y[3])) { x.lower_limit = Convert.ToDecimal(y[2]); x.upper_limit = Convert.ToDecimal(y[3]); x.view = BoundView.Range; } else { x.psi = Convert.ToDecimal(y[2]); x.flux = String.Copy(y[3]); } break; case 3: if (Regex.IsMatch(isValue, y[2])) { x.psi = Convert.ToDecimal(y[2]); } else { x.flux = String.Copy(y[3]); } break; } } return(x); }