All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Xpetra_EpetraIntVector.cpp
Go to the documentation of this file.
00001 // @HEADER
00002 //
00003 // ***********************************************************************
00004 //
00005 //             Xpetra: A linear algebra interface package
00006 //                  Copyright 2012 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact
00039 //                    Jonathan Hu       (jhu@sandia.gov)
00040 //                    Andrey Prokopenko (aprokop@sandia.gov)
00041 //                    Ray Tuminaro      (rstumin@sandia.gov)
00042 //
00043 // ***********************************************************************
00044 //
00045 // @HEADER
00046 #include "Xpetra_EpetraIntVector.hpp"
00047 #include "Xpetra_EpetraImport.hpp"
00048 #include "Xpetra_EpetraExport.hpp"
00049 
00050 namespace Xpetra {
00051 
00052   template<class EpetraGlobalOrdinal>
00053   void EpetraIntVectorT<EpetraGlobalOrdinal>::replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00054 
00055   template<class EpetraGlobalOrdinal>
00056   void EpetraIntVectorT<EpetraGlobalOrdinal>::sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00057 
00058   template<class EpetraGlobalOrdinal>
00059   void EpetraIntVectorT<EpetraGlobalOrdinal>::replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00060 
00061   template<class EpetraGlobalOrdinal>
00062   void EpetraIntVectorT<EpetraGlobalOrdinal>::sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00063 
00064   template<class EpetraGlobalOrdinal>
00065   int EpetraIntVectorT<EpetraGlobalOrdinal>::dot(const Vector<int,int,GlobalOrdinal,Node> &a) const { XPETRA_MONITOR("EpetraIntVectorT::dot"); TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00066 
00067   template<class EpetraGlobalOrdinal>
00068   Teuchos::ScalarTraits<int>::magnitudeType EpetraIntVectorT<EpetraGlobalOrdinal>::norm1() const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00069 
00070   template<class EpetraGlobalOrdinal>
00071   Teuchos::ScalarTraits<int>::magnitudeType EpetraIntVectorT<EpetraGlobalOrdinal>::norm2() const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00072 
00073   template<class EpetraGlobalOrdinal>
00074   Teuchos::ScalarTraits<int>::magnitudeType EpetraIntVectorT<EpetraGlobalOrdinal>::normInf() const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00075 
00076   template<class EpetraGlobalOrdinal>
00077   Teuchos::ScalarTraits<int>::magnitudeType EpetraIntVectorT<EpetraGlobalOrdinal>::normWeighted(const Vector<int,int,GlobalOrdinal,Node> &weights) const { XPETRA_MONITOR("EpetraIntVectorT::normWeighted"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00078 
00079   template<class EpetraGlobalOrdinal>
00080   int EpetraIntVectorT<EpetraGlobalOrdinal>::meanValue() const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00081 
00082   template<class EpetraGlobalOrdinal>
00083   int EpetraIntVectorT<EpetraGlobalOrdinal>::maxValue() const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); return -1; }
00084 
00085   template<class EpetraGlobalOrdinal>
00086   void EpetraIntVectorT<EpetraGlobalOrdinal>::randomize(bool bUseXpetraImplementation) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
00087 
00088   template<class EpetraGlobalOrdinal>
00089   void EpetraIntVectorT<EpetraGlobalOrdinal>::setSeed(unsigned int seed) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
00090 
00091   template<class EpetraGlobalOrdinal>
00092   Teuchos::RCP< const Vector< int,int,EpetraGlobalOrdinal, typename EpetraIntVectorT<EpetraGlobalOrdinal>::Node > > EpetraIntVectorT<EpetraGlobalOrdinal>::getVector(size_t j) const {
00093     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00094   }
00095 
00096   template<class EpetraGlobalOrdinal>
00097   Teuchos::RCP< Vector< int,int,EpetraGlobalOrdinal, typename EpetraIntVectorT<EpetraGlobalOrdinal>::Node > > EpetraIntVectorT<EpetraGlobalOrdinal>::getVectorNonConst(size_t j) {
00098     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00099   }
00100 
00101   template<class EpetraGlobalOrdinal>
00102   Teuchos::ArrayRCP<const int> EpetraIntVectorT<EpetraGlobalOrdinal>::getData(size_t j) const {
00103     XPETRA_MONITOR("EpetraIntVectorT::getData");
00104 
00105     int * data = vec_->Values();
00106     int localLength = vec_->MyLength();
00107 
00108     return ArrayRCP<int>(data, 0, localLength, false); // not ownership
00109   }
00110 
00111   template<class EpetraGlobalOrdinal>
00112   Teuchos::ArrayRCP<int> EpetraIntVectorT<EpetraGlobalOrdinal>::getDataNonConst(size_t j) {
00113     XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
00114 
00115     int * data = vec_->Values();
00116     int localLength = vec_->MyLength();
00117 
00118     return ArrayRCP<int>(data, 0, localLength, false); // not ownership
00119   }
00120 
00121   template<class EpetraGlobalOrdinal>
00122   void EpetraIntVectorT<EpetraGlobalOrdinal>::dot(const MultiVector<int,int,GlobalOrdinal,Node> &A, const Teuchos::ArrayView<int> &dots) const {
00123     XPETRA_MONITOR("EpetraIntVectorT::dot");
00124 
00125     //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
00126     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00127   }
00128 
00129   template<class EpetraGlobalOrdinal>
00130   void EpetraIntVectorT<EpetraGlobalOrdinal>::abs(const MultiVector<int,int,GlobalOrdinal,Node> &A) {
00131     XPETRA_MONITOR("EpetraIntVectorT::abs");
00132 
00133     //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
00134     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00135   }
00136 
00137   template<class EpetraGlobalOrdinal>
00138   void EpetraIntVectorT<EpetraGlobalOrdinal>::reciprocal(const MultiVector<int,int,GlobalOrdinal,Node> &A) {
00139     XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
00140 
00141     //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
00142     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00143   }
00144 
00145   template<class EpetraGlobalOrdinal>
00146   void EpetraIntVectorT<EpetraGlobalOrdinal>::scale(const int &alpha) {
00147     XPETRA_MONITOR("EpetraIntVectorT::scale");
00148     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00149   }
00150 
00151   template<class EpetraGlobalOrdinal>
00152   void EpetraIntVectorT<EpetraGlobalOrdinal>::scale (Teuchos::ArrayView< const int > alpha) {
00153     XPETRA_MONITOR("EpetraIntVectorT::scale");
00154     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00155   }
00156 
00157   template<class EpetraGlobalOrdinal>
00158   void EpetraIntVectorT<EpetraGlobalOrdinal>::update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta) {
00159     XPETRA_MONITOR("EpetraIntVectorT::update");
00160 
00161     // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
00162     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00163   }
00164 
00165   template<class EpetraGlobalOrdinal>
00166   void EpetraIntVectorT<EpetraGlobalOrdinal>::update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta, const MultiVector<int,int,GlobalOrdinal,Node> &B, const int &gamma) {
00167     XPETRA_MONITOR("EpetraIntVectorT::update");
00168 
00169     //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
00170     //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
00171     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
00172   }
00173 
00174   template<class EpetraGlobalOrdinal>
00175   void EpetraIntVectorT<EpetraGlobalOrdinal>::norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00176 
00177   template<class EpetraGlobalOrdinal>
00178   void EpetraIntVectorT<EpetraGlobalOrdinal>::norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00179 
00180   template<class EpetraGlobalOrdinal>
00181   void EpetraIntVectorT<EpetraGlobalOrdinal>::normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00182 
00183   template<class EpetraGlobalOrdinal>
00184   void EpetraIntVectorT<EpetraGlobalOrdinal>::normWeighted(const MultiVector<int,int,GlobalOrdinal,Node> &weights, const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::normWeighted"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00185 
00186   template<class EpetraGlobalOrdinal>
00187   void EpetraIntVectorT<EpetraGlobalOrdinal>::meanValue(const Teuchos::ArrayView<int> &means) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00188 
00189   template<class EpetraGlobalOrdinal>
00190   void EpetraIntVectorT<EpetraGlobalOrdinal>::maxValue(const Teuchos::ArrayView<int> &maxs) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00191 
00192   template<class EpetraGlobalOrdinal>
00193   void EpetraIntVectorT<EpetraGlobalOrdinal>::multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const MultiVector<int,int,GlobalOrdinal,Node> &B, const int &beta) { XPETRA_MONITOR("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
00194 
00195   template<class EpetraGlobalOrdinal>
00196   void EpetraIntVectorT<EpetraGlobalOrdinal>::elementWiseMultiply(int scalarAB, const Vector<int,int,GlobalOrdinal,Node> &A, const MultiVector<int,int,GlobalOrdinal,Node> &B, int scalarThis) {
00197     XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
00198     TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
00199   }
00200 
00201   template<class EpetraGlobalOrdinal>
00202   void EpetraIntVectorT<EpetraGlobalOrdinal>::replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00203 
00204   template<class EpetraGlobalOrdinal>
00205   void EpetraIntVectorT<EpetraGlobalOrdinal>::sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00206 
00207   template<class EpetraGlobalOrdinal>
00208   void EpetraIntVectorT<EpetraGlobalOrdinal>::replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00209 
00210   template<class EpetraGlobalOrdinal>
00211   void EpetraIntVectorT<EpetraGlobalOrdinal>::sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
00212 
00213   template<class EpetraGlobalOrdinal>
00214   size_t EpetraIntVectorT<EpetraGlobalOrdinal>::getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
00215 
00216   template<class EpetraGlobalOrdinal>
00217   std::string EpetraIntVectorT<EpetraGlobalOrdinal>::description() const {
00218     XPETRA_MONITOR("EpetraIntVectorT::description");
00219 
00220     // This implementation come from Epetra_Vector_def.hpp (without modification)
00221     std::ostringstream oss;
00222     oss << Teuchos::Describable::description();
00223     oss << "{length="<<this->getGlobalLength()
00224         << "}";
00225     return oss.str();
00226   }
00227 
00228   template<class EpetraGlobalOrdinal>
00229   void EpetraIntVectorT<EpetraGlobalOrdinal>::describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const {
00230     XPETRA_MONITOR("EpetraIntVectorT::describe");
00231 
00232     // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
00233     using std::endl;
00234     using std::setw;
00235     using Teuchos::VERB_DEFAULT;
00236     using Teuchos::VERB_NONE;
00237     using Teuchos::VERB_LOW;
00238     using Teuchos::VERB_MEDIUM;
00239     using Teuchos::VERB_HIGH;
00240     using Teuchos::VERB_EXTREME;
00241 
00242     if (verbLevel > Teuchos::VERB_NONE)
00243       vec_->Print(out);
00244   }
00245 
00246   template<class EpetraGlobalOrdinal>
00247   void EpetraIntVectorT<EpetraGlobalOrdinal>::doImport(const DistObject<int, int, GlobalOrdinal> &source,
00248                                  const Import<int, GlobalOrdinal> &importer, CombineMode CM) {
00249     XPETRA_MONITOR("EpetraIntVectorT::doImport");
00250 
00251     XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
00252     XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
00253 
00254     const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
00255     int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
00256     TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
00257   }
00258 
00259   template<class EpetraGlobalOrdinal>
00260   void EpetraIntVectorT<EpetraGlobalOrdinal>::doExport(const DistObject<int, LocalOrdinal, GlobalOrdinal> &dest,
00261                                  const Import<int, GlobalOrdinal>& importer, CombineMode CM) {
00262     XPETRA_MONITOR("EpetraIntVectorT::doExport");
00263 
00264     XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
00265     XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
00266 
00267     const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
00268     int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
00269     TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
00270   }
00271 
00272   template<class EpetraGlobalOrdinal>
00273   void EpetraIntVectorT<EpetraGlobalOrdinal>::doImport(const DistObject<int, LocalOrdinal, GlobalOrdinal> &source,
00274                                  const Export<int, GlobalOrdinal>& exporter, CombineMode CM) {
00275     XPETRA_MONITOR("EpetraIntVectorT::doImport");
00276 
00277     XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
00278     XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
00279 
00280     const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
00281     int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
00282     TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
00283   }
00284 
00285   template<class EpetraGlobalOrdinal>
00286   void EpetraIntVectorT<EpetraGlobalOrdinal>::doExport(const DistObject<int, LocalOrdinal, GlobalOrdinal> &dest,
00287                                  const Export<int, GlobalOrdinal>& exporter, CombineMode CM) {
00288     XPETRA_MONITOR("EpetraIntVectorT::doExport");
00289 
00290     XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
00291     XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
00292 
00293     const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
00294     int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
00295     TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
00296   }
00297 
00298   template<class EpetraGlobalOrdinal>
00299   void EpetraIntVectorT<EpetraGlobalOrdinal>::
00300   assign (const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal>& rhs)
00301   {
00302     typedef EpetraIntVectorT<GlobalOrdinal> this_type;
00303     const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
00304     TEUCHOS_TEST_FOR_EXCEPTION(
00305       rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
00306       "The left-hand side (LHS) of the assignment has a different type than "
00307       "the right-hand side (RHS).  The LHS has type Xpetra::EpetraIntVectorT "
00308       "(which means it wraps an Epetra_IntVector), but the RHS has some "
00309       "other type.  This probably means that the RHS wraps either an "
00310       "Tpetra::MultiVector, or an Epetra_MultiVector.  Xpetra::MultiVector "
00311       "does not currently implement assignment from a Tpetra object to an "
00312       "Epetra object, though this could be added with sufficient interest.");
00313 
00314     RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector ();
00315     RCP<Epetra_IntVector> lhsImpl = this->getEpetra_IntVector ();
00316 
00317     TEUCHOS_TEST_FOR_EXCEPTION(
00318       rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
00319       "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
00320       "the assignment) has a null RCP<Epetra_IntVector> inside.  Please "
00321       "report this bug to the Xpetra developers.");
00322     TEUCHOS_TEST_FOR_EXCEPTION(
00323       lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
00324       "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
00325       "assignment has a null RCP<Epetra_IntVector> inside.  Please report "
00326       "this bug to the Xpetra developers.");
00327 
00328     // Epetra_IntVector's assignment operator does a deep copy.
00329     *lhsImpl = *rhsImpl;
00330   }
00331 
00332 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
00333 template class EpetraIntVectorT<int>;
00334 #endif
00335 
00336 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
00337 template class EpetraIntVectorT<long long>;
00338 #endif
00339 
00340 } // namespace Xpetra
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines