Dear all,
I am starting a project that needs to locally modify a mesh (in C++). Now, the task right now is simple: I'd like to remove one cell, and in the future add some new cells, of course. In order to get used to MeshEditor
, I am playing with a square mesh, and extracting the boundary vertices.
However, it crashes (*). It seems that I am creating an invalid mesh, but since I am using a pre-existing mesh, I am puzzled. I think I don't understand how to use MeshEditor
, I thought I could modify meshes, but it can only create ones.
So, how can I locally modify a mesh?
Should I create a new mesh, each process adding its own old vertices (from the old mesh) except the chosen process that will use an updated vertex list? It seems quite a waste of memory...
Thanks!
(*)
// Local mesh data, may be useless
LocalMeshData local(squareMesh);
BoundaryMesh bdry(squareMesh, "local");
File bfile(dumpPath() + "localboundary.pvd", "compressed");
bfile << bdry;
MeshEditor e;
e.open(squareMesh, 2, 2);
// Print cell
if (num > 0)
{
info("Only rank %d will proceed", rank);
info("+++ RANK %d SIZE %d POS %d", rank, squareMesh.coordinates().size(), t.pos());
double coords[6];
t->get_vertex_coordinates(coords);
for (double q : coords)
info(" coord %f", q);
info("+++ vertXcell %d globV %d globC %d", local.num_vertices_per_cell, local.num_global_vertices, local.num_global_cells);
for (VertexIterator v(bdry); !v.end(); ++v)
{
info(" V [%f, %f]", bdry.geometry().x(v->index())[0], bdry.geometry().x(v->index())[1]);
}
}
e.close();