Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_PreconditionerState.cpp
1 // @HEADER
2 // *****************************************************************************
3 // Teko: A package for block and physics based preconditioning
4 //
5 // Copyright 2010 NTESS and the Teko contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #include "Teko_PreconditionerState.hpp"
11 
12 #include "Thyra_DefaultPreconditioner.hpp"
13 
14 using namespace Thyra;
15 
16 namespace Teko {
18 
20 void PreconditionerState::setParameterList(const RCP<Teuchos::ParameterList>& paramList) {
21  paramList_ = paramList;
22 }
23 
25 RCP<Teuchos::ParameterList> PreconditionerState::getNonconstParameterList() {
26  if (paramList_ == Teuchos::null) paramList_ = Teuchos::rcp(new Teuchos::ParameterList());
27 
28  return paramList_;
29 }
30 
32 RCP<Teuchos::ParameterList> PreconditionerState::unsetParameterList() {
33  RCP<Teuchos::ParameterList> paramList = paramList_;
34  paramList_ = Teuchos::null;
35  return paramList;
36 }
37 
39 void PreconditionerState::merge(const PreconditionerState& ps, int /* position */) {
40  // merge the two linearOps lists
41  linearOps_.insert(ps.linearOps_.begin(), ps.linearOps_.end());
42 
43  // merge two parameter lists
44  Teuchos::ParameterList::ConstIterator itr;
45  if (ps.paramList_ != Teuchos::null) {
46  Teuchos::RCP<Teuchos::ParameterList> paramList = getNonconstParameterList();
47  for (itr = ps.paramList_->begin(); itr != ps.paramList_->end(); ++itr)
48  paramList->setEntry(itr->first, itr->second);
49  }
50 }
51 
53 unsigned int PreconditionerState::getTag() const { return tag_; }
54 
56 void PreconditionerState::setTag(unsigned int tag) { tag_ = tag; }
57 
59 
60 } // end namespace Teko
Teuchos::RCP< Teuchos::ParameterList > paramList_
for ParameterListAcceptor
An implementation of a state object preconditioners.