<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Which version of PETSc are you using? If you use the dev version and try to call MatSetValues on a MATIS with a non-owned (subdomain-wise) dof it will raise an error, as MATIS does not implement any caching mechanisms for off-proc entries.<div class=""><div class="">Off-proc entries are a concept related with the AIJ format.</div><div class=""><br class=""></div><div class="">The local row and columns distribution of a Mat (any type, MATAIJ, MATIS or whatever type you want to use) are related with the local sizes of the vectors used in MatMult;</div><div class="">for MATIS, the size of the subdomain problem (call it nl) is inferred from the size of the ISLocalToGlobalMapping object used in the constructor (or passed in via MatSetLocalToGlobalMapping).</div><div class=""><br class=""></div><div class="">So, you can either do</div><div class=""><br class=""></div><div class="">A) loop over elements and call MatSetValuesLocal(A,element_dofs_in_subdomain_ordering…)</div><div class=""><div class="">B) loop over elements and call MatSetValues(A,element_dofs_in_global_ordering…)</div></div><div class=""><br class=""></div><div class="">in case A), if you want a code independent on the matrix type (AIJ or IS), you need to call MatSetLocalToGlobalMapping(A,l2g,l2g) before being able to call MatSetValuesLocal. The l2g map should map dofs from subdomain (0 to nl) to global ordering</div><div class=""><br class=""></div><div class="">in case B), the l2g map is only needed to create the MATIS object; in this case, when you call MatSetValues, the dofs in global ordering are mapped back to the subdomain ordering via ISGlobalToLocalMappingApply, that may not be memory scalable. So this is why Barry suggested you to use approach A).</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">You may want to take a look at <a href="http://epubs.siam.org/doi/abs/10.1137/15M1025785" class="">http://epubs.siam.org/doi/abs/10.1137/15M1025785</a> to better understand how MATIS works.</div><div class=""> </div><div class=""><div><blockquote type="cite" class=""><div class="">On Jun 7, 2017, at 3:18 PM, Hoang Giang Bui <<a href="mailto:hgbk2008@gmail.com" class="">hgbk2008@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span id="cid:6572F5C2-6457-40BB-9261-CB246290A6F3"><A00.ps></span></div></blockquote></div><br class=""></div></div></body></html>