Zoltan2
Loading...
Searching...
No Matches
Zoltan2_Parameters.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Zoltan2: A package of combinatorial algorithms for scientific computing
4//
5// Copyright 2012 NTESS and the Zoltan2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
15
16// Parameters.cpp builds the full lists from a series of member statics
19#include <Zoltan2_Problem.hpp>
24
25namespace Zoltan2 {
26
35void createAllParameters(Teuchos::ParameterList &pList)
36{
37 // the old method loads from a larger #define XML string
38 // the new way loads from a series of static functions
39
40 // The dummy adapter is arbitrary
41 // It allows us to keep the getValidParameters method in the class
42 // However currently that has no template dependence
43 typedef Zoltan2::BasicUserTypes<> dummyTypes;
45
46 // environment has some of it's own parameters to provide
48
49 // Problem provides the base set of parameters for all problems
51
52 // PartitioningProblem will also add parameters for each Algorithm
54
55 // Other problems have their own unique parameters
59}
60
85 const Teuchos::ParameterList &plSome, // in: user's parameters
86 const Teuchos::ParameterList &plAll, // in: validators for all params
87 Teuchos::ParameterList &plVal) // out: validators for user's params
88{
89 ParameterList::ConstIterator next = plSome.begin();
90
91 while (next != plSome.end()){
92
93 const std::string &name = next->first;
94 const ParameterEntry &entrySome = plSome.getEntry(name);
95 const ParameterEntry &entryAll = plAll.getEntry(name);
96
97 if (entrySome.isList()){
98 plVal.sublist(name); // create & get
99 // Don't set validators for sublists; sublists are for TPL's parameters
100 }
101 else{
102 plVal.setEntry(name, entryAll);
103 }
104
105 ++next;
106 }
107}
108
116 const Teuchos::ParameterList &plIn,
117 Teuchos::ParameterList &plOut)
118{
119 ParameterList allParameters;
120
121 try{
122 createAllParameters(allParameters);
123 }
125
126 setValidatorsInList(plIn, allParameters, plOut);
127}
128
129// Why isn't there a Teuchos method that does this?
130
132 const Teuchos::ParameterList &pl,
133 std::ostream &os,
134 std::string listNames)
135{
136
137 if (listNames.size() == 0)
138 listNames = std::string("top");
139
140 Array<std::string> subLists;
141 ParameterList::ConstIterator next = pl.begin();
142
143 while (next != pl.end()){
144 const std::string &name = next->first;
145 const ParameterEntry &entry = pl.getEntry(name);
146
147 if (entry.isList()){
148 subLists.append(name);
149 }
150 else{
151 std::string doc = entry.docString();
152 os << "List: "<< listNames << ", parameter: " << name << "\n";
153 if (doc.size())
154 os << doc << "\n";
155 }
156
157 ++next;
158 }
159
160 for (int i=0; i < subLists.size(); i++){
161 std::string newListName = listNames + std::string("/") + subLists[i];
162 const ParameterList &sublist = pl.sublist(subLists[i]);
163 printListDocumentation(sublist, os, newListName);
164 }
165}
166
167
168} //namespace Zoltan2
Defines the BasicIdentifierAdapter class.
Defines the ColoringProblem class.
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
Traits for application input objects.
Defines the MappingProblem class.
Defines the OrderingProblem class.
Defines Parameter related enumerators, declares functions.
Defines the PartitioningProblem class.
Defines the Problem base class.
This class represents a collection of global Identifiers and their associated weights,...
A simple class that can be the User template argument for an InputAdapter.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
static void getValidParameters(ParameterList &pl)
Collect the paramaters specific to Environment.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
static void getValidParameters(ParameterList &pl)
Created by mbenlioglu on Aug 31, 2020.
void printListDocumentation(const Teuchos::ParameterList &pl, std::ostream &os, std::string listNames)
static void setValidatorsInList(const Teuchos::ParameterList &plSome, const Teuchos::ParameterList &plAll, Teuchos::ParameterList &plVal)
Create a parameter list that can validate a specific list of parameters.
void createAllParameters(Teuchos::ParameterList &pList)
Create a list of all Zoltan2 parameters and validators.
void createValidatorList(const Teuchos::ParameterList &plIn, Teuchos::ParameterList &plOut)
Create a list by adding validators to the users parameter list.