AbstractLinAlgPack::VectorSpaceBlocked Class Reference

VectorSpace subclass for the composite of one or more VectorSpace objects. More...

#include <AbstractLinAlgPack_VectorSpaceBlocked.hpp>

Inheritance diagram for AbstractLinAlgPack::VectorSpaceBlocked:

Inheritance graph
[legend]
List of all members.

Overridden from VectorSpace

bool is_compatible (const VectorSpace &vec_space) const
 Returns true if same type and has compatible vector spaces.
index_type dim () const
 
space_fcty_ptr_t small_vec_spc_fcty () const
 
vec_mut_ptr_t create_member () const
 
multi_vec_mut_ptr_t create_members (size_type num_vecs) const
 
space_ptr_t clone () const
 
space_ptr_t sub_space (const Range1D &rng) const
 

Public Member Functions

 VectorSpaceBlocked (const VectorSpace::space_ptr_t vector_spaces[], int num_vector_spaces, const VectorSpace::space_fcty_ptr_t &small_vec_spc_fcty=Teuchos::null)
 Construct the vector space object.
void initialize (const VectorSpace::space_ptr_t vec_spaces[], int num_vector_spaces, const VectorSpace::space_fcty_ptr_t &small_vec_spc_fcty=Teuchos::null)
 Initialize with a set of vector space objects.
int num_vector_spaces () const
 Return the value of num_vec_spaces passed to this->initialize().
const VectorSpace::space_ptr_tvector_spaces () const
 
const index_typevector_spaces_offsets () const
 Returns array (length this->num_vector_spaces() + 1) of offsets for each constitient vector space in the composite vector.
void get_vector_space_position (index_type i, int *kth_vector_space, index_type *kth_global_offset) const
 Get the position of the vector space object and its offset into the composite vector of the vector space object that owns the ith index in the composite vector.

Detailed Description

VectorSpace subclass for the composite of one or more VectorSpace objects.

This subclass allows VectorSpace objects to be built out of one or more other vector space objects. This is essentially the product of vector spaces. The specific type of vector created by a VectorSpaceBlocked object is of type VectorMutableBlocked but the client need not ever know this or deal with this type directly.

For example, suppose you have p vector spaces V[k] for k = 0...p-1 and want to form a concatenated vector space Z containing all of these vector spaces stacked on top of each other to form:

     [ V[0]   ]
 Z = [ V[1]   ]
     [ .      ]
     [ V[p-1] ]
 
Such a vector space can be constructed as shown if the following function:
 void f( const VectorSpace::space_ptr_t V[], int p, VectorSpaceBlocked* Z )
 {
     Z->initialize( V, p );
 }
Once a VectorSpaceBlocked object is initialized, it can be used just like any other VectorSpace object. The method create_member() will create VectorWithOpMutableCompoisteStd objects containing members from the constitient vector spaces.

There are several methods that can be used by clients that need to work with the individual constituent vector spaces. The method num_vector_spaces() give the number of constitient vector spaces while vector_spaces() returns an array of the constitient vector spaces passed to initialize(). Some other useful utility methods are also defined. The method vector_spaces_offsets() returns an array that gives the offset of each constitient vector in the overall composite vector. For example, the ith (zero based) vector space this->vector_spaces()[i] owns the element indexes this->vector_spaces_offsets()[i]+1 to this->vector_spaces_offsets()[i+1]. Determining which constitient vector space owns a element index can be determined by calling get_vector_space_position().

The default assignment operator is allowed since it has the correct semantics. The default copy constructor is also allowed but only performs a shallow copy of the constituent vector space objects. If you want to copy the constituent vector space objects also you need to use the clone() method. The default constructor is not allowed (declared private) to avoid accidents.

Definition at line 86 of file AbstractLinAlgPack_VectorSpaceBlocked.hpp.


Constructor & Destructor Documentation

AbstractLinAlgPack::VectorSpaceBlocked::VectorSpaceBlocked ( const VectorSpace::space_ptr_t  vector_spaces[],
int  num_vector_spaces,
const VectorSpace::space_fcty_ptr_t small_vec_spc_fcty = Teuchos::null 
)

