meshmode icon indicating copy to clipboard operation
meshmode copied to clipboard

Weaken mesh check in `make_same_mesh_connection`

Open majosm opened this issue 3 years ago • 6 comments

Weakens the mesh check a bit to fix #358. Also adds an object identity check to the mesh __eq__ so it doesn't need to compare all the attributes if the two mesh objects are actually the same one.

majosm avatar Nov 01 '22 21:11 majosm

I don't know that I love this, because pretty much by definition, we'll have redundant meshes flying around, which seems avoidable. First of all, could you remind me where those come from? (Restart or something?) And do you think it'd be plausible to replace those two meshes with one "canonical" copy after determining that they're equal? I wouldn't be opposed to adding tools to help with that.

inducer avatar Nov 06 '22 12:11 inducer

I don't know that I love this, because pretty much by definition, we'll have redundant meshes flying around, which seems avoidable. First of all, could you remind me where those come from? (Restart or something?) And do you think it'd be plausible to replace those two meshes with one "canonical" copy after determining that they're equal? I wouldn't be opposed to adding tools to help with that.

It comes from here in inducer/grudge#285, where we promote the "part ID"s (rank, volume, or both depending on the problem) in the incoming mesh's adjacency data to a single data structure PartID. So each time a dcoll is created it makes a new mesh object. (We have two dcolls temporarily when we restart using a different order than what was stored in the restart file.) We could maybe memoize that function, but a mesh seems like kind of a heavyweight thing to memoize?

majosm avatar Nov 07 '22 19:11 majosm

Could you explain the reason for that normalization step? Why is it needed? (I'm not suggesting that it isn't, I'm just not currently understanding.)

inducer avatar Nov 08 '22 00:11 inducer

That was added to provide a uniform way of retrieving the neighbor parts' rank/volume for all of the possible mesh configurations (single/multiple volume, distributed/non-distributed). It was suggested as an alternative to the way I had been doing it previously with the part_id_helpers (see inducer/grudge#239, specifically https://github.com/inducer/grudge/pull/239/commits/09bac09d98f54dce412fac6d0b4f52babce4916f).

majosm avatar Nov 08 '22 01:11 majosm

Still sort of puzzled, sorry. Let's talk about it during our meeting tomorrow.

inducer avatar Nov 09 '22 14:11 inducer

As discussed during meeting: We'll leave this open, but for now the creation of duplicate meshes seems avoidable by checking if the normalization step is a no-op.

inducer avatar Nov 11 '22 00:11 inducer