<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> It is find to use such conditional checks if needed. <br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 2, 2021, at 4:06 PM, Anthony Paul Haas <<a href="mailto:aph@email.arizona.edu" class="">aph@email.arizona.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><font face="arial, sans-serif" class="">Hello,</font><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, sans-serif" class="">I recently updated our code from Petsc 3.7.4.0 to 3.13.3.0. Among other things I noticed is that all the includes (such as <span style="font-variant-ligatures:no-common-ligatures" class="">#include</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class=""><petsc/finclude/petscvec.h></span>) have now to be accompanied with use statements (such as <span style="font-variant-ligatures:no-common-ligatures" class="">use</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">petscvec</span>).</font></div><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, sans-serif" class="">It seems that due to the use statements the compiler is now way more strict. In our code, we can solve stability equations in real arithmetic or in complex arithmetic, where some subroutines are used for complex arithmetic and some other ones for real arithmetic.</font></div><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, sans-serif" class="">My question is, is it good practice to wrap around a Petsc call with the pre-compiler flag <span style="caret-color: rgb(0, 0, 0);" class="">PETSC_USE_COMPLEX in order to avoid compilation error if that call is not used say in the complex part of the code?</span></font></div><div class=""><span style="caret-color: rgb(0, 0, 0);" class=""><font face="arial, sans-serif" class=""><br class=""></font></span></div><div class=""><font class=""><font face="arial, sans-serif" class=""><span style="caret-color: rgb(0, 0, 0);" class="">Example, the call to </span><span style="caret-color: rgb(74, 0, 255);" class="">MatSetValuesBlocked below is not used in the complex arithmetic code, so to avoid a compilation error, I wrapped the call with </span></font><span style="font-family:arial,sans-serif" class="">PETSC_USE_COMPLEX==0 (Mat1 is a real array in this example)</span></font></div><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="arial, sans-serif" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">#if</span><span style="font-variant-ligatures:no-common-ligatures" class=""> (PETSC_USE_COMPLEX==0)</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="arial, sans-serif" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span class="gmail-Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures" class="">call</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">MatSetValuesBlocked</span><span style="font-variant-ligatures:no-common-ligatures" class="">(self%fieldLHSMat_ps,1,ptLoc-1,1,colIndex-1,</span><span style="font-variant-ligatures:no-common-ligatures" class="">transpose</span><span style="font-variant-ligatures:no-common-ligatures" class="">(Mat1(1:ndim1,1:ndim2)),INSERT_VALUES,ierr)</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><font face="arial, sans-serif" class="">#endif</font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><font face="arial, sans-serif" class=""><br class=""></font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><font face="arial, sans-serif" class="">Thanks,</font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><font face="arial, sans-serif" class=""><br class=""></font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><font face="arial, sans-serif" class="">Anthony</font></span></div>
<br class="gmail-Apple-interchange-newline"></div></div>
</div></blockquote></div><br class=""></body></html>