Teko  Version of the Day
 All Classes Files Functions Variables Pages
Public Member Functions | Protected Attributes | Related Functions | List of all members
Teko::BlockReorderManager Class Reference

Class that describes how a flat blocked operator should be reordered. More...

#include <Teko_BlockedReordering.hpp>

Inheritance diagram for Teko::BlockReorderManager:
Inheritance graph
[legend]

Public Member Functions

virtual Teuchos::RCP
< BlockReorderManager
Copy () const
 Returns a copy of this object. More...
 
virtual void SetNumBlocks (int sz)
 Sets the number of subblocks. More...
 
virtual int GetNumBlocks () const
 Gets the number of subblocks. More...
 
virtual void SetBlock (int blockIndex, int reorder)
 Sets the sublock to a specific index value. More...
 
virtual void SetBlock (int blockIndex, const Teuchos::RCP< BlockReorderManager > &reorder)
 Set the subblock to a use a particular reorder manager. More...
 
virtual const Teuchos::RCP
< BlockReorderManager
GetBlock (int blockIndex)
 Get a particular block. If there is no block at this index location return a new one. More...
 
virtual const Teuchos::RCP
< const BlockReorderManager
GetBlock (int blockIndex) const
 Get a particular block. If there is no block at this index location return Teuchos::null More...
 
virtual std::string toString () const
 For sanities sake, print a readable string. More...
 
virtual int LargestIndex () const
 Largest index in this manager. More...
 
Constructors
 BlockReorderManager ()
 Basic empty constructor. More...
 
 BlockReorderManager (int sz)
 Set this level to have size sz. More...
 
 BlockReorderManager (const BlockReorderManager &bmm)
 Copy constructor. More...
 
virtual ~BlockReorderManager ()
 Do nothing destructor. More...
 

Protected Attributes

std::vector< Teuchos::RCP
< BlockReorderManager > > 
children_
 Definitions of the subblocks. More...
 

Related Functions

(Note that these are not member functions.)

Teuchos::RCP< const
Thyra::VectorSpaceBase< double > > 
buildReorderedVectorSpace (const BlockReorderManager &mgr, const Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > &blkSpc)
 Use the BlockReorderManager to change a flat vector space into a composite vector space. More...
 
Teuchos::RCP< const
Thyra::LinearOpBase< double > > 
buildReorderedLinearOp (const BlockReorderManager &bmm, const Teuchos::RCP< const Thyra::BlockedLinearOpBase< double > > &blkOp)
 Use the BlockReorderManager to change a flat square blocked operator into a composite operator. More...
 
Teuchos::RCP< const
Thyra::LinearOpBase< double > > 
buildReorderedLinearOp (const BlockReorderManager &rowMgr, const BlockReorderManager &colMgr, const Teuchos::RCP< const Thyra::BlockedLinearOpBase< double > > &blkOp)
 Use the BlockReorderManager to change a flat blocked operator into a composite operator. More...
 
Teuchos::RCP< const
Thyra::VectorSpaceBase< double > > 
buildReorderedVectorSpace (const BlockReorderManager &mgr, const Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > &blkSpc)
 Use the BlockReorderManager to change a flat vector space into a composite vector space. More...
 
Teuchos::RCP
< Thyra::MultiVectorBase
< double > > 
buildReorderedMultiVector (const BlockReorderManager &mgr, const Teuchos::RCP< Thyra::ProductMultiVectorBase< double > > &blkVec)
 Convert a flat multi vector into a reordered multivector. More...
 
Teuchos::RCP< const
Thyra::MultiVectorBase< double > > 
buildReorderedMultiVector (const BlockReorderManager &mgr, const Teuchos::RCP< const Thyra::ProductMultiVectorBase< double > > &blkVec)
 Convert a flat multi vector into a reordered multivector. More...
 
Teuchos::RCP
< Thyra::MultiVectorBase
< double > > 
buildFlatMultiVector (const BlockReorderManager &mgr, const Teuchos::RCP< Thyra::ProductMultiVectorBase< double > > &blkVec)
 Convert a reordered multivector into a flat multivector. More...
 
Teuchos::RCP< const
Thyra::MultiVectorBase< double > > 
buildFlatMultiVector (const BlockReorderManager &mgr, const Teuchos::RCP< const Thyra::ProductMultiVectorBase< double > > &blkVec)
 Convert a reordered multivector into a flat multivector. More...
 
Teuchos::RCP< const
BlockReorderManager
blockedReorderFromString (std::string &reorder)
 Convert a string to a block reorder manager object. More...
 

Detailed Description

Class that describes how a flat blocked operator should be reordered.

Class that describes how a flat blocked operator should be reordered. The semenatics are very similar to a Teuchos::ParameterList. Each level expects you to set the size of the level and define what each subblock is. For example, to change the blocked 3x3 matrix from

$ Z = \left[\begin{array}{ccc} A & B & C \\ D & E & F \\ G & H & I \end{array}\right]$

to

$ Z' = \left[\begin{array}{cc} \left[\begin{array}{cc} A & B \\ D & E \end{array}\right] & \left[\begin{array}{c} C \\ F \end{array}\right] \\ \left[\begin{array}{cc} G & H \end{array}\right] & I \end{array}\right]$

the algorithm to build the appropriate block manager is

RCP<BlockReorderManager> bmm = rcp(new BlockReorderManager(2));
bmm->GetBlock(0)->SetNumBlocks(2);
bmm->GetBlock(0)->SetBlock(0,0);
bmm->GetBlock(0)->SetBlock(1,1);
bmm->SetBlock(1,2);

Suppose now you want to take your $Z$ operator and build $Z'$. The relevant code is

BlockedLinearOp Z = ...
LinearOp Zprime = buildReorderedLinearOp(*bmm,Z);

Definition at line 109 of file Teko_BlockedReordering.hpp.

Constructor & Destructor Documentation

Teko::BlockReorderManager::BlockReorderManager ( )
inline

Basic empty constructor.

Definition at line 115 of file Teko_BlockedReordering.hpp.

Teko::BlockReorderManager::BlockReorderManager ( int  sz)
inline

Set this level to have size sz.

Definition at line 118 of file Teko_BlockedReordering.hpp.

Teko::BlockReorderManager::BlockReorderManager ( const BlockReorderManager bmm)
inline

Copy constructor.

Definition at line 121 of file Teko_BlockedReordering.hpp.

virtual Teko::BlockReorderManager::~BlockReorderManager ( )
inlinevirtual

Do nothing destructor.

Definition at line 126 of file Teko_BlockedReordering.hpp.

Member Function Documentation

virtual Teuchos::RCP<BlockReorderManager> Teko::BlockReorderManager::Copy ( ) const
inlinevirtual

Returns a copy of this object.

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 131 of file Teko_BlockedReordering.hpp.

virtual void Teko::BlockReorderManager::SetNumBlocks ( int  sz)
inlinevirtual

Sets the number of subblocks.

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 135 of file Teko_BlockedReordering.hpp.

virtual int Teko::BlockReorderManager::GetNumBlocks ( ) const
inlinevirtual

Gets the number of subblocks.

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 139 of file Teko_BlockedReordering.hpp.

void Teko::BlockReorderManager::SetBlock ( int  blockIndex,
int  reorder 
)
virtual

Sets the sublock to a specific index value.

Sets the sublock to a specific index value

Parameters
[in]blockIndexSubblock to be set
[in]reorderThe value of the index in this subblock
Precondition
blockIndex<this->GetNumBlocks()

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 69 of file Teko_BlockedReordering.cpp.

virtual void Teko::BlockReorderManager::SetBlock ( int  blockIndex,
const Teuchos::RCP< BlockReorderManager > &  reorder 
)
virtual

Set the subblock to a use a particular reorder manager.

Set the subblock to a use a particular reorder manager. This facilitates recursive construction algorithms where the base case is not differentiated.

Parameters
[in]blockIndexSubblock to be set
[in]reorderReorder manager to be used in this block
Precondition
blockIndex<this->GetNumBlocks()
const Teuchos::RCP< BlockReorderManager > Teko::BlockReorderManager::GetBlock ( int  blockIndex)
virtual

Get a particular block. If there is no block at this index location return a new one.

Get a particular block. If there is no block at this index location return a new one.

Parameters
[in]blockIndexThe index queried.
Returns
A pointer to the BlockReorderManager object at this location, or if there is none, a new BlockReorderManager is created and returned.
Precondition
blockIndex<this->GetNumBlocks()
Postcondition
return value is not null

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 97 of file Teko_BlockedReordering.cpp.

const Teuchos::RCP< const BlockReorderManager > Teko::BlockReorderManager::GetBlock ( int  blockIndex) const
virtual

Get a particular block. If there is no block at this index location return Teuchos::null

Get a particular block. If there is no block at this index location return Teuchos::null

Parameters
[in]blockIndexThe index queried.
Returns
A pointer to the BlockReorderManager object at this location, or if there is none Teuchos::null is returned.
Precondition
blockIndex<this->GetNumBlocks()

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 107 of file Teko_BlockedReordering.cpp.

std::string Teko::BlockReorderManager::toString ( ) const
virtual

For sanities sake, print a readable string.

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 114 of file Teko_BlockedReordering.cpp.

int Teko::BlockReorderManager::LargestIndex ( ) const
virtual

Largest index in this manager.

Reimplemented in Teko::BlockReorderLeaf.

Definition at line 130 of file Teko_BlockedReordering.cpp.

Friends And Related Function Documentation

Teuchos::RCP< const Thyra::VectorSpaceBase< double > > buildReorderedVectorSpace ( const BlockReorderManager mgr,
const Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > &  blkSpc 
)
related

Use the BlockReorderManager to change a flat vector space into a composite vector space.

Use the BlockReorderManager to chanage a flat vector space a more complex composite structure. The manager should not have any indicies larger then the size of the blocked operator.

Parameters
[in]mgrBlockReorderManager that specifies how the space is to be restructured.
[in]blkSpcThe block space to be reordered and restructured. Only the first level of the space will be considered. Each subspace (even if it is itself blocked) will be handed as an individual space.
Returns
The reordered blocked vector space.
Precondition
The largest index in bmm is smaller then the dimension of the blkSpc.

Definition at line 261 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< const Thyra::LinearOpBase< double > > buildReorderedLinearOp ( const BlockReorderManager bmm,
const Teuchos::RCP< const Thyra::BlockedLinearOpBase< double > > &  blkOp 
)
related

Use the BlockReorderManager to change a flat square blocked operator into a composite operator.

Use the BlockReorderManager to chanage a flat square blocked operator into a more complex composite structure. The manager should not have any indicies larger then the size of the blocked operator.

Parameters
[in]bmmBlockReorderManager that specifies how the blocked operator is to be restructured.
[in]blkOpThe block operator to be reordered and restructured. Only the first level of the operator will be considered. Each subblock (even if it is itself blocked) will be handed as an individual operator.
Returns
The reordered blocked linear operator.
Precondition
The largest index in bmm is smaller then the dimension of the blkOp.
The opertor is square.

Definition at line 145 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< const Thyra::LinearOpBase< double > > buildReorderedLinearOp ( const BlockReorderManager rowMgr,
const BlockReorderManager colMgr,
const Teuchos::RCP< const Thyra::BlockedLinearOpBase< double > > &  blkOp 
)
related

Use the BlockReorderManager to change a flat blocked operator into a composite operator.

Use the BlockReorderManager to chanage a flat square blocked operator into a more complex composite structure. The manager should not have any indicies larger then the size of the blocked operator.

