Re: [petsc-dev] DMSetDefaultSection destroys old sections
Does this mean that I need a different DMComplex object for each section that I want to use? It seems like that would get expensive memory-wise pretty fast (unless DMComplexClone is just a shallow copy?) The reason I would like separate sections for each field is that different fields might have different stencil sizes- and there are a lot of constant fields that don't need any sort of stencils since they are generated and used only locally. So by having separate sections (and SF) for each field I can control what gets ghosted/communicated and what is not. On Thu, Aug 30, 2012 at 4:54 PM, Matthew Knepley <[email protected]> wrote:
On Thu, Aug 30, 2012 at 5:51 PM, Chris Eldred <[email protected]> wrote:
It appears that PetscObjectReference works for DM and Vec (in Fortran), but not for Section. Is this possibly related to the Fortran stub/binding for PetscObjectReference?
Sorry, I was not paying attention. PetscSection is not a PetscObject. That is also why it is not referenced. It was originally designed to be a helper object. So, in order to do what you want, currently (and actually this is how the other PETSc people want DM to behave), you should do
call DMComplexClone(dm, dmNew, ierr) call DMSetDefaultSection(dmNew, sectionNew, ierr)
Matt
On Thu, Aug 30, 2012 at 4:44 PM, Jed Brown <[email protected]> wrote:
You must have something else going on. The following works fine, for example.
diff --git a/src/snes/examples/tutorials/ex5f.F b/src/snes/examples/tutorials/ex5f.F --- a/src/snes/examples/tutorials/ex5f.F +++ b/src/snes/examples/tutorials/ex5f.F @@ -58,6 +58,7 @@ PetscErrorCode ierr PetscReal lambda_max,lambda_min PetscBool flg + DM da2
! Note: Any user-defined Fortran routines (such as FormJacobianLocal) @@ -144,6 +145,9 @@ call DMDASetLocalFunction(da,FormFunctionLocal,ierr) call DMDASetLocalJacobian(da,FormJacobianLocal,ierr) call SNESSetDM(snes,da,ierr) + da2 = da + call PetscObjectReference(da2,ierr) + call DMDestroy(da2,ierr)
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Customize nonlinear solver; set runtime options
On Thu, Aug 30, 2012 at 5:36 PM, Chris Eldred <[email protected]> wrote:
I get an error when I try to use that:
[0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Corrupt argument: see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind! [0]PETSC ERROR: Invalid type of object: Parameter # 1! [0]PETSC ERROR:
------------------------------------------------------------------------ [0]PETSC ERROR: Petsc Development HG revision: 56f27b189e4fd57f5a4b7ffd6aa6bb08bd8a4d5b HG Date: Wed Aug 29 12:03:50 2012 -0500 [0]PETSC ERROR: See docs/changes/index.html for recent updates. [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. [0]PETSC ERROR: See docs/index.html for manual pages. [0]PETSC ERROR:
------------------------------------------------------------------------ [0]PETSC ERROR: ./swe on a arch-linu named Puget-101334 by user Thu Aug 30 16:35:51 2012 [0]PETSC ERROR: Libraries linked from /home/user/Desktop/LIBRARIES/petsc-dev/arch-linux2-cxx-debug/lib [0]PETSC ERROR: Configure run at Wed Aug 29 12:49:26 2012 [0]PETSC ERROR: Configure options --download-boost --download-chaco --download-ctetgen --download-f-blas-lapack --download-fiat --download-generator --download-metis --download-ml --download-mpich --download-parmetis --download-scientificpython --download-triangle --with-clanguage=cxx --with-dynamic-loading --with-shared-libraries --with-sieve PETSC_ARCH=arch-linux2-cxx-debug [0]PETSC ERROR:
------------------------------------------------------------------------ [0]PETSC ERROR: PetscObjectReference() line 378 in /home/user/Desktop/LIBRARIES/petsc-dev/src/sys/objects/inherit.c application called MPI_Abort(MPI_COMM_WORLD, 64) - process 0 [unset]: aborting job: application called MPI_Abort(MPI_COMM_WORLD, 64) - process 0
On Thu, Aug 30, 2012 at 4:32 PM, Jed Brown <[email protected]> wrote:
On Thu, Aug 30, 2012 at 5:30 PM, Chris Eldred <[email protected]> wrote:
How would I use PetscObjectReference((PetscObject)section) in Fortran?
call PetscObjectReference(section,ierr)
On Thu, Aug 30, 2012 at 4:16 PM, Jed Brown <[email protected]> wrote:
On Thu, Aug 30, 2012 at 5:12 PM, Matthew Knepley <[email protected]> wrote:
Its not wrong. This is the way I wanted it. You set the PetscSection and give up control. If you do not want to give up control, then call PetscObjectReference() before passing it in.
Since this is (a) different from everything else in PETSc and (b) not explicitly documented, it is doubly wrong.
-- Chris Eldred DOE Computational Science Graduate Fellow Graduate Student, Atmospheric Science, Colorado State University B.S. Applied Computational Physics, Carnegie Mellon University, 2009 [email protected]
-- Chris Eldred DOE Computational Science Graduate Fellow Graduate Student, Atmospheric Science, Colorado State University B.S. Applied Computational Physics, Carnegie Mellon University, 2009 [email protected]
-- Chris Eldred DOE Computational Science Graduate Fellow Graduate Student, Atmospheric Science, Colorado State University B.S. Applied Computational Physics, Carnegie Mellon University, 2009 [email protected]
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
-- Chris Eldred DOE Computational Science Graduate Fellow Graduate Student, Atmospheric Science, Colorado State University B.S. Applied Computational Physics, Carnegie Mellon University, 2009 [email protected]
participants (1)
-
Chris Eldred