Thyra::SerialVectorBase< Scalar > Class Template Reference
[Thyra Operator/Vector Base Support Subclasses for Serial Shared-Memory Implementations]

Efficient base subclass of serial vectors. More...

#include <Thyra_SerialVectorBaseDecl.hpp>

Inheritance diagram for Thyra::SerialVectorBase< Scalar >:

[legend]
List of all members.

Constructors

 SerialVectorBase ()
 

Pure virtual methods to be overridden by subclasses

virtual void getData (Scalar **values, Index *stride)=0
 Sets a non-const pointer to the beginning of the vector data (and its stride).
virtual void commitData (Scalar **values)=0
 Commits updated vector data that was accessed using this->getData().

Virtual methods with default implementations.

virtual void getData (const Scalar **values, Index *stride) const
 Returns a const pointer to the beginning of the vector data.
virtual void freeData (const Scalar **values) const
 Frees a const view of vector data that was accessed using this->getData().

Overridden from VectorBase

void applyOp (const RTOpPack::RTOpT< Scalar > &op, const int num_vecs, const VectorBase< Scalar > *vecs[], const int num_targ_vecs, VectorBase< Scalar > *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const Index first_ele, const Index sub_dim, const Index global_offset) const
 Implements this method through the methods getSubVector(), freeSubVector() and commitSubVector().
void freeSubVector (RTOpPack::SubVectorT< Scalar > *sub_vec) const
 
void getSubVector (const Range1D &rng, RTOpPack::MutableSubVectorT< Scalar > *sub_vec)
 
void commitSubVector (RTOpPack::MutableSubVectorT< Scalar > *sub_vec)
 
void setSubVector (const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
 

Detailed Description

template<class Scalar>
class Thyra::SerialVectorBase< Scalar >

Efficient base subclass of serial vectors.

This base subclass contains the an implementation of applyOp() that relies on implementations of the methods getSubVector(), freeSubVector() and commitSubVector(). This class also contains default implementations of getSubVector(), freeSubVector() and commitSubVector().

Notes to subclass developers

All that is needed to develop a concrete subclass is to override the pure virtual functions getData(), commitData() and space() (for which a subclass of SerialVectorSpaceBase should be used).

Definition at line 55 of file Thyra_SerialVectorBaseDecl.hpp.


Constructor & Destructor Documentation

template<class Scalar>
Thyra::SerialVectorBase< Scalar >::SerialVectorBase  ) 
 

Definition at line 40 of file Thyra_SerialVectorBase.hpp.


Member Function Documentation

template<class Scalar>
virtual void Thyra::SerialVectorBase< Scalar >::getData Scalar **  values,
Index stride
[pure virtual]
 

Sets a non-const pointer to the beginning of the vector data (and its stride).

Parameters:
values [out] On output *values will point to an array of the values.
stride [out] On output *stride will be the stride between elements in (*values)[]
Preconditions:
  • values!=NULL
  • stride!=NULL

Postconditions:

  • *values!=NULL
  • *stride!=0

Note, the data view returned from this function must be committed back by a call to this->commitData() in case dynamic memory allocation had to be used and therefore the pointer returned does not point to internal storage.

Implemented in Thyra::SerialVectorStd< Scalar >.

template<class Scalar>
virtual void Thyra::SerialVectorBase< Scalar >::commitData Scalar **  values  )  [pure virtual]
 

Commits updated vector data that was accessed using this->getData().

Parameters:
values [in/out] On input *values must have been set by a previous call to this->getData(). On output *values==NULL.
Preconditions:
  • values!=NULL
  • *values!=NULL

Preconditions:

  • *this will be updated to the entries in *values.
  • *values==NULL

Implemented in Thyra::SerialVectorStd< Scalar >.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::getData const Scalar **  values,
Index stride
const [virtual]
 

Returns a const pointer to the beginning of the vector data.

Parameters:
values [out] On output *values will point to an array of the values.
stride [out] On output *stride will be the stride between elements in (*values)[]
Preconditions:
  • values!=NULL
  • stride!=NULL

Postconditions:

  • *values!=NULL
  • *stride!=0

Note, the data view returned from this function must be freed by a call to this->freeData() in case dynamic memory allocation had to be used and therefore the pointer returned does not point to internal storage.

The default implementation performs a const_cast of this and then calls the non-const version of this function. An override of this function should only be provided if dynamic memory allocation is used and data copies have to be performed. If this function is overridden then the function freeData() must be overridden as well!

Reimplemented in Thyra::SerialVectorStd< Scalar >.

Definition at line 47 of file Thyra_SerialVectorBase.hpp.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::freeData const Scalar **  values  )  const [virtual]
 

Frees a const view of vector data that was accessed using this->getData().

Parameters:
values [in/out] On input *values must have been set by a previous call to this->getData(). On output *values==NULL.
Preconditions:
  • values!=NULL
  • *values!=NULL

Postconditions:

  • *values==NULL

The default implementation performs a const_cast of this and then calls the non-const function this->commitData(). If the const version of the getData() function is overridden then this function must be overridden also.

Reimplemented in Thyra::SerialVectorStd< Scalar >.

Definition at line 53 of file Thyra_SerialVectorBase.hpp.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::applyOp const RTOpPack::RTOpT< Scalar > &  op,
const int  num_vecs,
const VectorBase< Scalar > *  vecs[],
const int  num_targ_vecs,
VectorBase< Scalar > *  targ_vecs[],
RTOpPack::ReductTarget reduct_obj,
const Index  first_ele,
const Index  sub_dim,
const Index  global_offset
const
 

Implements this method through the methods getSubVector(), freeSubVector() and commitSubVector().

Note that if this method is entered again before a call has been completed, then this is an indication that the methods getSubVector(), freeSubVector() and/or commitSubVector() have not been overridden properly.

Definition at line 61 of file Thyra_SerialVectorBase.hpp.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::freeSubVector RTOpPack::SubVectorT< Scalar > *  sub_vec  )  const
 

Definition at line 114 of file Thyra_SerialVectorBase.hpp.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::getSubVector const Range1D rng,
RTOpPack::MutableSubVectorT< Scalar > *  sub_vec
 

Definition at line 120 of file Thyra_SerialVectorBase.hpp.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::commitSubVector RTOpPack::MutableSubVectorT< Scalar > *  sub_vec  ) 
 

Definition at line 142 of file Thyra_SerialVectorBase.hpp.

template<class Scalar>
void Thyra::SerialVectorBase< Scalar >::setSubVector const RTOpPack::SparseSubVectorT< Scalar > &  sub_vec  ) 
 

Definition at line 148 of file Thyra_SerialVectorBase.hpp.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 12:39:54 2008 for Thyra ANA Operator/VectorBase Interfaces and Related Software by doxygen 1.3.9.1