PetscValidIntPointer() Re: DACreate2d() and DAGetMatrix()
Matthew Knepley
knepley at gmail.com
Thu Feb 12 16:19:19 CST 2009
On Thu, Feb 12, 2009 at 4:08 PM, (Rebecca) Xuefei YUAN
<xy2102 at columbia.edu>wrote:
> Hi,all,
>
> Where could I see the source code of PetscValidIntPointer()?
include/private/petscimpl.h
Matt
>
> Thanks,
>
> Rebecca
>
>
> Quoting "(Rebecca) Xuefei YUAN" <xy2102 at columbia.edu>:
>
> I check the matrix.c and find that the x,y,z direction has been
>> reversed as in line 1249-1252 in MatSetStencil(), can I get to know why
>> we do this?
>>
>> Thanks.
>>
>>
>> 1249: for (i=0; i<dim; i++) {
>> 1250: mat->stencil.dims[i] = dims[dim-i-1]; /* copy the
>> values in backwards */
>> 1251: mat->stencil.starts[i] = starts[dim-i-1];
>> 1252: }
>>
>> Quoting "(Rebecca) Xuefei YUAN" <xy2102 at columbia.edu>:
>>
>> I think the dims should be {9,5,4,0} if it is Xperiodic, and should be
>>> {5,9,4,0} if it is Yperiodic. Am I right?
>>>
>>> Thanks,
>>>
>>> Rebecca
>>>
>>>
>>> Quoting "(Rebecca) Xuefei YUAN" <xy2102 at columbia.edu>:
>>>
>>> If I have -da_grid_x 5 -da_grid_y 5 -dmmg_nlevels 1 and the DA and
>>>> jacobian like:
>>>>
>>>>> ierr = DMMGCreate(comm, 1, &appCtx, &dmmg);CHKERRQ(ierr);
>>>>>> ierr = DACreate2d(comm,DA_XPERIODIC,DA_STENCIL_STAR, -5, -5,
>>>>>> PETSC_DECIDE, PETSC_DECIDE, 4, 2, 0, 0, &da);CHKERRQ(ierr);
>>>>>> ierr = DMMGSetDM(dmmg, (DM)da);CHKERRQ(ierr);
>>>>>> ierr = DAGetMatrix(DMMGGetDA(dmmg), MATAIJ, &jacobian);CHKERRQ(ierr);
>>>>>>
>>>>>
>>>> will that be right if I have jacobian->stencil.dims ={5, 9, 4, 0}?
>>>>
>>>> Thanks,
>>>>
>>>> Rebecca
>>>>
>>>>
>>>>
>>>> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>>>>
>>>>
>>>>> The dof argument to DACreate2d() is greater than 1. Thus the
>>>>> "dimension" that is associated with the matrix is 3 dimensions. Is
>>>>> this causing a problem?
>>>>>
>>>>>
>>>>> Barry
>>>>>
>>>>> Note: the "dimension" of the matrix affects the MatSetValuesStencil()
>>>>> but not much else I can think of;
>>>>>
>>>>>
>>>>> On Feb 12, 2009, at 11:44 AM, (Rebecca) Xuefei YUAN wrote:
>>>>>
>>>>> Hi,
>>>>>>
>>>>>> I use the following set of codes to create the jacobian matrix,
>>>>>> however, the dimensions of jacobian becomes 3 (dim=3) although I use
>>>>>> DACreate2d to create this da. I wanna know where is wrong?
>>>>>>
>>>>>> ierr = DMMGCreate(comm, 1, &appCtx, &dmmg);CHKERRQ(ierr);
>>>>>> ierr = DACreate2d(comm,DA_XPERIODIC,DA_STENCIL_STAR, -5, -5,
>>>>>> PETSC_DECIDE, PETSC_DECIDE, 4, 2, 0, 0, &da);CHKERRQ(ierr);
>>>>>> ierr = DMMGSetDM(dmmg, (DM)da);CHKERRQ(ierr);
>>>>>> ierr = DAGetMatrix(DMMGGetDA(dmmg), MATAIJ, &jacobian);CHKERRQ(ierr);
>>>>>>
>>>>>> Thanks very much!
>>>>>>
>>>>>> Rebecca
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> (Rebecca) Xuefei YUAN
>>>> Department of Applied Physics and Applied Mathematics
>>>> Columbia University
>>>> Tel:917-399-8032
>>>> www.columbia.edu/~xy2102 <http://www.columbia.edu/%7Exy2102>
>>>>
>>>
>>>
>>>
>>> --
>>> (Rebecca) Xuefei YUAN
>>> Department of Applied Physics and Applied Mathematics
>>> Columbia University
>>> Tel:917-399-8032
>>> www.columbia.edu/~xy2102 <http://www.columbia.edu/%7Exy2102>
>>>
>>
>>
>>
>> --
>> (Rebecca) Xuefei YUAN
>> Department of Applied Physics and Applied Mathematics
>> Columbia University
>> Tel:917-399-8032
>> www.columbia.edu/~xy2102 <http://www.columbia.edu/%7Exy2102>
>>
>
>
>
> --
> (Rebecca) Xuefei YUAN
> Department of Applied Physics and Applied Mathematics
> Columbia University
> Tel:917-399-8032
> www.columbia.edu/~xy2102 <http://www.columbia.edu/%7Exy2102>
>
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090212/19734fe4/attachment.htm>
More information about the petsc-users
mailing list