|
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_LOCALFILTER_DECL_HPP 00044 #define IFPACK2_LOCALFILTER_DECL_HPP 00045 00046 #include <Ifpack2_ConfigDefs.hpp> 00047 #include <Tpetra_RowMatrix.hpp> 00048 #include <vector> 00049 00050 00051 namespace Ifpack2 { 00052 00160 template<class MatrixType> 00161 class LocalFilter : 00162 virtual public Tpetra::RowMatrix<typename MatrixType::scalar_type, 00163 typename MatrixType::local_ordinal_type, 00164 typename MatrixType::global_ordinal_type, 00165 typename MatrixType::node_type>, 00166 virtual public Teuchos::Describable 00167 { 00168 public: 00170 00171 00173 typedef typename MatrixType::scalar_type scalar_type; 00174 00176 TEUCHOS_DEPRECATED typedef typename MatrixType::scalar_type Scalar; 00177 00178 00180 typedef typename MatrixType::local_ordinal_type local_ordinal_type; 00181 00183 TEUCHOS_DEPRECATED typedef typename MatrixType::local_ordinal_type LocalOrdinal; 00184 00185 00187 typedef typename MatrixType::global_ordinal_type global_ordinal_type; 00188 00190 TEUCHOS_DEPRECATED typedef typename MatrixType::global_ordinal_type GlobalOrdinal; 00191 00192 00194 typedef typename MatrixType::node_type node_type; 00195 00197 TEUCHOS_DEPRECATED typedef typename MatrixType::node_type Node; 00198 00199 00201 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type; 00202 00204 TEUCHOS_DEPRECATED typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitudeType; 00205 00207 typedef Tpetra::RowMatrix<scalar_type, 00208 local_ordinal_type, 00209 global_ordinal_type, 00210 node_type> row_matrix_type; 00211 00213 typedef Tpetra::Map<local_ordinal_type, 00214 global_ordinal_type, 00215 node_type> map_type; 00217 00218 00219 00221 virtual std::string description () const; 00222 00224 virtual void 00225 describe (Teuchos::FancyOStream &out, 00226 const Teuchos::EVerbosityLevel verbLevel = 00227 Teuchos::Describable::verbLevel_default) const; 00228 00230 00231 00232 00238 explicit LocalFilter (const Teuchos::RCP<const row_matrix_type>& A); 00239 00241 virtual ~LocalFilter(); 00242 00244 00245 00246 00248 virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm() const; 00249 00251 virtual Teuchos::RCP<node_type> getNode() const; 00252 00254 virtual Teuchos::RCP<const map_type> getRowMap() const; 00255 00257 virtual Teuchos::RCP<const map_type> getColMap() const; 00258 00260 virtual Teuchos::RCP<const map_type> getDomainMap() const; 00261 00263 virtual Teuchos::RCP<const map_type> getRangeMap() const; 00264 00266 virtual Teuchos::RCP<const Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > 00267 getGraph () const; 00268 00270 virtual global_size_t getGlobalNumRows() const; 00271 00273 virtual global_size_t getGlobalNumCols() const; 00274 00276 virtual size_t getNodeNumRows() const; 00277 00279 virtual size_t getNodeNumCols() const; 00280 00282 virtual global_ordinal_type getIndexBase() const; 00283 00285 virtual global_size_t getGlobalNumEntries() const; 00286 00288 virtual size_t getNodeNumEntries() const; 00289 00295 virtual size_t getNumEntriesInGlobalRow (global_ordinal_type globalRow) const; 00296 00302 virtual size_t getNumEntriesInLocalRow (local_ordinal_type localRow) const; 00303 00305 virtual global_size_t getGlobalNumDiags() const; 00306 00308 virtual size_t getNodeNumDiags() const; 00309 00311 virtual size_t getGlobalMaxNumRowEntries() const; 00312 00314 virtual size_t getNodeMaxNumRowEntries() const; 00315 00317 virtual bool hasColMap() const; 00318 00320 virtual bool isLowerTriangular() const; 00321 00323 virtual bool isUpperTriangular() const; 00324 00326 virtual bool isLocallyIndexed() const; 00327 00329 virtual bool isGloballyIndexed() const; 00330 00332 virtual bool isFillComplete() const; 00333 00335 virtual bool supportsRowViews() const; 00336 00338 00339 00340 00354 virtual void 00355 getGlobalRowCopy (global_ordinal_type GlobalRow, 00356 const Teuchos::ArrayView<global_ordinal_type> &Indices, 00357 const Teuchos::ArrayView<scalar_type> &Values, 00358 size_t &NumEntries) const; 00359 00373 virtual void 00374 getLocalRowCopy (local_ordinal_type LocalRow, 00375 const Teuchos::ArrayView<local_ordinal_type> &Indices, 00376 const Teuchos::ArrayView<scalar_type> &Values, 00377 size_t &NumEntries) const ; 00378 00380 00390 virtual void 00391 getGlobalRowView (global_ordinal_type GlobalRow, 00392 Teuchos::ArrayView<const global_ordinal_type> &indices, 00393 Teuchos::ArrayView<const scalar_type> &values) const; 00394 00396 00406 virtual void 00407 getLocalRowView (local_ordinal_type LocalRow, 00408 Teuchos::ArrayView<const local_ordinal_type> &indices, 00409 Teuchos::ArrayView<const scalar_type> &values) const; 00410 00417 virtual void 00418 getLocalDiagCopy (Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> &diag) const; 00419 00421 00422 00423 00433 virtual void leftScale(const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x); 00434 00444 virtual void rightScale(const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x); 00445 00454 virtual magnitude_type getFrobeniusNorm() const; 00455 00462 virtual void 00463 apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> &X, 00464 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> &Y, 00465 Teuchos::ETransp mode = Teuchos::NO_TRANS, 00466 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(), 00467 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const; 00468 00470 virtual bool hasTransposeApply() const; 00471 00473 00474 00475 00477 00486 TPETRA_DEPRECATED 00487 virtual void getGlobalRowView(global_ordinal_type GlobalRow, 00488 Teuchos::ArrayRCP<const global_ordinal_type> &indices, 00489 Teuchos::ArrayRCP<const scalar_type> &values) const; 00490 00492 00501 TPETRA_DEPRECATED 00502 virtual void getLocalRowView(local_ordinal_type LocalRow, 00503 Teuchos::ArrayRCP<const local_ordinal_type> &indices, 00504 Teuchos::ArrayRCP<const scalar_type> &values) const; 00506 00507 00508 private: 00510 typedef Tpetra::RowGraph<local_ordinal_type, 00511 global_ordinal_type, 00512 node_type> row_graph_type; 00514 void 00515 applyNonAliased (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X, 00516 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y, 00517 Teuchos::ETransp mode, 00518 scalar_type alpha, 00519 scalar_type beta) const; 00520 00533 static bool 00534 mapPairIsFitted (const map_type& map1, const map_type& map2); 00535 00539 // If both pairs of Maps of the original matrix A are fitted on this 00540 // process, then this process can use a fast "view" implementation. 00541 static bool 00542 mapPairsAreFitted (const row_matrix_type& A); 00543 00545 Teuchos::RCP<const row_matrix_type> A_; 00546 00548 Teuchos::RCP<const map_type> localRowMap_; 00549 00551 Teuchos::RCP<const map_type> localDomainMap_; 00552 00554 Teuchos::RCP<const map_type> localRangeMap_; 00555 00557 size_t NumNonzeros_; 00559 size_t MaxNumEntries_; 00561 size_t MaxNumEntriesA_; 00563 std::vector<size_t> NumEntries_; 00564 00566 mutable Teuchos::Array<local_ordinal_type> localIndices_; 00567 00569 mutable Teuchos::Array<scalar_type> Values_; 00570 };// class LocalFilter 00571 00572 }// namespace Ifpack2 00573 00574 #endif /* IFPACK2_LOCALFILTER_DECL_HPP */
1.7.6.1