Пример #1
0
        //=========================
        // constructor
        //=========================

        public RoundStrap(int ID, double position, double Length, BarMaterial Material)
        {
            this.ID       = ID;
            this.position = position;
            this.Length   = Length;
            this.Material = Material;
        }
Пример #2
0
        private void LoadInput(int strapID, string inputPath)
        {
            string targetWord  = "RoundStrapCount";
            int    currentLine = 0;

            string[] lines = File.ReadAllLines(inputPath);
            string[] parts;
            bool     targetFound = false;

            foreach (var line in lines)
            {
                if (line.Contains(targetWord) ||
                    line.Contains(targetWord.ToUpper()) ||
                    line.Contains(targetWord.ToLower()))
                {
                    targetFound = true;
                    break;
                }
                currentLine++;
            }

            if (targetFound)
            {
                currentLine++;  // skip header
                parts = lines[currentLine + strapID].Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

                Length   = Convert.ToDouble(parts[1]);
                position = Convert.ToDouble(parts[2]);

                if (position < 0 || position >= 1)
                {
                    throw new ArgumentException("Position input for round strap should be between 0 and 1");
                }

                Material = new BarMaterial()
                {
                    Density  = Convert.ToDouble(parts[3]),
                    Diameter = Convert.ToDouble(parts[4]),
                    EA       = Convert.ToDouble(parts[5]),
                    EI       = Convert.ToDouble(parts[6])
                };
            }
            else
            {
                throw new IOException(String.Format("Incomplete input file, case sensitive \'{0}\', \'{1}\' or \'{2}\' tag is not found!",
                                                    targetWord, targetWord.ToUpper(), targetWord.ToLower()));
            }
        }
Пример #3
0
        private void LoadInput(string inputPath)
        {
            string targetWord  = "IncludeSelvedges";
            int    currentLine = 0;

            string[] lines = File.ReadAllLines(inputPath);
            string[] parts;
            bool     targetFound = false;

            foreach (var line in lines)
            {
                if (line.Contains(targetWord) ||
                    line.Contains(targetWord.ToUpper()) ||
                    line.Contains(targetWord.ToLower()))
                {
                    targetFound = true;
                    break;
                }
                currentLine++;
            }

            if (targetFound)
            {
                currentLine += 2; // skip header
                parts        = lines[currentLine].Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

                Length   = Convert.ToDouble(parts[0]);
                Material = new BarMaterial()
                {
                    Density  = Convert.ToDouble(parts[1]),
                    Diameter = Convert.ToDouble(parts[2]),
                    EA       = Convert.ToDouble(parts[3]),
                    EI       = Convert.ToDouble(parts[4])
                };
            }
            else
            {
                throw new IOException(String.Format("Incomplete input file, case sensitive \'{0}\', \'{1}\' or \'{2}\' tag is not found!",
                                                    targetWord, targetWord.ToUpper(), targetWord.ToLower()));
            }
        }
Пример #4
0
        //=========================
        // constructor
        //=========================

        public Selvedge(int ID, double Length, BarMaterial Material)
        {
            this.ID       = ID;
            this.Length   = Length;
            this.Material = Material;
        }