[petsc-users] question about MatSetLocalToGlobalMapping

Karthikeyan Chockalingam - STFC UKRI karthikeyan.chockalingam at stfc.ac.uk
Thu Apr 20 05:12:45 CDT 2023


Hello,

I created a new thread, thought would it be more appropriate (and is a continuation of my previous post). I want to construct the below K matrix (which is composed of submatrices)

K = [A P^T
       P   0]

Where K is of type MatMPIAIJ. I first constructed the top left [A] using MatSetValues().

Now, I would like to construct the bottom left [p] and top right [p^T] using MatSetValuesLocal().

To use  MatSetValuesLocal(),  I first have to create a local-to-global mapping using ISLocalToGlobalMappingCreate. I have created two mapping row_mapping and column_mapping.

Q1) At what point should I declare MatSetLocalToGlobalMapping – is it just before I use MatSetValuesLocal()?


I will use MatSetLocalToGlobalMapping(K, row_mapping, column_mapping) to build the bottom left [P].


Q2) Can now I reset the mapping as MatSetLocalToGlobalMapping(K, column_mapping, row_mapping) to build the top right [P^T]?


Many thanks!

Kind regards,
Karthik.









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230420/4f7d4dea/attachment-0001.html>


More information about the petsc-users mailing list