[petsc-users] a question about PetscSectionCreate

leejearl leejearl at 126.com
Sun May 28 01:31:48 CDT 2017


Hi, PETSc developer:

     I need to create a PetscSection with a struct. The struct is 
defined as follow,

    typedef struct
    {
       PetscReal x;
       PetscInt id;
    } testStruct;

    When I run the program, I got a wrong output as follow,

    Vec Object: 1 MPI processes
   type: seq
2.
4.94066e-324
2.
4.94066e-324
2.
4.94066e-324
2.
4.94066e-324
2.
4.94066e-324
2.
4.94066e-324
2.
4.94066e-324
2.
4.94066e-324

But when I defined the struct as

    typedef struct
    {
       PetscReal x;
       PetscReal id;
    } testStruct;

The output is ok. It seems that  there is some wrong with the memories 
when I define the "id" as a PetscInt type.

I can not find out the reasons, and any one can help me with it? The 
source file "test.c" is attached.


Thanks,

leejearl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 2198 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170528/fd8f4dba/attachment.c>


More information about the petsc-users mailing list