[petsc-users] Gauss-Lobatto-Legendre Element Gradient -- Caught signal number 11 SEGV

Duan Junming junming.duan at epfl.ch
Thu Jun 1 00:45:18 CDT 2023


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230601/bec4b006/attachment.html>


More information about the petsc-users mailing list