inducer / meshmode

High-order unstructured mesh representation and discrete function spaces
https://documen.tician.de/meshmode/
25 stars 24 forks source link

Make Mesh into a dataclass #400

Closed alexfikl closed 2 months ago

alexfikl commented 2 months ago

This starts making Mesh into a dataclass. Right now it's mostly just porting away from pytools.Record, since it's hard to make it a clean dataclass while being backwards compatible.

The main additions are:

~The nodal / facial adjacency attributes were very annoying. Currently it overwrites __getattribute__ to make it behave a bit like before. Let me know if you have some better ideas on how to make that work..~

This is still a WIP, but I had it lying around for a while, so might as well. Things still to do:

alexfikl commented 2 months ago

@inducer I think all of my initial questions are solved now, so this is ready for a proper review.

Port at least the internal uses of the various functions to avoid deprecation warnings.

I'm thinking of leaving this for a followup PR, since this is sufficiently big?

inducer commented 2 months ago

Pushed a commit that ports the internal uses of Mesh(). Mostly a sed job.

inducer commented 2 months ago

I guess I sort of understand why you might have changed the make_mesh arguments to groups, *, vertices, but I don't think it's worth the headache. 99% of meshes have vertices, and the 1% that don't can just pass None for that first argument.

alexfikl commented 2 months ago

I guess I sort of understand why you might have changed the make_mesh arguments to groups, *, vertices, but I don't think it's worth the headache. 99% of meshes have vertices, and the 1% that don't can just pass None for that first argument.

That's fair enough. It definitely makes the porting easier :grin: Thanks for helping with that and fixing all the issues!

inducer commented 2 months ago

Thanks for getting this most of the way!