[Trilinos-Users] Teuchos MpiComm

Heroux, Michael A maherou at sandia.gov
Tue Dec 23 13:53:01 MST 2014


Something this simple should not be so hard to do.  Can we introduce a
helper function in Teuchos?

Mike

On 12/23/14, 12:49 PM, "Bartlett, Roscoe A." <bartlettra at ornl.gov> wrote:

>> > Teuchos::RCP<matrix_t> A...;
>> >
>> > //doesn't work:
>> > Teuchos::RCP< const Teuchos::MpiComm< int > >  tr_comm = m_A-
>> > >getComm();
>> >
>> > //works, but I don't have an MpiComm:
>> > Teuchos::RCP< const Teuchos::Comm< int > >  tr_comm = m_A-
>> >getComm();
>> >
>> > //fails because I don't have an MpiComm
>> > Teuchos::RCP<const Teuchos::OpaqueWrapper<int> > cmm =
>> > tr_comm->getRawMpiComm();
>> 
>> Teuchos::RCP<const Teuchos::OpaqueWrapper<int> >  cmm =
>>    rcp_dynamic_cast<Teuchos::MpiComm<int> > (tr_comm, true)-
>> >getRawMpiComm();
>
>Forgot the const.
>
>Teuchos::RCP<const Teuchos::OpaqueWrapper<int> >  cmm =
>   rcp_dynamic_cast<const Teuchos::MpiComm<int> > (tr_comm,
>true)->getRawMpiComm();
>
>NOTE: You should not need Teuchos:: before the rcp_dynamic_cast due to
>ADL.  The "true" is so that if the dynamic cast fails, you get a good
>error message and not just a null pointer.
>
>-Ross
>
>
>_______________________________________________
>Trilinos-Users mailing list
>Trilinos-Users at software.sandia.gov
>https://software.sandia.gov/mailman/listinfo/trilinos-users



More information about the Trilinos-Users mailing list