dpploy / cortix

Cortix is a Python library for network dynamics modeling and HPC simulation.
https://cortix.org
Other
11 stars 4 forks source link

Cortix Network Class #227

Open ghost opened 5 years ago

ghost commented 5 years ago

The idea of a Network class is a great one. I think with some tweaking, this should be our next step further.

I was thinking however, what if we kept it at the Cortix level, and modeled modules as nodes in this network. This would look like, for example,

c = Cortix(use_mpi=False)

# Create one network
net1 = Network()
net1.module(Vortex())
for i in range(n_droplets):
    net1.module(Droplet())
net1.connect("Droplet", "Vortex")

# Create another network
net2 = Network()
net2.module(Vortex())
for i in range(n_droplets):
    net2.module(Droplet())
    net2.module(DataPlot())
net2.connect(Droplet, DataPlot)
net2.connect(Droplet, Vortex)

# Add both networks to the simulation
c.add_network(net1)
c.add_network(net2)

# Run the networks simultaneously 
c.run()

The networks look expressive enough to eventually take the place of ports. Thoughts?

dealmeidavf commented 5 years ago

I am working on a nested network example and I will post. Then it should provide food for thought on a realistic test of how to go forward.