|
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_MULTI_VECTOR_DEFAULT_BASE_DECL_HPP 00030 #define THYRA_MULTI_VECTOR_DEFAULT_BASE_DECL_HPP 00031 00032 #include "Thyra_MultiVectorBase.hpp" 00033 #include "Thyra_LinearOpDefaultBase_decl.hpp" 00034 00035 00036 namespace Thyra { 00037 00038 00056 template<class Scalar> 00057 class MultiVectorDefaultBase 00058 : virtual public MultiVectorBase<Scalar> 00059 , virtual protected LinearOpDefaultBase<Scalar> 00060 { 00061 public: 00062 00065 00074 virtual RCP<MultiVectorBase<Scalar> > clone_mv() const; 00075 00077 00078 protected: 00079 00082 00084 RCP<const MultiVectorBase<Scalar> > 00085 contigSubViewImpl( const Range1D& colRng ) const; 00086 00088 RCP<MultiVectorBase<Scalar> > 00089 nonconstContigSubViewImpl( const Range1D& colRng ); 00090 00092 RCP<const MultiVectorBase<Scalar> > 00093 nonContigSubViewImpl( const ArrayView<const int> &cols ) const; 00094 00096 RCP<MultiVectorBase<Scalar> > 00097 nonconstNonContigSubViewImpl( const ArrayView<const int> &cols ); 00098 00104 virtual void mvMultiReductApplyOpImpl( 00105 const RTOpPack::RTOpT<Scalar> &primary_op, 00106 const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs, 00107 const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs, 00108 const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs, 00109 const Ordinal primary_global_offset 00110 ) const; 00111 00117 virtual void mvSingleReductApplyOpImpl( 00118 const RTOpPack::RTOpT<Scalar> &primary_op, 00119 const RTOpPack::RTOpT<Scalar> &secondary_op, 00120 const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs, 00121 const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs, 00122 const Ptr<RTOpPack::ReductTarget> &reduct_obj, 00123 const Ordinal primary_global_offset 00124 ) const; 00125 00141 virtual void acquireDetachedMultiVectorViewImpl( 00142 const Range1D &rowRng, 00143 const Range1D &colRng, 00144 RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv 00145 ) const; 00146 00153 virtual void releaseDetachedMultiVectorViewImpl( 00154 RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv 00155 ) const; 00156 00172 virtual void acquireNonconstDetachedMultiVectorViewImpl( 00173 const Range1D &rowRng, 00174 const Range1D &colRng, 00175 RTOpPack::SubMultiVectorView<Scalar> *sub_mv 00176 ); 00177 00184 virtual void commitNonconstDetachedMultiVectorViewImpl( 00185 RTOpPack::SubMultiVectorView<Scalar>* sub_mv 00186 ); 00187 00189 00190 }; 00191 00192 00193 } // namespace Thyra 00194 00195 00196 #define THYRA_ASSERT_MV_COLS(FUNCNAME, cols) \ 00197 { \ 00198 const int numCols = cols.size(); \ 00199 const Thyra::Ordinal dimDomain = this->domain()->dim(); \ 00200 const std::string msgErr = this->description()+"::"+FUNCNAME; \ 00201 TEST_FOR_EXCEPTION( !( 1 <= numCols && numCols <= dimDomain ), \ 00202 std::invalid_argument, msgErr<<"Error!"); \ 00203 for (int k = 0; k < numCols; ++k) { \ 00204 const int col_k = cols[k]; \ 00205 TEST_FOR_EXCEPTION( \ 00206 !( 0<= col_k && col_k < dimDomain ), std::out_of_range, \ 00207 msgErr<<": col["<<k<<"] = " << col_k \ 00208 << " is not in the range [0,"<<(dimDomain-1)<<"]!" \ 00209 ); \ 00210 } \ 00211 } \ 00212 typedef int THYRA_ASSERT_MV_COLS_t 00213 00214 #ifdef THYRA_DEBUG 00215 # define THYRA_DEBUG_ASSERT_MV_COLS(FUNCNAME, cols) \ 00216 THYRA_ASSERT_MV_COLS(FUNCNAME, cols) 00217 #else 00218 # define THYRA_DEBUG_ASSERT_MV_COLS(FUNCNAME, cols) 00219 #endif 00220 00221 #endif // THYRA_MULTI_VECTOR_DEFAULT_BASE_DECL_HPP
1.7.4