[petsc-users] Create DM matrix

Dave May dave.mayhem23 at gmail.com
Thu Feb 11 00:18:01 CST 2016


I think he wants the source location so that he can copy and implementation
and "tweak" it slightly

The location is here
${PETSC_DIR}/src/dm/impls/da/fdda.c

/Users/dmay/software/petsc-3.6.0/src
dmay at nikkan:~/software/petsc-3.6.0/src $ grep -r
DMCreateMatrix_DA_3d_MPIAIJ *
dm/impls/da/fdda.c:extern PetscErrorCode
DMCreateMatrix_DA_3d_MPIAIJ(DM,Mat);
dm/impls/da/fdda.c:extern PetscErrorCode
DMCreateMatrix_DA_3d_MPIAIJ_Fill(DM,Mat);
dm/impls/da/fdda.c:        ierr =
DMCreateMatrix_DA_3d_MPIAIJ_Fill(da,A);CHKERRQ(ierr);
dm/impls/da/fdda.c:        ierr =
DMCreateMatrix_DA_3d_MPIAIJ(da,A);CHKERRQ(ierr);


*dm/impls/da/fdda.c:#define __FUNCT__
"DMCreateMatrix_DA_3d_MPIAIJ"dm/impls/da/fdda.c:PetscErrorCode
DMCreateMatrix_DA_3d_MPIAIJ(DM da,Mat J)*dm/impls/da/fdda.c:#define
__FUNCT__ "DMCreateMatrix_DA_3d_MPIAIJ_Fill"
dm/impls/da/fdda.c:PetscErrorCode DMCreateMatrix_DA_3d_MPIAIJ_Fill(DM
da,Mat J)


On 11 February 2016 at 04:08, Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Feb 10, 2016 at 8:59 PM, Sang pham van <pvsang002 at gmail.com>
> wrote:
>
>> The irregular rows is quite many. The matrix really needs to be
>> preallocated.
>> Could you show me how to use DMCreateMatrix_DA_3d_MPIAIJ() directly?
>>
>> Just put the declaration right into your source.
>
>    Matt
>
>> Pham
>> On Feb 11, 2016 9:52 AM, "Matthew Knepley" <knepley at gmail.com> wrote:
>>
>>> On Wed, Feb 10, 2016 at 8:44 PM, Sang pham van <pvsang002 at gmail.com>
>>> wrote:
>>>
>>>> That is because my matrix has some rows which need more entries than
>>>> usual.
>>>>
>>>
>>> If its only a few, you could just turn off the allocation error.
>>>
>>>
>>>> Where can i find source code of DMCreateMatrix()?
>>>>
>>>>
>>>
>>> https://bitbucket.org/petsc/petsc/src/827b69d6bb12709ff9b9a0dede31640477fc2b74/src/dm/impls/da/fdda.c?at=master&fileviewer=file-view-default#fdda.c-1024
>>>
>>>   Matt
>>>
>>>> Pham.
>>>> On Feb 11, 2016 8:35 AM, "Matthew Knepley" <knepley at gmail.com> wrote:
>>>>
>>>>> On Wed, Feb 10, 2016 at 6:14 PM, Sang pham van <pvsang002 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to create a DM matrix with DMCreateMatrix_DA_3d_MPIAIJ()
>>>>>> instead of using DMCreateMatrix().
>>>>>>
>>>>>
>>>>> Why, that should be called automatically by DMCreateMatrix()?
>>>>>
>>>>>   Matt
>>>>>
>>>>>
>>>>>> Which header file should I include to use that routine? also, what is
>>>>>> the source file containing the DMCreateMatrix() routine?
>>>>>>
>>>>>> Many thanks in advance.
>>>>>> Pham
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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
>>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>
>
> --
> 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/20160211/920d898b/attachment.html>


More information about the petsc-users mailing list