Exemple #1
0
        public static bool Find()
        {
            string       path = @"Job-case1.inp";
            StreamReader sr   = File.OpenText(path);

            string s;

            bool[] c      = new bool[4];
            bool   status = false;
            bool   corr   = false;

            while ((s = sr.ReadLine()) != null)
            {
                if ((BM.BoyerMooreHorspoolSearch("** STEP:", s)) > -1)
                {
                    status = true;
                }
                if ((BM.BoyerMooreHorspoolSearch("** Interaction:", s)) > -1)
                {
                    c[0] = true;
                    continue;
                }
                if ((BM.BoyerMooreHorspoolSearch("** OUTPUT REQUESTS", s)) > -1)
                {
                    c[1] = true;
                    continue;
                }
                if ((BM.BoyerMooreHorspoolSearch("** FIELD OUTPUT:", s)) > -1)
                {
                    c[2] = true;
                    continue;
                }
                if ((BM.BoyerMooreHorspoolSearch("** HISTORY OUTPUT:", s)) > -1)
                {
                    c[3] = true;
                    continue;
                }
                if ((BM.BoyerMooreHorspoolSearch("*End Step", s)) > -1)
                {
                    if ((status == true && c[0] == true && c[1] == true && c[2] == true && c[3] == true) ||
                        status == true && c[0] == false && c[1] == false && c[2] == false && c[3] == false)
                    {
                        corr = true;
                        break;
                    }
                    status = false;
                    c[0]   = false;
                    c[1]   = false;
                    c[2]   = false;
                    c[3]   = false;
                }
            }
            sr.Close();
            return(corr);
        }
Exemple #2
0
        public static Materialy[] Find()
        {
            string       path = @"Job-case1.inp";
            StreamReader sr   = File.OpenText(path);

            List <string> list = new List <string>();
            string        s;
            int           i   = 0;
            int           j   = 0;
            bool          inc = false;
            int           h;

            Materialy[] m = new Materialy[5];
            while ((s = sr.ReadLine()) != null)
            {
                if ((h = BM.BoyerMooreHorspoolSearch("*Material", s)) > -1)
                {
                    s          = s.Remove(0, h + 16);
                    m[i].Nazwa = s;
                    inc        = true;
                }
                if (j == 2)
                {
                    s = s.TrimEnd(',');
                    s = s.Replace('.', ',');
                    //Console.WriteLine(s);
                    m[i].Conductivity = Double.Parse(s);
                }
                if (j == 4)
                {
                    s            = s.TrimEnd(',');
                    s            = s.Replace('.', ',');
                    m[i].Density = Double.Parse(s);
                }
                if (j == 6)
                {
                    s = s.TrimEnd(',');
                    s = s.Replace('.', ',');
                    m[i].Specific_Heat = Double.Parse(s);
                    inc = false;
                    j   = 0;
                    i++;
                }
                if (inc)
                {
                    j++;
                }
            }
            sr.Close();
            return(m);
        }
Exemple #3
0
        public static List <string> Find()
        {
            string       path = @"Job-case1.inp";
            StreamReader sr   = File.OpenText(path);

            List <string> list = new List <string>();
            string        s;

            while ((s = sr.ReadLine()) != null)
            {
                if (((BM.BoyerMooreHorspoolSearch("*Elset, elset=", s) > -1) || (BM.BoyerMooreHorspoolSearch("*Nset, nset=", s) > -1)) == true)
                {
                    s = s.Remove(0, s.LastIndexOf("=") + 1);
                    list.Add(s);
                }
            }
            sr.Close();
            return(list);
        }
Exemple #4
0
        public static List <string> Find()
        {
            string       path = @"Job-case1.inp";
            StreamReader sr   = File.OpenText(path);

            List <string> list = new List <string>();
            string        s;
            int           h;

            while ((s = sr.ReadLine()) != null)
            {
                if ((h = BM.BoyerMooreHorspoolSearch("*Element, type=", s)) > -1)
                {
                    s = s.Remove(0, h + 15);
                    list.Add(s);
                }
            }
            sr.Close();
            return(list);
        }