Zoltan2
Loading...
Searching...
No Matches
Zoltan2_Parameters.cpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Zoltan2: A package of combinatorial algorithms for scientific computing
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Karen Devine (kddevin@sandia.gov)
39// Erik Boman (egboman@sandia.gov)
40// Siva Rajamanickam (srajama@sandia.gov)
41//
42// ***********************************************************************
43//
44// @HEADER
45
51
52// Parameters.cpp builds the full lists from a series of member statics
55#include <Zoltan2_Problem.hpp>
60
61namespace Zoltan2 {
62
71void createAllParameters(Teuchos::ParameterList &pList)
72{
73 // the old method loads from a larger #define XML string
74 // the new way loads from a series of static functions
75
76 // The dummy adapter is arbitrary
77 // It allows us to keep the getValidParameters method in the class
78 // However currently that has no template dependence
79 typedef Zoltan2::BasicUserTypes<> dummyTypes;
81
82 // environment has some of it's own parameters to provide
84
85 // Problem provides the base set of parameters for all problems
87
88 // PartitioningProblem will also add parameters for each Algorithm
90
91 // Other problems have their own unique parameters
95}
96
121 const Teuchos::ParameterList &plSome, // in: user's parameters
122 const Teuchos::ParameterList &plAll, // in: validators for all params
123 Teuchos::ParameterList &plVal) // out: validators for user's params
124{
125 ParameterList::ConstIterator next = plSome.begin();
126
127 while (next != plSome.end()){
128
129 const std::string &name = next->first;
130 const ParameterEntry &entrySome = plSome.getEntry(name);
131 const ParameterEntry &entryAll = plAll.getEntry(name);
132
133 if (entrySome.isList()){
134 plVal.sublist(name); // create & get
135 // Don't set validators for sublists; sublists are for TPL's parameters
136 }
137 else{
138 plVal.setEntry(name, entryAll);
139 }
140
141 ++next;
142 }
143}
144
152 const Teuchos::ParameterList &plIn,
153 Teuchos::ParameterList &plOut)
154{
155 ParameterList allParameters;
156
157 try{
158 createAllParameters(allParameters);
159 }
161
162 setValidatorsInList(plIn, allParameters, plOut);
163}
164
165// Why isn't there a Teuchos method that does this?
166
168 const Teuchos::ParameterList &pl,
169 std::ostream &os,
170 std::string listNames)
171{
172
173 if (listNames.size() == 0)
174 listNames = std::string("top");
175
176 Array<std::string> subLists;
177 ParameterList::ConstIterator next = pl.begin();
178
179 while (next != pl.end()){
180 const std::string &name = next->first;
181 const ParameterEntry &entry = pl.getEntry(name);
182
183 if (entry.isList()){
184 subLists.append(name);
185 }
186 else{
187 std::string doc = entry.docString();
188 os << "List: "<< listNames << ", parameter: " << name << "\n";
189 if (doc.size())
190 os << doc << "\n";
191 }
192
193 ++next;
194 }
195
196 for (int i=0; i < subLists.size(); i++){
197 std::string newListName = listNames + std::string("/") + subLists[i];
198 const ParameterList &sublist = pl.sublist(subLists[i]);
199 printListDocumentation(sublist, os, newListName);
200 }
201}
202
203
204} //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.