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) bnd.IKLE3 = \ np.repeat(bnd.NPOIN2*np.arange(slf.NPLAN-1),bnd.NELEM2*bnd.NDP3).reshape((bnd.NELEM2*(slf.NPLAN-1),bnd.NDP3)) + \ np.tile(np.add(np.tile(bnd.IKLE2,2),np.repeat(bnd.NPOIN2*np.arange(2),bnd.NDP2)),(slf.NPLAN-1,1)) else: bnd.IPOB3 = bnd.IPOB2 bnd.IKLE3 = bnd.IKLE2 # Mesh coordinates bnd.MESHX = geo.MESHX[BOR - 1] bnd.MESHY = geo.MESHY[BOR - 1] print ' +> writing header' # Write header bnd.appendHeaderSLF()
ini.VARINDEX = range(ini.NVAR) # Sizes and mesh connectivity ini.NPLAN = slf.NPLAN ini.NDP2 = 3 ini.NDP3 = 6 ini.NPOIN2 = geo.NPOIN2 ini.NPOIN3 = geo.NPOIN2*ini.NPLAN ini.NELEM2 = geo.NELEM2 ini.NELEM3 = ini.NELEM2*(ini.NPLAN-1) print ' +> setting connectivity' ini.IKLE3 = \ np.repeat(geo.NPOIN2*np.arange(ini.NPLAN-1),geo.NELEM2*ini.NDP3).reshape((geo.NELEM2*(ini.NPLAN-1),ini.NDP3)) + \ np.tile(np.add(np.tile(geo.IKLE2,2),np.repeat(geo.NPOIN2*np.arange(2),geo.NDP2)),(ini.NPLAN-1,1)) ini.IPOB3 = np.ravel(np.add(np.repeat(geo.IPOB2,ini.NPLAN).reshape((geo.NPOIN2,ini.NPLAN)),geo.NPOIN2*np.arange(ini.NPLAN)).T) ini.IPARAM = [0,0,0,0,0,0,ini.NPLAN,0,0,0] # Mesh coordinates ini.MESHX = geo.MESHX ini.MESHY = geo.MESHY print ' +> writing header' # Write header ini.appendHeaderSLF() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ writes INI core ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print ' +> setting variables' # TIME and DATE extraction
slf2d.NDP3 = 3 slf2d.NPOIN2 = n slf2d.NPOIN3 = n 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
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 atm.IPARAM = [0, 0, 0, 0, 0, 0, atm.NPLAN, 0, 0, 0] # Mesh coordinates atm.MESHX = geo.MESHX atm.MESHY = geo.MESHY print ' +> writing header'
slf2d.NDP3 = 3 slf2d.NPOIN2 = n slf2d.NPOIN3 = n 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