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 #ifndef THYRA_MPI_VECTOR_STD_HPP
00030 #define THYRA_MPI_VECTOR_STD_HPP
00031
00032 #include "Thyra_MPIVectorStdDecl.hpp"
00033 #include "Thyra_MPIVectorBase.hpp"
00034 #include "Thyra_MPIVectorSpaceBase.hpp"
00035
00036 namespace Thyra {
00037
00038
00039
00040 template<class Scalar>
00041 MPIVectorStd<Scalar>::MPIVectorStd()
00042 :stride_(0)
00043 {}
00044
00045 template<class Scalar>
00046 MPIVectorStd<Scalar>::MPIVectorStd(
00047 const Teuchos::RefCountPtr<const MPIVectorSpaceBase<Scalar> > &mpiSpace
00048 ,const Teuchos::RefCountPtr<Scalar> &localValues
00049 ,const Index stride
00050 )
00051 {
00052 initialize(mpiSpace,localValues,stride);
00053 }
00054
00055 template<class Scalar>
00056 void MPIVectorStd<Scalar>::initialize(
00057 const Teuchos::RefCountPtr<const MPIVectorSpaceBase<Scalar> > &mpiSpace
00058 ,const Teuchos::RefCountPtr<Scalar> &localValues
00059 ,const Index stride
00060 )
00061 {
00062 #ifdef _DEBUG
00063 TEST_FOR_EXCEPT(mpiSpace.get()==NULL);
00064 TEST_FOR_EXCEPT(localValues.get()==NULL);
00065 TEST_FOR_EXCEPT(stride==0);
00066 #endif
00067 mpiSpace_ = mpiSpace;
00068 localValues_ = localValues;
00069 stride_ = stride;
00070 this->updateMpiSpace();
00071 }
00072
00073 template<class Scalar>
00074 void MPIVectorStd<Scalar>::uninitialize(
00075 Teuchos::RefCountPtr<const MPIVectorSpaceBase<Scalar> > *mpiSpace
00076 ,Teuchos::RefCountPtr<Scalar> *localValues
00077 ,Index *stride
00078 )
00079 {
00080 if(mpiSpace) *mpiSpace = mpiSpace_;
00081 if(localValues) *localValues = localValues_;
00082 if(stride) *stride = stride_;
00083
00084 mpiSpace_ = Teuchos::null;
00085 localValues_ = Teuchos::null;
00086 stride_ = 0;
00087
00088 this->updateMpiSpace();
00089 }
00090
00091
00092
00093 template<class Scalar>
00094 std::string MPIVectorStd<Scalar>::description() const
00095 {
00096 return (std::string("MPIVectorStd<") + Teuchos::ScalarTraits<Scalar>::name() + std::string(">"));
00097 }
00098
00099
00100
00101 template<class Scalar>
00102 Teuchos::RefCountPtr<const MPIVectorSpaceBase<Scalar> >
00103 MPIVectorStd<Scalar>::mpiSpace() const
00104 {
00105 return mpiSpace_;
00106 }
00107
00108 template<class Scalar>
00109 void MPIVectorStd<Scalar>::getLocalData( Scalar** localValues, Index* stride )
00110 {
00111 #ifdef _DEBUG
00112 TEST_FOR_EXCEPT( localValues==NULL );
00113 TEST_FOR_EXCEPT( stride==NULL );
00114 #endif
00115 *localValues = &*localValues_;
00116 *stride = stride_;
00117 }
00118
00119 template<class Scalar>
00120 void MPIVectorStd<Scalar>::commitLocalData( Scalar* localValues )
00121 {
00122 #ifdef _DEBUG
00123 TEST_FOR_EXCEPT( localValues!=&*localValues_ );
00124 #endif
00125
00126 }
00127
00128 template<class Scalar>
00129 void MPIVectorStd<Scalar>::getLocalData( const Scalar** localValues, Index* stride ) const
00130 {
00131 #ifdef _DEBUG
00132 TEST_FOR_EXCEPT( localValues==NULL );
00133 TEST_FOR_EXCEPT( stride==NULL );
00134 #endif
00135 *localValues = &*localValues_;
00136 *stride = stride_;
00137 }
00138
00139 template<class Scalar>
00140 void MPIVectorStd<Scalar>::freeLocalData( const Scalar* localValues ) const
00141 {
00142 #ifdef _DEBUG
00143 TEST_FOR_EXCEPT( localValues!=&*localValues_ );
00144 #endif
00145
00146 }
00147
00148 }
00149
00150 #endif // THYRA_MPI_VECTOR_STD_HPP