Parameters
[in]rowMgrBlockReorderManager that specifies how the rows are to be restructured.
[in]colMgrBlockReorderManager that specifies how the columns are to be restructured.
[in]blkOpThe block operator to be reordered and restructured. Only the first level of the operator will be considered. Each subblock (even if it is itself blocked) will be handed as an individual operator.
Returns
The reordered blocked linear operator.
Precondition
The largest index in bmm is smaller then the dimension of the blkOp.

Definition at line 152 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< const Thyra::VectorSpaceBase< double > > buildReorderedVectorSpace ( const BlockReorderManager mgr,
const Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > &  blkSpc 
)
related

Use the BlockReorderManager to change a flat vector space into a composite vector space.

Use the BlockReorderManager to chanage a flat vector space a more complex composite structure. The manager should not have any indicies larger then the size of the blocked operator.

Parameters
[in]mgrBlockReorderManager that specifies how the space is to be restructured.
[in]blkSpcThe block space to be reordered and restructured. Only the first level of the space will be considered. Each subspace (even if it is itself blocked) will be handed as an individual space.
Returns
The reordered blocked vector space.
Precondition
The largest index in bmm is smaller then the dimension of the blkSpc.
Teuchos::RCP< Thyra::MultiVectorBase< double > > buildReorderedMultiVector ( const BlockReorderManager mgr,
const Teuchos::RCP< Thyra::ProductMultiVectorBase< double > > &  blkVec 
)
related

Convert a flat multi vector into a reordered multivector.

Convert a flat multi vector into a reordered multivector.

Parameters
[in]mgrBlock manager describing the reordered multivector.
[in]blkVecThe flat multivector.
Returns
A reordered multivector structured to be consistent with mgr.

Definition at line 301 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< const Thyra::MultiVectorBase< double > > buildReorderedMultiVector ( const BlockReorderManager mgr,
const Teuchos::RCP< const Thyra::ProductMultiVectorBase< double > > &  blkVec 
)
related

Convert a flat multi vector into a reordered multivector.

Convert a flat multi vector into a reordered multivector.

Parameters
[in]mgrBlock manager describing the reordered multivector.
[in]blkVecThe flat multivector.
Returns
A reordered multivector structured to be consistent with mgr.

Definition at line 344 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< Thyra::MultiVectorBase< double > > buildFlatMultiVector ( const BlockReorderManager mgr,
const Teuchos::RCP< Thyra::ProductMultiVectorBase< double > > &  blkVec 
)
related

Convert a reordered multivector into a flat multivector.

Convert a reordered multivector into a flat multivector.

Parameters
[in]mgrBlock manager describing the reordered multivector.
[in]blkVecThe reordered multivector structured in a way that is consistent with by mgr
Returns
A flattened multivector.

Definition at line 451 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< const Thyra::MultiVectorBase< double > > buildFlatMultiVector ( const BlockReorderManager mgr,
const Teuchos::RCP< const Thyra::ProductMultiVectorBase< double > > &  blkVec 
)
related

Convert a reordered multivector into a flat multivector.

Convert a reordered multivector into a flat multivector.

Parameters
[in]mgrBlock manager describing the reordered multivector.
[in]blkVecThe reordered multivector structured in a way that is consistent with by mgr
Returns
A flattened multivector.

Definition at line 475 of file Teko_BlockedReordering.cpp.

Teuchos::RCP< const BlockReorderManager > blockedReorderFromString ( std::string &  reorder)
related

Convert a string to a block reorder manager object.

Convert a string to a block reorder manager object. These strings have numbers delimted by [,]. For example, the string "[[2 1] 0]" will give a manager with [2 1] in the first block and 0 in the second block.

Parameters
[in]reorderBlock structure corresponding to the manager
Returns
A block reorder manager with the requested structure

Definition at line 683 of file Teko_BlockedReordering.cpp.

Member Data Documentation

std::vector<Teuchos::RCP<BlockReorderManager> > Teko::BlockReorderManager::children_
protected

Definitions of the subblocks.

Definition at line 207 of file Teko_BlockedReordering.hpp.


The documentation for this class was generated from the following files: