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   using Teuchos::tuple;
00363   const Range1D rng = rng_in.full_range() ? Range1D(0,this->space()->dim()-1) : rng_in;
00364 #ifdef TEUCHOS_DEBUG
00365   TEUCHOS_TEST_FOR_EXCEPTION(
00366     !(rng.ubound() < this->space()->dim()), std::out_of_range
00367     ,"VectorDefaultBase<Scalar>::acquireDetachedVectorViewImpl(rng,...):"
00368     " Error, rng = ["<<rng.lbound()<<","<<rng.ubound()
00369     <<"] is not in range = [0,"<<(this->space()->dim()-1)<<"]" );
00370 #endif
00371   // Initialize the operator
00372   RTOpPack::ROpGetSubVector<Scalar> get_sub_vector_op(rng.lbound(),rng.ubound());
00373   // Create the reduction object (another sub_vec)
00374   RCP<RTOpPack::ReductTarget>
00375     reduct_obj = get_sub_vector_op.reduct_obj_create(); // This is really of type RTOpPack::ConstSubVectorView<Scalar>!
00376   // Perform the reduction (get the sub-vector requested)
00377   ::Thyra::applyOp<Scalar>(get_sub_vector_op, tuple(Teuchos::ptr<const VectorBase<Scalar> >(this))(),
00378     Teuchos::null, reduct_obj.ptr());
00379   // Get the sub-vector.
00380   *sub_vec_inout = get_sub_vector_op(*reduct_obj);
00381 }
00382 
00383 
00384 template<class Scalar>
00385 void VectorDefaultBase<Scalar>::releaseDetachedVectorViewImpl(
00386   RTOpPack::ConstSubVectorView<Scalar>* sub_vec
00387   ) const
00388 {
00389   TEUCHOS_TEST_FOR_EXCEPT(sub_vec == 0);
00390   sub_vec->uninitialize();
00391 }
00392 
00393 
00394 template<class Scalar>
00395 void VectorDefaultBase<Scalar>::acquireNonconstDetachedVectorViewImpl(
00396   const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec_inout
00397   )
00398 {
00399   //
00400   // Here we get a copy of the data for the sub-vector that the
00401   // client will modify.  We must later commit these changes to the
00402   // actual vector when the client calls commitDetachedView(...).
00403   // Note, this implementation is very dependent on the behavior of
00404   // the default implementation of constant version of
00405   // VectorDefaultBase<Scalar>::acquireDetachedView(...) and the implementation of
00406   // VectorDefaultBase<Scalar>::setSubVector(...)!
00407   //
00408   RTOpPack::ConstSubVectorView<Scalar> sub_vec;
00409   VectorDefaultBase<Scalar>::acquireDetachedVectorViewImpl( rng, &sub_vec );
00410   sub_vec_inout->initialize(
00411     sub_vec.globalOffset(), sub_vec.subDim(),
00412     Teuchos::arcp_const_cast<Scalar>(sub_vec.values()), sub_vec.stride()
00413     );
00414 }
00415 
00416 
00417 template<class Scalar>
00418 void VectorDefaultBase<Scalar>::commitNonconstDetachedVectorViewImpl(
00419   RTOpPack::SubVectorView<Scalar>* sub_vec_inout
00420   )
00421 {
00422   TEUCHOS_TEST_FOR_EXCEPT(sub_vec_inout == 0);
00423   RTOpPack::SparseSubVectorT<Scalar> spc_sub_vec(
00424     sub_vec_inout->globalOffset(), sub_vec_inout->subDim()
00425     ,sub_vec_inout->values(), sub_vec_inout->stride()
00426     );
00427   VectorDefaultBase<Scalar>::setSubVectorImpl(spc_sub_vec); // Commit the changes!
00428   sub_vec_inout->uninitialize(); // Make null as promised!
00429 }
00430 
00431 
00432 template<class Scalar>
00433 void VectorDefaultBase<Scalar>::setSubVectorImpl( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec )
00434 {
00435   RTOpPack::TOpSetSubVector<Scalar> set_sub_vector_op(sub_vec);
00436   ::Thyra::applyOp<Scalar>(set_sub_vector_op, Teuchos::null,
00437     Teuchos::tuple(Teuchos::ptr<VectorBase<Scalar> >(this))(), Teuchos::null);
00438 }
00439 
00440 
00441 // Overridden protected functions from LinearOpBase
00442 
00443 
00444 template<class Scalar>
00445 bool VectorDefaultBase<Scalar>::opSupportedImpl(EOpTransp M_trans) const
00446 {
00447   typedef Teuchos::ScalarTraits<Scalar> ST;
00448   return ( ST::isComplex ? ( M_trans==NOTRANS || M_trans==CONJTRANS ) : true );
00449 }
00450 
00451 
00452 template<class Scalar>
00453 void VectorDefaultBase<Scalar>::applyImpl(
00454   const EOpTransp M_trans,
00455   const MultiVectorBase<Scalar> &X,
00456   const Ptr<MultiVectorBase<Scalar> > &Y,
00457   const Scalar alpha,
00458   const Scalar beta
00459   ) const
00460 {
00461 
00462   typedef Teuchos::ScalarTraits<Scalar> ST;
00463 
00464   // Validate input
00465 #ifdef TEUCHOS_DEBUG
00466   THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES(
00467     "VectorDefaultBase<Scalar>::apply()", *this, M_trans, X, &*Y);
00468 #endif
00469 
00470   const Ordinal numCols = X.domain()->dim();
00471 
00472   for (Ordinal col_j = 0; col_j < numCols; ++col_j) {
00473 
00474     // Get single column vectors
00475     const RCP<const VectorBase<Scalar> > x = X.col(col_j);
00476     const RCP<VectorBase<Scalar> > y = Y->col(col_j);
00477 
00478     // Here M = m (where m is a column vector)
00479     if( M_trans == NOTRANS || (M_trans == CONJ && !ST::isComplex) ) {
00480       // y = beta*y + alpha*m*x  (x is a scalar!)
00481 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00482       THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00483       *dbgout << "\nThyra::VectorDefaultBase<"
00484               <<Teuchos::ScalarTraits<Scalar>::name()
00485               <<">::apply(...) : y = beta*y + alpha*m*x  (x is a scalar!)\n";
00486 #endif
00487       Vt_S( y.ptr(), beta );
00488       Vp_StV( y.ptr(), Scalar(alpha*get_ele(*x,0)), *this );
00489     }
00490     else if( M_trans == CONJTRANS || (M_trans == TRANS && !ST::isComplex) ) {
00491       // y = beta*y + alpha*m'*x  (y is a scalar!)
00492 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00493       THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
00494       *dbgout << "\nThyra::VectorDefaultBase<"
00495               <<Teuchos::ScalarTraits<Scalar>::name()
00496               <<">::apply(...) : y = beta*y + alpha*m'*x  (y is a scalar!)\n";
00497 #endif
00498       Scalar y_inout;
00499       if( beta == ST::zero() ) {
00500         y_inout = ST::zero();
00501       }
00502       else {
00503         y_inout = beta*get_ele(*y,0);
00504       }
00505 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_SPMD_APPLY_OP_DUMP)
00506       RTOpPack::show_spmd_apply_op_dump = true;
00507 #endif
00508 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_RTOPT_HELPER_DUMP_OUTPUT)
00509       RTOpPack::rtop_helpers_dump_all = true;
00510 #endif
00511       y_inout += alpha * this->space()->scalarProd(*this, *x);
00512 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_SPMD_APPLY_OP_DUMP)
00513       RTOpPack::show_spmd_apply_op_dump = false;
00514 #endif
00515 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_RTOPT_HELPER_DUMP_OUTPUT)
00516       RTOpPack::rtop_helpers_dump_all = false;
00517 #endif
00518       set_ele(0, y_inout, y.ptr());
00519 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
00520       *dbgout
00521         << "\nThyra::VectorDefaultBase<"<<ST::name()<<">::apply(...) : y_inout = "
00522         << y_inout << "\n";
00523 #endif
00524     }
00525     else {
00526       TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
00527         "VectorBase<"<<ST::name()<<">::apply(M_trans,...): Error, M_trans="
00528         <<toString(M_trans)<<" not supported!" );
00529     }
00530     
00531   }
00532 
00533 }
00534 
00535 
00536 // private
00537 
00538 
00539 template<class Scalar>
00540 inline
00541 void VectorDefaultBase<Scalar>::validateColRng( const Range1D &col_rng ) const
00542 {
00543 #ifdef TEUCHOS_DEBUG
00544   TEUCHOS_TEST_FOR_EXCEPT(
00545     !( col_rng.full_range() || ( col_rng.lbound() == 0 && col_rng.ubound() == 0) ) );
00546 #endif
00547 }
00548 
00549 
00550 template<class Scalar>
00551 inline
00552 void VectorDefaultBase<Scalar>::validateColIndexes(
00553   const ArrayView<const int>&cols ) const
00554 {
00555 #ifdef TEUCHOS_DEBUG
00556   TEUCHOS_TEST_FOR_EXCEPT( cols.size() != 1 || cols[0] != 0 );
00557 #endif
00558 }
00559 
00560 
00561 } // end namespace Thyra
00562 
00563 
00564 #endif  // THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines