[petsc-users] DMCreateMatrix from one DMDA to an another

Dave May dave.mayhem23 at gmail.com
Sat Dec 5 05:41:14 CST 2015


On 5 December 2015 at 11:15, Timothée Nicolas <timothee.nicolas at gmail.com>
wrote:

> Hi,
>
> I need to create a rectangular matrix which takes vector structured by a
> DMDA and transforms them to vectors structured with an other DMDA. It does
> not look like there is a routine to do this since apparently DMCreateMatrix
> assumes square matrix. What is the clean way to do this ?
>

Do the DMDA's have exactly the same parallel layout and only differ by the
number of DOFs?

If yes, and you only want to move entries between vectors associated with
the two DMDA's, you can perform the transfer between vectors locally
(rank-wise) in a very simple manner using the local number of points from
DMDA and the known block sizes (DOFs) associated with your DMDA and the
size of the subspace you ultimately want to construct.

Thanks,
  Dave


> The problem is I have a DMDA with 8 degrees of freedom (dof) and my matrix
> sends vectors living in a subspace with 3 dof to the other 5 dof subspace.
> I can define a square matrix living in the large, 8 dof subspace, but this
> is of course very inefficient in terms of memory and time.
>
> Thanks
>
> Best
>
> Timothée
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151205/a93196fa/attachment.html>


More information about the petsc-users mailing list