<div dir="ltr"><font face="arial, sans-serif">Hello,</font><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif" color="#000000">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">#include</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures"><petsc/finclude/petscvec.h></span>) have now to be accompanied with use statements (such as <span style="font-variant-ligatures:no-common-ligatures">use</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">petscvec</span>).</font></div><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><font face="arial, sans-serif" color="#000000">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><font face="arial, sans-serif" color="#000000"><br></font></div><div><font face="arial, sans-serif" color="#000000">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);">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><span style="caret-color: rgb(0, 0, 0);"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><font color="#000000"><font face="arial, sans-serif"><span style="caret-color: rgb(0, 0, 0);">Example, the call to </span><span style="caret-color: rgb(74, 0, 255);">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">PETSC_USE_COMPLEX==0 (Mat1 is a real array in this example)</span></font></div><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><p style="margin:0px;font-stretch:normal;line-height:normal"><font face="arial, sans-serif" color="#000000"><span style="font-variant-ligatures:no-common-ligatures">#if</span><span style="font-variant-ligatures:no-common-ligatures"> (PETSC_USE_COMPLEX==0)</span></font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal"><font face="arial, sans-serif" color="#000000"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">MatSetValuesBlocked</span><span style="font-variant-ligatures:no-common-ligatures">(self%fieldLHSMat_ps,1,ptLoc-1,1,colIndex-1,</span><span style="font-variant-ligatures:no-common-ligatures">transpose</span><span style="font-variant-ligatures:no-common-ligatures">(Mat1(1:ndim1,1:ndim2)),INSERT_VALUES,ierr)</span></font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif" color="#000000">#endif</font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif" color="#000000">Thanks,</font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif" color="#000000">Anthony</font></span></p>
<br class="gmail-Apple-interchange-newline"></div></div>