Skip to content

If the same space is created twice, are they exactly the same? #3357

Discussion options

You must be logged in to vote

I see that if I create the same space twice e.g. space0 = FunctionSpace(mesh, "Lagrange", 1) and space1 = FunctionSpace(mesh, "Lagrange", 1) that they share some data which is cached on the mesh. Is there a reason space0 and space1 are not the same object

I believe when we implemented singleton patterns for function spaces, we decided just to cache the "heavy" data, so that FunctionSpace itself is a lightweight thing that is "cheap" to make, as long as one with the same dof layout has already been created. Part of the rationale is that the expensive-to-construct things are actually less specific than the cache key you would naively build using the "obvious" information that is available…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jrmaddison
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants