EscriptParams.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __ESCRIPT_PARAMS_H__
#define __ESCRIPT_PARAMS_H__
#include <boost/python/list.hpp>
#include <string>
#include <unordered_set>
namespace escript
{
class EscriptParams
{
typedef std::unordered_set<std::string> FeatureSet;
public:
EscriptParams();
int getInt(const std::string& name, int sentinel = 0) const;
void setInt(const std::string& name, int value);
boost::python::list listEscriptParams() const;
inline int getAutoLazy() const { return autoLazy; }
inline int getLazyStrFmt() const { return lazyStrFmt; }
inline int getLazyVerbose() const { return lazyVerbose; }
inline int getResolveCollective() const { return resolveCollective; }
inline int getTooManyLevels() const { return tooManyLevels; }
inline int getTooManyLines() const { return tooManyLines; }
bool hasFeature(const std::string& name) const;
boost::python::list listFeatures() const;
private:
FeatureSet features;
// the number of parameters is small enough to avoid a map for performance
// reasons
int autoLazy;
int lazyStrFmt;
int lazyVerbose;
int resolveCollective;
int tooManyLevels;
int tooManyLines;
};
extern EscriptParams escriptParams;
inline void setEscriptParamInt(const std::string& name, int value)
{
escriptParams.setInt(name, value);
}
inline int getEscriptParamInt(const std::string& name, int sentinel=0)
{
return escriptParams.getInt(name, sentinel);
}
inline boost::python::list listEscriptParams()
{
return escriptParams.listEscriptParams();
}
inline bool hasFeature(const std::string& name)
{
return escriptParams.hasFeature(name);
}
inline boost::python::list listFeatures()
{
return escriptParams.listFeatures();
}
} // namespace escript
#endif // __ESCRIPT_PARAMS_H__
escript::EscriptParams::resolveCollective
int resolveCollective
Definition: EscriptParams.h:85
escript::EscriptParams::listEscriptParams
boost::python::list listEscriptParams() const
Definition: EscriptParams.cpp:173
escript::EscriptParams::getResolveCollective
int getResolveCollective() const
Definition: EscriptParams.h:71
escript::EscriptParams::getTooManyLevels
int getTooManyLevels() const
Definition: EscriptParams.h:72
escript::EscriptParams::tooManyLines
int tooManyLines
Definition: EscriptParams.h:87
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:92
escript::EscriptParams::listFeatures
boost::python::list listFeatures() const
Definition: EscriptParams.cpp:201
escript::listFeatures
boost::python::list listFeatures()
returns a list of features escript was compiled with.
Definition: EscriptParams.h:119
escript::listEscriptParams
boost::python::list listEscriptParams()
describe available parameters.
Definition: EscriptParams.h:101
escript::EscriptParams::EscriptParams
EscriptParams()
Definition: EscriptParams.cpp:46
MPI_COMM_WORLD
#define MPI_COMM_WORLD
Definition: EsysMPI.h:48
escript::EscriptParams
Definition: EscriptParams.h:43
escript::EscriptParams::autoLazy
int autoLazy
Definition: EscriptParams.h:82
escript::EscriptParams::hasFeature
bool hasFeature(const std::string &name) const
Definition: EscriptParams.cpp:185
EscriptParams.h
escript::EscriptParams::getLazyVerbose
int getLazyVerbose() const
Definition: EscriptParams.h:70
escript::EscriptParams::tooManyLevels
int tooManyLevels
Definition: EscriptParams.h:86
escript::EscriptParams::setInt
void setInt(const std::string &name, int value)
Definition: EscriptParams.cpp:155
escript::escriptParams
EscriptParams escriptParams
Definition: EscriptParams.cpp:43
escript::EscriptParams::getLazyStrFmt
int getLazyStrFmt() const
Definition: EscriptParams.h:69
escript::EscriptParams::lazyVerbose
int lazyVerbose
Definition: EscriptParams.h:84
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:83
EsysException.h
escript::EscriptParams::FeatureSet
std::unordered_set< std::string > FeatureSet
Definition: EscriptParams.h:59
escript
Definition: AbstractContinuousDomain.cpp:23
escript::EscriptParams::features
FeatureSet features
Definition: EscriptParams.h:79
escript::EscriptParams::getAutoLazy
int getAutoLazy() const
Definition: EscriptParams.h:68
escript::EscriptParams::getTooManyLines
int getTooManyLines() const
Definition: EscriptParams.h:73
escript::hasFeature
bool hasFeature(const std::string &name)
returns true if escript was compiled with the feature name, false otherwise.
Definition: EscriptParams.h:110
escript::EscriptParams::lazyStrFmt
int lazyStrFmt
Definition: EscriptParams.h:83
escript::EscriptParams::getInt
int getInt(const std::string &name, int sentinel=0) const
Definition: EscriptParams.cpp:136
EsysMPI.h
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:103