|
Ifpack2 Templated Preconditioning Package
Version 1.0
|
00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack2: Tempated Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2009) 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 Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 */ 00042 00043 #ifndef IFPACK2_OVERLAPPINGROWMATRIX_DECL_HPP 00044 #define IFPACK2_OVERLAPPINGROWMATRIX_DECL_HPP 00045 00046 #include "Ifpack2_ConfigDefs.hpp" 00047 #include "Tpetra_RowMatrix.hpp" 00048 #include "Tpetra_CrsMatrix_decl.hpp" // only need the declaration here 00049 #include "Tpetra_Import.hpp" 00050 #include "Tpetra_Map.hpp" 00051 00052 00053 namespace Ifpack2 { 00054 00058 template<class MatrixType> 00059 class OverlappingRowMatrix : 00060 virtual public Tpetra::RowMatrix<typename MatrixType::scalar_type, 00061 typename MatrixType::local_ordinal_type, 00062 typename MatrixType::global_ordinal_type, 00063 typename MatrixType::node_type> { 00064 public: 00066 00067 typedef typename MatrixType::scalar_type scalar_type; 00068 typedef typename MatrixType::local_ordinal_type local_ordinal_type; 00069 typedef typename MatrixType::global_ordinal_type global_ordinal_type; 00070 typedef typename MatrixType::node_type node_type; 00071 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type; 00072 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, 00073 global_ordinal_type, node_type> row_matrix_type; 00075 00076 00077 00088 OverlappingRowMatrix (const Teuchos::RCP<const row_matrix_type>& A, 00089 const int overlapLevel); 00090 00092 OverlappingRowMatrix (const Teuchos::RCP<const row_matrix_type>& A, 00093 const int overlapLevel, 00094 const int subdomainID); 00096 ~OverlappingRowMatrix (); 00097 00099 00100 00101 00103 virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm() const; 00104 00106 virtual Teuchos::RCP<node_type> getNode() const; 00107 00109 virtual Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> > 00110 getRowMap () const; 00111 00113 virtual Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> > 00114 getColMap () const; 00115 00119 virtual Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> > 00120 getDomainMap () const; 00121 00125 virtual Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> > 00126 getRangeMap () const; 00127 00129 virtual Teuchos::RCP<const Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type> > 00130 getGraph () const; 00131 00133 virtual global_size_t getGlobalNumRows () const; 00134 00136 virtual global_size_t getGlobalNumCols () const; 00137 00139 virtual size_t getNodeNumRows () const; 00140 00146 virtual size_t getNodeNumCols () const; 00147 00149 virtual global_ordinal_type getIndexBase () const; 00150 00152 virtual global_size_t getGlobalNumEntries () const; 00153 00155 virtual size_t getNodeNumEntries () const; 00156 00166 virtual size_t getNumEntriesInGlobalRow (global_ordinal_type globalRow) const; 00167 00177 virtual size_t getNumEntriesInLocalRow (local_ordinal_type localRow) const; 00178 00180 virtual global_size_t getGlobalNumDiags () const; 00181 00183 virtual size_t getNodeNumDiags () const; 00184 00186 virtual size_t getGlobalMaxNumRowEntries () const; 00187 00189 virtual size_t getNodeMaxNumRowEntries() const; 00190 00192 virtual bool hasColMap() const; 00193 00195 virtual bool isLowerTriangular() const; 00196 00198 virtual bool isUpperTriangular() const; 00199 00201 virtual bool isLocallyIndexed () const; 00202 00204 virtual bool isGloballyIndexed () const; 00205 00207 virtual bool isFillComplete() const; 00208 00210 virtual bool supportsRowViews() const; 00211 00213 00214 00215 00217 00227 virtual void 00228 getGlobalRowCopy (global_ordinal_type GlobalRow, 00229 const Teuchos::ArrayView<global_ordinal_type> &Indices, 00230 const Teuchos::ArrayView<scalar_type> &Values, 00231 size_t &NumEntries) const; 00232 00234 00244 virtual void 00245 getLocalRowCopy (local_ordinal_type LocalRow, 00246 const Teuchos::ArrayView<local_ordinal_type> &Indices, 00247 const Teuchos::ArrayView<scalar_type> &Values, 00248 size_t &NumEntries) const; 00249 00251 00260 virtual void 00261 getGlobalRowView (global_ordinal_type GlobalRow, 00262 Teuchos::ArrayView<const global_ordinal_type> &indices, 00263 Teuchos::ArrayView<const scalar_type> &values) const; 00264 00266 00275 virtual void 00276 getLocalRowView (local_ordinal_type LocalRow, 00277 Teuchos::ArrayView<const local_ordinal_type> &indices, 00278 Teuchos::ArrayView<const scalar_type> &values) const; 00279 00281 00283 virtual 00284 void getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &diag) const; 00285 00287 00288 00289 00299 virtual void 00300 leftScale (const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x); 00301 00311 virtual void 00312 rightScale (const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x); 00313 00315 00318 virtual typename Teuchos::ScalarTraits<scalar_type>::magnitudeType 00319 getFrobeniusNorm () const; 00320 00322 00329 virtual void 00330 apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X, 00331 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y, 00332 Teuchos::ETransp mode = Teuchos::NO_TRANS, 00333 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(), 00334 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const; 00335 00337 virtual bool hasTransposeApply() const; 00338 00339 virtual void 00340 importMultiVector (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X, 00341 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX, 00342 Tpetra::CombineMode CM = Tpetra::INSERT); 00343 00344 virtual void 00345 exportMultiVector (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX, 00346 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X, 00347 Tpetra::CombineMode CM = Tpetra::ADD); 00349 00350 std::string description() const; 00351 00352 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const; 00353 00354 private: 00355 typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> map_type; 00356 typedef Tpetra::Import<local_ordinal_type, global_ordinal_type, node_type> import_type; 00357 typedef Tpetra::Export<local_ordinal_type, global_ordinal_type, node_type> export_type; 00358 typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type> row_graph_type; 00359 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type; 00360 00362 Teuchos::RCP<const row_matrix_type> A_; 00363 00364 Tpetra::global_size_t NumGlobalRows_; 00365 Tpetra::global_size_t NumGlobalNonzeros_; 00366 size_t MaxNumEntries_; 00367 int OverlapLevel_; 00368 00369 // Subcommunicator stuff 00370 bool UseSubComm_; 00371 int subdomainID_; 00372 00373 // Wrapper matrix objects 00374 Teuchos::RCP<const map_type> RowMap_; 00375 Teuchos::RCP<const map_type> ColMap_; 00376 Teuchos::RCP<const import_type> Importer_; 00377 00379 Teuchos::RCP<row_matrix_type> ExtMatrix_; 00380 Teuchos::RCP<map_type> ExtMap_; 00381 Teuchos::RCP<import_type> ExtImporter_; 00382 00384 Teuchos::RCP<const row_graph_type> graph_; 00385 00387 mutable Teuchos::Array<local_ordinal_type> Indices_; 00389 mutable Teuchos::Array<scalar_type> Values_; 00390 00391 }; // class OverlappingRowMatrix 00392 00393 } // namespace Ifpack2 00394 00395 #endif // IFPACK2_OVERLAPPINGROWMATRIX_DECL_HPP
1.7.6.1