示例#1
0
 bnd.NPOIN2 = len(BOR)
 bnd.NPOIN3 = bnd.NPOIN2 * slf.NPLAN
 bnd.IPARAM = [0, 0, 0, 0, 0, 0, bnd.NPLAN, 0, 0, 0]
 bnd.IPOB2 = BOR  # /!\ Note that IPOBO keeps the original numbering
 print '   +> masking and setting connectivity'
 # Set the array that only includes elements of geo.IKLE2 with at least two nodes in BOR
 MASK = geo.IKLE2[np.where(
     np.sum(np.in1d(geo.IKLE2, np.sort(BOR -
                                       1)).reshape(geo.NELEM2, geo.NDP2),
            axis=1) == 2)]
 IKLE2 = np.ravel(MASK)[np.in1d(MASK, np.sort(BOR - 1))].reshape(
     len(MASK), 2)  # this IKLE2 keeps the original numbering
 # ~~> re-numbering IKLE2 as a local connectivity matrix
 KNOLG, indices = np.unique(np.ravel(IKLE2), return_index=True)
 KNOGL = dict(zip(KNOLG, range(len(KNOLG))))
 bnd.IKLE2 = -np.ones_like(IKLE2, dtype=np.int)
 for k in range(len(IKLE2)):
     bnd.IKLE2[k] = [
         KNOGL[IKLE2[k][0]], KNOGL[IKLE2[k][1]]
     ]  # /!\ bnd.IKLE2 has a local numbering, fit to the boundary elements
 # Last few numbers
 bnd.NELEM2 = len(bnd.IKLE2)
 if slf.NPLAN > 1: bnd.NELEM3 = bnd.NELEM2 * (slf.NPLAN - 1)
 else: bnd.NELEM3 = bnd.NELEM2
 # 3D structures
 if slf.NPLAN > 1:
     bnd.IPOB3 = np.ravel(
         np.add(
             np.repeat(bnd.IPOB2,
                       slf.NPLAN).reshape((bnd.NPOIN2, slf.NPLAN)),
             bnd.NPOIN2 * np.arange(slf.NPLAN)).T)
示例#2
0
slf2d.NELEM2 = e
slf2d.NELEM3 = e
slf2d.IPARAM = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

#print '     +> Set SELAFIN mesh'
slf2d.MESHX = x
slf2d.MESHY = y

#print '     +> Set SELAFIN IPOBO'
junkIPOB = np.zeros(n - len(b))
junkIPOB = junkIPOB.astype(np.int16)
slf2d.IPOB2 = np.hstack((b, junkIPOB))
slf2d.IPOB3 = slf2d.IPOB2

#print '     +> Set SELAFIN IKLE'
slf2d.IKLE2 = ikle
slf2d.IKLE3 = ikle

#print '     +> Set SELAFIN times and cores'
# these two lists are empty after constructor is instantiated
slf2d.tags['cores'].append(0)
slf2d.tags['times'].append(0)

#slf2d.tags = { 'times':[0] } # time (sec)
#slf2d.DATETIME = sel.DATETIME
slf2d.DATETIME = [2015, 1, 1, 1, 1, 1]
#slf2d.tags = { 'cores':[long(0)] } # time frame

#print '     +> Write SELAFIN headers'
slf2d.fole.update({'hook': open(slf_file, 'w')})
slf2d.fole.update({'name': 'Converted from gmsh by pputils'})
示例#3
0
       'DEGREES         ']
    atm.NVAR = atm.NBV1
    atm.VARINDEX = range(atm.NVAR)

    # Sizes and mesh connectivity
    atm.NPLAN = slf.NPLAN  # it should be 2D but why the heack not ...
    atm.NDP2 = slf.NDP2
    atm.NDP3 = slf.NDP3
    atm.NPOIN2 = geo.NPOIN2
    atm.NPOIN3 = geo.NPOIN2 * atm.NPLAN
    atm.NELEM2 = geo.NELEM2

    print '   +> setting connectivity'
    if atm.NPLAN > 1:
        atm.NELEM3 = geo.NELEM2 * (atm.NPLAN - 1)
        atm.IKLE2 = geo.IKLE2
        atm.IKLE3 = \
           np.repeat(geo.NPOIN2*np.arange(atm.NPLAN-1),geo.NELEM2*atm.NDP3).reshape((geo.NELEM2*(atm.NPLAN-1),atm.NDP3)) + \
           np.tile(np.add(np.tile(geo.IKLE2,2),np.repeat(geo.NPOIN2*np.arange(2),geo.NDP2)),(atm.NPLAN-1,1))
        atm.IPOB2 = geo.IPOB2
        atm.IPOB3 = np.ravel(
            np.add(
                np.repeat(geo.IPOB2,
                          atm.NPLAN).reshape((geo.NPOIN2, atm.NPLAN)),
                geo.NPOIN2 * np.arange(atm.NPLAN)).T)
    else:
        atm.NELEM3 = geo.NELEM2
        atm.IKLE2 = geo.IKLE2
        atm.IKLE3 = geo.IKLE3
        atm.IPOB2 = geo.IPOB2
        atm.IPOB3 = geo.IPOB3
示例#4
0
slf2d.NELEM2 = e
slf2d.NELEM3 = e
slf2d.IPARAM = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

#print '     +> Set SELAFIN mesh'
slf2d.MESHX = x
slf2d.MESHY = y

#print '     +> Set SELAFIN IPOBO'
junkIPOB = np.zeros(n-len(b))
junkIPOB = junkIPOB.astype(np.int16)
slf2d.IPOB2 = np.hstack((b,junkIPOB))
slf2d.IPOB3 = slf2d.IPOB2

#print '     +> Set SELAFIN IKLE'
slf2d.IKLE2 = ikle
slf2d.IKLE3 = ikle

#print '     +> Set SELAFIN times and cores'
# these two lists are empty after constructor is instantiated
slf2d.tags['cores'].append(0)
slf2d.tags['times'].append(0)

#slf2d.tags = { 'times':[0] } # time (sec)
#slf2d.DATETIME = sel.DATETIME
slf2d.DATETIME = [2015, 1, 1, 1, 1, 1]
#slf2d.tags = { 'cores':[long(0)] } # time frame 

#print '     +> Write SELAFIN headers'
slf2d.fole.update({ 'hook': open(slf_file,'w') })
slf2d.fole.update({ 'name': 'Converted from gmsh by pputils' })