/// <summary> /// Constructor for the metha information of a Green's function /// </summary> /// <param name="Entry">Green's function meta information.</param> public GreenFunctionEntry(GreenFunctionEntry Entry) { this.Description = Entry.Description; this.FileName = Entry.FileName; this.EarthModel = Entry.EarthModel; this.Source = Entry.Source; this.Pattern = Entry.Pattern; this.Frame = Entry.Frame; }
internal void getGreensFunction(string path) { string[] dirs = Directory.GetFiles(path + FilePath._EarthModels + Path.DirectorySeparatorChar); for (int i = 0; i < dirs.Length; i++) { GreenFunctionEntry gfn = new GreenFunctionEntry(); gfn.FileName = Path.GetFileName(dirs[i]); string[] parts = Path.GetFileName(dirs[i]).Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); switch (parts[1]) { case "gbaver": gfn.EarthModel = "gbaver"; break; case "gbcont": gfn.EarthModel = "gbcont"; break; case "gbocen": gfn.EarthModel = "gbcont"; break; } switch (parts[2]) { case "wef": gfn.Source = "W.E. Farrel"; break; } switch (parts[3]) { case "p01": gfn.Pattern = "coarse"; break; case "p02": gfn.Pattern = "fine"; break; } switch (parts[4]) { case "ce": gfn.Frame = "Common"; break; case "cm": gfn.Frame = "GPS"; break; } FileStream fs = new FileStream(dirs[i], FileMode.Open); GZipStream decompressingStream = new GZipStream(fs, CompressionMode.Decompress); using (var sr = new StreamReader(decompressingStream)) { string tmp = sr.ReadLine().TrimEnd(); tmp = tmp.Remove(0, 3).TrimStart(); gfn.Description = tmp; } AddGreenFunctionEntry(gfn); } }
/// <summary> /// Compares two Green's function. /// </summary> /// <param name="Entry">Green's function to be compared.</param> /// <returns>Equal: TRUE; not equal: FALSE.</returns> public bool Equal(GreenFunctionEntry Entry) { if (this != null && Entry != null) { if (this.Description == Entry.Description && this.FileName == Entry.FileName && this.EarthModel == Entry.EarthModel && this.Source == Entry.Source && this.Pattern == Entry.Pattern && this.Frame == Entry.Frame) { return(true); } else { return(false); } } else { return(false); } }
public int AddGreenFunctionEntry(GreenFunctionEntry item) { return(GreensFunctionData.Add(item)); }