Exemplo n.º 1
0
def combine_table_2(myssr1, myssr2):
    
    newrecord = br._FortranRecord("", 0)
    newrecord.put_int( [myssr1.niwr ])
    newrecord.put_int( [myssr1.mipts])
    newrecord.put_int( [myssr1.kjaq ])
    newrecord.put_int(myssr1.table2extra) #, len(myssr1.table2extra))
    
    return newrecord
Exemplo n.º 2
0
 def put_header(self):
     """
     Write the header part of the header
     to the surface source file
     """
     rec = [self.kod, self.ver, self.loddat, self.idtm, self.probid, self.aid]
     newrecord = _FortranRecord("".join(rec), len("".join(rec)))
     newrecord.put_int([self.knod])
     self.put_fortran_record(newrecord)
     return
Exemplo n.º 3
0
 def put_summary(self):
     """
     Write the summary part of the header
     to the surface source file
     """
     newrecord = _FortranRecord("", 0)
     newrecord.put_int( [self.summaryTable])
     newrecord.put_int( [self.summaryExtra])
     self.put_fortran_record(newrecord)
     return
Exemplo n.º 4
0
def combine_table_1(myssr1, myssr2):
    
    newrecord = br._FortranRecord("", 0)
    
    newrecord.put_long( [-1* myssr1.np1 + 0*-1* myssr2.np1 ])
    newrecord.put_long( [myssr1.nrss + 0*myssr2.nrss])
    newrecord.put_int(  [myssr1.ncrd])
    newrecord.put_int(  [myssr1.njsw])
    newrecord.put_long( [myssr1.niss])
    
    return newrecord
Exemplo n.º 5
0
 def put_summary(self):
     """
     Write the summary part of the header
     to the surface source file
     """
     newrecord = _FortranRecord("", 0)
     newrecord.put_int( list(self.summaryTable) )
     newrecord.put_int( list(self.summaryExtra) )
     #newrecord.put_int( [self.summaryTable])
     #newrecord.put_int( [self.summaryExtra])
     self.put_fortran_record(newrecord)
     return
Exemplo n.º 6
0
 def put_table_2(self):
     """
     Write the table2 part of the header
     to the surface source file
     """
     newrecord = _FortranRecord("", 0)
     newrecord.put_int( [self.niwr ])
     newrecord.put_int( [self.mipts])
     newrecord.put_int( [self.kjaq ])
     newrecord.put_int( self.table2extra)
     self.put_fortran_record(newrecord)
     return
Exemplo n.º 7
0
def combine_header_records(myssr1, myssr2):

    mykod    = "{0:<8}".format( myssr1.kod         )
    myver    = "{0:<5}".format( myssr1.ver         )
    myloddat = "{0:<8}".format( myssr1.loddat      )
    myidtm   = "{0:<19}".format( myssr1.idtm )#"1"                )
    myprobid = "{0:<19}".format( myssr1.probid )#"1"                )
    myaid    = "{0:<80}".format( myssr1.aid         )
    rec = [mykod, myver, myloddat, myidtm, myprobid, myaid]
    newrecord = br._FortranRecord("".join(rec), len("".join(rec)))
    newrecord.put_int([myssr1.knod])
    
    return newrecord
Exemplo n.º 8
0
 def put_table_1(self):
     """
     Write the table1 part of the header
     to the surface source file
     """
     newrecord = _FortranRecord("", 0)
     newrecord.put_long( [self.np1])
     newrecord.put_long( [self.nrss])
     newrecord.put_int(  [self.ncrd])
     newrecord.put_int(  [self.njsw])
     newrecord.put_long( [self.niss])
     self.put_fortran_record(newrecord)
     return
Exemplo n.º 9
0
    def put_surface_info(self):
        """
        Write the record for each surface
        to the surface source file
        """

        for cnt, s in enumerate(self.surflist):
            newrecord = _FortranRecord("",0)
            newrecord.put_int(s.id)
            if self.kjaq == 1:
                newrecord.put_int(s.facetId) # don't add a 'dummy facet ID'
            # else no macrobody flag byte in the record

            newrecord.put_int(s.type)
            newrecord.put_int(s.numParams)
            newrecord.put_double(s.surfParams)
            
            self.put_fortran_record(newrecord)
        return
Exemplo n.º 10
0
    newheader = combine_header_records(ssr,ssr)
    newtable1 = combine_table_1(ssr,ssr2)
    newtable2 = combine_table_2(ssr,ssr2)

    recordlist = [newheader, newtable1, newtable2]
    
    newssr = mcnp.SurfSrc("rssa","wb") #newssr.w","wb")

    for rec in recordlist:
        newssr.put_fortran_record(rec)
        
    numparticles = ssr.np1

    # adding lines for surfaces
    for cnt, s in enumerate(ssr.surflist): # being suspicious here
        surf = br._FortranRecord("",0)
        
        
        surf.put_int(s.id)
        if ssr.kjaq == 1:
            surf.put_int(s.facetId) # don't add a 'dummy facet ID'
        #else, no byte should be in the record.
        surf.put_int(s.type)
        surf.put_int(s.numParams)
        surf.put_double(s.surfParams)
        
        newssr.put_fortran_record(surf)
        
        if cnt > ssr.njsw:
            print "Warning: njsw does not match number of entries in surfacelist!"