UCL / dxh

Collection of helper functions for working with DOLFINx Python interface
http://github-pages.ucl.ac.uk/dxh/
MIT License
3 stars 0 forks source link

Remove the `DirichletBCMetaClass` from dxh #10

Closed samcunliffe closed 11 months ago

samcunliffe commented 1 year ago

The meta classes have been removed from dolfinx about three month ago, see https://github.com/FEniCS/dolfinx/commit/44d612240ee3423add975b48ccb7f89920c394bd, which is causing problems for me as I'm running a more recent version of dolfinx.

samcunliffe commented 1 year ago

@matt-graham what do you think: straight removal? Or just fix the import to work if not found and deprecate the function?

matt-graham commented 1 year ago

A bit hacky, but to maintain compatibility with current stable release (v0.6.0) and also current development version we could do something like

try:
    # For compatibility with dolfinx@0.6 try initially import old 
    # DirichletBCMetaClass name
    from dolfinx.fem import DirichletBCMetaClass as DirichletBC
except ImportError:
    from dolfinx.fem import DirichletBC

and update the type hint accordingly (as it's only used in a type hint I think the slightly misleading aliasing of DirichletBCMetaClass to DirichletBC shouldn't matter too much).