/usr/include/dune/common/function.hh is in libdune-common-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set ts=8 sw=2 et sts=2:
#ifndef DUNE_FUNCTION_HH
#define DUNE_FUNCTION_HH
#include "typetraits.hh"
namespace Dune {
/** @addtogroup Common
@{
*/
/*! \file
\brief Simple base class templates for functions.
*/
/**
* \brief Base class template for function classes
*
* \tparam Domain Type of input variable. This could be some 'const T' or 'const T&'.
*
* \tparam Range Type of output variable. This should be some non-const 'T&' to allow to return results.
*/
template <class Domain, class Range>
class Function
{
typedef typename ConstantVolatileTraits<typename TypeTraits< Domain >::ReferredType >::UnqualifiedType RawDomainType;
typedef typename ConstantVolatileTraits<typename TypeTraits< Range >::ReferredType >::UnqualifiedType RawRangeType;
public:
//! Raw type of input variable with removed reference and constness
typedef RawRangeType RangeType;
//! Raw type of output variable with removed reference and constness
typedef RawDomainType DomainType;
//! Traits class containing raw types
struct Traits
{
typedef RawDomainType DomainType;
typedef RawRangeType RangeType;
};
/**
* \brief Function evaluation.
*
* \param x Argument for function evaluation.
* \param y Result of function evaluation.
*/
void evaluate(Domain x, Range y) const;
}; // end of Function class
/**
* \brief Virtual base class template for function classes.
*
* \tparam DomainType The type of the input variable is 'const DomainType &'
*
* \tparam RangeType The type of the output variable is 'RangeType &'
*/
template <class DomainType, class RangeType>
class VirtualFunction :
public Function<const DomainType&, RangeType&>
{
public:
virtual ~VirtualFunction() {}
/**
* \brief Function evaluation.
*
* \param x Argument for function evaluation.
* \param y Result of function evaluation.
*/
virtual void evaluate(const DomainType& x, RangeType& y) const = 0;
}; // end of VirtualFunction class
/** @} end documentation */
} // end namespace
#endif
|