<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">sorry... previously I had tried with a cast ... something like (PetscInt)sum... I knew PetscGetReal is a function... but I just replaced PetscInt with PetscGetReal... without moving parenthesis<div>thanks again<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Luigia Ambrosio</div><div><br></div><div>Se la gente ferisce è perchè tu sei migliore e lo capisce bene! - Tiziano Ferro</div><div><br></div></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br><div><div>Il giorno 04/lug/2012, alle ore 10:20, Jed Brown ha scritto:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Wed, Jul 4, 2012 at 12:15 AM, Luigia Ambrosio <span dir="ltr"><<a href="mailto:ambrosio.luigia@gmail.com" target="_blank">ambrosio.luigia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>this is the source code (very simple)</div><div> Vec x;</div><div> PetscInt n = 10;</div><div> PetscErrorCode ierr;</div><div> PetscScalar one = 1.0;</div><div><div>
<br></div><div> ierr = VecCreateMPI(PETSC_COMM_WORLD, PETSC_DECIDE, n, &x);CHKERRQ(ierr);</div><div> ierr = VecSet(x,one);CHKERRQ(ierr);</div></div><div> PetscScalar sum=0.0;</div><div> ierr = VecSum(x,&sum);CHKERRQ(ierr);</div>
<div> ierr = PetscPrintf(PETSC_COMM_WORLD,"sum %f\n",(PetscRealPart)sum);</div></div></blockquote><div><br></div><div>Use PetscRealPart(sum), it is a function, not a type.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div> CHKERRQ(ierr); puts("");</div></div></blockquote><div><br></div><div>This puts will be issued by every process, leading to messy output, especially for larger runs. Just add a second \n to the string passed to PetscPrintf() if you want another newline.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>...</div><div><br></div><div>and this is the error message I get trying make myex</div>
<div class="im"><div><div> error: 'PetscRealPart' was not declared in this scope</div></div><div><br></div></div><div>this is how I compile myex</div><div><div>myex: myex.o chkopts</div><div> -${CLINKER} -o myex myex.o ${PETSC_VEC_LIB}</div>
<div> ${RM} -f myex.o</div></div><div><br></div><div>I have petsc 3.3 developer version</div><div class="im"><div><br></div><div>
<div style="word-wrap:break-word"><div>Luigia Ambrosio</div><div><br></div><div>Se la gente ferisce è perchè tu sei migliore e lo capisce bene! - Tiziano Ferro</div><div><br></div></div><br><br>
</div>
<br></div><div><div>Il giorno 04/lug/2012, alle ore 09:58, Jed Brown ha scritto:</div><div><div class="h5"><br><blockquote type="cite"><div class="gmail_quote">On Tue, Jul 3, 2012 at 11:53 PM, Luigia Ambrosio <span dir="ltr"><<a href="mailto:ambrosio.luigia@gmail.com" target="_blank">ambrosio.luigia@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">It seems I don't have this function. I checked my configuring options, in particular<div>--with-scalar-type=complex </div></div></blockquote><div><br></div><div>Which version of PETSc? Can you send the full error message?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>so I'm sure that a PetscScalar variable is handled as a complex number. I tried to use the PetscRealPart but it says:</div>
<div>error: 'PetscRealPart' was not declared in this scope</div><div><br></div><div>I included also the header "petscmat.h" but there isn't defined this function. </div><div>It seems that I don't include the right header, I googled it but I didn't find it. Which header shiuld I include?</div>
</div></blockquote><div><br></div><div>That header includes petscmath.h (which you should not include directly).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>thanks</div><div><br></div><div><div><div>
<div style="word-wrap:break-word"><div>Luigia Ambrosio</div><div><br></div><div>Se la gente ferisce è perchè tu sei migliore e lo capisce bene! - Tiziano Ferro</div><div><br></div></div><br><br>
</div>
<br></div><div><div>Il giorno 04/lug/2012, alle ore 09:28, Jed Brown ha scritto:</div><div><br><blockquote type="cite"><div class="gmail_quote">On Tue, Jul 3, 2012 at 11:26 PM, Luigia Ambrosio <span dir="ltr"><<a href="mailto:ambrosio.luigia@gmail.com" target="_blank">ambrosio.luigia@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Is there a function already avilable to get the real part of a petscscalar value?<div><br></div></div></blockquote><div><br></div><div>PetscRealPart() and PetscImaginaryPart() </div></div>
</blockquote></div></div><br></div></div></blockquote></div><br>
</blockquote></div></div></div><br></div></blockquote></div><br>
</blockquote></div><br></div></body></html>