|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Thyra: Interfaces and Support for Abstract Numerical Algorithms 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef THYRA_SPMD_VECTOR_BASE_DECL_HPP 00030 #define THYRA_SPMD_VECTOR_BASE_DECL_HPP 00031 00032 00033 #include "Thyra_VectorDefaultBase.hpp" 00034 #include "Thyra_SpmdVectorSpaceDefaultBase_decl.hpp" 00035 00036 00037 //#define THYRA_SPMD_VECTOR_BASE_DUMP 00038 00039 00040 namespace Thyra { 00041 00042 00104 template<class Scalar> 00105 class SpmdVectorBase : virtual public VectorDefaultBase<Scalar> { 00106 public: 00107 00110 00112 SpmdVectorBase(); 00113 00116 virtual Teuchos::RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const = 0; 00117 00122 RTOpPack::SubVectorView<Scalar> getNonconstLocalSubVector(); 00123 00128 RTOpPack::ConstSubVectorView<Scalar> getLocalSubVector() const; 00129 00147 void getNonconstLocalData(const Ptr<ArrayRCP<Scalar> > &localValues) 00148 { this->getNonconstLocalDataImpl(localValues); } 00149 00167 void getLocalData(const Ptr<ArrayRCP<const Scalar> > &localValues) const 00168 { this->getLocalDataImpl(localValues); } 00169 00171 00177 virtual void applyOpImplWithComm( 00178 const Ptr<const Teuchos::Comm<Ordinal> > &comm, 00179 const RTOpPack::RTOpT<Scalar> &op, 00180 const ArrayView<const Ptr<const VectorBase<Scalar> > > &vecs, 00181 const ArrayView<const Ptr<VectorBase<Scalar> > > &targ_vecs, 00182 const Ptr<RTOpPack::ReductTarget> &reduct_obj, 00183 const Ordinal global_offset 00184 ) const; 00185 00187 00191 std::string description() const; 00193 00196 00198 Teuchos::RCP<const VectorSpaceBase<Scalar> > space() const; 00199 00201 00204 00206 THYRA_DEPRECATED void getLocalData( Scalar** localValues, Ordinal* stride ); 00208 THYRA_DEPRECATED void commitLocalData( Scalar* localValues ); 00210 THYRA_DEPRECATED void getLocalData( const Scalar** localValues, Ordinal* stride ) const; 00212 THYRA_DEPRECATED void freeLocalData( const Scalar* localValues ) const; 00213 00215 00216 protected: 00217 00220 00222 virtual void getNonconstLocalDataImpl( 00223 const Ptr<ArrayRCP<Scalar> > &localValues) = 0; 00224 00226 virtual void getLocalDataImpl( 00227 const Ptr<ArrayRCP<const Scalar> > &localValues) const = 0; 00228 00230 00233 00235 void applyOpImpl( 00236 const RTOpPack::RTOpT<Scalar> &op, 00237 const ArrayView<const Ptr<const VectorBase<Scalar> > > &vecs, 00238 const ArrayView<const Ptr<VectorBase<Scalar> > > &targ_vecs, 00239 const Ptr<RTOpPack::ReductTarget> &reduct_obj, 00240 const Ordinal global_offset 00241 ) const; 00243 void acquireDetachedVectorViewImpl( 00244 const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec 00245 ) const; 00247 void releaseDetachedVectorViewImpl( 00248 RTOpPack::ConstSubVectorView<Scalar>* sub_vec 00249 ) const; 00251 void acquireNonconstDetachedVectorViewImpl( 00252 const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec 00253 ); 00255 void commitNonconstDetachedVectorViewImpl( 00256 RTOpPack::SubVectorView<Scalar>* sub_vec 00257 ); 00258 00260 00263 00267 virtual void updateSpmdSpace(); 00268 00270 00271 private: 00272 00273 // /////////////////////////////////////// 00274 // Private data members 00275 00276 mutable bool in_applyOpImpl_; 00277 00278 // Cached (only on vector space!) 00279 mutable Ordinal globalDim_; 00280 mutable Ordinal localOffset_; 00281 mutable Ordinal localSubDim_; 00282 00283 // ///////////////////////////////////// 00284 // Private member functions 00285 00286 Range1D validateRange( const Range1D& rng_in ) const; 00287 00288 #ifdef THYRA_SPMD_VECTOR_BASE_DUMP 00289 public: 00290 static bool show_dump; 00291 #endif // THYRA_SPMD_VECTOR_BASE_DUMP 00292 00293 }; // end class SpmdVectorBase 00294 00295 00296 } // end namespace Thyra 00297 00298 00299 #endif // THYRA_SPMD_VECTOR_BASE_DECL_HPP
1.7.4