|
Thyra Version of the Day
|

The following functions and classes are used to create Thyra objects which wrap (or adapt) Epetra objects:
Thyra::create_VectorSpace() accepts an Epetra_Map object and returns a Thyra::VectorSpaceBase object.
Thyra::create_Vector() accepts an Epetra_Vector object and returns a Thyra::VectorBase object.
Thyra::create_MultiVector() accepts an Epetra_MultiVector object and returns a Thyra::MultiVectorBase object.
Thyra::epetraLinearOp() adapts an Epetra_Operator object to form a Thyra::EpetraLinearOp object.
The above adapter code is based directly from the general Thyra Operator/Vector Subclasses for SPMD Distributed-Memory Platforms. Therefore these Epetra adapted objects are automatically compatible with any other such MPI-based SPMD adapter subclasses.
There is, however, one issue that requires a little care and that is using arbitrary Thyra::VectorBase and Thyra::MultiVectorBase objects with the vector and multi-vector versions of Thyra::EpetraLinearOp::apply(). The issue is that the underlying Epetra_Operator::Apply() function can only accept Epetra_MultiVector objects. The utility functions Thyra::get_Epetra_MultiVector() return an Epetra_MultiVector view of any Thyra::MultiVectorBase object with a compatible range space. Studying the implementations of these utility functions will show you how simple it is to provide for this type of interoperabiity. This type of interoperabiity machinary should also be used for other types of concrete adapter subclasses.
Other types of code will need to extract an Epetra_Vector view of a Thyra::VectorBase object. For this purpose the Thyra::get_Epetra_Vector() functions are provided.
The utility functions Thyra::get_Epetra_Operator() are also provided that encapsulate the extraction of an "adapted" Epetra_Operator object out of a Thyra::EpetraLinearOp object through its Thyra::LinearOpBase base interface. This is a common type of activity in object-oriented programming.