Collection of functions for wrapping and unwrapping Epetra objects
[Epetra to Thyra Operator/Vector Adapter Code]

Collaboration diagram for Collection of functions for wrapping and unwrapping Epetra objects:


Functions

Teuchos::RCP< const Teuchos::Comm<
Thyra::Index > > 
Thyra::create_Comm (const RCP< const Epetra_Comm > &epetraComm)
 Given an Epetra_Comm object, return an equivalent Teuchos::Comm object.
Teuchos::RCP< const Thyra::VectorSpaceBase<
double > > 
Thyra::create_VectorSpace (const RCP< const Epetra_Map > &epetra_map)
 Create an VectorSpaceBase object given an Epetra_Map object.
Teuchos::RCP< const Thyra::VectorSpaceBase<
double > > 
Thyra::create_LocallyReplicatedVectorSpace (const RCP< const VectorSpaceBase< double > > &parentSpace, const int dim)
 Create a VectorSpaceBase object that creates locally replicated vector objects.
Teuchos::RCP< Thyra::VectorBase<
double > > 
Thyra::create_Vector (const RCP< Epetra_Vector > &epetra_v, const RCP< const VectorSpaceBase< double > > &space)
 Create a non-const VectorBase object from a non-const Epetra_Vector object.
Teuchos::RCP< const Thyra::VectorBase<
double > > 
Thyra::create_Vector (const RCP< const Epetra_Vector > &epetra_v, const RCP< const VectorSpaceBase< double > > &space)
 Create an const VectorBase wrapper object for a const Epetra_Vector object.
