<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class="">Hi,</div>
<div class=""><br class="">
</div>
<div class="">Now I think the DMStagStencilToIndexLocal provides the local index for given (stencil) positions. How can we use that local index information to eliminate the rows? </div>
<div class=""><br class="">
</div>
<div class="">Is the following code possible:</div>
<div class=""><br class="">
</div>
<div class="">MatSetLocalToGlobalMapping(…);</div>
<div class="">If (is_boundary){</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>PetscInt ix;</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>DMStagStencilToIndexLocal(…, &ix);</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>MatZeroRowsLocal(… &ix, …);</div>
<div class="">}</div>
<div class=""><br class="">
</div>
<div class="">The comment of MatZeroRowsLocal said "rows - the global row indices”. But this seems inconsistent with its name, so I am confused.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">
<div class="">Qi</div>
<br class="Apple-interchange-newline">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 20, 2021, at 2:18 AM, Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" class="">patrick.sanan@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Qi -
<div class=""><br class="">
</div>
<div class="">I just opened a PR to make DMStagStencilToIndexLocal() public</div>
<div class=""><a href="https://urldefense.com/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/4180__;!!HXCxUKc!mAeQntyQFk-B3KHmJJWuOGKXTfKh8A-uC-v9JFZHW-VbJT7ejxWH7LlaFNM-Zg$" class="">https://gitlab.com/petsc/petsc/-/merge_requests/4180</a></div>
<div class=""><br class="">
</div>
<div class="">(Sorry for my inattention - I think I may have missed some communications in processing the flood of PETSc emails too quickly - I still plan to get some more automatic DMStag fieldsplit capabilities into main, if it's not too late).<br class="">
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">Am 20.07.2021 um 02:47 schrieb Tang, Qi <<a href="mailto:tangqi@msu.edu" class="">tangqi@msu.edu</a>>:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class="">Hi,</div>
<div class="">As a part of implementing this process by ourself, we would like to eliminate boundary dofs. By reading DMStag code, we guess we can use</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>DMStagStencilToIndexLocal</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>MatZeroRowsLocal</div>
<div class=""><br class="">
</div>
<div class="">We note that DMStagStencilToIndexLocal is not explicitly defined in the header file. Is this function ready to use? And will we be able to eliminate the dofs using the above functions?</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Qi<br class="">
<div class=""><br class="">
</div>
<br class="Apple-interchange-newline">
</div>
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 16, 2021, at 8:17 PM, Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
Zakariae,
<div class=""><br class="">
</div>
<div class=""> MatGetSubMatrix() was removed a long time ago, the routine is now MatCreateSubMatrix() but it does not work in way you had hoped. There is currently no mechanism to move values you put into the sub matrix back into the original larger matrix
(though perhaps there should be?). </div>
<div class=""><br class="">
</div>
<div class=""> Please look at MatCreateSubMatrixVirtual() and also MatCreateNest() to see if either of those approaches satisfy your needs. </div>
<div class=""><br class="">
</div>
<div class=""> Please let us know if there are extensions that would be useful for you to accomplish what you need. </div>
<div class=""><br class="">
</div>
<div class=""> Barry</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 16, 2021, at 7:45 PM, Jorti, Zakariae via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Hello,</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">I have a matrix A = [A00 , A01 ; A10, A11]. </div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">I extract the submatrix A11 with MatGetSubMatrix.</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">I only know the global IS is1 and is2, so to get A11 I call: </div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">MatGetSubMatrix(A,is2,is2,MAT_INITIAL_MATRIX,&A11);</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">I want to modify A11 and update the changes on the global matrix A but I could not find any <span style="font-size: 12pt;" class="">MatRestoreSubMatrix routine.</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Is there something similar to </span><span style="font-size: 12pt;" class="">VecGetSubVector and VecRestoreSubVector for matrices that uses only global indices?</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Many thanks.</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Best regards,</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""><br class="">
</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Zakariae </span></div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>