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 <boost/python/list.hpp>
22 
23 #include <string>
24 #include <unordered_set>
25 
26 namespace escript
27 {
28 
29 class EscriptParams
30 {
31  typedef std::unordered_set<std::string> FeatureSet;
32 
33 public:
34  EscriptParams();
35 
36  int getInt(const std::string& name, int sentinel = 0) const;
37  void setInt(const std::string& name, int value);
38  boost::python::list listEscriptParams() const;
39 
40  inline int getAutoLazy() const { return autoLazy; }
41  inline int getLazyStrFmt() const { return lazyStrFmt; }
42  inline int getLazyVerbose() const { return lazyVerbose; }
43  inline int getResolveCollective() const { return resolveCollective; }
44  inline int getTooManyLevels() const { return tooManyLevels; }
45  inline int getTooManyLines() const { return tooManyLines; }
46 
47  bool hasFeature(const std::string& name) const;
48  boost::python::list listFeatures() const;
49 
50 private:
52  // the number of parameters is small enough to avoid a map for performance
53  // reasons
54  int autoLazy;
55  int lazyStrFmt;
58  int tooManyLevels;
59  int tooManyLines;
60 };
61 
62 
64 
69 inline void setEscriptParamInt(const std::string& name, int value)
70 {
71  escriptParams.setInt(name, value);
72 }
73 
78 inline int getEscriptParamInt(const std::string& name, int sentinel=0)
79 {
80  return escriptParams.getInt(name, sentinel);
81 }
82 
87 inline boost::python::list listEscriptParams()
88 {
90 }
91 
96 inline bool hasFeature(const std::string& name)
97 {
98  return escriptParams.hasFeature(name);
99 }
100 
105 inline boost::python::list listFeatures()
106 {
107  return escriptParams.listFeatures();
108 }
109 
110 } // namespace escript
111 
112 #endif // __ESCRIPT_PARAMS_H__
113 
escript::EscriptParams::resolveCollective
int resolveCollective
Definition: EscriptParams.h:82
escript::EscriptParams::listEscriptParams
boost::python::list listEscriptParams() const
Definition: EscriptParams.cpp:171
escript::EscriptParams::getResolveCollective
int getResolveCollective() const
Definition: EscriptParams.h:68
escript::EscriptParams::getTooManyLevels
int getTooManyLevels() const
Definition: EscriptParams.h:69
escript::EscriptParams::tooManyLines
int tooManyLines
Definition: EscriptParams.h:84
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:90
escript::EscriptParams::listFeatures
boost::python::list listFeatures() const
Definition: EscriptParams.cpp:199
escript::listFeatures
boost::python::list listFeatures()
returns a list of features escript was compiled with.
Definition: EscriptParams.h:117
escript::listEscriptParams
boost::python::list listEscriptParams()
describe available parameters.
Definition: EscriptParams.h:99
escript::EscriptParams::EscriptParams
EscriptParams()
Definition: EscriptParams.cpp:44
MPI_COMM_WORLD
#define MPI_COMM_WORLD
Definition: EsysMPI.h:47
escript::EscriptParams
Definition: EscriptParams.h:41
escript::EscriptParams::autoLazy
int autoLazy
Definition: EscriptParams.h:79
escript::EscriptParams::hasFeature
bool hasFeature(const std::string &name) const
Definition: EscriptParams.cpp:183
EscriptParams.h
escript::EscriptParams::getLazyVerbose
int getLazyVerbose() const
Definition: EscriptParams.h:67
escript::EscriptParams::tooManyLevels
int tooManyLevels
Definition: EscriptParams.h:83
escript::EscriptParams::setInt
void setInt(const std::string &name, int value)
Definition: EscriptParams.cpp:153
escript::escriptParams
EscriptParams escriptParams
Definition: EscriptParams.cpp:41
escript::EscriptParams::getLazyStrFmt
int getLazyStrFmt() const
Definition: EscriptParams.h:66
escript::EscriptParams::lazyVerbose
int lazyVerbose
Definition: EscriptParams.h:81
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:81
EsysException.h
escript::EscriptParams::FeatureSet
std::unordered_set< std::string > FeatureSet
Definition: EscriptParams.h:56
escript
Definition: AbstractContinuousDomain.cpp:23
escript::EscriptParams::features
FeatureSet features
Definition: EscriptParams.h:76
escript::EscriptParams::getAutoLazy
int getAutoLazy() const
Definition: EscriptParams.h:65
escript::EscriptParams::getTooManyLines
int getTooManyLines() const
Definition: EscriptParams.h:70
escript::hasFeature
bool hasFeature(const std::string &name)
returns true if escript was compiled with the feature name, false otherwise.
Definition: EscriptParams.h:108
escript::EscriptParams::lazyStrFmt
int lazyStrFmt
Definition: EscriptParams.h:80
escript::EscriptParams::getInt
int getInt(const std::string &name, int sentinel=0) const
Definition: EscriptParams.cpp:134
EsysMPI.h
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:101