Example #1
0
                break  # Si el sistema percola, terminamos
        abiertos = float(self.N ** 2 - len(cerrados))
        # La estimación del umbral de percolación
        return abiertos / (self.N * self.N)

if __name__ == '__main__':
    t0 = time.time()
    prom = 0.0
    if rank == 0:
        sim1 = sim / size + sim % size
    else:
        sim1 = sim / size

    for i in range(sim1):
        Perc = PercolationSimulation(N)
        prom += Perc.umbral()
    prom = prom / (sim1)
    if rank != 0:
        comm.send(prom, dest=0)
    if rank == 0:
        final = 0
        for i in range(1, size):
            final += comm.recv(source=i)
        final += prom
        final = final / size
        final = final * cont
        TF = time.time()
        T = TF - t0
        crearPDFBD(enfe, dist, N, final, T, nombre)
        envio_mail(mail, nombre)
Example #2
0
                break  # Si el sistema percola, terminamos
        abiertos = float(self.N ** 2 - len(cerrados))
        # La estimación del umbral de percolación
        return abiertos / (self.N * self.N)

if __name__ == '__main__':
    t0 = time.time()
    prom = 0.0
    if rank == 0:
        sim1 = sim / size + sim % size
    else:
        sim1 = sim / size

    for i in range(sim1):
        Perc = PercolationSimulation(N)
        prom += Perc.umbral()
    prom = prom / (sim1)
    if rank != 0:
        comm.send(prom, dest=0)
    if rank == 0:
        final = 0
        for i in range(1, size):
            final += comm.recv(source=i)
        final += prom
        final = final / size
        final = final * comb
        TF = time.time()
        T = TF - t0
        crearPDFBD(arbol, suelo, dist, N, final, T, nombre)
        envio_mail(mail, nombre)