00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "Thyra_MultiVectorBase.hpp"
00030
00031 #ifndef THYRA_EXPLICIT_MULTI_VECTOR_VIEW_HPP
00032 #define THYRA_EXPLICIT_MULTI_VECTOR_VIEW_HPP
00033
00034 namespace Thyra {
00035
00040 template<class Scalar>
00041 class ConstDetachedMultiVectorView {
00042 public:
00044 ConstDetachedMultiVectorView(
00045 const MultiVectorBase<Scalar>& mv, const Range1D &rowRng = Range1D(), const Range1D &colRng = Range1D()
00046 )
00047 : mv_(mv) { mv_.acquireDetachedView(rowRng,colRng,&smv_); }
00049 ~ConstDetachedMultiVectorView() { mv_.releaseDetachedView(&smv_); }
00051 const RTOpPack::ConstSubMultiVectorView<Scalar>& smv() const { return smv_; }
00053 Teuchos_Index globalOffset() const { return smv_.globalOffset(); }
00055 Teuchos_Index subDim() const { return smv_.subDim(); }
00057 Teuchos_Index colOffset() const { return smv_.colOffset(); }
00059 Teuchos_Index numSubCols() const { return smv_.numSubCols(); }
00061 const Scalar* values() const { return smv_.values(); }
00063 Teuchos_Index leadingDim() const { return smv_.leadingDim(); }
00065 const Scalar& operator()(Teuchos_Index i,Teuchos_Index j) const { return smv_(i,j); }
00066 private:
00067 const MultiVectorBase<Scalar> &mv_;
00068 RTOpPack::ConstSubMultiVectorView<Scalar> smv_;
00069
00070 ConstDetachedMultiVectorView();
00071 ConstDetachedMultiVectorView(const ConstDetachedMultiVectorView<Scalar>&);
00072 ConstDetachedMultiVectorView<Scalar>& operator==(const ConstDetachedMultiVectorView<Scalar>&);
00073 };
00074
00079 template<class Scalar>
00080 class DetachedMultiVectorView {
00081 public:
00083 DetachedMultiVectorView(
00084 MultiVectorBase<Scalar>& mv, const Range1D &rowRng = Range1D(), const Range1D &colRng = Range1D()
00085 )
00086 : mv_(mv) { mv_.acquireDetachedView(rowRng,colRng,&smv_); }
00088 ~DetachedMultiVectorView() { mv_.commitDetachedView(&smv_); }
00090 const RTOpPack::SubMultiVectorView<Scalar>& smv() const { return smv_; }
00092 Teuchos_Index globalOffset() const { return smv_.globalOffset(); }
00094 Teuchos_Index subDim() const { return smv_.subDim(); }
00096 Teuchos_Index colOffset() const { return smv_.colOffset(); }
00098 Teuchos_Index numSubCols() const { return smv_.numSubCols(); }
00100 Scalar* values() const { return smv_.values(); }
00102 Teuchos_Index leadingDim() const { return smv_.leadingDim(); }
00104 Scalar& operator()(Teuchos_Index i,Teuchos_Index j) { return smv_(i,j); }
00105 private:
00106 MultiVectorBase<Scalar> &mv_;
00107 RTOpPack::SubMultiVectorView<Scalar> smv_;
00108
00109 DetachedMultiVectorView();
00110 DetachedMultiVectorView(const DetachedMultiVectorView<Scalar>&);
00111 DetachedMultiVectorView<Scalar>& operator==(const DetachedMultiVectorView<Scalar>&);
00112 };
00113
00114 }
00115
00116 #endif // THYRA_EXPLICIT_MULTI_VECTOR_VIEW_HPP