Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Details_Fic_def.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4 //
5 // Copyright 2009 NTESS and the Ifpack2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
11 
12 #ifndef __IFPACK2_FIC_DEF_HPP__
13 #define __IFPACK2_FIC_DEF_HPP__
14 
15 #include "Ifpack2_Details_Fic_decl.hpp"
17 #include <Kokkos_Timer.hpp>
18 #include <shylu_fastic.hpp>
19 
20 namespace Ifpack2
21 {
22 namespace Details
23 {
24 
25 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
28  FastILU_Base<Scalar, LocalOrdinal, GlobalOrdinal, Node>(A) {}
29 
30 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
32 getSweeps() const
33 {
34  return localPrec_->getNFact();
35 }
36 
37 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
40 {
41  return localPrec_->getSpTrsvType();
42 }
43 
44 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
46 getNTrisol() const
47 {
48  return localPrec_->getNTrisol();
49 }
50 
51 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
53 checkLocalIC() const
54 {
55  localPrec_->checkIC();
56 }
57 
58 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
61 {
62  auto nRows = this->mat_->getLocalNumRows();
63  auto& p = this->params_;
64  localPrec_ = Teuchos::rcp(new LocalFIC(this->localRowPtrs_, this->localColInds_, this->localValues_, nRows, (p.sptrsv_algo != FastILU::SpTRSV::Fast),
65  p.nFact, p.nTrisol, p.level, p.omega, p.shift, p.guessFlag ? 1 : 0, p.blockSizeILU, p.blockSize));
66  localPrec_->initialize();
67  this->initTime_ = localPrec_->getInitializeTime();
68 }
69 
70 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
73 {
74  //update values in local prec (until compute(), values aren't needed)
75  localPrec_->setValues(this->localValues_);
76  localPrec_->compute();
77  this->computeTime_ = localPrec_->getComputeTime();
78 }
79 
80 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
83 {
84  localPrec_->apply(x, y);
85  //since this may be applied to multiple vectors, add to applyTime_ instead of setting it
86  this->applyTime_ += localPrec_->getApplyTime();
87 }
88 
89 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
91 getName() const
92 {
93  return "Fic";
94 }
95 
96 #define IFPACK2_DETAILS_FIC_INSTANT(S, L, G, N) \
97 template class Ifpack2::Details::Fic<S, L, G, N>;
98 
99 } //namespace Details
100 } //namespace Ifpack2
101 
102 #endif
103 
Fic(Teuchos::RCP< const TRowMatrix > mat_)
Constructor.
Definition: Ifpack2_Details_Fic_def.hpp:27
int getSweeps() const
Get the sweeps ("nFact") from localPrec_.
Definition: Ifpack2_Details_Fic_def.hpp:32
std::string getName() const
Get the name of the underlying preconditioner (&quot;Filu&quot;, &quot;Fildl&quot; or &quot;Fic&quot;)
Definition: Ifpack2_Details_Fic_def.hpp:91
void initLocalPrec()
Construct the underlying preconditioner (localPrec_) using given params and then call localPrec_-&gt;ini...
Definition: Ifpack2_Details_Fic_def.hpp:60
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
The base class of the Ifpack2 FastILU wrappers (Filu, Fildl and Fic)
Definition: Ifpack2_Details_FastILU_Base_decl.hpp:38
void computeLocalPrec()
Get values array from the matrix and then call compute() on the underlying preconditioner.
Definition: Ifpack2_Details_Fic_def.hpp:72
std::string getSpTrsvType() const
Get the name of triangular solve algorithm.
Definition: Ifpack2_Details_Fic_def.hpp:39
Kokkos::View< ImplScalar *, execution_space > ImplScalarArray
Array of Scalar on device.
Definition: Ifpack2_Details_FastILU_Base_decl.hpp:62
void applyLocalPrec(ImplScalarArray x, ImplScalarArray y) const
Apply the local preconditioner with 1-D views of the local parts of X and Y (one vector only) ...
Definition: Ifpack2_Details_Fic_def.hpp:82
int getNTrisol() const
Get the number of triangular solves ("nTrisol") from localPrec_.
Definition: Ifpack2_Details_Fic_def.hpp:46
void checkLocalIC() const
Verify and print debug info about the internal IC preconditioner.
Definition: Ifpack2_Details_Fic_def.hpp:53
Provides functions for retrieving local CRS arrays (row pointers, column indices, and values) from Tp...