escript  Revision_
EscriptParams.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 #ifndef __ESCRIPT_PARAMS_H__
18 #define __ESCRIPT_PARAMS_H__
19 
20 #include <boost/python/list.hpp>
21 
22 #include <string>
23 #include <unordered_set>
24 
25 namespace escript
26 {
27 
29 {
30  typedef std::unordered_set<std::string> FeatureSet;
31 
32 public:
33  EscriptParams();
34 
35  int getInt(const std::string& name, int sentinel = 0) const;
36  void setInt(const std::string& name, int value);
37  boost::python::list listEscriptParams() const;
38 
39  inline int getAutoLazy() const { return autoLazy; }
40  inline int getLazyStrFmt() const { return lazyStrFmt; }
41  inline int getLazyVerbose() const { return lazyVerbose; }
42  inline int getResolveCollective() const { return resolveCollective; }
43  inline int getTooManyLevels() const { return tooManyLevels; }
44  inline int getTooManyLines() const { return tooManyLines; }
45 
46  bool hasFeature(const std::string& name) const;
47  boost::python::list listFeatures() const;
48 
49 private:
50  FeatureSet features;
51  // the number of parameters is small enough to avoid a map for performance
52  // reasons
53  int autoLazy;
59 };
60 
61 
63 
68 inline void setEscriptParamInt(const std::string& name, int value)
69 {
70  escriptParams.setInt(name, value);
71 }
72 
77 inline int getEscriptParamInt(const std::string& name, int sentinel=0)
78 {
79  return escriptParams.getInt(name, sentinel);
80 }
81 
86 inline boost::python::list listEscriptParams()
87 {
88  return escriptParams.listEscriptParams();
89 }
90 
95 inline bool hasFeature(const std::string& name)
96 {
97  return escriptParams.hasFeature(name);
98 }
99 
104 inline boost::python::list listFeatures()
105 {
106  return escriptParams.listFeatures();
107 }
108 
109 } // namespace escript
110 
111 #endif // __ESCRIPT_PARAMS_H__
112 
int tooManyLines
Definition: EscriptParams.h:58
boost::python::list listEscriptParams() const
Definition: EscriptParams.cpp:154
int getTooManyLevels() const
Definition: EscriptParams.h:43
int autoLazy
Definition: EscriptParams.h:53
Definition: AbstractContinuousDomain.cpp:22
int getInt(const std::string &name, int sentinel=0) const
Definition: EscriptParams.cpp:117
EscriptParams()
Definition: EscriptParams.cpp:31
bool hasFeature(const std::string &name) const
Definition: EscriptParams.cpp:166
int getLazyStrFmt() const
Definition: EscriptParams.h:40
int tooManyLevels
Definition: EscriptParams.h:57
int getEscriptParamInt(const std::string &name, int sentinel=0)
get the value of a named parameter. See listEscriptParams() for available parameters.
Definition: EscriptParams.h:77
int getLazyVerbose() const
Definition: EscriptParams.h:41
void setInt(const std::string &name, int value)
Definition: EscriptParams.cpp:136
boost::python::list listFeatures() const
Definition: EscriptParams.cpp:182
Definition: EscriptParams.h:28
int getAutoLazy() const
Definition: EscriptParams.h:39
EscriptParams escriptParams
Definition: EscriptParams.cpp:28
int resolveCollective
Definition: EscriptParams.h:56
void setEscriptParamInt(const std::string &name, int value)
Set the value of a named parameter. See listEscriptParams() for available parameters.
Definition: EscriptParams.h:68
int getResolveCollective() const
Definition: EscriptParams.h:42
FeatureSet features
Definition: EscriptParams.h:50
std::unordered_set< std::string > FeatureSet
Definition: EscriptParams.h:30
int getTooManyLines() const
Definition: EscriptParams.h:44
int lazyVerbose
Definition: EscriptParams.h:55
int lazyStrFmt
Definition: EscriptParams.h:54