[petsc-users] Petsc ObjectStateIncrease without proivate header

Pichler, Franz franz.pichler at v2c2.at
Tue Jun 6 09:14:08 CDT 2023


Hello, very sorry for the very late reply, but thank you even more for the ver helpful suggestion!
Using valgrinds callgrind I cann see that matassemblyBegin/End takes some cycles, but I guess I can take take,
a perfect solution would have no overhead,

Ii still changed the code to get rid of the private dependency,

Thank you!

From: Stefano Zampini <stefano.zampini at gmail.com>
Sent: Monday, May 8, 2023 3:31 PM
To: Pichler, Franz <franz.pichler at v2c2.at>
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] Petsc ObjectStateIncrease without proivate header

You can achieve the same effect by calling MatAssemblyBegin/End

Il giorno lun 8 mag 2023 alle ore 15:54 Pichler, Franz <franz.pichler at v2c2.at<mailto:franz.pichler at v2c2.at>> ha scritto:
Hello,
i am using petsc in a single cpu setup where I have preassembled crs matrices that I wrap via PetSC’s
MatCreateSeqAIJWithArrays  Functionality.

Now I manipulate the values of these matrices (wohtout changing the sparsity) without using petsc,

When I now want to solve again I have to call
PetscObjectStateIncrease((PetscObject)petsc_A);

So that oetsc actually solves again (otherwise thinking nothing hs changed ,
This means I have to include the private header
#include <petsc/private/petscimpl.h>

Which makes a seamingless implementation of petsc into a cmake process more complicate (This guy has to be stated explicitly in the cmake process at the moment)

I would like to resolve that by “going” around the private header,
My first intuition was to increase the state by hand
((PetscObject)petsc_A_aux[the_sys])->state++;
This is the definition of petscstateincrease in the header. This throws me an
error: invalid use of incomplete type ‘struct _p_PetscObject’

compilation error.

Is there any elegeant way around this?
This is the first time I use the petsc mailing list so apologies for any beginners mistake I did in formatting or anything else.

Best regards

Franz Pichler



--
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230606/5a0a9559/attachment.html>


More information about the petsc-users mailing list