Re: [petsc-users] Verifying matching PetscFunctionBeginUser() and PetscFunctionReturn()

2023-07-11 Thread Barry Smith
#define PetscStackPop_Private(stack__, func__) \ do { \ PetscCheckAbort(!stack__.check || stack__.currentsize > 0, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Invalid stack size %d, pop %s %s:%d.\n", stack__.currentsize, func__, __FILE__, __LINE__); \ if (--stack__.currentsize < PETSCSTA

[petsc-users] Verifying matching PetscFunctionBeginUser() and PetscFunctionReturn()

2023-07-11 Thread Aagaard, Brad T via petsc-users
PETSc developers, When I fail to have matching PetscFunctionBeginUser() and PetscFunctionReturn() in my code, I get segfaults and valgrind reports invalid writes at places in PETSc where memory is freed. As a result, it is difficult to track down the actual source of the error. I know there use

Re: [petsc-users] windows build

2023-07-11 Thread Satish Balay via petsc-users
On Tue, 11 Jul 2023, Константин via petsc-users wrote: > > Hello, I'm trying to build petsc on windows. And when I make it I have such > problem from the screenshot - it appears you are not using cygwin terminal(bash-shell) - as per instructions https://petsc.org/release/install/windows/ Wha

Re: [petsc-users] (no subject)

2023-07-11 Thread Matthew Knepley
On Tue, Jul 11, 2023 at 3:58 PM Константин via petsc-users < petsc-users@mcs.anl.gov> wrote: > Hello, I'm trying to build petsc on windows. And when I make it I have > such problem > > Did you run configure first? Thanks, Matt > -- > Константин > -- What most experimenters take for g

[petsc-users] (no subject)

2023-07-11 Thread Константин via petsc-users
Hello, I'm trying to build petsc on windows. And when I make it I have such problem   -- Константин

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread neil liu
Thanks for your explanation so much. On Tue, Jul 11, 2023 at 12:41 PM Barry Smith wrote: > > > On Jul 11, 2023, at 12:16 PM, neil liu wrote: > > I think I understood that. > > 1) In order to save memory, use a larger real system > > >This will save a little memory, but requires a slight cha

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread Barry Smith
> On Jul 11, 2023, at 12:16 PM, neil liu wrote: > > I think I understood that. > > 1) In order to save memory, use a larger real system This will save a little memory, but requires a slight change to your model/code for your problem > 2) vec will store the real part with imaginary part e

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread neil liu
I think I understood that. 1) In order to save memory, use a larger real system 2) vec will store the real part with imaginary part equal to zero in the context of --scalar =complex. But this will not save memory. Right? Thanks, Xiaodong On Tue, Jul 11, 2023 at 12:03 PM neil liu wrote: > Do

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread neil liu
Do you mean that, even if I configure with --scalar=complex, when I use vecGetarray to get the coords, the coords array is still stored in a real manner? Thanks, Xiaodong On Tue, Jul 11, 2023 at 11:54 AM Matthew Knepley wrote: > On Tue, Jul 11, 2023 at 11:48 AM neil liu wrote: > >> Thanks fo

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread Matthew Knepley
On Tue, Jul 11, 2023 at 11:48 AM neil liu wrote: > Thanks for your reply. > I am using DMPLEX to read GMSH. And it seems I have to use > DMGetCoordinatesLocal(); > VecGetArray(veccords, &coords);//it seems coords has to be defined by > complex either. > > 2) Store the coordinates in coords with i

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread neil liu
Thanks for your reply. I am using DMPLEX to read GMSH. And it seems I have to use DMGetCoordinatesLocal(); VecGetArray(veccords, &coords);//it seems coords has to be defined by complex either. 2) Store the coordinates in coords with imaginary part equal to zero. I got the coordinates from above fu

Re: [petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread Barry Smith
Not really. PetscScalar (and entries of vectors etc) are either real or complex, they cannot be mixed. What parts of PETSc are you using, DM? You can 1) store the coordinates in arrays and not use Vec for them. (of if you are not using DM) 2) sore them in Vec but with imaginary part

[petsc-users] Inquiry about the PetscScalar in Petsc.

2023-07-11 Thread neil liu
Dear Petsc developers, My computation involves both real and complex numbers. For example, my coordinate is real, but my matrix is complex. I use VecGetArray to get the coordinates. But it seems coordinates have to be defined in a complex manner to be consistent with complex matrix. Is there som