Thyra Version of the Day
Thyra_VectorDefaultBase_def.hpp
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
00043 #define THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
00044 
00045 
00046 // Define to make some verbose output
00047 //#define THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00048 
00049 
00050 #include "Thyra_VectorDefaultBase_decl.hpp"
00051 #include "Thyra_VectorSpaceFactoryBase.hpp"
00052 #include "Thyra_VectorBase.hpp"
00053 #include "Thyra_VectorStdOps.hpp"
00054 #include "Thyra_MultiVectorDefaultBase.hpp"
00055 #include "Thyra_AssertOp.hpp"
00056 #include "Thyra_MultiVectorBase.hpp"
00057 #include "Thyra_DetachedVectorView.hpp"
00058 #include "RTOpPack_ROpGetSubVector.hpp"
00059 #include "RTOpPack_TOpSetSubVector.hpp"
00060 #include "Teuchos_Assert.hpp"
00061 
00062 
00063 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00064 #  include "Teuchos_VerboseObject.hpp"
00065 #  define THYRA_VECTOR_VERBOSE_OUT_STATEMENT \
00066      RCP<Teuchos::FancyOStream> dbgout = Teuchos::VerboseObjectBase::getDefaultOStream()
00067 #endif // THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00068 
00069 
00070 
00071 namespace Thyra {
00072 
00073 
00074 // Overridden from Teuchos::Describable
00075 
00076 
00077 template<class Scalar>
00078 std::string VectorDefaultBase<Scalar>::description() const
00079 {
00080   std::ostringstream oss;
00081   const RCP<const VectorSpaceBase<Scalar> > vs = this->space();
00082   oss << Teuchos::Describable::description();
00083   if(is_null(vs)) {
00084     oss << "{space=NULL}"; 
00085   }
00086   else {
00087     const Ordinal dim = vs->dim();
00088     oss << "{dim=" << dim << "}";
00089   }
00090   return oss.str();
00091 }
00092 
00093 
00094 template<class Scalar>
00095 void VectorDefaultBase<Scalar>::describe(
00096   Teuchos::FancyOStream &out_arg,
00097   const Teuchos::EVerbosityLevel verbLevel
00098   ) const
00099 {
00100   using Teuchos::FancyOStream;
00101   using Teuchos::OSTab;
00102   RCP<FancyOStream> out = Teuchos::rcpFromRef(out_arg);
00103   OSTab tab(out);
00104   *out << this->description() << "\n";
00105   if (this->space()->dim()) {
00106     tab.incrTab();
00107     if (verbLevel >= Teuchos::VERB_HIGH) {
00108       const ConstDetachedVectorView<Scalar> dvv(*this);
00109       for( Ordinal i = 0; i < dvv.subDim(); ++i )
00110         *out << i << ":" << dvv[i] << std::endl;
00111     }
00112   }
00113 }
00114 
00115 
00116 // Overridden from LinearOpBase
00117 
00118 
00119 template<class Scalar>
00120 RCP< const VectorSpaceBase<Scalar> >
00121 VectorDefaultBase<Scalar>::range() const
00122 {
00123 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00124   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00125   *dbgout << "\nThyra::VectorDefaultBase<"
00126           <<Teuchos::ScalarTraits<Scalar>::name()
00127           <<">::range() called!\n";
00128 #endif
00129   return this->space();
00130 }
00131 
00132 
00133 template<class Scalar>
00134 RCP< const VectorSpaceBase<Scalar> >
00135 VectorDefaultBase<Scalar>::domain() const
00136 {
00137 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00138   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00139   *dbgout << "\nThyra::VectorDefaultBase<"
00140           <<Teuchos::ScalarTraits<Scalar>::name()
00141           <<">::domain() called!\n";
00142 #endif
00143   if(!domain_.get()) {
00144     domain_ = range()->smallVecSpcFcty()->createVecSpc(1);
00145   }
00146   return domain_;
00147 }
00148 
00149 
00150 // Overridden from MultiVectorBase
00151 
00152 
00153 template<class Scalar>
00154 RCP<MultiVectorBase<Scalar> >
00155 VectorDefaultBase<Scalar>::clone_mv() const
00156 {
00157 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00158   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00159   *dbgout << "\nThyra::VectorDefaultBase<"
00160           <<Teuchos::ScalarTraits<Scalar>::name()
00161           <<">::clone_mv() called!\n";
00162 #endif
00163   return this->clone_v();
00164 }
00165 
00166 
00167 // Overridden from VectorBase
00168 
00169 
00170 template<class Scalar>
00171 RCP<VectorBase<Scalar> >
00172 VectorDefaultBase<Scalar>::clone_v() const
00173 {
00174 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00175   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00176   *dbgout << "\nThyra::VectorDefaultBase<"
00177           <<Teuchos::ScalarTraits<Scalar>::name()
00178           <<">::clone_v() called!\n";
00179 #endif
00180   RCP<VectorBase<Scalar> > copy = createMember(this->space());
00181   assign(copy.ptr(), *this);
00182   return copy;
00183 }
00184 
00185 
00186 // protected
00187 
00188 
00189 // Overridden protected functions from MultiVectorVectorBase
00190 
00191 
00192 template<class Scalar>
00193 RCP<VectorBase<Scalar> >
00194 VectorDefaultBase<Scalar>::nonconstColImpl(Ordinal j)
00195 {
00196 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00197   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00198   *dbgout << "\nThyra::VectorDefaultBase<"
00199           <<Teuchos::ScalarTraits<Scalar>::name()<<">::nonconstColImpl(j) called!\n";
00200 #endif
00201 #ifdef TEUCHOS_DEBUG
00202   TEUCHOS_TEST_FOR_EXCEPT( j != 0 );
00203 #endif
00204   return Teuchos::rcp(this,false);
00205 }
00206 
00207 
00208 template<class Scalar>
00209 RCP<const MultiVectorBase<Scalar> >
00210 VectorDefaultBase<Scalar>::contigSubViewImpl( const Range1D& col_rng ) const
00211 {
00212 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00213   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00214   *dbgout << "\nThyra::VectorDefaultBase<"
00215           <<Teuchos::ScalarTraits<Scalar>::name()
00216           <<">::contigSubViewImpl(col_rng) const called!\n";
00217 #endif
00218   validateColRng(col_rng);
00219   return Teuchos::rcp(this,false);
00220 }
00221 
00222 
00223 template<class Scalar>
00224 RCP<MultiVectorBase<Scalar> >
00225 VectorDefaultBase<Scalar>::nonconstContigSubViewImpl( const Range1D& col_rng )
00226 {
00227 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00228   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00229   *dbgout << "\nThyra::VectorDefaultBase<"
00230           <<Teuchos::ScalarTraits<Scalar>::name()
00231           <<">::nonconstContigSubViewImpl(col_rng) called!\n";
00232 #endif
00233   validateColRng(col_rng);
00234   return Teuchos::rcp(this,false);
00235 }
00236 
00237 
00238 template<class Scalar>
00239 RCP<const MultiVectorBase<Scalar> >
00240 VectorDefaultBase<Scalar>::nonContigSubViewImpl(
00241   const ArrayView<const int> &cols ) const
00242 {
00243 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00244   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00245   *dbgout << "\nThyra::VectorDefaultBase<"
00246           <<Teuchos::ScalarTraits<Scalar>::name()
00247           <<">::nonContigSubViewImpl(cols) called!\n";
00248 #endif
00249   validateColIndexes(cols);
00250   return Teuchos::rcp(this,false);
00251 }
00252 
00253 
00254 template<class Scalar>
00255 RCP<MultiVectorBase<Scalar> >
00256 VectorDefaultBase<Scalar>::nonconstNonContigSubViewImpl(
00257   const ArrayView<const int> &cols )
00258 {
00259 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00260   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00261   *dbgout << "\nThyra::VectorDefaultBase<"
00262           <<Teuchos::ScalarTraits<Scalar>::name()
00263           <<">::nonconstNonContigSubViewImpl(cols) called!\n";
00264 #endif
00265   validateColIndexes(cols);
00266   return Teuchos::rcp(this,false);
00267 }
00268 
00269 
00270 template<class Scalar>
00271 void VectorDefaultBase<Scalar>::acquireDetachedMultiVectorViewImpl(
00272   const Range1D &rowRng,
00273   const Range1D &colRng,
00274   RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv
00275   ) const
00276 {
00277 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00278   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00279   *dbgout << "\nThyra::VectorDefaultBase<"
00280           <<Teuchos::ScalarTraits<Scalar>::name()
00281           <<">::acquireDetachedMultiVectorViewImpl() const called!\n";
00282 #endif
00283 #ifdef TEUCHOS_DEBUG
00284   TEUCHOS_TEST_FOR_EXCEPT(sub_mv==NULL);
00285 #endif
00286   validateColRng(colRng);
00287   RTOpPack::ConstSubVectorView<Scalar> sv;
00288   this->acquireDetachedView(rowRng,&sv);
00289 #ifdef TEUCHOS_DEBUG
00290   TEUCHOS_TEST_FOR_EXCEPT( sv.stride() != 1 ); // Can't handle non-unit stride yet but we could
00291 #endif
00292   sub_mv->initialize( sv.globalOffset(), sv.subDim(), 0, 1, sv.values(), sv.subDim() );
00293 }
00294 
00295 
00296 template<class Scalar>
00297 void VectorDefaultBase<Scalar>::releaseDetachedMultiVectorViewImpl(
00298   RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv
00299   ) const
00300 {
00301   TEUCHOS_TEST_FOR_EXCEPT(sub_mv == 0);
00302   sub_mv->uninitialize();
00303 }
00304 
00305 
00306 template<class Scalar>
00307 void VectorDefaultBase<Scalar>::acquireNonconstDetachedMultiVectorViewImpl(
00308   const Range1D &rowRng,
00309   const Range1D &colRng,
00310   RTOpPack::SubMultiVectorView<Scalar> *sub_mv
00311   )
00312 {
00313 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00314   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00315   *dbgout << "\nThyra::VectorDefaultBase<"
00316           <<Teuchos::ScalarTraits<Scalar>::name()
00317           <<">::acquireNonconstDetachedMultiVectorViewImpl() called!\n";
00318 #endif
00319 #ifdef TEUCHOS_DEBUG
00320   TEUCHOS_TEST_FOR_EXCEPT(sub_mv==NULL);
00321 #endif
00322   validateColRng(colRng);
00323   RTOpPack::SubVectorView<Scalar> sv;
00324   this->acquireDetachedView(rowRng,&sv);
00325 #ifdef TEUCHOS_DEBUG
00326   TEUCHOS_TEST_FOR_EXCEPT( sv.stride() != 1 ); // Can't handle non-unit stride yet but we could
00327 #endif
00328   sub_mv->initialize( sv.globalOffset(), sv.subDim(), 0, 1, sv.values(), sv.subDim() );
00329 }
00330 
00331 
00332 template<class Scalar>
00333 void VectorDefaultBase<Scalar>::commitNonconstDetachedMultiVectorViewImpl(
00334   RTOpPack::SubMultiVectorView<Scalar>* sub_mv
00335   )
00336 {
00337 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00338   THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00339   *dbgout << "\nThyra::VectorDefaultBase<"
00340           <<Teuchos::ScalarTraits<Scalar>::name()
00341           <<">::commitNonconstDetachedMultiVectorViewImpl() called!\n";
00342 #endif
00343 #ifdef TEUCHOS_DEBUG
00344   TEUCHOS_TEST_FOR_EXCEPT(sub_mv==NULL);
00345 #endif
00346   RTOpPack::SubVectorView<Scalar> sv(
00347     sub_mv->globalOffset(),sub_mv->subDim(),sub_mv->values(),1);
00348   this->commitDetachedView(&sv);
00349   sub_mv->uninitialize();
00350 }
00351 
00352 
00353 // Overridden protected functions from VectorBase
00354 
00355 
00356 template<class Scalar>
00357 void VectorDefaultBase<Scalar>::acquireDetachedVectorViewImpl(
00358   const Range1D& rng_in, RTOpPack::ConstSubVectorView<Scalar>* sub_vec_inout
00359   ) const
00360 {
00361   using Teuchos::dyn_cast;
00362   const Range1D rng = rng_in.full_range() ? Range1D(0,this->space()->dim()-1) : rng_in;
00363 #ifdef TEUCHOS_DEBUG
00364   TEUCHOS_TEST_FOR_EXCEPTION(
00365     !(rng.ubound() < this->space()->dim()), std::out_of_range
00366     ,"VectorDefaultBase<Scalar>::acquireDetachedVectorViewImpl(rng,...):"
00367     " Error, rng = ["<<rng.lbound()<<","<<rng.ubound()
00368     <<"] is not in range = [0,"<<(this->space()->dim()-1)<<"]" );
00369 #endif
00370   // Initialize the operator
00371   RTOpPack::ROpGetSubVector<Scalar> get_sub_vector_op(rng.lbound(),rng.ubound());
00372   // Create the reduction object (another sub_vec)
00373   RCP<RTOpPack::ReductTarget>
00374     reduct_obj = get_sub_vector_op.reduct_obj_create(); // This is really of type RTOpPack::ConstSubVectorView<Scalar>!
00375   // Perform the reduction (get the sub-vector requested)
00376   ::Thyra::applyOp<Scalar>(get_sub_vector_op, tuple(Teuchos::ptr<const VectorBase<Scalar> >(this))(),
00377     Teuchos::null, reduct_obj.ptr());
00378   // Get the sub-vector.
00379   *sub_vec_inout = get_sub_vector_op(*reduct_obj);
00380 }
00381 
00382 
00383 template<class Scalar>
00384 void VectorDefaultBase<Scalar>::releaseDetachedVectorViewImpl(
00385   RTOpPack::ConstSubVectorView<Scalar>* sub_vec
00386   ) const
00387 {
00388   TEUCHOS_TEST_FOR_EXCEPT(sub_vec == 0);
00389   sub_vec->uninitialize();
00390 }
00391 
00392 
00393 template<class Scalar>
00394 void VectorDefaultBase<Scalar>::acquireNonconstDetachedVectorViewImpl(
00395   const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec_inout
00396   )
00397 {
00398   //
00399   // Here we get a copy of the data for the sub-vector that the
00400   // client will modify.  We must later commit these changes to the
00401   // actual vector when the client calls commitDetachedView(...).
00402   // Note, this implementation is very dependent on the behavior of
00403   // the default implementation of constant version of
00404   // VectorDefaultBase<Scalar>::acquireDetachedView(...) and the implementation of
00405   // VectorDefaultBase<Scalar>::setSubVector(...)!
00406   //
00407   RTOpPack::ConstSubVectorView<Scalar> sub_vec;
00408   VectorDefaultBase<Scalar>::acquireDetachedVectorViewImpl( rng, &sub_vec );
00409   sub_vec_inout->initialize(
00410     sub_vec.globalOffset(), sub_vec.subDim(),
00411     Teuchos::arcp_const_cast<Scalar>(sub_vec.values()), sub_vec.stride()
00412     );
00413 }
00414 
00415 
00416 template<class Scalar>
00417 void VectorDefaultBase<Scalar>::commitNonconstDetachedVectorViewImpl(
00418   RTOpPack::SubVectorView<Scalar>* sub_vec_inout
00419   )
00420 {
00421   TEUCHOS_TEST_FOR_EXCEPT(sub_vec_inout == 0);
00422   RTOpPack::SparseSubVectorT<Scalar> spc_sub_vec(
00423     sub_vec_inout->globalOffset(), sub_vec_inout->subDim()
00424     ,sub_vec_inout->values(), sub_vec_inout->stride()
00425     );
00426   VectorDefaultBase<Scalar>::setSubVectorImpl(spc_sub_vec); // Commit the changes!
00427   sub_vec_inout->uninitialize(); // Make null as promised!
00428 }
00429 
00430 
00431 template<class Scalar>
00432 void VectorDefaultBase<Scalar>::setSubVectorImpl( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec )
00433 {
00434   RTOpPack::TOpSetSubVector<Scalar> set_sub_vector_op(sub_vec);
00435   ::Thyra::applyOp<Scalar>(set_sub_vector_op, Teuchos::null,
00436     Teuchos::tuple(Teuchos::ptr<VectorBase<Scalar> >(this))(), Teuchos::null);
00437 }
00438 
00439 
00440 // Overridden protected functions from LinearOpBase
00441 
00442 
00443 template<class Scalar>
00444 bool VectorDefaultBase<Scalar>::opSupportedImpl(EOpTransp M_trans) const
00445 {
00446   typedef Teuchos::ScalarTraits<Scalar> ST;
00447   return ( ST::isComplex ? ( M_trans==NOTRANS || M_trans==CONJTRANS ) : true );
00448 }
00449 
00450 
00451 template<class Scalar>
00452 void VectorDefaultBase<Scalar>::applyImpl(
00453   const EOpTransp M_trans,
00454   const MultiVectorBase<Scalar> &X,
00455   const Ptr<MultiVectorBase<Scalar> > &Y,
00456   const Scalar alpha,
00457   const Scalar beta
00458   ) const
00459 {
00460 
00461   typedef Teuchos::ScalarTraits<Scalar> ST;
00462 
00463   // Validate input
00464 #ifdef TEUCHOS_DEBUG
00465   THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES(
00466     "VectorDefaultBase<Scalar>::apply()", *this, M_trans, X, &*Y);
00467 #endif
00468 
00469   const Ordinal numCols = X.domain()->dim();
00470 
00471   for (Ordinal col_j = 0; col_j < numCols; ++col_j) {
00472 
00473     // Get single column vectors
00474     const RCP<const VectorBase<Scalar> > x = X.col(col_j);
00475     const RCP<VectorBase<Scalar> > y = Y->col(col_j);
00476 
00477     // Here M = m (where m is a column vector)
00478     if( M_trans == NOTRANS || (M_trans == CONJ && !ST::isComplex) ) {
00479       // y = beta*y + alpha*m*x  (x is a scalar!)
00480 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00481       THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00482       *dbgout << "\nThyra::VectorDefaultBase<"
00483               <<Teuchos::ScalarTraits<Scalar>::name()
00484               <<">::apply(...) : y = beta*y + alpha*m*x  (x is a scalar!)\n";
00485 #endif
00486       Vt_S( y.ptr(), beta );
00487       Vp_StV( y.ptr(), Scalar(alpha*get_ele(*x,0)), *this );
00488     }
00489     else if( M_trans == CONJTRANS || (M_trans == TRANS && !ST::isComplex) ) {
00490       // y = beta*y + alpha*m'*x  (y is a scalar!)
00491 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00492       THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00493       *dbgout << "\nThyra::VectorDefaultBase<"
00494               <<Teuchos::ScalarTraits<Scalar>::name()
00495               <<">::apply(...) : y = beta*y + alpha*m'*x  (y is a scalar!)\n";
00496 #endif
00497       Scalar y_inout;
00498       if( beta == ST::zero() ) {
00499         y_inout = ST::zero();
00500       }
00501       else {
00502         y_inout = beta*get_ele(*y,0);
00503       }
00504 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_SPMD_APPLY_OP_DUMP)
00505       RTOpPack::show_spmd_apply_op_dump = true;
00506 #endif
00507 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_RTOPT_HELPER_DUMP_OUTPUT)
00508       RTOpPack::rtop_helpers_dump_all = true;
00509 #endif
00510       y_inout += alpha * this->space()->scalarProd(*this, *x);
00511 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_SPMD_APPLY_OP_DUMP)
00512       RTOpPack::show_spmd_apply_op_dump = false;
00513 #endif
00514 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_RTOPT_HELPER_DUMP_OUTPUT)
00515       RTOpPack::rtop_helpers_dump_all = false;
00516 #endif
00517       set_ele(0, y_inout, y.ptr());
00518 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00519       *dbgout
00520         << "\nThyra::VectorDefaultBase<"<<ST::name()<<">::apply(...) : y_inout = "
00521         << y_inout << "\n";
00522 #endif
00523     }
00524     else {
00525       TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
00526         "VectorBase<"<<ST::name()<<">::apply(M_trans,...): Error, M_trans="
00527         <<toString(M_trans)<<" not supported!" );
00528     }
00529     
00530   }
00531 
00532 }
00533 
00534 
00535 // private
00536 
00537 
00538 template<class Scalar>
00539 inline
00540 void VectorDefaultBase<Scalar>::validateColRng( const Range1D &col_rng ) const
00541 {
00542 #ifdef TEUCHOS_DEBUG
00543   TEUCHOS_TEST_FOR_EXCEPT(
00544     !( col_rng.full_range() || ( col_rng.lbound() == 0 && col_rng.ubound() == 0) ) );
00545 #endif
00546 }
00547 
00548 
00549 template<class Scalar>
00550 inline
00551 void VectorDefaultBase<Scalar>::validateColIndexes(
00552   const ArrayView<const int>&cols ) const
00553 {
00554 #ifdef TEUCHOS_DEBUG
00555   TEUCHOS_TEST_FOR_EXCEPT( cols.size() != 1 || cols[0] != 0 );
00556 #endif
00557 }
00558 
00559 
00560 } // end namespace Thyra
00561 
00562 
00563 #endif  // THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines