Thyra Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Testing Program for Thyra/Epetra Adapters

Here we show the testing program that is used to perform regression tests on the Epetra adapter subclasses and tests a number of other classes as well. More...

Collaboration diagram for Testing Program for Thyra/Epetra Adapters:

Here we show the testing program that is used to perform regression tests on the Epetra adapter subclasses and tests a number of other classes as well.

This testing program is contained in the source file

./thyra/test/test_epetra_adapters.cpp 

where ./ is the base source directory for epetra.

This testing program will be shown in its entirety below but first we will point out some of the more significant parts of the program and highlight some interesting functionality.

First, the testing program reads in a number of options as shown below:

Next, some MPI functions are called to get the context of the parallel program (if built with MPI support and RTOp_USE_MPI is defined):

This program then creates two different (parallel or serial) vector spaces where one is of type Thyra::EpetraVectorSpace and the other is some non-Epetra vector space:

Given these vector spaces a couple Epetra and non-Epetra vectors and multi-vectors are created:

Most of the operations performed in this testing program are fairly mundane and we show a few of these simpler examples before going onto some more interesting ones.

These vectors and multi-vectors are then initialized using the Thyra::assign() wrapper functions:

The one norms of these vectors and multi-vectors are are then computed using various overloads of Thyra::norm_1() as:

The first set of more interesting operations are mixing objects of different concrete type in vector transformation operations. The following code shows assigning vectors and multi-vectors of various types

What is significant about some of the above function calls is that they mix and match objects with different concrete types. For example, a non-Epetra vector is assigned to an Epetra in the line:

Thyra::assign( &*ev1, *nev2 );

and an Epetra vector is assigned to a non-Epetra in the line:

Thyra::assign( &*nev1, *ev2 );

Similarly, non-Epetra and Epetra multi-vectors are assigned to and from in the calls:

Thyra::assign( &*eV1, *neV2 );
Thyra::assign( &*neV1, *eV2 );

Developer's that really want to understand how this type of interoperability between different concrete types works are cautiously encouraged to look at the implementations of the functions Thyra::SerialVectorBase::applyOp() and Thyra::SerialMultiVectorBase::applyOp() in a serial build and Thyra::MPIVectorBase::applyOp() and Thyra::MPIMultiVectorBase::applyOp().

The Thyra::LinearOpBase interface that all vectors and multi-vectors support is tested by the testing class Thyra::LinearOpTester which is created in the line:

This testing class is then called for all of the vector and multi-vector objects is the following lines:

Now we show how an Epetra_Operator object is wrapped by a Thyra::EpetraLinearOp object to give the Epetra object a Thyra skin.

First we create a simple diagonal Epetra operator in the following lines of code:

We then wrap this Epetra operator object as:

This object is then tested in the line:

Before the next set of tests we create some Epetra and non-Epetra working vectors and mulit-vectors in the lines:

In the next set of lines of code shows how different Epetra and non-Epetra vectors and multi-vectors can be mixed and matched with with this Thyra::EpetraLinearOp object:

Note that many of the above function calls involve using non-Epetra vector and multi-vector objects with the underlying Epetra_Operator object. This magic happens through the use of the utility function Thyra::get_Epetra_MultiVector() by the overridden function Thyra::EpetraLinearOp::euclideanApply().

ToDo: Finish this discussion.

To see the full listing of this click: test_epetra_adpaters.cpp .