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

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

Functions

Teuchos::RefCountPtr< const
MPIVectorSpaceBase< double > > 
Thyra::create_MPIVectorSpaceBase (const Teuchos::RefCountPtr< const Epetra_Map > &epetra_map)
 Concrete an MPIVectorSpaceBase object given an Epetra_Map object.
Teuchos::RefCountPtr< MPIVectorBase<
double > > 
Thyra::create_MPIVectorBase (const Teuchos::RefCountPtr< Epetra_Vector > &epetra_v, const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &space)
 Create a non-const MPIVectorBase object from a const> Epetra_Vector object.
Teuchos::RefCountPtr< const
MPIVectorBase< double > > 
Thyra::create_MPIVectorBase (const Teuchos::RefCountPtr< const Epetra_Vector > &epetra_v, const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &space)
 Create an const MPIVectorBase wrapper object for a const Epetra_Vector object.
Teuchos::RefCountPtr< MPIMultiVectorBase<
double > > 
Thyra::create_MPIMultiVectorBase (const Teuchos::RefCountPtr< Epetra_MultiVector > &epetra_mv, const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &range, const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &domain)
 Create a non-const MPIMultiVectorBase object from a const> Epetra_MultiVector object.
Teuchos::RefCountPtr< const
MPIMultiVectorBase< double > > 
Thyra::create_MPIMultiVectorBase (const Teuchos::RefCountPtr< const Epetra_MultiVector > &epetra_mv, const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &range, const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &domain)
 Create an const MPIMultiVectorBase wrapper object for a const Epetra_MultiVector object.
Teuchos::RefCountPtr< Epetra_VectorThyra::get_Epetra_Vector (const Epetra_Map &map, const Teuchos::RefCountPtr< VectorBase< double > > &v)
 Get a non-const Epetra_Vector view from a non-const VectorBase object if possible.
Teuchos::RefCountPtr< const
Epetra_Vector
Thyra::get_Epetra_Vector (const Epetra_Map &map, const Teuchos::RefCountPtr< const VectorBase< double > > &v)
 Get a const Epetra_Vector view from a const VectorBase object if possible.
Teuchos::RefCountPtr< Epetra_MultiVectorThyra::get_Epetra_MultiVector (const Epetra_Map &map, const Teuchos::RefCountPtr< MultiVectorBase< double > > &mv)
 Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible.
Teuchos::RefCountPtr< const
Epetra_MultiVector
Thyra::get_Epetra_MultiVector (const Epetra_Map &map, const Teuchos::RefCountPtr< const MultiVectorBase< double > > &mv)
 Get a const Epetra_MultiVector view from a const MultiVectorBase object if possible.

Detailed Description

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


Function Documentation

Teuchos::RefCountPtr< const Thyra::MPIVectorSpaceBase< double > > Thyra::create_MPIVectorSpaceBase const Teuchos::RefCountPtr< const Epetra_Map > &  epetra_map  ) 
 

Concrete an MPIVectorSpaceBase object given an Epetra_Map object.

Parameters:
epetra_map [in] The Epetra map defining the partitioning of elements to processors.
Preconditions:
  • epetra_map.get() != NULL

Postconditions:

  • return.get() != NULL
  • The RefCountPtr object epetra_map is copied into the return object and therefore a memory of epetra_map is kept.

This uses an Epetra_Map object to initialize a compatible MPIVectorSpaceStd 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 MPI (i.e. HAVE_MPI is not defined when compiling and linking). If MPI support is not compiled into Epetra, then the dummy implementation defined in RTOp_mpi.h is used instead.

Examples:
test_epetra_adapters.cpp.

Definition at line 46 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< Thyra::MPIVectorBase< double > > Thyra::create_MPIVectorBase const Teuchos::RefCountPtr< Epetra_Vector > &  epetra_v,
const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &  space
 

Create a non-const MPIVectorBase object from 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:
  • epetra_v.get()!=NULL
  • space.get()!=NULL

Returns:
The returned RefCountPtr object contains a copy of the input RefCountPtr<Epetra_Vector> wrapped Epetra_Vector object. It is also stated that *epetra_v will only be guaranteed to be modifed after the last RefCountPtr to the returned MPIVectorBase 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 98 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< const Thyra::MPIVectorBase< double > > Thyra::create_MPIVectorBase const Teuchos::RefCountPtr< const Epetra_Vector > &  epetra_v,
const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &  space
 

Create an const MPIVectorBase 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:
  • epetra_v.get()!=NULL
  • space.get()!=NULL

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

Definition at line 117 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< Thyra::MPIMultiVectorBase< double > > Thyra::create_MPIMultiVectorBase const Teuchos::RefCountPtr< Epetra_MultiVector > &  epetra_mv,
const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &  range,
const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &  domain
 

Create a non-const MPIMultiVectorBase object from 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.
Precondiitions:
  • epetra_mv.get()!=NULL
  • range.get()!=NULL
  • domain.get()!=NULL

Returns:
The returned RefCountPtr object contains a copy of the input RefCountPtr<Epetra_MultiVector> wrapped Epetra_MultiVector object. It is also stated that *epetra_mv will only be guaranteed to be modifed after the last RefCountPtr to the returned MPIMultiVectorBase 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 136 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< const Thyra::MPIMultiVectorBase< double > > Thyra::create_MPIMultiVectorBase const Teuchos::RefCountPtr< const Epetra_MultiVector > &  epetra_mv,
const Teuchos::RefCountPtr< const MPIVectorSpaceBase< double > > &  range,
const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &  domain
 

Create an const MPIMultiVectorBase 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.
Precondiitions:
  • epetra_mv.get()!=NULL
  • range.get()!=NULL
  • domain.get()!=NULL

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

Definition at line 162 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< Epetra_Vector > Thyra::get_Epetra_Vector const Epetra_Map map,
const Teuchos::RefCountPtr< VectorBase< double > > &  v
 

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

Preconditions:

  • v.get()!=NULL
  • map must be compatible with *v.space()

If a Teuchos::RefCountPtr<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 188 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< const Epetra_Vector > Thyra::get_Epetra_Vector const Epetra_Map map,
const Teuchos::RefCountPtr< const VectorBase< double > > &  v
 

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

Preconditions:

  • v.get()!=NULL
  • map must be compatible with *v.space()

If a Teuchos::RefCountPtr<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 258 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< Epetra_MultiVector > Thyra::get_Epetra_MultiVector const Epetra_Map map,
const Teuchos::RefCountPtr< MultiVectorBase< double > > &  mv
 

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

Preconditions:

  • mv.get()!=NULL
  • map must be compatible with *mv.range()

If a Teuchos::RefCountPtr<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 316 of file Thyra_EpetraThyraWrappers.cpp.

Teuchos::RefCountPtr< const Epetra_MultiVector > Thyra::get_Epetra_MultiVector const Epetra_Map map,
const Teuchos::RefCountPtr< const MultiVectorBase< double > > &  mv
 

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

Preconditions:

  • mv.get()!=NULL
  • map must be compatible with *mv.range()

If a Teuchos::RefCountPtr<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 388 of file Thyra_EpetraThyraWrappers.cpp.


Generated on Thu Sep 18 12:40:21 2008 for Epetra to Thyra Adapter Software by doxygen 1.3.9.1