Tpetra_ImportExportData.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //          Tpetra: Templated Linear Algebra Services Package
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 TPETRA_IMPORTEXPORTDATA_HPP
00030 #define TPETRA_IMPORTEXPORTDATA_HPP
00031 
00032 #include <Teuchos_RCP.hpp>
00033 #include <Teuchos_OrdinalTraits.hpp>
00034 #include <Teuchos_Array.hpp>
00035 #include <Teuchos_ArrayRCP.hpp>
00036 #include <Teuchos_Object.hpp>
00037 
00038 namespace Tpetra {
00039 
00040 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00041   // forward declaration of Import,Export, needed to prevent circular inclusions
00042   template<typename Ordinal> class Import;
00043   template<typename Ordinal> class Export;
00044 #endif
00045 
00046   template<typename Ordinal>
00047   class ImportExportData : public Teuchos::Object {
00048     friend class Import<Ordinal>;
00049     friend class Export<Ordinal>;
00050   public:
00051     ImportExportData(const Map<Ordinal> & source, const Map<Ordinal> & target);
00052     ~ImportExportData();
00053 
00054   protected:
00055     // OT vectors
00056     Teuchos::Array<Ordinal> permuteToLIDs_;
00057     Teuchos::Array<Ordinal> permuteFromLIDs_;
00058     Teuchos::Array<Ordinal> remoteLIDs_;
00059     Teuchos::Array<Ordinal> remoteGIDs_;
00060     Teuchos::ArrayRCP<Ordinal> exportLIDs_;
00061     Teuchos::ArrayRCP<Ordinal> exportGIDs_;
00062     Teuchos::ArrayRCP<Ordinal> exportImageIDs_;
00063 
00064     // OTs
00065     Ordinal numSameIDs_;
00066     Ordinal numPermuteIDs_;
00067     Ordinal numRemoteIDs_;
00068     Ordinal numExportIDs_;
00069 
00070     // Maps
00071     const Map<Ordinal> source_;
00072     const Map<Ordinal> target_;
00073 
00074     // Platform, Comm, Distributor, etc.
00075     Teuchos::RCP<const Platform<Ordinal> > platform_;
00076     Distributor<Ordinal> distributor_;
00077 
00078   private:
00080     ImportExportData(ImportExportData<Ordinal> const& rhs);
00082     ImportExportData<Ordinal>& operator = (ImportExportData<Ordinal> const& rhs);
00083   }; // class ImportExportData
00084 
00085 
00086   template <typename Ordinal>
00087   ImportExportData<Ordinal>::ImportExportData(const Map<Ordinal> & source, const Map<Ordinal> & target)
00088   : Teuchos::Object("Tpetra::ImportExportData")
00089   , numSameIDs_(Teuchos::OrdinalTraits<Ordinal>::zero())
00090   , numPermuteIDs_(Teuchos::OrdinalTraits<Ordinal>::zero())
00091   , numRemoteIDs_(Teuchos::OrdinalTraits<Ordinal>::zero())
00092   , numExportIDs_(Teuchos::OrdinalTraits<Ordinal>::zero())
00093   , source_(source)
00094   , target_(target)
00095   , platform_(source.getPlatform()->clone())
00096   , distributor_(platform_->createComm())
00097   {}
00098 
00099   template <typename Ordinal>
00100   ImportExportData<Ordinal>::~ImportExportData() 
00101   {}
00102 
00103 } // namespace Tpetra
00104 
00105 #endif // TPETRA_IMPORTEXPORTDATA_HPP

Generated on Wed May 12 21:59:41 2010 for Tpetra Matrix/Vector Services by  doxygen 1.4.7