Example #1
0
        public static string GetIsotopeFile(int Z, int A, FILETYP ftype)
        {
            string rtyp     = FileTypeDir[ftype] + FileTypeName[ftype];
            string sz       = Z.ToString("D3");
            string sa       = A.ToString("D3");
            string filePath = rtyp + sz + "_" + ElementNames[Z] + "_" + sa + ".endf";

            return(RootDir + filePath);
        }
Example #2
0
        public static string[] GetFileNames(FILETYP ftype)
        {
            string rtyp = FileTypeDir[ftype];

            string[] filePaths = Directory.GetFiles($"{RootDir}{rtyp}", "*.endf", SearchOption.TopDirectoryOnly);
            for (int i = 0; i < filePaths.Length; i++)
            {
                filePaths[i] = Path.GetFileName(filePaths[i]);
            }
            return(filePaths);
        }
Example #3
0
        public static string GetIsotopeFile(int zaid, FILETYP ftype)
        {
            string rtyp = FileTypeDir[ftype] + FileTypeName[ftype];
            int    z    = zaid / 1000;
            int    a    = zaid - z * 1000;

            string sz       = z.ToString("D3");
            string sa       = a.ToString("D3");
            string filePath = rtyp + sz + "_" + ElementNames[z] + "_" + sa + ".endf";

            return(RootDir + filePath);
        }
        public FileStream GetFileStream(int Z, int A, FILETYP fileType)
        {
            string fn = Globals.GetIsotopeFile(Z, A, fileType);

            FileStream fileStream;

            try
            {
                fileStream = new FileStream(fn, FileMode.Open, FileAccess.Read);
            }
            catch (FileNotFoundException ex)
            {
                return(null);
            }
            return(fileStream);
        }
Example #5
0
        public static string GetIsotopeFile(string name, int A, FILETYP ftype)
        {
            string rtyp = FileTypeDir[ftype] + FileTypeName[ftype];
            var    z    = ElementNames.ToList().IndexOf(name);

            if (z == -1)
            {
                return(string.Empty);
            }

            string sz       = z.ToString("D3");
            string sa       = A.ToString("D3");
            string filePath = rtyp + sz + "_" + ElementNames[z] + "_" + sa + ".endf";

            return(RootDir + filePath);
        }
Example #6
0
        public static List <Element> GetAllElements(FILETYP fileType)
        {
            var elements = new List <Element>();
            var dir      = FileTypeName[fileType];
            var files    = GetFileNames(fileType);

            for (int i = 0; i < files.Length; i++)
            {
                files[i] = files[i].Replace(dir, "");
                files[i] = files[i].Replace(".endf", "");
                var str = files[i].Split('_');
                int z   = Convert.ToInt32(str[0]);
                if (str[2].Contains("m"))
                {
                    continue;
                }
                int a = Convert.ToInt32(str[2]);
                elements.Add(new Element(z, a));
            }
            return(elements);
        }
Example #7
0
        public string IsotopeFileName(Isotope iso, int ZA, FILETYP ftype)
        {
            string rtyp = "_";

            if (ftype == FILETYP.DECAY)
            {
                rtyp = "decay/dec-";
            }
            if (ftype == FILETYP.NEUTRON)
            {
                rtyp = "neutron/n-";
            }
            if (ftype == FILETYP.FISSION)
            {
                rtyp = "nfy/nfy-";
            }

            int Z = ZA / 1000;
            int A = ZA - Z * 1000;

            iso.A    = A;
            iso.Z    = Z;
            iso.ZAID = ZA;
            int    z  = 1000 + Z;
            string sz = z.ToString();

            sz = sz.Substring(1, 3);
            int    a  = 1000 + A;
            string sa = a.ToString();

            sa = sa.Substring(1, 3);
            string nm = ElementNames[Z] + sa;

            iso.Name        = nm;
            iso.ElementName = ElementNames[Z];
            string filePath = "xsdir/" + rtyp + sz + "_" + ElementNames[Z] + "_" + sa + ".endf";

            return(filePath);
        }