/// <summary> /// /// </summary> /// <param name="files"></param> /// <param name="previousFile"></param> /// <param name="snap"></param> /// <returns></returns> GroupTabFile NextGroupTabFile(GroupTabFile previousFile, short snap) { int ifile = (previousFile == null?0: previousFile.ifile+1); GroupTabFile groupFile = new GroupTabFile(GetGroupTab(inPath, snap, ifile), previousFile); return groupFile; }
//string filename, bool _hasVelDisp, short snapnum, float redshift) /// <summary> /// /// </summary> /// <param name="_process"></param> /// <param name="filename"></param> /// <param name="_snapnum"></param> /// <param name="_ifile"></param> public GroupTabFile(string filename, GroupTabFile previous) { this.ifile = (previous == null ? 0 : previous.ifile + 1); // no need for records/bytesRead, not in fortran format using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open))) { numGroups = reader.ReadInt32(); totalGroups = reader.ReadInt32(); numIDs = reader.ReadInt32(); totalIDs = reader.ReadInt64(); numFiles = reader.ReadInt32(); previousLastGroupIndex = (previous == null ? -1 : previous.lastGroupIndex); groups = new GroupTabInfo[numGroups]; for (int i = 0; i < numGroups; i++) groups[i] = new GroupTabInfo(); // Len+offset+Mass reader.ReadBytes(4*3*numGroups); for (int i = 0; i < numGroups; i++) { groups[i].cmx = reader.ReadSingle(); groups[i].cmy = reader.ReadSingle(); groups[i].cmz = reader.ReadSingle(); } for (int i = 0; i < numGroups; i++) { groups[i].cvx = reader.ReadSingle(); groups[i].cvy = reader.ReadSingle(); groups[i].cvz = reader.ReadSingle(); } } }