[Trilinos-Users] Thyra::LinearOpBase - Constructing blocked operators

Bartlett, Roscoe A. bartlettra at ornl.gov
Fri Mar 9 12:22:27 MST 2012


Einar,

These vector spaces are *not* compatible, as shown in the error message.  The range space on this blocked matrix is a 2x product vector (with two Tpetra vectors) and the vector you are trying to pass in for y is just a regular single concrete Tpetra vector.  As you can see in the error messages, the types are not the same (Thyra::DefaultProductVectorSpace vs. Thyra::TpetraVectorSpace).  Just because they have the same global dimension does not mean they are compatible.  For a simple serial vector you would think they should be but for more complex vector spaces, it is not trivial to implement and is instead counter-productive to try to make them compatible.

You need to create your vectors given the range and domain spaces of the linear operators if possible.  For example:

  RCP<Thyra::LinearOpBase<double> > myOp;
  // Create myOp and fill it
  ...
  const RCP<Thyra::VectorBase<double> > x = createMember(myOp->domain());
  // Fill the RHS x
  ...
  const RCP<Thyra::VectorBase<double > > y = createMember(myOp->range());
  apply(*myOp, Thyra::NOTRANS, *x, y.ptr());

The above is guaranteed to work.

Since you have a 2x product vector, you will have to dynamic cast to get the individual members.  For example:

    const RCP<Thyra::ProductVectorBase<double> > y_prod = Thyra::nonconstProductVectorBase(y);
    const RCP<Thyra::VectorBase<double> > y_0 = y_prod->getNonconstVectorBlock(0);
    const RCP<Thyra::VectorBase<double> > y_1 = y_prod->getNonconstVectorBlock(1);
    ...

We likely need better tutorial material for this stuff to describe type compatibility, how things fit together, and where dyanamic casting is needed to perform certain tasks.

Cheers,

-Ross







From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf Of Einar Otnes
Sent: Friday, March 09, 2012 12:47 PM
To: trilinos-users at software.sandia.gov
Subject: [Trilinos-Users] Thyra::LinearOpBase - Constructing blocked operators

Dear experts,
I've been trying to construct blocky matrices using Thyra::PhysicallyBlockedLinearOpBase and I'm struggling a bit with understanding the error message below
as it complains about non-compatible vector spaces between the blocky operator and the vectors it operates on. From what I can read from the messages below is that I have
"compatible" vector spaces. Or have I missed something?

The output from throwing the instance follows below.

Thanks for all your help.

Best,
Einar Otnes




Error message follows:

terminate called after throwing an instance of 'Thyra::Exceptions::IncompatibleVectorSpaces'
 what():  /dd/packages/trilinos/10.10.1/gcc/64/debug/include/Thyra_DefaultBlockedLinearOp_def.hpp:447:

Throw number = 1

Throw test that evaluated to true: !l_isCompatible

DefaultBlockedLinearOp<Scalar>::apply(...):

Spaces check failed for *this * X_in and &*Y_inout:



Error, the following vector spaces are not compatible:

(*this).range() : Thyra::DefaultProductVectorSpace<float>{dim=4,numBlocks=2}
  Constituent vector spaces V[0], V[1], ... V[numBlocks-1]:
   V[0] = Thyra::TpetraVectorSpace<float, int, int, Kokkos::TPINode>{globalDim=2,localSubDim=2,localOffset=0,comm=Teuchos::SerialComm<long int>}
   V[1] = Thyra::TpetraVectorSpace<float, int, int, Kokkos::TPINode>{globalDim=2,localSubDim=2,localOffset=0,comm=Teuchos::SerialComm<long int>}

*(&*Y_inout)->range() : Thyra::TpetraVectorSpace<float, int, int, Kokkos::TPINode>{globalDim=4,localSubDim=4,localOffset=0,comm=Teuchos::SerialComm<long int>}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20120309/36ad73ef/attachment.html 


More information about the Trilinos-Users mailing list