Skip to content
Snippets Groups Projects
Commit 94977131 authored by Robert K's avatar Robert K
Browse files
parents 5e1c53ed 9c7779c3
No related branches found
No related tags found
No related merge requests found
Showing
with 309 additions and 75 deletions
......@@ -23,7 +23,10 @@ Dependencies
dune-common depends on the following software packages
- pkg-config
- icc (C/C++) >= 7.0 or GNU C, C++ >=3.4
- GNU C, C++ >=4.4
these might also work:
icc (C/C++) >= 13.0
Clang >= 3.2
The following software is recommend but optional:
......
......@@ -6,7 +6,7 @@ following programs installed on your system:
automake >= 1.9
autoconf >= 2.52
autoconf >= 2.62
libtool
......
......@@ -5,7 +5,7 @@ install-exec-local:
echo "set($(PACKAGE)_SCRIPT_DIR \"$(datadir)/dune/cmake/scripts\")" >> $(PACKAGE)-config.tmp; \
fi; \
if test "$(PACKAGE)" = "dune-common"; then \
echo "set(DOXYSTYLE_FILE \"$(docdir)/doxygen/Doxystyle\")" >> $(PACKAGE)-config.tmp; \
echo "set(DOXYSTYLE_FILE \"$(datadir)/dune-common/doc/doxygen/Doxystyle\")" >> $(PACKAGE)-config.tmp; \
fi; \
if test -d $(top_srcdir)/cmake/modules; then \
echo "set($(PACKAGE)_MODULE_PATH \"$(datadir)/dune/cmake/modules\")" >> $(PACKAGE)-config.tmp; \
......
......@@ -536,11 +536,6 @@ run_default_vcsetup() {
}
run_default_update () {
DUNELINK=0
if test -L dune; then
rm dune
DUNELINK=1
fi
if test -d .svn; then
svn update
elif test -d CVS; then
......@@ -566,10 +561,6 @@ run_default_update () {
echo "WARNING: $module is not under a known version control system."
echo " We support svn, git and cvs."
fi
if test "$DUNELINK" != 0 && ! test -d dune; then
echo "WARNING: $module is using the deprecated dune symlink"
ln -s . dune
fi
}
run_default_autogen () {
......@@ -673,7 +664,7 @@ run_default_configure () {
fi
done
# create build directory if requested
test -d "$BUILDDIR" || mkdir "$BUILDDIR"
test -d "$BUILDDIR" || mkdir -p "$BUILDDIR"
SRCDIR="$PWD"
cd "$BUILDDIR"
echo "$PREPARAMS $CMAKE -DCMAKE_MODULE_PATH=\"$CMAKE_MODULE_PATH\" $CMAKE_PARAMS $CMAKE_FLAGS \"$SRCDIR\""
......@@ -683,7 +674,7 @@ run_default_configure () {
echo ./configure "$PARAMS"
# create build directory if requested
if test -n "$BUILDDIR"; then
test -d "$BUILDDIR" || mkdir "$BUILDDIR"
test -d "$BUILDDIR" || mkdir -p "$BUILDDIR"
SRCDIR="$PWD"
cd "$BUILDDIR"
eval "$SRCDIR/configure" "$PARAMS" || exit 1
......
......@@ -524,8 +524,8 @@ Version: @VERSION@
Description: $MODULE module
URL: http://dune-project.org/
Requires: ${DEPENDENCIES}
Libs: -L${libdir}
Cflags: -I${includedir}
Libs: -L\${libdir}
Cflags: -I\${includedir}
CC_DELIM
echo " Please remember to update your $PROJECT/$MODULE.pc.in,"
echo " Description and URL are missing right now."
......
......@@ -23,12 +23,12 @@ else
fi
# By default, we disallow trailing whitespace for the following files, but the check for C/C++ sources
# By default, we disallow trailing whitespace for the following files, but the check for C/C++ and CMake sources
# happens in the tab-in-indent check to avoid confusing users with duplicate error messages
TRAILING_WHITESPACE_DEFAULT='.*(Makefile.am|configure.ac|dune.module|README|README.SVN|COPYING|INSTALL|TODO|\.cmake|CMakeLists.txt|\.pc\.in)$'
TRAILING_WHITESPACE_DEFAULT='.*(Makefile.am|configure.ac|dune.module|README|README.SVN|COPYING|INSTALL|TODO|\.pc\.in)$'
# By default, we disallow tabs in indents and trailing whitespace in C/C++ source files
TAB_IN_INDENT_DEFAULT='\.(cpp|hpp|cc|hh|c|h)$'
# By default, we disallow tabs in indents and trailing whitespace in C/C++ and CMake source files
TAB_IN_INDENT_DEFAULT='.*(\.cpp|\.hpp|\.cc|\.hh|\.c|\.h|\.cmake|CMakeLists.txt)$'
# Get user preferences
TRAILING_WHITESPACE_FILES=$(git config hooks.whitespace.trailing)
......
......@@ -39,7 +39,7 @@ findm4dir() {
return
fi
# installed
M4DIR="$BINDIR/../share/aclocal"
M4DIR="$BINDIR/../share/dune/aclocal"
if test -f "$M4DIR/mpi-config.m4"; then
echo "$M4DIR"
return
......
......@@ -34,7 +34,7 @@
/* does the compiler support __attribute__((unused))? */
#cmakedefine HAS_ATTRIBUTE_UNUSED 1
/* Define to 1 if the <array> C++11 is available and support array::fill */
/* Define to 1 if the header <array> from C++11 is available and supports array::fill */
#cmakedefine HAVE_ARRAY 1
/* Define if you have a BLAS library. */
......
......@@ -98,12 +98,7 @@ namespace Dune
static void apply ( DenseMatrix &denseMatrix, const RHS &rhs )
{
typedef typename DenseMatrix::field_type field_type;
const field_type value = static_cast< field_type >( rhs );
const std::size_t size = denseMatrix.size();
for( std::size_t i = 0; i < size; ++i )
denseMatrix[ i ] = value;
std::fill( denseMatrix.begin(), denseMatrix.end(), static_cast< field_type >( rhs ) );
}
};
......@@ -175,7 +170,7 @@ namespace Dune
/** @brief Error thrown if operations of a FieldMatrix fail. */
class FMatrixError : public Exception {};
class FMatrixError : public MathError {};
/**
@brief A dense n x m matrix.
......@@ -250,13 +245,13 @@ namespace Dune
//===== iterator interface to rows of the matrix
//! Iterator class for sequential access
typedef DenseIterator<DenseMatrix,row_type> Iterator;
typedef DenseIterator<DenseMatrix,row_type,row_reference> Iterator;
//! typedef for stl compliant access
typedef Iterator iterator;
//! rename the iterators for easier access
typedef Iterator RowIterator;
//! rename the iterators for easier access
typedef typename row_type::Iterator ColIterator;
typedef typename remove_reference<row_reference>::type::Iterator ColIterator;
//! begin iterator
Iterator begin ()
......@@ -285,13 +280,13 @@ namespace Dune
}
//! Iterator class for sequential access
typedef DenseIterator<const DenseMatrix,const row_type> ConstIterator;
typedef DenseIterator<const DenseMatrix,const row_type,const_row_reference> ConstIterator;
//! typedef for stl compliant access
typedef ConstIterator const_iterator;
//! rename the iterators for easier access
typedef ConstIterator ConstRowIterator;
//! rename the iterators for easier access
typedef typename row_type::ConstIterator ConstColIterator;
typedef typename remove_reference<const_row_reference>::type::ConstIterator ConstColIterator;
//! begin iterator
ConstIterator begin () const
......@@ -580,9 +575,9 @@ namespace Dune
return 0.0;
ConstIterator it = begin();
typename remove_const< typename FieldTraits<value_type>::real_type >::type max = it->one_norm();
typename remove_const< typename FieldTraits<value_type>::real_type >::type max = (*it).one_norm();
for (it = it + 1; it != end(); ++it)
max = std::max(max, it->one_norm());
max = std::max(max, (*it).one_norm());
return max;
}
......@@ -594,9 +589,9 @@ namespace Dune
return 0.0;
ConstIterator it = begin();
typename remove_const< typename FieldTraits<value_type>::real_type >::type max = it->one_norm_real();
typename remove_const< typename FieldTraits<value_type>::real_type >::type max = (*it).one_norm_real();
for (it = it + 1; it != end(); ++it)
max = std::max(max, it->one_norm_real());
max = std::max(max, (*it).one_norm_real());
return max;
}
......
......@@ -116,13 +116,15 @@ namespace Dune {
provides sequential access to DenseVector, FieldVector and FieldMatrix
*/
template<class C, class T>
template<class C, class T, class R =T&>
class DenseIterator :
public Dune::RandomAccessIteratorFacade<DenseIterator<C,T>,T, T&, std::ptrdiff_t>
public Dune::RandomAccessIteratorFacade<DenseIterator<C,T,R>,T, R, std::ptrdiff_t>
{
friend class DenseIterator<typename remove_const<C>::type, typename remove_const<T>::type >;
friend class DenseIterator<const typename remove_const<C>::type, const typename remove_const<T>::type >;
friend class DenseIterator<typename remove_const<C>::type, typename remove_const<T>::type, typename mutable_reference<R>::type >;
friend class DenseIterator<const typename remove_const<C>::type, const typename remove_const<T>::type, typename const_reference<R>::type >;
typedef DenseIterator<typename remove_const<C>::type, typename remove_const<T>::type, typename mutable_reference<R>::type > MutableIterator;
typedef DenseIterator<const typename remove_const<C>::type, const typename remove_const<T>::type, typename const_reference<R>::type > ConstIterator;
public:
/**
......@@ -144,23 +146,27 @@ namespace Dune {
: container_(&cont), position_(pos)
{}
DenseIterator(const DenseIterator<typename remove_const<C>::type, typename remove_const<T>::type >& other)
DenseIterator(const MutableIterator & other)
: container_(other.container_), position_(other.position_)
{}
DenseIterator(const ConstIterator & other)
: container_(other.container_), position_(other.position_)
{}
// Methods needed by the forward iterator
bool equals(const DenseIterator<typename remove_const<C>::type,typename remove_const<T>::type>& other) const
bool equals(const MutableIterator &other) const
{
return position_ == other.position_ && container_ == other.container_;
}
bool equals(const DenseIterator<const typename remove_const<C>::type,const typename remove_const<T>::type>& other) const
bool equals(const ConstIterator & other) const
{
return position_ == other.position_ && container_ == other.container_;
}
T& dereference() const {
R dereference() const {
return container_->operator[](position_);
}
......@@ -174,7 +180,7 @@ namespace Dune {
}
// Additional function needed by RandomAccessIterator
T& elementAt(DifferenceType i) const {
R elementAt(DifferenceType i) const {
return container_->operator[](position_+i);
}
......
......@@ -71,6 +71,17 @@ namespace Dune {
_data(x._data)
{}
//! Constructor making vector with identical coordinates
template<class X>
DynamicVector (const DenseVector< X > & x) :
_data( )
{
const size_type n = x.size();
_data.reserve(n);
for( size_type i =0; i<n ;++i)
_data.push_back( x[ i ] );
}
using Base::operator=;
//==== forward some methods of std::vector
......
......@@ -202,7 +202,7 @@ namespace Dune
/**
* @brief Exception indicating that the index set is not in the expected state.
*/
class InvalidIndexSetState : public Exception {};
class InvalidIndexSetState : public InvalidStateException {};
// Forward declaration
template<class I> class GlobalLookupIndexSet;
......
......@@ -33,7 +33,7 @@ namespace Dune
class InterfaceBuilder
{
public:
class RemotexIndicesStateError : public Exception
class RemoteIndicesStateError : public InvalidStateException
{};
virtual ~InterfaceBuilder()
......@@ -358,7 +358,7 @@ namespace Dune
{
if(!remoteIndices.isSynced())
DUNE_THROW(RemotexIndicesStateError,"RemoteIndices is not in sync with the index set. Call RemoteIndices::rebuild first!");
DUNE_THROW(RemoteIndicesStateError,"RemoteIndices is not in sync with the index set. Call RemoteIndices::rebuild first!");
// Allocate the memory for the data type construction.
typedef R RemoteIndices;
typedef typename RemoteIndices::RemoteIndexMap::const_iterator const_iterator;
......
......@@ -14,8 +14,8 @@
#include <sstream>
#include <fstream>
#include <set>
#include <dune/common/exceptions.hh>
#include <map>
#include <algorithm>
std::string Dune::ParameterTreeParser::ltrim(const std::string& s)
{
......@@ -117,7 +117,7 @@ void Dune::ParameterTreeParser::readINITree(std::istream& in,
}
if (keysInFile.count(key) != 0)
DUNE_THROW(Exception, "Key '" << key <<
DUNE_THROW(ParameterTreeParserError, "Key '" << key <<
"' appears twice in " << srcname << " !");
else
{
......@@ -132,7 +132,6 @@ void Dune::ParameterTreeParser::readINITree(std::istream& in,
}
void Dune::ParameterTreeParser::readOptions(int argc, char* argv [],
ParameterTree& pt)
{
......@@ -158,3 +157,92 @@ void Dune::ParameterTreeParser::readOptions(int argc, char* argv [],
}
}
void Dune::ParameterTreeParser::readNamedOptions(int argc, char* argv[],
ParameterTree& pt,
std::vector<std::string> keywords,
unsigned int required,
bool allow_more,
bool overwrite,
std::vector<std::string> help)
{
std::string helpstr = generateHelpString(argv[0], keywords, required, help);
std::vector<bool> done(keywords.size(),false);
std::size_t current = 0;
for (std::size_t i=1; i<std::size_t(argc); i++)
{
std::string opt = argv[i];
// check for help
if (opt == "-h" || opt == "--help")
DUNE_THROW(HelpRequest, helpstr);
// is this a named parameter?
if (opt.substr(0,2) == "--")
{
size_t pos = opt.find('=',2);
if (pos == std::string::npos)
DUNE_THROW(ParameterTreeParserError,
"value missing for parameter " << opt << "\n" << helpstr);
std::string key = opt.substr(2,pos-2);
std::string value = opt.substr(pos+1,opt.size()-pos-1);
auto it = std::find(keywords.begin(), keywords.end(), key);
// is this param in the keywords?
if (!allow_more && it == keywords.end())
DUNE_THROW(ParameterTreeParserError,
"unknown parameter " << key << "\n" << helpstr);
// do we overwrite an existing entry?
if (!overwrite && pt[key] != "")
DUNE_THROW(ParameterTreeParserError,
"parameter " << key << " already specified" << "\n" << helpstr);
pt[key] = value;
done[std::distance(keywords.begin(),it)] = true; // mark key as stored
}
else {
// map to the next keyword in the list
while(current < done.size() && done[current]) ++current;
// are there keywords left?
if (current >= done.size())
DUNE_THROW(ParameterTreeParserError,
"superfluous unnamed parameter" << "\n" << helpstr);
// do we overwrite an existing entry?
if (!overwrite && pt[keywords[current]] != "")
DUNE_THROW(ParameterTreeParserError,
"parameter " << keywords[current] << " already specified" << "\n" << helpstr);
pt[keywords[current]] = opt;
done[current] = true; // mark key as stored
}
}
// check that we receive all required keywords
std::string missing = "";
for (unsigned int i=0; i<keywords.size(); i++)
if ((i < required) && ! done[i]) // is this param required?
missing += std::string(" ") + keywords[i];
if (missing.size())
DUNE_THROW(ParameterTreeParserError,
"missing parameter(s) ... " << missing << "\n" << helpstr);
}
std::string Dune::ParameterTreeParser::generateHelpString(
std::string progname, std::vector<std::string> keywords, unsigned int required, std::vector<std::string> help)
{
static const char braces[] = "<>[]";
std::string helpstr = "";
helpstr = helpstr + "Usage: " + progname;
for (std::size_t i=0; i<keywords.size(); i++)
{
bool req = (i < required);
helpstr = helpstr +
" " + braces[req*2] +
keywords[i] +braces[req*2+1];
}
helpstr = helpstr + "\n"
"Options:\n"
"-h / --help: this help\n";
for (std::size_t i=0; i<std::min(keywords.size(),help.size()); i++)
{
if (help[i] != "")
helpstr = helpstr + "-" +
keywords[i] + ":\t" + help[i] + "\n";
}
return helpstr;
}
......@@ -9,11 +9,22 @@
#include <istream>
#include <string>
#include <vector>
#include <dune/common/parametertree.hh>
#include <dune/common/exceptions.hh>
namespace Dune {
/** \brief report parser error while reading ParameterTree */
class ParameterTreeParserError : public RangeError {};
/** \brief exception thrown if the user wants to see help string
this exception is only thrown if the command line parameters
contain an option --help or -h
*/
class HelpRequest : public Exception {};
/** \brief Parsers to set up a ParameterTree from various input sources
* \ingroup Common
*
......@@ -75,7 +86,7 @@ namespace Dune {
* Parses C++ stream and build hierarchical config structure.
*
* \param in The stream to parse
* \param pt The parameter tree to store the config structure.
* \param[out] pt The parameter tree to store the config structure.
* \param overwrite Whether to overwrite already existing values.
* If false, values in the stream will be ignored
* if the key is already present.
......@@ -93,7 +104,7 @@ namespace Dune {
* Parses C++ stream and build hierarchical config structure.
*
* \param in The stream to parse
* \param pt The parameter tree to store the config structure.
* \param[out] pt The parameter tree to store the config structure.
* \param srcname Name of the configuration source for error
* messages, "stdin" or a filename.
* \param overwrite Whether to overwrite already existing values.
......@@ -110,7 +121,7 @@ namespace Dune {
* Parses file with given name and build hierarchical config structure.
*
* \param file filename
* \param pt The parameter tree to store the config structure.
* \param[out] pt The parameter tree to store the config structure.
* \param overwrite Whether to overwrite already existing values.
* If false, values in the stream will be ignored
* if the key is already present.
......@@ -128,10 +139,37 @@ namespace Dune {
*
* \param argc arg count
* \param argv arg values
* \param pt The parameter tree to store the config structure.
* \param[out] pt The parameter tree to store the config structure.
*/
static void readOptions(int argc, char* argv [], ParameterTree& pt);
/**
* \brief read [named] command line options and build hierarchical ParameterTree structure
*
* Similar to pythons named options we expect the parameters in the
* ordering induced by keywords, but allow the user to pass named options
* in the form of --key=value. Optionally the user can pass an additional
* vector with help strings.
*
* \param argc arg count
* \param argv arg values
* \param[out] pt The parameter tree to store the config structure.
* \param keywords vector with keywords names
* \param required number of required options (the first n keywords are required, default is all are required)
* \param allow_more allow more options than these listed in keywords (default = true)
* \param overwrite allow to overwrite existing options (default = true)
* \param help vector containing help strings
*/
static void readNamedOptions(int argc, char* argv[],
ParameterTree& pt,
std::vector<std::string> keywords,
unsigned int required = std::numeric_limits<unsigned int>::max(),
bool allow_more = true,
bool overwrite = true,
std::vector<std::string> help = std::vector<std::string>());
private:
static std::string generateHelpString(std::string progname, std::vector<std::string> keywords, unsigned int required, std::vector<std::string> help);
};
} // end namespace Dune
......
......@@ -16,11 +16,12 @@
#include <cassert>
#include <new>
//forward declarations.
#ifndef DOXYGEN
// forward declarations.
// we need to know the test function to declare it friend
template<std::size_t size, typename T>
struct testPoolMain;
#endif
namespace Dune
{
......
......@@ -53,7 +53,7 @@ namespace Dune
class Singleton
{
/** @brief Smartpointer to the instance. */
static std::auto_ptr<T> instance_;
static std::unique_ptr<T> instance_;
protected:
/* @brief Private constructor. */
Singleton(){}
......@@ -70,13 +70,13 @@ namespace Dune
static T& instance()
{
if(instance_.get() == 0)
instance_ = std::auto_ptr<T>(new T());
instance_ = std::unique_ptr<T>(new T());
return *instance_;
}
};
template<class T>
typename std::auto_ptr<T> Singleton<T>::instance_;
typename std::unique_ptr<T> Singleton<T>::instance_;
} // namespace Dune
......
#ifndef DUNE_COMMON_STD_CONSTEXPR_HH
#define DUNE_COMMON_STD_CONSTEXPR_HH
#if HAVE_CONSTEXPR
/**
* \file
* \brief Definition of the DUNE_CONSTEXPR macro
*/
#if HAVE_CONSTEXPR || defined(DOXYGEN)
/**
* \brief Set method or expression constexpr if supported by the compiler.
* \code
#include <dune/common/std/constexpr.hh>
* \endcode
*
* This is a preprocessor define which can be used to mark expressions or
* functions as constexpr. C++11 introduced constexpr, C++1y will extend
* constexpr's use cases.
*/
#define DUNE_CONSTEXPR constexpr
#else // #if HAVE_CONSTEXPR
#define DUNE_CONSTEXPR
#endif // #else // #if HAVE_CONSTEXPR
......
......@@ -13,10 +13,10 @@ template<class P>
void testparam(const P & p)
{
// try accessing key
std::cout << p.template get<int>("x1") << std::endl;
std::cout << p.template get<double>("x1") << std::endl;
std::cout << p.template get<std::string>("x2") << std::endl;
std::cout << p.template get<bool>("x3") << std::endl;
assert(p.template get<int>("x1") == 1);
assert(p.template get<double>("x1") == 1.0);
assert(p.template get<std::string>("x2") == "hallo");
assert(p.template get<bool>("x3") == false);
// try reading array like structures
std::vector<unsigned int>
array1 = p.template get< std::vector<unsigned int> >("array");
......@@ -27,15 +27,12 @@ void testparam(const P & p)
array3 = p.template get< Dune::FieldVector<unsigned int, 8> >("array");
#endif
assert(array1.size() == 8);
std::cout << "array =";
for (unsigned int i=0; i<8; i++)
{
assert(array1[i] == i+1);
assert(array2[i] == i+1);
assert(array3[i] == i+1);
std::cout << "\t" << array1[i];
}
std::cout << std::endl;
// try accessing subtree
p.sub("Foo");
p.sub("Foo").template get<std::string>("peng");
......@@ -102,6 +99,90 @@ void testmodify(P parameterSet)
DUNE_THROW(Dune::Exception, "Failed to write subtree entry");
}
void testOptionsParserResults(std::vector<std::string> args,
const std::vector<std::string> & keywords,
unsigned int required,
bool allow_more,
bool overwrite,
std::string foo, std::string bar,
const std::string referr = "")
{
Dune::ParameterTree pt;
try {
char * argv[10];
for (std::size_t i = 0; i < args.size(); ++i)
argv[i] = &args[i][0];
Dune::ParameterTreeParser::readNamedOptions(args.size(), argv, pt, keywords, required, allow_more, overwrite);
assert(referr == "");
}
catch (const Dune::ParameterTreeParserError & e)
{
std::string err = e.what();
std::size_t offset = err.find("]: ");
err = err.substr(offset + 3, err.find('\n') - offset - 3);
assert(referr == err);
}
if (foo != "" && foo != pt.get<std::string>("foo"))
DUNE_THROW(Dune::Exception, "Options parser failed... foo = "
<< pt.get<std::string>("foo") << " != " << foo);
if (bar != "" && bar != pt.get<std::string>("bar"))
DUNE_THROW(Dune::Exception, "Options parser failed... bar = "
<< pt.get<std::string>("bar") << " != " << bar);
}
void testOptionsParser()
{
std::vector<std::string> keywords = { "foo", "bar" };
// check normal behaviour
{
std::vector<std::string> args = { "progname", "--bar=ligapokal", "peng", "--bar=ligapokal", "--argh=other"};
testOptionsParserResults(args,keywords,keywords.size(),true,true,"peng","ligapokal",
"" /* no error */ );
}
// bail out on overwrite
{
std::vector<std::string> args = { "progname", "--bar=ligapokal", "peng", "--bar=ligapokal", "--argh=other"};
testOptionsParserResults(args,keywords,keywords.size(),true,false,"peng","ligapokal",
"parameter bar already specified");
}
// bail out on unknown options
{
std::vector<std::string> args = { "progname", "--bar=ligapokal", "peng", "--bar=ligapokal", "--argh=other"};
testOptionsParserResults(args,keywords,keywords.size(),false,true,"peng","ligapokal",
"unknown parameter argh");
}
// bail out on missing parameter
{
std::vector<std::string> args = { "progname", "--bar=ligapokal"};
testOptionsParserResults(args,keywords,keywords.size(),true,true,"","ligapokal",
"missing parameter(s) ... foo");
}
// check optional parameter
{
std::vector<std::string> args = { "progname", "--foo=peng"};
testOptionsParserResults(args,keywords,1,true,true,"peng","",
"" /* no error */);
}
// check optional parameter, but bail out on missing parameter
{
std::vector<std::string> args = { "progname", "--bar=ligapokal"};
testOptionsParserResults(args,keywords,1,true,true,"","ligapokal",
"missing parameter(s) ... foo");
}
// bail out on too many parameters
{
std::vector<std::string> args = { "progname", "peng", "ligapokal", "hurz"};
testOptionsParserResults(args,keywords,keywords.size(),true,true,"peng","ligapokal",
"superfluous unnamed parameter");
}
// bail out on missing value
{
std::vector<std::string> args = { "progname", "--foo=peng", "--bar=ligapokal", "--hurz"};
testOptionsParserResults(args,keywords,keywords.size(),true,true,"peng","ligapokal",
"value missing for parameter --hurz");
}
}
int main()
{
try {
......@@ -128,11 +209,14 @@ int main()
// more const tests
testparam<Dune::ParameterTree>(c);
// check the command line parser
testOptionsParser();
}
catch (Dune::Exception & e)
{
std::cout << e << std::endl;
return 1;
}
return (0);
return 0;
}
......@@ -8,25 +8,25 @@ AC_ARG_ENABLE(compilercheck,
[disable check for supported compilers]),
[compilercheck=$enableval], [compilercheck=yes])
SUPPORTED_COMPILER="gcc (>= 4.1), should work with recent versions of icc and clang (>= 3.0)"
SUPPORTED_COMPILER="gcc (>= 4.4), should work with recent versions of icc (>= 13) and clang (>= 3.2)"
AC_REQUIRE([AC_PROG_CXX])
cat >conftest.cc <<_ACEOF
#include <cstdio>
#if defined __ICC && ! defined CXX_SUPPORTED
#if __ICC >= 700
#if __ICC >= 1300
#define CXX_SUPPORTED "icc %2.2f", 1.0*__ICC/100
#endif
#endif
#if defined __clang__ && ! defined CXX_SUPPORTED
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2)
#define CXX_SUPPORTED \
"clang %i.%i.%i", __clang_major__, __clang_minor__, __clang_patchlevel__
#endif
#endif
#if defined __GNUC__ && ! defined CXX_SUPPORTED
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#define CXX_SUPPORTED \
"gcc %i.%i.%i", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment