Re: [petsc-users] Petsc ObjectStateIncrease without proivate header
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 Sent: Monday, May 8, 2023 3:31 PM To: Pichler, Franz Cc: petsc-users@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 mailto:franz.pich...@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 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
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.pich...@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 > > > > 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
[petsc-users] Petsc ObjectStateIncrease without proivate header
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 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