Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
14 #include <Zoltan2_Parameters.hpp>
15 
16 // Parameters.cpp builds the full lists from a series of member statics
17 #include <Zoltan2_InputTraits.hpp>
19 #include <Zoltan2_Problem.hpp>
24 
25 namespace Zoltan2 {
26 
35 void 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 
84 static void setValidatorsInList(
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 ColoringProblem class.
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
Defines Parameter related enumerators, declares functions.
void createValidatorList(const Teuchos::ParameterList &plIn, Teuchos::ParameterList &plOut)
Create a list by adding validators to the users parameter list.
A simple class that can be the User template argument for an InputAdapter.
void createAllParameters(Teuchos::ParameterList &pList)
Create a list of all Zoltan2 parameters and validators.
void printListDocumentation(const Teuchos::ParameterList &pl, std::ostream &os, std::string listNames)
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
This class represents a collection of global Identifiers and their associated weights, if any.
static void getValidParameters(ParameterList &pl)
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
static void getValidParameters(ParameterList &pl)
Collect the paramaters specific to Environment.
Defines the Problem base class.
Traits for application input objects.
Defines the OrderingProblem class.
Defines the BasicIdentifierAdapter class.
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.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
Defines the PartitioningProblem class.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
Defines the MappingProblem class.