MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_ParameterListUtils.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// MueLu: A package for multigrid based preconditioning
4
//
5
// Copyright 2012 NTESS and the MueLu contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef MUELU_PARAMETERLISTUTILS_HPP
11
#define MUELU_PARAMETERLISTUTILS_HPP
12
13
#include <string>
14
#include <sstream>
15
16
#include <Teuchos_ParameterList.hpp>
17
#include <Teuchos_RCPDecl.hpp>
18
#include "
MueLu_ConfigDefs.hpp
"
19
20
namespace
MueLu
{
21
22
/* See also: ML_Epetra::UpdateList */
23
void
MergeParameterList
(
const
Teuchos::ParameterList& source, Teuchos::ParameterList& dest,
bool
overWrite);
24
25
void
CreateSublists
(
const
Teuchos::ParameterList& List, Teuchos::ParameterList& newList);
26
27
// Usage: GetMLSubList(paramList, "smoother", 2);
28
const
Teuchos::ParameterList&
GetMLSubList
(
const
Teuchos::ParameterList& paramList,
const
std::string& type,
int
levelID);
29
30
// Extract all the parameters that begin with "str:" (but skip sublist)
31
Teuchos::RCP<Teuchos::ParameterList>
ExtractSetOfParameters
(
const
Teuchos::ParameterList& paramList,
const
std::string& str);
32
38
void
replaceAll
(std::string& str,
const
std::string& from,
const
std::string& to);
39
41
template
<
typename
Type>
42
bool
replacePlaceholder
(std::string& str,
const
std::string& placeholder, Type data) {
43
std::stringstream s;
44
s << data;
45
replaceAll
(str, placeholder, s.str());
46
return
true
;
47
}
48
49
template
<
typename
Type>
50
bool
actionInterpretParameter
(Teuchos::ParameterList& mlParams,
const
std::string& paramName, std::string& str) {
51
// MUELU_READ_PARAM(mlParams, paramName, int, 0, data);
52
53
Type varName;
// = defaultValue; // extract from master list
54
if
(mlParams.isParameter(paramName)) varName = mlParams.get<Type>(paramName);
55
56
std::stringstream placeholder;
57
placeholder <<
"$"
<< paramName <<
"$"
;
58
59
return
MueLu::replacePlaceholder<Type>
(str, placeholder.str(), varName);
60
}
61
62
}
// namespace MueLu
63
64
#endif
// MUELU_PARAMETERLISTUTILS_HPP
MueLu_ConfigDefs.hpp
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:42
MueLu::CreateSublists
void CreateSublists(const Teuchos::ParameterList &List, Teuchos::ParameterList &newList)
Definition
MueLu_ParameterListUtils.cpp:27
MueLu::ExtractSetOfParameters
Teuchos::RCP< Teuchos::ParameterList > ExtractSetOfParameters(const Teuchos::ParameterList ¶mList, const std::string &str)
Definition
MueLu_ParameterListUtils.cpp:119
MueLu::replaceAll
void replaceAll(std::string &str, const std::string &from, const std::string &to)
Definition
MueLu_ParameterListUtils.cpp:134
MueLu::actionInterpretParameter
bool actionInterpretParameter(Teuchos::ParameterList &mlParams, const std::string ¶mName, std::string &str)
Definition
MueLu_ParameterListUtils.hpp:50
MueLu::replacePlaceholder
bool replacePlaceholder(std::string &str, const std::string &placeholder, Type data)
templated version to replace placeholder by data in "str"
Definition
MueLu_ParameterListUtils.hpp:42
MueLu::MergeParameterList
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
Definition
MueLu_ParameterListUtils.cpp:21
MueLu::GetMLSubList
const Teuchos::ParameterList & GetMLSubList(const Teuchos::ParameterList ¶mList, const std::string &type, int levelID)
Definition
MueLu_ParameterListUtils.cpp:104
src
Interface
MueLu_ParameterListUtils.hpp
Generated by
1.17.0