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 Spmd subclass implementations and for getting Epetra views of Thyra objects. More...

Functions

Teuchos::RefCountPtr< const
Teuchos::Comm< Index > > 
Thyra::create_Comm (const Teuchos::RefCountPtr< const Epetra_Comm > &epetraComm)
 Given an Epetra_Comm object, return an equivalent Teuchos::Comm object.
Teuchos::RefCountPtr< const
SpmdVectorSpaceDefaultBase<
double > > 
Thyra::create_VectorSpace (const Teuchos::RefCountPtr< const Epetra_Map > &epetra_map)
 Concrete an SpmdVectorSpaceBase object given an Epetra_Map object.
Teuchos::RefCountPtr< SpmdVectorBase<
double > > 
Thyra::create_Vector (const Teuchos::RefCountPtr< Epetra_Vector > &epetra_v, const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &space)
 Create a non-const SpmdVectorBase object from a const> Epetra_Vector object.
Teuchos::RefCountPtr< const
SpmdVectorBase< double > > 
Thyra::create_Vector (const Teuchos::RefCountPtr< const Epetra_Vector > &epetra_v, const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &space)
 Create an const SpmdVectorBase wrapper object for a const Epetra_Vector object.
Teuchos::RefCountPtr< SpmdMultiVectorBase<
double > > 
Thyra::create_MultiVector (const Teuchos::RefCountPtr< Epetra_MultiVector > &epetra_mv, const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &range, const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &domain=Teuchos::null)
 Create a non-const SpmdMultiVectorBase object from a const> Epetra_MultiVector object.
Teuchos::RefCountPtr< const
SpmdMultiVectorBase< double > > 
Thyra::create_MultiVector (const Teuchos::RefCountPtr< const Epetra_MultiVector > &epetra_mv, const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &range, const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &domain=Teuchos::null)
 Create an const SpmdMultiVectorBase 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 Spmd subclass implementations and for getting Epetra views of Thyra objects.


Function Documentation

Teuchos::RefCountPtr< const Teuchos::Comm< Thyra::Index > > Thyra::create_Comm const Teuchos::RefCountPtr< 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.

Teuchos::RefCountPtr< const Thyra::SpmdVectorSpaceDefaultBase< double > > Thyra::create_VectorSpace const Teuchos::RefCountPtr< const Epetra_Map > &  epetra_map  ) 
 

Concrete an SpmdVectorSpaceBase 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 DefaultSpmdVectorSpace 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_Spmd is not defined when compiling and linking). If Spmd support is not compiled into Epetra, then the dummy implementation defined in RTOp_mpi.h is used instead.

Examples:
test_epetra_adapters.cpp.

Teuchos::RefCountPtr< Thyra::SpmdVectorBase< double > > Thyra::create_Vector const Teuchos::RefCountPtr< Epetra_Vector > &  epetra_v,
const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &  space
 

Create a non-const SpmdVectorBase 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

Postconditions:

  • [epetra_v.get()==NULL] return.get()==NULL
  • [epetra_v.get()!=NULL] return.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 SpmdVectorBase is destroyed. In addition, *return is only valid as long as one RefCoutPtr wrapper object still exits.
Examples:
test_epetra_adapters.cpp.

Teuchos::RefCountPtr< const Thyra::SpmdVectorBase< double > > Thyra::create_Vector const Teuchos::RefCountPtr< const Epetra_Vector > &  epetra_v,
const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &  space
 

Create an const SpmdVectorBase 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

Postconditions:

  • [epetra_v.get()==NULL] return.get()==NULL
  • [epetra_v.get()!=NULL] return.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.

Teuchos::RefCountPtr< Thyra::SpmdMultiVectorBase< double > > Thyra::create_MultiVector const Teuchos::RefCountPtr< Epetra_MultiVector > &  epetra_mv,
const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &  range,
const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &  domain = Teuchos::null
 

Create a non-const SpmdMultiVectorBase 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. If domain.get()==NULL, then a space will be created internally.
Precondiitions:
  • epetra_mv.get()!=NULL
  • range.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 SpmdMultiVectorBase is destroyed. In addition, *return is only valid as long as one RefCoutPtr wrapper object still exits.
Examples:
test_epetra_adapters.cpp.

Teuchos::RefCountPtr< const Thyra::SpmdMultiVectorBase< double > > Thyra::create_MultiVector const Teuchos::RefCountPtr< const Epetra_MultiVector > &  epetra_mv,
const Teuchos::RefCountPtr< const SpmdVectorSpaceBase< double > > &  range,
const Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase< double > > &  domain = Teuchos::null
 

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

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.

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.

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.

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.


Generated on Sun May 20 13:06:11 2007 for Epetra to Thyra Adapter Software by doxygen 1.3.9.1