|
Amesos2 - Direct Sparse Solver Interfaces
Version of the Day
|
00001 // @HEADER 00002 // 00003 // *********************************************************************** 00004 // 00005 // Amesos2: Templated Direct Sparse Solver Package 00006 // Copyright 2011 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 Michael A. Heroux (maherou@sandia.gov) 00039 // 00040 // *********************************************************************** 00041 // 00042 // @HEADER 00043 00053 #ifndef AMESOS2_EPETRA_MULTIVEC_ADAPTER_DECL_HPP 00054 #define AMESOS2_EPETRA_MULTIVEC_ADAPTER_DECL_HPP 00055 00056 #include <Teuchos_RCP.hpp> 00057 #include <Teuchos_Array.hpp> 00058 #include <Teuchos_as.hpp> 00059 00060 #include <Tpetra_DefaultPlatform.hpp> 00061 #include <Tpetra_Vector.hpp> 00062 #include <Tpetra_Map.hpp> 00063 00064 #include <Epetra_MultiVector.h> 00065 00066 #include "Amesos2_MultiVecAdapter_decl.hpp" 00067 00068 namespace Amesos2 { 00069 00075 template <> 00076 class MultiVecAdapter<Epetra_MultiVector> 00077 { 00078 public: 00079 00080 // public type definitions 00081 typedef double scalar_t; 00082 typedef int local_ordinal_t; 00083 typedef int global_ordinal_t; 00084 typedef size_t global_size_t; 00085 typedef Tpetra::DefaultPlatform::DefaultPlatformType::NodeType node_t; 00086 typedef Epetra_MultiVector multivec_t; 00087 00088 friend Teuchos::RCP<MultiVecAdapter<multivec_t> > createMultiVecAdapter<>(Teuchos::RCP<multivec_t>); 00089 friend Teuchos::RCP<const MultiVecAdapter<multivec_t> > createConstMultiVecAdapter<>(Teuchos::RCP<const multivec_t>); 00090 00091 00092 static const char* name; 00093 00094 00095 protected: 00097 MultiVecAdapter( const MultiVecAdapter<multivec_t>& adapter ); 00098 00104 MultiVecAdapter( const Teuchos::RCP<multivec_t>& m ); 00105 00106 00107 public: 00108 00109 ~MultiVecAdapter() 00110 { } 00111 00112 00114 bool isLocallyIndexed() const; 00115 00116 bool isGloballyIndexed() const; 00117 00118 00125 Teuchos::RCP<const Tpetra::Map<local_ordinal_t, global_ordinal_t, node_t> > 00126 getMap() const; 00127 00129 const Teuchos::RCP<const Teuchos::Comm<int> > getComm() const; 00130 00131 00133 size_t getLocalLength() const; 00134 00135 00137 size_t getLocalNumVectors() const; 00138 00139 00141 global_size_t getGlobalLength() const; 00142 00143 00145 size_t getGlobalNumVectors() const; 00146 00147 00149 size_t getStride() const; 00150 00151 00153 bool isConstantStride() const; 00154 00155 00157 Teuchos::RCP<const Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> > 00158 getVector( size_t j ) const; 00159 00160 00168 Teuchos::RCP<Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> > 00169 getVectorNonConst( size_t j ); 00170 00171 00177 void get1dCopy( const Teuchos::ArrayView<scalar_t>& A, 00178 size_t lda, 00179 Teuchos::Ptr< 00180 const Tpetra::Map<local_ordinal_t, 00181 global_ordinal_t, 00182 node_t> > distribution_map ) const; 00183 00184 00202 Teuchos::ArrayRCP<scalar_t> get1dViewNonConst( bool local = false ); 00203 00204 00215 void put1dData( const Teuchos::ArrayView<const scalar_t>& new_data, 00216 size_t lda, 00217 Teuchos::Ptr< 00218 const Tpetra::Map<local_ordinal_t, 00219 global_ordinal_t, 00220 node_t> > source_map ); 00221 00222 00223 00225 std::string description() const; 00226 00227 00229 void describe( Teuchos::FancyOStream& os, 00230 const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const; 00231 00232 00233 private: 00234 00236 Teuchos::RCP<multivec_t> mv_; 00237 00238 mutable Teuchos::RCP<Epetra_Import> importer_; 00239 mutable Teuchos::RCP<Epetra_Export> exporter_; 00240 00241 mutable Teuchos::RCP<const Epetra_BlockMap> mv_map_; 00242 00243 }; // end class MultiVecAdapter<NewMultiVec> 00244 00245 } // end namespace Amesos2 00246 00247 00248 #endif // AMESOS2_EPETRA_MULTIVEC_ADAPTER_DECL_HPP
1.7.6.1