On Thu, Aug 30, 2012 at 5:10 PM, Jed Brown <jedbrown@mcs.anl.gov> wrote:
On Thu, Aug 30, 2012 at 5:06 PM, Chris Eldred <chris.eldred@gmail.com> wrote:The code for DMSetDefaultSection is:
3016: PetscSectionDestroy(&dm->defaultSection);
3017: PetscSectionDestroy(&dm->defaultGlobalSection);
3018: dm->defaultSection = section;
3019: return(0);This code is wrong. It should likely have used PetscObjectReference((PetscObject)section) before these lines.
which destroys the "current" default section before setting the new
one. Since my sections are passed by reference in Fortran, the only
recourse I can see is to create a copy of the section before it is
passed to DMSetDefaultSection. Any other ideas?
On Thu, Aug 30, 2012 at 4:03 PM, Jed Brown <jedbrown@mcs.anl.gov> wrote:
> I think the bug is not that the old section is destroyed, but that the new
> one is not referenced.
>
>
> On Thu, Aug 30, 2012 at 5:00 PM, Chris Eldred <chris.eldred@gmail.com>
> wrote:
>>
>> I am using DMSetDefaultSection and DMCreateLocalVector to create
>> vectors in my code, but errors are occurring because
>> DMSetDefaultSection destroys old sections. My usage pattern is
>>
>> for each variable
>> call DMSetDefaultSection
>> call DMCreateLocalVector
>>
>> which fails if there is more than one 1 variable that uses the same
>> section since the sections are being destroyed when a new one is set.
>> Is there a reason for this behavior in DMSetDefaultSection (ie can a
>> version of DMSetDefaultSection that does not destroy the old sections
>> be provided)?
>>
>> --
>> Chris Eldred
>> DOE Computational Science Graduate Fellow
>> Graduate Student, Atmospheric Science, Colorado State University
>> B.S. Applied Computational Physics, Carnegie Mellon University, 2009
>> chris.eldred@gmail.com
>
>
--
Chris Eldred
DOE Computational Science Graduate Fellow
Graduate Student, Atmospheric Science, Colorado State University
B.S. Applied Computational Physics, Carnegie Mellon University, 2009
chris.eldred@gmail.com