Exemple #1
0
 public void Add(Process process)
 {
     if(process == null)
         return;
     processes.Add(process);
     process.runner = this;
 }
        Process process; // the process holding on to configuration

        #endregion Fields

        #region Constructors

        public FOFOrderedSnapFile(Process _process, String filename)
        {
            this.process = _process;
            int record, bytesRead;
            using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open)))
            {
                record = reader.ReadInt32(); // unformatted fortran record start
                bytesRead = 0;
                for (int i = 0; i < 6; i++) // 24
                {
                    numParts[i] = reader.ReadUInt32();
                    bytesRead += 4;
                }
                for (int i = 0; i < 6; i++) // 48
                {
                    massParts[i] = reader.ReadDouble();
                    bytesRead += 8;
                }
                time = reader.ReadDouble(); // time, 8
                bytesRead += 8;
                redshift = reader.ReadDouble(); //redshift, 8
                bytesRead += 8;

                flag_sfr = reader.ReadUInt32(); //flag_sfr, 4
                bytesRead += 4;
                flag_feedback = reader.ReadUInt32(); //flag_feedback, 4
                bytesRead += 4;
                for (int i = 0; i < 6; i++)
                {
                    numTotals[i] = reader.ReadUInt32(); //npartall, 24
                    bytesRead += 4;
                }
                flag_cooling = reader.ReadUInt32(); // flag_cooling, 4
                bytesRead += 4;
                numSubfiles = reader.ReadUInt32(); //Nsubfiles, 4
                bytesRead += 4;
                boxSize = reader.ReadDouble(); //boxsize, 8
                bytesRead += 8;
                omega0 = reader.ReadDouble();
                bytesRead += 8;
                omegaLambda = reader.ReadDouble();
                bytesRead += 8;
                hubbleParam = reader.ReadDouble();
                bytesRead += 8;
                flag_age = reader.ReadUInt32();
                bytesRead += 4;
                flag_metals = reader.ReadUInt32();
                bytesRead += 4;

                for (int i = 0; i < 6; i++)
                {
                    nLargeSims[i] = reader.ReadUInt32();
                    bytesRead += 4;
                }

                flag_entr_ics = reader.ReadUInt32();
                bytesRead += 4;

                reader.ReadBytes(record-bytesRead);
                int record2 = reader.ReadInt32();
                if (record != record2)
                    throw new Exception("Record end not equal to record begin!"); // unformatted fortran record end

                uint np = numParts[1];

                particles = new FOFOrderedParticle[np];
                ReadData(reader);
            }
        }