Add functionality to add elements to a mesh
In cpppetsc/src/include/ae108/cpppetsc/Mesh.h, implement a function
template <class Policy>
template <class Container>
Mesh<Policy> Mesh<Policy>::addElements(const Container &elementVertexIDs);
Which adds new elements to the mesh.
The argument elementVertexIDs
should be like the same parameter in fromConnectivity
(see examples/ForceElement.cc).
The underlying object is a PETSc DMPlex. An example on how to add elements to a PETSc mesh is given here: https://petsc.org/release/src/ts/tutorials/ex11_sa.c.html Starting at line 793, DMPlexGetChart / DMPlexSetChart are used to increase the number of total objects (vertices, edges, faces, cells) and DMPlexGetConeSize / DMPlexSetConeSize are used to get / set the cone size (1 for vertex, 2 for edge, 3 for face, ...).
But parts of the needed functionality is already wrapped in cpppetsc/src/include/ae108/cpppetsc/Mesh.h,
e.g. addChart
.
Also this function either should make sure, that at the end all the elements are properly redistributed to all involved processes or a call to Mesh::distributeMesh
should work after modifying the mesh.