[Trilinos-Users] Teucho::RCP Call by reference

Sunghwan Choi iomn159753 at kaist.ac.kr
Thu Aug 8 09:38:34 MDT 2013


Dear all,

Hi I met a weird situation. I computed scaling of Epetra_MultiVector in a
function and I got it through 'call by reference' I check the Scale does do
its work but outside of function the value was not changed. I wrote pseudo
code 

 

int func(Teuchos::RCP<Epetra_MultiVector>
before_values,Teuchos::RCP<Epetra_MultiVector> after_values){

after_values = Teuchos::rcp(new Epetra_MultiVector(*before_values) );

            double scaling = 0.5;

cout <<"before values" <<endl;

            cout << *after_values <<endl;

            after_values->Scale(1.0/scaling) ;

            cout <<"after values" <<endl;

            cout << *after_values<<endl;

            return;

}

 

This is super simple code but I don't know why it is not working. In other
part of my code, I used call-by-reference using Teuchos::RCP but this is not
working. Do you have any idea on this situation? 

 

Sunghwan Choi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130809/9c1ab741/attachment.html 


More information about the Trilinos-Users mailing list