Dear all,
I have a simple demo code attached below, which gives a segmentation violation
error.
Can you help me with this problem? I think the problem is due to the destroy
function.
I am using version 3.19.2 with debugging.
#include <petsc.h>
static char help[] = "test.\n";
int main(int argc, char *argv[]) {
PetscCall(PetscInitialize(&argc, &argv, 0, help));
PetscScalar *nodes;
PetscScalar *weights;
PetscScalar **diff;
PetscInt n = 3;
PetscCall(PetscMalloc2(n, &nodes, n, &weights));
PetscCall(PetscDTGaussLobattoLegendreQuadrature(n,
PETSCGAUSSLOBATTOLEGENDRE_VIA_LINEAR_ALGEBRA, nodes, weights));
PetscCall(PetscGaussLobattoLegendreElementGradientCreate(n, nodes, weights,
&diff, NULL));
PetscCall(PetscGaussLobattoLegendreElementGradientDestroy(n, nodes, weights,
&diff, NULL));
PetscCall(PetscFree2(nodes, weights));
PetscCall(PetscFinalize());
return 0;
}
Junming