Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodal fields redesign #77

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open

Nodal fields redesign #77

wants to merge 58 commits into from

Conversation

biancagi
Copy link
Contributor

@biancagi biancagi commented Jun 9, 2024

  • Redesign of nodal fields as maps from a node to a tensor (scalar, vector, second-order tensor, ...)
  • Redesign of summit and vtk writers accordingly
  • Implement summit reader for a DG mesh

Define {HAVE_TENSOR} and {HAVE_COMPACT_PACKINGS} before including {pyre}.
Here, we pass down to the writer a {fields::field} which is then evaluated on the nodes.
Fixed bug for which nodes in {NodalField} were duplicated across adjacent elements. When nodes are inserted in a mesh with mesh.insert({node0, node1, node2}), nodes are copied. Therefore, a hash function and {operator==} based on the nodes addresses will create copies for each instance of a node in a mesh (that is for the same node appearing in adjacent elements).

For now, the problem is fixed by setting nodes equal if their underlying vertex and points are equal and by editing the hash function to trivially combine the hashes of vertex and point (this needs to be improved to reduce the chance of clash).

However, these choices will be revisited when we implement discontinuous Galerkin.
…oudWriter} classes

This is necessary because writing nodal fields requires to store the vtu grid as state.
No need to use a map, as the 'value' (that is the sequential index of the point stored) can be retrieved by the distance of a given point from the beginning of the set memory allocation.
biancagi and others added 28 commits June 3, 2024 12:09
A bug in gcc does not make the (protected!) attributes of the parent class visible in the derived class scope.
Directly access {dim} when possible.
This is necessary so as to avoid having the same node being copied into different nodes when inserting a geometric simplex in a mesh. Copying a node now results in copying its shared pointer.

The current implementation has some issues, though:

1) While originally the {SharedPointer} class was designed for not owning the resource, now a {SharedPointer} may instantiate a resource. This breaks the design and a mechanism for deletion of the resource should be implemented.

2) Nodes are now 'special' geometric simplices, in that they do reference counting while the other geometric simplices do not. This implies that sometimes they need to be treated as special cases (for example in the extraction of the boundary of a segment).
This class extends the {std::shared_ptr} in order to provide a constructor with a suitable argument list, as well as an id, which enables hashing and <==> operators.
Instead of implementing two almost identical methods for fetching the boundary of a mesh of segments and of any other mesh, devise the suitable type of the boundary (either a cloud of nodes or a proper boundary mesh) at compile time.
Remove {requires} from {concept} definition when possible.
…he same code for segments, triangles and tets
This will make it easier to generalize the reader / writer to the case of nonsimplicial elements.
The new design is informed of the difference between points and nodes. This
prepares the ground for supporting both CG and DG meshes.
…ts relocated headers can be handled gracefully
Deriving {StdSharedPointer} from {std::shared_ptr} leads to memory leaks (in this case, memory not being freed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants