import os
import string
from numpy import *


class Tpsinput:
    """handles the input information
    """
    NSW = 200         # maximal number of relaxation steps
    SHOOTFACTOR = 0.1
    TIMEFACTOR = 0.1

    def __init__(self):
        cexist = 0
        ifile = open('INPFILE', 'r')
        for line in ifile.readlines():
            line = string.split(line, '=')
            if len(line) != 2:
                continue
            line[0] = string.strip(line[0])
            line[0] = string.upper(line[0])
            line[1] = string.strip(line[1])
            line[1] = string.split(line[1])
            if len(line[1]) > 1:
                line_long = line[1][1:]
            line[1] = line[1][0]
            if line[0] == 'NSW':
                self.NSW = int(line[1])
            elif line[0] == 'SHOOTFACTOR':
                self.SHOOTFACTOR = float(line[1])
            elif line[0] == 'TIMEFACTOR':
                self.TIMEFACTOR = float(line[1])
        ifile.close()
