pyccel / sympde

Symbolic calculus for partial differential equations (and variational forms)
http://sympde.readthedocs.io/
MIT License
20 stars 4 forks source link

Inconsistent from_file when reading a topological domain from a file, that has been exported #144

Open ratnania opened 7 months ago

ratnania commented 7 months ago

We consider the following code:

from sympde.topology import Domain
from sympde.topology import InteriorDomain
from sympde.topology import Union
from sympde.topology import Interface
from sympde.topology import Connectivity
from sympde.topology import Boundary

# ... create a domain with 2 subdomains A and B
A = InteriorDomain('A', dim=2)
B = InteriorDomain('B', dim=2)

connectivity = Connectivity()

bnd_A_1 = Boundary('Gamma_1', A)
bnd_A_2 = Boundary('Gamma_2', A)
bnd_A_3 = Boundary('Gamma_3', A)

bnd_B_1 = Boundary('Gamma_1', B)
bnd_B_2 = Boundary('Gamma_2', B)
bnd_B_3 = Boundary('Gamma_3', B)

connectivity['I'] = Interface('I', bnd_A_1, bnd_B_2)

Omega = Domain('Omega',
               interiors=[A, B],
               boundaries=[bnd_A_2, bnd_A_3, bnd_B_1, bnd_B_3],
               connectivity=connectivity)

# export
Omega.export('omega.h5')

Now when reading the topological domain from the exported file, using;

domain = Domain.from_file('omega.h5')

we get the following error

File ~/PYCCEL/IGA-Python/.iga-python/lib/python3.10/site-packages/sympde/topology/domain.py:355, in Domain.from_file(cls, filename)
    352 if dtype == 'None': dtype = None
    354 assert dtype is not None
--> 355 assert all(dtype)
    356 if isinstance(d_interior, dict):
    357     d_interior = [d_interior]

AssertionError: 
yguclu commented 7 months ago

In Psydac we read files with the call

domain_h = Geometry(filename = 'geom.h5')

I suspect that Domain.from_file() is not used there.