Beispiel #1
0
def read_ntal(lines):
    """
    read line with ntal and npert,  and all following tally names.
    """
    l = lines.pop(0)
    n = map(int, l.split()[1::2])
    tals = read_values(lines, n[0], int, True)
    return n, tals
Beispiel #2
0
def read_ntal(f):
    """
    read line with ntal and npert
    """
    l = f.next()
    n = map(int, l.split()[1::2])
    tals = read_values(f, n[0], type_=int, True)
    return n, tals
Beispiel #3
0
def read_tall_cn(f):
    l = f.next()
    t = l.split() + [
        0
    ]  # the last entry is optional, if 0. If it is given, this 0 is not used.
    c = t.pop(0)[1:]
    n, f = map(int, t[:2])
    # read bin boundaries or variable values
    v = read_values(f, n, float, True)
    return n, f, c, v
Beispiel #4
0
 def _read_t_fn(self, lines):
     """
     Read Fn and the following list of cell/surface numbers
     """
     l = lines.pop(0)
     fn = int(l.split()[1])
     if self.mij[-1] == 0:
         fnl = read_values(lines, fn, int) 
     else:
         fnl = []
     self.f = fn, fnl
     return
Beispiel #5
0
def read_tally_fn(f, j):
    """
    read number of cells and cell names.

    j -- type of tally (detector?).
    """
    l = f.next()
    t = l.split()
    assert t[0] in 'fF'
    t = map(int, t[1:])
    n = t  # number of cells, followed by the mesh size in each direction for tmesh tallies
    if len(n) == 1 and j == 0:
        # n is the number of cells. Read cell names
        cells = read_values(f, n[0], int, True)
        return n, cells
    elif len(n) == 4:
        # this is a tmesh tally.
        cor = []
        for nn in n[2:]:
            cor.append(read_values(f, nn + 1, float, True))
        return n, cor
Beispiel #6
0
    def _read_t_vals(self, lines):
        """
        Read tally values. lines should start with the line containing the 'VALS' keyword.
        """
        # tuple of dimensions
        s = (2, self.t[1], self.e[1], self.c[1], self.m[1], self.s[1], self.u[1], self.d, self.f[0])
        s = filter(lambda x: x>0, s)
        v = numpy.zeros(s)
        t = read_values(lines, v.size, float)
        t = numpy.array(t)
        t.
        print s

        return
Beispiel #7
0
 def __read_cet(self, lines):
     cnf = lines.pop(0).split()
     if len(cnf) == 3:
         c, n, f = cnf
     else:
         c, n = cnf
         f = 0
     n = int(n)
     f = int(f)
     if f == 0:
         nv = n
     else:
         nv = n + 1
     if nv > 0:
         bvl = read_values(lines, nv, float)
     else:
         bvl = []
     return c, n, f, bvl