25class BlockMultiVector {
29 typedef BlockMultiVector<SC,LO,GO,NO> BlockMultiVector_Type;
30 typedef Teuchos::RCP<BlockMultiVector_Type> BlockMultiVectorPtr_Type;
31 typedef Teuchos::RCP<const BlockMultiVector_Type> BlockMultiVectorConstPtr_Type;
34 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
35 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorConstPtr_Type;
37 typedef typename MultiVector_Type::Map_Type Map_Type;
38 typedef typename MultiVector_Type::MapPtr_Type MapPtr_Type;
39 typedef typename MultiVector_Type::MapConstPtr_Type MapConstPtr_Type;
41 typedef typename MultiVector_Type::Comm_Type Comm_Type;
42 typedef typename MultiVector_Type::CommConstPtr_Type CommConstPtr_Type;
45 typedef Teuchos::RCP<BlockMap_Type> BlockMapPtr_Type;
46 typedef Teuchos::RCP<const BlockMap_Type> BlockMapConstPtr_Type;
50 BlockMultiVector(UN size);
52 BlockMultiVector( BlockMultiVectorPtr_Type bMVIn);
54 BlockMultiVector( std::vector<MapConstPtr_Type>& maps,
int numMV = 1 );
56 BlockMultiVector( BlockMapConstPtr_Type blockMap,
int numMV = 1 );
60 BlockMultiVector_Type& operator= (
const BlockMultiVector_Type& rhs) {
61 TEUCHOS_TEST_FOR_EXCEPTION( size() != rhs.size(), std::logic_error,
"BlockMultiVector sizes are not equal for deep copy.");
62 for (
int i=0; i<size(); i++) {
63 *blockMultiVector_[i] = *rhs[i];
68 MultiVectorPtr_Type operator[] (
int i)
const{
69 TEUCHOS_TEST_FOR_EXCEPTION( i > size()-1, std::logic_error,
"The requested MultiVector does not exist in BlockMultiVector.");
70 return blockMultiVector_[i];
73 void resize( UN size );
75 void buildFromMaps( std::vector<MapConstPtr_Type>& maps,
int numMV );
77 void buildFromBlockMap( BlockMapConstPtr_Type blockMap,
int numMV );
81 void mergeBlock(UN block);
85 void splitBlock(UN block);
87 void determineLocalOffsets();
89 void determineGlobalOffsets();
91 void setMergedVector( MultiVectorPtr_Type& mv );
95 UN getNumVectors()
const;
97 void addBlock(
const MultiVectorPtr_Type& multiVector,
int i);
99 MultiVectorConstPtr_Type getBlock(
int i)
const;
101 MultiVectorPtr_Type getBlockNonConst(
int i);
103 Teuchos::RCP< Thyra::MultiVectorBase<SC> > getThyraMultiVector( );
105 Teuchos::RCP<const Thyra::MultiVectorBase<SC> > getThyraMultiVectorConst( );
107 Teuchos::RCP< Thyra::ProductMultiVectorBase<SC> > getProdThyraMultiVector( );
109 Teuchos::RCP<const Thyra::ProductMultiVectorBase<SC> > getThyraProdMultiVectorConst( )
const;
111 void fromThyraMultiVector( Teuchos::RCP< Thyra::MultiVectorBase<SC> > thyraMV);
113 void fromThyraProdMultiVector( Teuchos::RCP< Thyra::ProductMultiVectorBase<SC> > thyraMV);
115 void norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<SC>::magnitudeType> &norms)
const;
117 void normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<SC>::magnitudeType> &norms)
const;
119 void dot(BlockMultiVectorConstPtr_Type a,
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<SC>::magnitudeType> &dots) ;
121 void update(
const SC& alpha,
const BlockMultiVector_Type& A,
const SC& beta );
123 void update(
const SC& alpha,
const BlockMultiVector_Type& A,
const SC& beta ,
const BlockMultiVector_Type& B,
const SC& gamma);
125 BlockMultiVectorPtr_Type sumColumns()
const;
128 void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB,
const SC &alpha, BlockMultiVectorConstPtr_Type &A, BlockMultiVectorConstPtr_Type &B,
const SC &beta);
130 void putScalar(
const SC& alpha );
132 void scale(
const SC& alpha );
134 void writeMM(std::string fN =
"blockMV")
const;
136 void print(Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_EXTREME);
138 BlockMapConstPtr_Type getMap()
const;
140 MultiVectorConstPtr_Type getMergedVector();
144 Teuchos::Array<MultiVectorPtr_Type> blockMultiVector_;
145 BlockMapPtr_Type blockMap_;
146 MultiVectorPtr_Type mergedMultiVector_;
147 MapPtr_Type mergedMap_;
148 Teuchos::ArrayRCP<LO> localBlockOffsets_;
149 Teuchos::ArrayRCP<GO> globalBlockOffsets_;