escript  Revision_
EscriptParams.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2018 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 
28 class EscriptParams
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:
51  // the number of parameters is small enough to avoid a map for performance
52  // reasons
53  int autoLazy;
54  int lazyStrFmt;
55  int lazyVerbose;
57  int tooManyLevels;
58  int tooManyLines;
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 {
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 {
107 }
108 
109 } // namespace escript
110 
111 #endif // __ESCRIPT_PARAMS_H__
112 
escript::EscriptParams::resolveCollective
int resolveCollective
Definition: EscriptParams.h:79
escript::EscriptParams::listEscriptParams
boost::python::list listEscriptParams() const
Definition: EscriptParams.cpp:165
escript::EscriptParams::getResolveCollective
int getResolveCollective() const
Definition: EscriptParams.h:65
escript::EscriptParams::getTooManyLevels
int getTooManyLevels() const
Definition: EscriptParams.h:66
escript::EscriptParams::tooManyLines
int tooManyLines
Definition: EscriptParams.h:81
escript::getEscriptParamInt
int getEscriptParamInt(const std::string &name, int sentinel=0)
get the value of a named parameter. See listEscriptParams() for available parameters.
Definition: EscriptParams.h:88
escript::EscriptParams::listFeatures
boost::python::list listFeatures() const
Definition: EscriptParams.cpp:193
escript::listFeatures
boost::python::list listFeatures()
returns a list of features escript was compiled with.
Definition: EscriptParams.h:115
escript::listEscriptParams
boost::python::list listEscriptParams()
describe available parameters.
Definition: EscriptParams.h:97
escript::EscriptParams::EscriptParams
EscriptParams()
Definition: EscriptParams.cpp:42
MPI_COMM_WORLD
#define MPI_COMM_WORLD
Definition: EsysMPI.h:46
escript::EscriptParams
Definition: EscriptParams.h:39
escript::EscriptParams::autoLazy
int autoLazy
Definition: EscriptParams.h:76
escript::EscriptParams::hasFeature
bool hasFeature(const std::string &name) const
Definition: EscriptParams.cpp:177
EscriptParams.h
escript::EscriptParams::getLazyVerbose
int getLazyVerbose() const
Definition: EscriptParams.h:64
escript::EscriptParams::tooManyLevels
int tooManyLevels
Definition: EscriptParams.h:80
escript::EscriptParams::setInt
void setInt(const std::string &name, int value)
Definition: EscriptParams.cpp:147
escript::escriptParams
EscriptParams escriptParams
Definition: EscriptParams.cpp:39
escript::EscriptParams::getLazyStrFmt
int getLazyStrFmt() const
Definition: EscriptParams.h:63
escript::EscriptParams::lazyVerbose
int lazyVerbose
Definition: EscriptParams.h:78
escript::setEscriptParamInt
void setEscriptParamInt(const std::string &name, int value)
Set the value of a named parameter. See listEscriptParams() for available parameters.
Definition: EscriptParams.h:79
EsysException.h
escript::EscriptParams::FeatureSet
std::unordered_set< std::string > FeatureSet
Definition: EscriptParams.h:53
escript
Definition: AbstractContinuousDomain.cpp:22
escript::EscriptParams::features
FeatureSet features
Definition: EscriptParams.h:73
escript::EscriptParams::getAutoLazy
int getAutoLazy() const
Definition: EscriptParams.h:62
escript::EscriptParams::getTooManyLines
int getTooManyLines() const
Definition: EscriptParams.h:67
escript::hasFeature
bool hasFeature(const std::string &name)
returns true if escript was compiled with the feature name, false otherwise.
Definition: EscriptParams.h:106
escript::EscriptParams::lazyStrFmt
int lazyStrFmt
Definition: EscriptParams.h:77
escript::EscriptParams::getInt
int getInt(const std::string &name, int sentinel=0) const
Definition: EscriptParams.cpp:128
EsysMPI.h
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:99