Construct the vector space object.

Calls this->initialize().

Definition at line 43 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.


Member Function Documentation

void AbstractLinAlgPack::VectorSpaceBlocked::initialize ( const VectorSpace::space_ptr_t  vec_spaces[],
int  num_vector_spaces,
const VectorSpace::space_fcty_ptr_t small_vec_spc_fcty = Teuchos::null 
)

Initialize with a set of vector space objects.

Postconditions:

Parameters:
vector_spaces [in] Array (length num_vector_spaces) that give the vector space objects that compose this composite vector space. The quantity vector_spaces[i].get(), for i = 0...num_vector_spaces-1 gives the ith vector_space object. vector_spaces an be NULL if num_vector_spaces == 0.
num_vector_spaces [in] Number of constitient vector spaces. Can be zero (empty vector space).
small_vec_spc_fcty [in] Defines the vector space factory returned by this->small_vec_spc_fcty()

Definition at line 52 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

int AbstractLinAlgPack::VectorSpaceBlocked::num_vector_spaces (  )  const [inline]

Return the value of num_vec_spaces passed to this->initialize().

Definition at line 231 of file AbstractLinAlgPack_VectorSpaceBlocked.hpp.

const VectorSpace::space_ptr_t* AbstractLinAlgPack::VectorSpaceBlocked::vector_spaces (  )  const

const index_type * AbstractLinAlgPack::VectorSpaceBlocked::vector_spaces_offsets (  )  const [inline]

Returns array (length this->num_vector_spaces() + 1) of offsets for each constitient vector space in the composite vector.

Definition at line 244 of file AbstractLinAlgPack_VectorSpaceBlocked.hpp.

void AbstractLinAlgPack::VectorSpaceBlocked::get_vector_space_position ( index_type  i,
int *  kth_vector_space,
index_type kth_global_offset 
) const

Get the position of the vector space object and its offset into the composite vector of the vector space object that owns the ith index in the composite vector.

Preconditions:

Postconditions:

Parameters:
i [in] The index of the element to find the vector space object for.
kth_vector_space [out] The index for this->vector_spaces()[kth_vector_space] that owns the element i.
kth_global_offset [out] The global offset for this->vector_spaces()[kth_vector_space] in the composite vector.

Definition at line 67 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

bool AbstractLinAlgPack::VectorSpaceBlocked::is_compatible ( const VectorSpace vec_space  )  const [virtual]

Returns true if same type and has compatible vector spaces.

This method will only return true if all of the following are true:

Otherwise, this method will return false.

Implements AbstractLinAlgPack::VectorSpace.

Definition at line 95 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

index_type AbstractLinAlgPack::VectorSpaceBlocked::dim (  )  const [virtual]

Implements AbstractLinAlgPack::VectorSpace.

Definition at line 109 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

space_fcty_ptr_t AbstractLinAlgPack::VectorSpaceBlocked::small_vec_spc_fcty (  )  const [virtual]

Reimplemented from AbstractLinAlgPack::VectorSpace.

VectorSpace::vec_mut_ptr_t AbstractLinAlgPack::VectorSpaceBlocked::create_member (  )  const [virtual]

Implements AbstractLinAlgPack::VectorSpace.

Definition at line 121 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

VectorSpace::multi_vec_mut_ptr_t AbstractLinAlgPack::VectorSpaceBlocked::create_members ( size_type  num_vecs  )  const [virtual]

Reimplemented from AbstractLinAlgPack::VectorSpace.

Definition at line 143 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

VectorSpace::space_ptr_t AbstractLinAlgPack::VectorSpaceBlocked::clone (  )  const [virtual]

Implements AbstractLinAlgPack::VectorSpace.

Definition at line 150 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.

VectorSpace::space_ptr_t AbstractLinAlgPack::VectorSpaceBlocked::sub_space ( const Range1D rng  )  const [virtual]

Reimplemented from AbstractLinAlgPack::VectorSpace.

Definition at line 156 of file AbstractLinAlgPack_VectorSpaceBlocked.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 13 09:29:04 2010 for AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects by  doxygen 1.4.7