Teuchos::RCP< Thyra::MultiVectorBase<
double > > 
Thyra::create_MultiVector (const RCP< Epetra_MultiVector > &epetra_mv, const RCP< const VectorSpaceBase< double > > &range, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
 Create a non-const MultiVectorBase object from a non-const Epetra_MultiVector object.
Teuchos::RCP< const Thyra::MultiVectorBase<
double > > 
Thyra::create_MultiVector (const RCP< const Epetra_MultiVector > &epetra_mv, const RCP< const VectorSpaceBase< double > > &range, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
 Create an const MultiVectorBase wrapper object for a const Epetra_MultiVector object.
Teuchos::RCP< Epetra_VectorThyra::get_Epetra_Vector (const Epetra_Map &map, const RCP< VectorBase< double > > &v)
 Get a non-const Epetra_Vector view from a non-const VectorBase object if possible.
Teuchos::RCP< const Epetra_VectorThyra::get_Epetra_Vector (const Epetra_Map &map, const RCP< const VectorBase< double > > &v)
 Get a const Epetra_Vector view from a const VectorBase object if possible.
Teuchos::RCP< Epetra_MultiVectorThyra::get_Epetra_MultiVector (const Epetra_Map &map, const RCP< MultiVectorBase< double > > &mv)
 Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible.
Teuchos::RCP< const Epetra_MultiVectorThyra::get_Epetra_MultiVector (const Epetra_Map &map, const RCP< const MultiVectorBase< double > > &mv)
 Get a const Epetra_MultiVector view from a const MultiVectorBase object if possible.
Teuchos::RCP< Epetra_MultiVectorThyra::get_Epetra_MultiVector (const Epetra_Map &map, MultiVectorBase< double > &mv)
 Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible where the client must maintain the memory of the input multivector.
Teuchos::RCP< const Epetra_MultiVectorThyra::get_Epetra_MultiVector (const Epetra_Map &map, const MultiVectorBase< double > &mv)
 Get a const Epetra_MultiVector view from a const MultiVectorBase object if possible where the client must maintain the memory of the input multivector.

Detailed Description

This set of functions provides some general utility code for wrapping Epetra objects in standard Thyra subclass implementations and for getting Epetra views of Thyra objects.

Function Documentation

RCP< const Teuchos::Comm< Index > > Thyra::create_Comm ( const RCP< const Epetra_Comm > &  epetraComm  ) 

Given an Epetra_Comm object, return an equivalent Teuchos::Comm object.

If a successful conversion could not be performed then return.get()==NULL.

Examples:
test_epetra_adapters.cpp.

Definition at line 54 of file Thyra_EpetraThyraWrappers.cpp.

RCP< const VectorSpaceBase< double > > Thyra::create_VectorSpace ( const RCP< const Epetra_Map > &  epetra_map  ) 

Create an VectorSpaceBase object given an Epetra_Map object.

Parameters:
epetra_map [in] The Epetra map defining the partitioning of elements to processors.
Preconditions:

Postconditions:

This uses an Epetra_Map object to initialize a compatible VectorSpaceBase object.

The fact that this function only accepts an Epetra_Map object means that only maps that have elements of size one can be used to define a vector space. General Epetra_BlockMaps can not be used. This is not a serious limitation since Epetra_Operator's domain and range maps are of type Epetra_Map.

This function works properly even if Epetra is not compiled with support for SPMD (i.e. HAVE_MPI is not defined when compiling and linking). If SPMD support is not compiled into Epetra, then a serial implementation of the communication is used instead.

Examples:
test_epetra_adapters.cpp.

Definition at line 91 of file Thyra_EpetraThyraWrappers.cpp.

RCP< const VectorSpaceBase< double > > Thyra::create_LocallyReplicatedVectorSpace ( const RCP< const VectorSpaceBase< double > > &  parentSpace,
const int  dim 
)

Create a VectorSpaceBase object that creates locally replicated vector objects.

Parameters:
parentSpace [in] The vector space that will be used to create the smaller locally-replicated vector space.
dim [in] The dimension of the locally replicated vector space.
Note: This vector space will be compatible with the domain space of a multivector. which has the range space parentSpace.

Definition at line 125 of file Thyra_EpetraThyraWrappers.cpp.

RCP< VectorBase< double > > Thyra::create_Vector ( const RCP< Epetra_Vector > &  epetra_v,
const RCP< const VectorSpaceBase< double > > &  space 
)

Create a non-const VectorBase object from a non-const Epetra_Vector object.

Parameters:
epetra_v [in] Smart pointer to the Epetra_Vector object to wrap.
space [in] The vector space that is compatible with epetra_v->Map().
Precondiitions:

Postconditions:

Returns:
The returned RCP object contains a copy of the input RCP<Epetra_Vector> wrapped Epetra_Vector object. It is also stated that *epetra_v will only be guaranteed to be modifed after the last RCP to the returned VectorBase is destroyed. In addition, *return is only valid as long as one RefCoutPtr wrapper object still exits.
Examples:
test_epetra_adapters.cpp.

Definition at line 141 of file Thyra_EpetraThyraWrappers.cpp.

RCP< const VectorBase< double > > Thyra::create_Vector ( const RCP< const Epetra_Vector > &  epetra_v,
const RCP< const VectorSpaceBase< double > > &  space 
)

Create an const VectorBase wrapper object for a const Epetra_Vector object.

Parameters:
epetra_v [in] Smart pointer to the Epetra_Vector object to wrap.
space [in] The vector space that is compatible with epetra_v->Map().
Precondiitions:

Postconditions:

Returns:
The returned RCP object contains a copy of the input RCP<Epetra_Vector> wrapped Epetra_Vector object. In addition, *return is only valid as long as one RefCoutPtr wrapper object still exits.

Definition at line 172 of file Thyra_EpetraThyraWrappers.cpp.

RCP< MultiVectorBase< double > > Thyra::create_MultiVector ( const RCP< Epetra_MultiVector > &  epetra_mv,
const RCP< const VectorSpaceBase< double > > &  range,
const RCP< const VectorSpaceBase< double > > &  domain = Teuchos::null 
)

Create a non-const MultiVectorBase object from a non-const Epetra_MultiVector object.

Parameters:
epetra_mv [in] Smart pointer to the Epetra_MultiVector object to wrap.
range [in] The vector space that is compatible with epetra_mv->Map().
domain [in] The vector space that is compatible with epetra_mv.NumVectors. If domain.get()==NULL, then a space will be created internally.
Precondiitions:

Returns:
The returned RCP object contains a copy of the input RCP<Epetra_MultiVector> wrapped Epetra_MultiVector object. It is also stated that *epetra_mv will only be guaranteed to be modifed after the last RCP to the returned MultiVectorBase is destroyed. In addition, *return is only valid as long as one RefCoutPtr wrapper object still exits.
Examples:
test_epetra_adapters.cpp.

Definition at line 203 of file Thyra_EpetraThyraWrappers.cpp.

RCP< const MultiVectorBase< double > > Thyra::create_MultiVector ( const RCP< const Epetra_MultiVector > &  epetra_mv,
const RCP< const VectorSpaceBase< double > > &  range,
const RCP< const VectorSpaceBase< double > > &  domain = Teuchos::null 
)

Create an const MultiVectorBase wrapper object for a const Epetra_MultiVector object.

Parameters:
epetra_mv [in] Smart pointer to the Epetra_MultiVector object to wrap.
range [in] The vector space that is compatible with epetra_mv->Map().
domain [in] The vector space that is compatible with epetra_mv.NumVectors. If domain.get()==NULL, then a space will be created internally.
Preconditions:

Returns:
The returned RCP object contains a copy of the input RCP<Epetra_MultiVector> wrapped Epetra_MultiVector object. In addition, *return is only valid as long as one RefCoutPtr wrapper object still exits.

Definition at line 251 of file Thyra_EpetraThyraWrappers.cpp.

RCP< Epetra_Vector > Thyra::get_Epetra_Vector ( const Epetra_Map map,
const RCP< VectorBase< double > > &  v 
)

Get a non-const Epetra_Vector view from a non-const VectorBase object if possible.

Preconditions:

If a RCP<Epetra_Vector> object is already attached to the node of the smart pointer for mv then this is returned directly. If not, then a view of the data in *v is created and returned. In the latter case the smart pointer v is copied and attached to the returned RCP object. Therefore, a temporary VectorBase object can be created in the call to this function and the view in return will persist until all of the RCP objects to the returned Epetra_Vector object go away.

Note: the v object is not guaranteed to be modified until the last smart pointer to the returned Epetra_Vector object is destroyed.

Examples:
test_epetra_adapters.cpp.

Definition at line 299 of file Thyra_EpetraThyraWrappers.cpp.

RCP< const Epetra_Vector > Thyra::get_Epetra_Vector ( const Epetra_Map map,
const RCP< const VectorBase< double > > &  v 
)

Get a const Epetra_Vector view from a const VectorBase object if possible.

Preconditions:

If a RCP<Epetra_Vector> object is already attached to the node of the smart pointer for mv then this is returned directly. If not, then a view of the data in *v is created and returned. In the latter case the smart pointer v is copied and attached to the returned RCP object. Therefore, a temporary VectorBase object can be created in the call to this function and the view in return will persist until all of the RCP objects to the returned Epetra_Vector object go away.

Definition at line 375 of file Thyra_EpetraThyraWrappers.cpp.

RCP< Epetra_MultiVector > Thyra::get_Epetra_MultiVector ( const Epetra_Map map,
const RCP< MultiVectorBase< double > > &  mv 
)

Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible.

Preconditions:

If a RCP<Epetra_MultiVector> object is already attached to the node of the smart pointer for mv then this is returned directly. If not, then a view of the data in *mv is created and returned. In the latter case the smart pointer mv is copied and attached to the returned RCP object. Therefore, a temporary MultiVectorBase object can be created in the call to this function and the view in return will persist until all of the RCP objects to the returned Epetra_MultiVector object go away.

Note: the mv object is not guaranteed to be modified until the last smart pointer to the returned Epetra_MultiVector object is destroyed.

Examples:
test_epetra_adapters.cpp.

Definition at line 441 of file Thyra_EpetraThyraWrappers.cpp.

RCP< const Epetra_MultiVector > Thyra::get_Epetra_MultiVector ( const Epetra_Map map,
const RCP< const MultiVectorBase< double > > &  mv 
)

Get a const Epetra_MultiVector view from a const MultiVectorBase object if possible.

Preconditions:

If a RCP<const Epetra_MultiVector> object is already attached to the node of the smart pointer for mv then this is returned directly. If not, then a view of the data in *mv is created and returned. In the latter case the smart pointer mv is copied and attached to the returned RCP object. Therefore, a temporary MultiVectorBase object can be created in the call to this function and the view in return will persist until all of the RCP objects to the returned Epetra_MultiVector object go away.

Definition at line 518 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RCP< Epetra_MultiVector > Thyra::get_Epetra_MultiVector ( const Epetra_Map map,
MultiVectorBase< double > &  mv 
)

Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible where the client must maintain the memory of the input multivector.

Preconditions:

This function trys to dynamic cast some some known interfaces classes where data can be directly accessed and no RCP magic needs to be used. This results in improved performance in time-critical use cases (like when called for EpetraLinearOp in the inner loop of a Krylov solver).

If this function can not dynamic cast to the direct data access interfaces it punts and calls the more general (but more expensive) get_Epetra_MultiVector() function.

Note: the mv object is not guaranteed to be modified until the last smart pointer to the returned Epetra_MultiVector object is destroyed.

Definition at line 585 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RCP< const Epetra_MultiVector > Thyra::get_Epetra_MultiVector ( const Epetra_Map map,
const MultiVectorBase< double > &  mv 
)

Get a const Epetra_MultiVector view from a const MultiVectorBase object if possible where the client must maintain the memory of the input multivector.

Preconditions:

This function trys to dynamic cast some some known interfaces classes where data can be directly accessed and no RCP magic needs to be used. This results in improved performance in time-critical use cases (like when called for EpetraLinearOp in the inner loop of a Krylov solver).

If this function can not dynamic cast to the direct data access interfaces it punts and calls the more general (but more expensive) get_Epetra_MultiVector() function.

Definition at line 618 of file Thyra_EpetraThyraWrappers.cpp.


Generated on Wed May 12 21:42:57 2010 for Epetra to Thyra Adapter Software by  doxygen 1.4.7