escript  Revision_
EscriptParams.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 #ifndef __ESCRIPT_PARAMS_H__
19 #define __ESCRIPT_PARAMS_H__
20 
21 #include "system_dep.h"
22 
23 #include <boost/python/list.hpp>
24 
25 #include <string>
26 #include <unordered_set>
27 
28 namespace escript
29 {
30 
32 {
33  typedef std::unordered_set<std::string> FeatureSet;
34 
35 public:
36  EscriptParams();
37 
38  int getInt(const std::string& name, int sentinel = 0) const;
39  void setInt(const std::string& name, int value);
40  boost::python::list listEscriptParams() const;
41 
42  inline int getAutoLazy() const { return autoLazy; }
43  inline int getLazyStrFmt() const { return lazyStrFmt; }
44  inline int getLazyVerbose() const { return lazyVerbose; }
45  inline int getResolveCollective() const { return resolveCollective; }
46  inline int getTooManyLevels() const { return tooManyLevels; }
47  inline int getTooManyLines() const { return tooManyLines; }
48 
49  bool hasFeature(const std::string& name) const;
50  boost::python::list listFeatures() const;
51 
52 private:
54  // the number of parameters is small enough to avoid a map for performance
55  // reasons
56  int autoLazy;
62 };
63 
64 
66 
71 inline void setEscriptParamInt(const std::string& name, int value)
72 {
73  escriptParams.setInt(name, value);
74 }
75 
80 inline int getEscriptParamInt(const std::string& name, int sentinel=0)
81 {
82  return escriptParams.getInt(name, sentinel);
83 }
84 
89 inline boost::python::list listEscriptParams()
90 {
92 }
93 
99 inline bool hasFeature(const std::string& name)
100 {
101  return escriptParams.hasFeature(name);
102 }
103 
108 inline boost::python::list listFeatures()
109 {
110  return escriptParams.listFeatures();
111 }
112 
113 } // namespace escript
114 
115 #endif // __ESCRIPT_PARAMS_H__
116 
Definition: EscriptParams.h:32
int getLazyVerbose() const
Definition: EscriptParams.h:44
int getInt(const std::string &name, int sentinel=0) const
Definition: EscriptParams.cpp:129
int getLazyStrFmt() const
Definition: EscriptParams.h:43
int resolveCollective
Definition: EscriptParams.h:59
int autoLazy
Definition: EscriptParams.h:56
int tooManyLevels
Definition: EscriptParams.h:60
bool hasFeature(const std::string &name) const
Definition: EscriptParams.cpp:178
int getAutoLazy() const
Definition: EscriptParams.h:42
void setInt(const std::string &name, int value)
Definition: EscriptParams.cpp:148
int tooManyLines
Definition: EscriptParams.h:61
int getTooManyLines() const
Definition: EscriptParams.h:47
boost::python::list listFeatures() const
Definition: EscriptParams.cpp:194
boost::python::list listEscriptParams() const
Definition: EscriptParams.cpp:166
int getTooManyLevels() const
Definition: EscriptParams.h:46
int getResolveCollective() const
Definition: EscriptParams.h:45
FeatureSet features
Definition: EscriptParams.h:53
int lazyVerbose
Definition: EscriptParams.h:58
std::unordered_set< std::string > FeatureSet
Definition: EscriptParams.h:33
int lazyStrFmt
Definition: EscriptParams.h:57
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
Definition: AbstractContinuousDomain.cpp:23
bool hasFeature(const std::string &name)
returns true if escript was compiled with the feature name, false otherwise.
Definition: EscriptParams.h:99
boost::python::list listFeatures()
returns a list of features escript was compiled with.
Definition: EscriptParams.h:108
int getEscriptParamInt(const std::string &name, int sentinel=0)
get the value of a named parameter. See listEscriptParams() for available parameters.
Definition: EscriptParams.h:80
void setEscriptParamInt(const std::string &name, int value)
Set the value of a named parameter. See listEscriptParams() for available parameters.
Definition: EscriptParams.h:71
boost::python::list listEscriptParams()
describe available parameters.
Definition: EscriptParams.h:89
EscriptParams escriptParams
Definition: EscriptParams.cpp:29