-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
Dear SCOREC colleagues,
Hi =)
While I was trying to create a PRISM type curved element, I encoutered a seg fault in writing it into VTK using pumi_mesh_write
.
My source code looks as below. I couldn't see a seg fault with PUMI_TET, and was able to see the curved tet in Paraview. But PUMI_PRISM causes the runtime error, the seg fault.
#include <mpi.h>
#include <pumi.h>
#include <cassert>
#include <iostream>
int main(int argc, char** argv)
{
MPI_Init(&argc, &argv);
pumi_start();
pGeom g = pumi_geom_load("null", "null");
pMesh mesh = pumi_mesh_create(g, 3, false);
double points[6][3] = {{0,0,0},{1,0,0},{0,1,0},{0,0,1},{1,0,1},{0,1,1}};
pMeshEnt vertices[6];
for (int i = 0; i < 6; ++i)
vertices[i] = pumi_mesh_createVtx(mesh, NULL, points[i]);
pumi_mesh_createElem(mesh, NULL, PUMI_PRISM, vertices);
pumi_mesh_freeze(mesh);
pumi_mesh_verify(mesh);
// ES: after mesh is created, I'd like to change its order
pumi_mesh_setShape(mesh, pumi_shape_getLagrange(2));
double coord[3];
pMeshIter mit = mesh->begin(1);
pMeshEnt e;
while(e = mesh->iterate(mit))
{
pumi_node_getCoord(e, 0, coord); // 0th node on an edge
coord[1] += 0.1;
pumi_node_setCoord(e, 0, coord);
}
mesh->end(mit);
pumi_mesh_write(mesh, "oneprism", "vtk");
pumi_mesh_delete(mesh);
pumi_finalize();
MPI_Finalize();
}
gdb shows below.
Program received signal SIGSEGV, Segmentation fault.
apf::countElementNodes (n=0x8f15c0, e=0x5) at /home/esyoon/core/apf/apfVtk.cc:411
411 return n->getShape()->getEntityShape(n->getMesh()->getType(e))->countNodes();
(gdb)
Could you tell me if I'm using APIs in a wrong way and how I can correct this issue, please?
Thank you in advance!
Metadata
Metadata
Assignees
Labels
No labels