Ejemplo n.º 1
0
    print "Lancer le script en parallele avec plus d'un processus !"
    exit(-1)
nbDoms = size
fich = open("output%03d" % rank, 'w')

fich.write("Décomposition sur %d domaines : je suis le domaine %d\n" %
           (nbDoms, rank))

m = mesh.read(meshName)
coords = m[0]
elt2verts = m[1]
nbVerts = coords.shape[0]
nbElts = elt2verts.shape[0]

fich.write("elt2verts global : %s\n" % repr(elt2verts))
begVert2Elts, vert2elts = mesh.compvert2elts(elt2verts)

etsDomains = splitter.splitEltMesh(nbDoms, nbVerts, elt2verts)
nbElts_loc = etsDomains[rank].shape[0]
fich.write("Nombre d'éléments contenus dans le domaine : %d\n" % nbElts_loc)

if rank == 0:
    elt2doms = np.zeros((nbElts, ), np.double)
    ia = 0.
    for a in etsDomains:
        for e in a:
            elt2doms[e] = ia
        ia += 1

    # Calcul l'interface :
    ie = 0
    v_loc)  #associates local indices of vertices to global indices of vertices
v_glo2loc = np.array([-1] *
                     coords.shape[0])  #this is the inverse map of v_loc2glo

for ind in range(len(v_loc2glo)):
    v_glo2loc[v_loc2glo[ind]] = ind

#we give values for e2v_loc
for ie_loc in range(len(ets_loc2glo)):
    ie = ets_loc2glo[ie_loc]
    e2v_loc[ie_loc, 0] = v_glo2loc[elt2verts[ie, 0]]
    e2v_loc[ie_loc, 1] = v_glo2loc[elt2verts[ie, 1]]
    e2v_loc[ie_loc, 2] = v_glo2loc[elt2verts[ie, 2]]

#structure for the sparse local matrix
begVert2Elts_loc, vert2elts_loc = mesh.compvert2elts(e2v_loc)

begRows_loc, indCols_loc = fem.comp_skel_csr_mat(
    e2v_loc, (begVert2Elts_loc, vert2elts_loc))
nz = begRows_loc[-1]
file.write("\nNumber of non zero in sparse matrix : {}".format(nz))

#number of vertices and number of elements in the local mesh
nbV_loc = len(v_loc2glo)
nbE_loc = e2v_loc.shape[0]

spCoefs = np.zeros((nz, ), np.double)  #coefficients of the sparse matrix

#we add elementary matrices, only for each element in the local mesh
for iElt in range(nbE_loc):
    iVertices = e2v_loc[iElt, :]